| 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 "SkDeflate.h" | 11 #include "SkDeflate.h" |
| 12 #include "SkStream.h" | 12 #include "SkStream.h" |
| 13 | 13 |
| 14 namespace { | |
| 15 | |
| 16 #ifdef ZLIB_INCLUDE | 14 #ifdef ZLIB_INCLUDE |
| 17 #include ZLIB_INCLUDE | 15 #include ZLIB_INCLUDE |
| 18 #else | 16 #else |
| 19 #include "zlib.h" | 17 #include "zlib.h" |
| 20 #endif | 18 #endif |
| 21 | 19 |
| 20 namespace { |
| 21 |
| 22 // Different zlib implementations use different T. | 22 // Different zlib implementations use different T. |
| 23 // We've seen size_t and unsigned. | 23 // We've seen size_t and unsigned. |
| 24 template <typename T> void* skia_alloc_func(void*, T items, T size) { | 24 template <typename T> void* skia_alloc_func(void*, T items, T size) { |
| 25 return sk_calloc_throw(SkToSizeT(items) * SkToSizeT(size)); | 25 return sk_calloc_throw(SkToSizeT(items) * SkToSizeT(size)); |
| 26 } | 26 } |
| 27 | 27 |
| 28 void skia_free_func(void*, void* address) { sk_free(address); } | 28 void skia_free_func(void*, void* address) { sk_free(address); } |
| 29 | 29 |
| 30 } // namespace | 30 } // namespace |
| 31 | 31 |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 110 fImpl->fInBuffer, fImpl->fInBufferIndex); | 110 fImpl->fInBuffer, fImpl->fInBufferIndex); |
| 111 fImpl->fInBufferIndex = 0; | 111 fImpl->fInBufferIndex = 0; |
| 112 } | 112 } |
| 113 } | 113 } |
| 114 return true; | 114 return true; |
| 115 } | 115 } |
| 116 | 116 |
| 117 size_t SkDeflateWStream::bytesWritten() const { | 117 size_t SkDeflateWStream::bytesWritten() const { |
| 118 return fImpl->fZStream.total_in + fImpl->fInBufferIndex; | 118 return fImpl->fZStream.total_in + fImpl->fInBufferIndex; |
| 119 } | 119 } |
| OLD | NEW |