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 | 16 |
17 /** | 17 /** |
18 * 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 |
19 * this stream using the Deflate algorithm. Uses Zlib's | 19 * this stream using the Deflate algorithm. Uses Zlib's |
20 * Z_DEFAULT_COMPRESSION level. | 20 * Z_DEFAULT_COMPRESSION level. |
21 * | 21 * |
22 * See http://en.wikipedia.org/wiki/DEFLATE | 22 * See http://en.wikipedia.org/wiki/DEFLATE |
23 */ | 23 */ |
24 class SkDeflateWStream : public SkWStream { | 24 class SkDeflateWStream final : public SkWStream { |
25 public: | 25 public: |
26 /** Does not take ownership of the stream. */ | 26 /** Does not take ownership of the stream. */ |
27 SkDeflateWStream(SkWStream*); | 27 SkDeflateWStream(SkWStream*); |
28 | 28 |
29 /** The destructor calls finalize(). */ | 29 /** The destructor calls finalize(). */ |
30 ~SkDeflateWStream(); | 30 ~SkDeflateWStream(); |
31 | 31 |
32 /** Write the end of the compressed stream. All subsequent calls to | 32 /** Write the end of the compressed stream. All subsequent calls to |
33 write() will fail. Subsequent calls to finalize() do nothing. */ | 33 write() will fail. Subsequent calls to finalize() do nothing. */ |
34 void finalize(); | 34 void finalize(); |
35 | 35 |
36 // The SkWStream interface: | 36 // The SkWStream interface: |
37 bool write(const void*, size_t) override; | 37 bool write(const void*, size_t) override; |
38 size_t bytesWritten() const override; | 38 size_t bytesWritten() const override; |
39 | 39 |
40 private: | 40 private: |
41 struct Impl; | 41 struct Impl; |
42 SkAutoTDelete<Impl> fImpl; | 42 SkAutoTDelete<Impl> fImpl; |
43 }; | 43 }; |
44 | 44 |
45 #endif // SkFlate_DEFINED | 45 #endif // SkFlate_DEFINED |
OLD | NEW |