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 #ifndef SK_HAS_ZLIB | 14 #ifdef SK_NO_FLATE |
15 bool SkFlate::HaveFlate() { return false; } | 15 bool SkFlate::HaveFlate() { return false; } |
16 bool SkFlate::Deflate(SkStream*, SkWStream*) { return false; } | 16 bool SkFlate::Deflate(SkStream*, SkWStream*) { return false; } |
17 bool SkFlate::Deflate(const void*, size_t, SkWStream*) { return false; } | 17 bool SkFlate::Deflate(const void*, size_t, SkWStream*) { return false; } |
18 bool SkFlate::Deflate(const SkData*, SkWStream*) { return false; } | 18 bool SkFlate::Deflate(const SkData*, SkWStream*) { return false; } |
19 bool SkFlate::Inflate(SkStream*, SkWStream*) { return false; } | 19 bool SkFlate::Inflate(SkStream*, SkWStream*) { return false; } |
20 #else | 20 #else |
21 | 21 |
22 // static | 22 // static |
23 bool SkFlate::HaveFlate() { | 23 bool SkFlate::HaveFlate() { |
24 return true; | 24 return true; |
25 } | 25 } |
26 | 26 |
27 namespace { | 27 namespace { |
28 | 28 |
29 #ifdef SK_SYSTEM_ZLIB | 29 #include "zlib.h" |
30 #include <zlib.h> | |
31 #else | |
32 #include SK_ZLIB_INCLUDE | |
33 #endif | |
34 | 30 |
35 // static | 31 // static |
36 const size_t kBufferSize = 1024; | 32 const size_t kBufferSize = 1024; |
37 | 33 |
38 bool doFlate(bool compress, SkStream* src, SkWStream* dst) { | 34 bool doFlate(bool compress, SkStream* src, SkWStream* dst) { |
39 uint8_t inputBuffer[kBufferSize]; | 35 uint8_t inputBuffer[kBufferSize]; |
40 uint8_t outputBuffer[kBufferSize]; | 36 uint8_t outputBuffer[kBufferSize]; |
41 z_stream flateData; | 37 z_stream flateData; |
42 flateData.zalloc = NULL; | 38 flateData.zalloc = NULL; |
43 flateData.zfree = NULL; | 39 flateData.zfree = NULL; |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
131 } | 127 } |
132 return false; | 128 return false; |
133 } | 129 } |
134 | 130 |
135 // static | 131 // static |
136 bool SkFlate::Inflate(SkStream* src, SkWStream* dst) { | 132 bool SkFlate::Inflate(SkStream* src, SkWStream* dst) { |
137 return doFlate(false, src, dst); | 133 return doFlate(false, src, dst); |
138 } | 134 } |
139 | 135 |
140 #endif | 136 #endif |
OLD | NEW |