add ptr/len and SkData versions of Deflate()
git-svn-id: http://skia.googlecode.com/svn/trunk@1726 2bbb7eff-a529-9590-31e7-b0007b416f81
This commit is contained in:
parent
effc5016f0
commit
314e9b3ba0
@ -19,6 +19,7 @@
|
||||
|
||||
#include "SkTypes.h"
|
||||
|
||||
class SkData;
|
||||
class SkWStream;
|
||||
class SkStream;
|
||||
|
||||
@ -31,11 +32,24 @@ public:
|
||||
*/
|
||||
static bool HaveFlate();
|
||||
|
||||
/** Use the flate compression algorithm to compress the data in src,
|
||||
putting the result into dst. Returns false if an error occurs.
|
||||
/**
|
||||
* Use the flate compression algorithm to compress the data in src,
|
||||
* putting the result into dst. Returns false if an error occurs.
|
||||
*/
|
||||
static bool Deflate(SkStream* src, SkWStream* dst);
|
||||
|
||||
/**
|
||||
* Use the flate compression algorithm to compress the data in src,
|
||||
* putting the result into dst. Returns false if an error occurs.
|
||||
*/
|
||||
static bool Deflate(const void* src, size_t len, SkWStream* dst);
|
||||
|
||||
/**
|
||||
* Use the flate compression algorithm to compress the data,
|
||||
* putting the result into dst. Returns false if an error occurs.
|
||||
*/
|
||||
static bool Deflate(const SkData*, SkWStream* dst);
|
||||
|
||||
/** Use the flate compression algorithm to decompress the data in src,
|
||||
putting the result into dst. Returns false if an error occurs.
|
||||
*/
|
||||
|
@ -14,6 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "SkData.h"
|
||||
#include "SkFlate.h"
|
||||
#include "SkStream.h"
|
||||
|
||||
@ -123,6 +124,19 @@ bool SkFlate::Deflate(SkStream* src, SkWStream* dst) {
|
||||
return doFlate(true, src, dst);
|
||||
}
|
||||
|
||||
bool SkFlate::Deflate(const void* ptr, size_t len, SkWStream* dst) {
|
||||
SkMemoryStream stream(ptr, len);
|
||||
return doFlate(true, &stream, dst);
|
||||
}
|
||||
|
||||
bool SkFlate::Deflate(const SkData* data, SkWStream* dst) {
|
||||
if (data) {
|
||||
SkMemoryStream stream(data->data(), data->size());
|
||||
return doFlate(true, &stream, dst);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// static
|
||||
bool SkFlate::Inflate(SkStream* src, SkWStream* dst) {
|
||||
return doFlate(false, src, dst);
|
||||
|
Loading…
Reference in New Issue
Block a user