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 #ifndef Sk_NO_FLATE | 15 #ifndef Sk_NO_FLATE |
16 | 16 |
17 class SkData; | 17 class SkData; |
18 class SkWStream; | 18 #include "SkStream.h" |
scroggo
2015/02/26 17:56:53
nit: Don't we typically place includes above class
mtklein
2015/02/26 18:00:16
I guess 'c' does come after '#'...
| |
19 class SkStream; | |
20 | 19 |
21 /** \class SkFlate | 20 /** \class SkFlate |
22 A class to provide access to the flate compression algorithm. | 21 A class to provide access to the flate compression algorithm. |
23 */ | 22 */ |
24 class SkFlate { | 23 class SkFlate { |
25 public: | 24 public: |
26 /** | 25 /** |
27 * Use the flate compression algorithm to compress the data in src, | 26 * Use the flate compression algorithm to compress the data in src, |
28 * putting the result into dst. Returns false if an error occurs. | 27 * putting the result into dst. Returns false if an error occurs. |
29 */ | 28 */ |
(...skipping 10 matching lines...) Expand all Loading... | |
40 * putting the result into dst. Returns false if an error occurs. | 39 * putting the result into dst. Returns false if an error occurs. |
41 */ | 40 */ |
42 static bool Deflate(const SkData*, SkWStream* dst); | 41 static bool Deflate(const SkData*, SkWStream* dst); |
43 | 42 |
44 /** Use the flate compression algorithm to decompress the data in src, | 43 /** Use the flate compression algorithm to decompress the data in src, |
45 putting the result into dst. Returns false if an error occurs. | 44 putting the result into dst. Returns false if an error occurs. |
46 */ | 45 */ |
47 static bool Inflate(SkStream* src, SkWStream* dst); | 46 static bool Inflate(SkStream* src, SkWStream* dst); |
48 }; | 47 }; |
49 | 48 |
49 class SkDeflateWStream : public SkWStream { | |
50 public: | |
51 /** Does not take ownership of the stream. */ | |
52 SkDeflateWStream(SkWStream*); | |
53 | |
54 /** The destructor calls finalize(). */ | |
55 ~SkDeflateWStream(); | |
56 | |
57 /** Write the end of the compressed stream. All subsequent calls to | |
58 write() will fail. Subsequent calls to finalize() do nothing. */ | |
59 void finalize(); | |
60 | |
61 // The SkWStream interface: | |
62 bool write(const void*, size_t) SK_OVERRIDE; | |
63 size_t bytesWritten() const SK_OVERRIDE; | |
64 | |
65 private: | |
66 struct Impl; | |
67 SkAutoTDelete<Impl> fImpl; | |
68 }; | |
69 | |
50 #endif // SK_NO_FLATE | 70 #endif // SK_NO_FLATE |
51 #endif // SkFlate_DEFINED | 71 #endif // SkFlate_DEFINED |
OLD | NEW |