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 #include "SkData.h" | 10 #include "SkData.h" |
11 #include "SkFlate.h" | 11 #include "SkFlate.h" |
12 #include "SkStream.h" | 12 #include "SkStream.h" |
13 | 13 |
14 #ifdef SK_NO_FLATE | 14 #ifndef SK_NO_FLATE |
15 bool SkFlate::HaveFlate() { return false; } | |
16 bool SkFlate::Deflate(SkStream*, SkWStream*) { return false; } | |
17 bool SkFlate::Deflate(const void*, size_t, SkWStream*) { return false; } | |
18 bool SkFlate::Deflate(const SkData*, SkWStream*) { return false; } | |
19 bool SkFlate::Inflate(SkStream*, SkWStream*) { return false; } | |
20 #else | |
21 | |
22 // static | |
23 bool SkFlate::HaveFlate() { | |
24 return true; | |
25 } | |
26 | 15 |
27 namespace { | 16 namespace { |
28 | 17 |
29 #include "zlib.h" | 18 #include "zlib.h" |
30 | 19 |
31 // static | 20 // static |
32 const size_t kBufferSize = 1024; | 21 const size_t kBufferSize = 1024; |
33 | 22 |
34 bool doFlate(bool compress, SkStream* src, SkWStream* dst) { | 23 bool doFlate(bool compress, SkStream* src, SkWStream* dst) { |
35 uint8_t inputBuffer[kBufferSize]; | 24 uint8_t inputBuffer[kBufferSize]; |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
126 return doFlate(true, &stream, dst); | 115 return doFlate(true, &stream, dst); |
127 } | 116 } |
128 return false; | 117 return false; |
129 } | 118 } |
130 | 119 |
131 // static | 120 // static |
132 bool SkFlate::Inflate(SkStream* src, SkWStream* dst) { | 121 bool SkFlate::Inflate(SkStream* src, SkWStream* dst) { |
133 return doFlate(false, src, dst); | 122 return doFlate(false, src, dst); |
134 } | 123 } |
135 | 124 |
136 #endif | 125 #endif // SK_NO_FLATE |
| 126 |
OLD | NEW |