| OLD | NEW |
| 1 | 1 |
| 2 /* | 2 /* |
| 3 * Copyright 2010 The Android Open Source Project | 3 * Copyright 2010 The Android Open Source Project |
| 4 * | 4 * |
| 5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
| 6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
| 7 */ | 7 */ |
| 8 | 8 |
| 9 | 9 |
| 10 #ifndef SkFlate_DEFINED | 10 #ifndef SkFlate_DEFINED |
| 11 #define SkFlate_DEFINED | 11 #define SkFlate_DEFINED |
| 12 | 12 |
| 13 #include "SkTypes.h" | 13 #include "SkTypes.h" |
| 14 | 14 |
| 15 #include "SkStream.h" | 15 #include "SkStream.h" |
| 16 class SkData; | |
| 17 | |
| 18 /** \class SkFlate | |
| 19 A class to provide access to the flate compression algorithm. | |
| 20 */ | |
| 21 class SkFlate { | |
| 22 public: | |
| 23 /** | |
| 24 * Use the flate compression algorithm to compress the data in src, | |
| 25 * putting the result into dst. Returns false if an error occurs. | |
| 26 */ | |
| 27 static bool Deflate(SkStream* src, SkWStream* dst); | |
| 28 | |
| 29 /** | |
| 30 * Use the flate compression algorithm to compress the data in src, | |
| 31 * putting the result into dst. Returns false if an error occurs. | |
| 32 */ | |
| 33 static bool Deflate(const void* src, size_t len, SkWStream* dst); | |
| 34 | |
| 35 /** | |
| 36 * Use the flate compression algorithm to compress the data, | |
| 37 * putting the result into dst. Returns false if an error occurs. | |
| 38 */ | |
| 39 static bool Deflate(const SkData*, SkWStream* dst); | |
| 40 | |
| 41 /** Use the flate compression algorithm to decompress the data in src, | |
| 42 putting the result into dst. Returns false if an error occurs. | |
| 43 */ | |
| 44 static bool Inflate(SkStream* src, SkWStream* dst); | |
| 45 }; | |
| 46 | 16 |
| 47 /** | 17 /** |
| 48 * Wrap a stream in this class to compress the information written to | 18 * Wrap a stream in this class to compress the information written to |
| 49 * this stream using the Deflate algorithm. Uses Zlib's | 19 * this stream using the Deflate algorithm. Uses Zlib's |
| 50 * Z_DEFAULT_COMPRESSION level. | 20 * Z_DEFAULT_COMPRESSION level. |
| 51 * | 21 * |
| 52 * See http://en.wikipedia.org/wiki/DEFLATE | 22 * See http://en.wikipedia.org/wiki/DEFLATE |
| 53 */ | 23 */ |
| 54 class SkDeflateWStream : public SkWStream { | 24 class SkDeflateWStream : public SkWStream { |
| 55 public: | 25 public: |
| (...skipping 10 matching lines...) Expand all Loading... |
| 66 // The SkWStream interface: | 36 // The SkWStream interface: |
| 67 bool write(const void*, size_t) override; | 37 bool write(const void*, size_t) override; |
| 68 size_t bytesWritten() const override; | 38 size_t bytesWritten() const override; |
| 69 | 39 |
| 70 private: | 40 private: |
| 71 struct Impl; | 41 struct Impl; |
| 72 SkAutoTDelete<Impl> fImpl; | 42 SkAutoTDelete<Impl> fImpl; |
| 73 }; | 43 }; |
| 74 | 44 |
| 75 #endif // SkFlate_DEFINED | 45 #endif // SkFlate_DEFINED |
| OLD | NEW |