OLD | NEW |
| (Empty) |
1 /* | |
2 * Copyright 2015 Google Inc. | |
3 * | |
4 * Use of this source code is governed by a BSD-style license that can be | |
5 * found in the LICENSE file. | |
6 */ | |
7 | |
8 #ifndef SkDeflateWStream_DEFINED | |
9 #define SkDeflateWStream_DEFINED | |
10 | |
11 #include "SkStream.h" | |
12 // https://skia.org/dev/contrib/style#no-define-before-sktypes | |
13 | |
14 #ifndef SK_NO_FLATE // Clients of this class should be guarded. | |
15 | |
16 /** | |
17 * Wrap a stream in this class to compress the information written to | |
18 * this stream using the Deflate algorithm. Uses Zlib's | |
19 * Z_DEFAULT_COMPRESSION level. | |
20 * | |
21 * See http://en.wikipedia.org/wiki/DEFLATE | |
22 */ | |
23 class SkDeflateWStream : public SkWStream { | |
24 public: | |
25 /** Does not take ownership of the stream. */ | |
26 SkDeflateWStream(SkWStream*); | |
27 | |
28 /** The destructor calls finalize(). */ | |
29 ~SkDeflateWStream(); | |
30 | |
31 /** Write the end of the compressed stream. All subsequent calls to | |
32 write() will fail. Subsequent calls to finalize() do nothing. */ | |
33 void finalize(); | |
34 | |
35 // The SkWStream interface: | |
36 bool write(const void*, size_t) SK_OVERRIDE; | |
37 size_t bytesWritten() const SK_OVERRIDE; | |
38 | |
39 private: | |
40 struct Impl; | |
41 SkAutoTDelete<Impl> fImpl; | |
42 }; | |
43 #endif // SK_NO_FLATE | |
44 | |
45 #endif // SkDeflateWStream_DEFINED | |
OLD | NEW |