| OLD | NEW |
| 1 | 1 |
| 2 /* | 2 /* |
| 3 * Copyright 2008 The Android Open Source Project | 3 * Copyright 2008 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 SkPackBits_DEFINED | 10 #ifndef SkPackBits_DEFINED |
| 11 #define SkPackBits_DEFINED | 11 #define SkPackBits_DEFINED |
| 12 | 12 |
| 13 #include "SkTypes.h" | 13 #include "SkTypes.h" |
| 14 | 14 |
| 15 class SkPackBits { | 15 class SkPackBits { |
| 16 public: | 16 public: |
| 17 /** Given the number of 8bit values that will be passed to Pack8, | 17 /** Given the number of 8bit values that will be passed to Pack8, |
| 18 returns the worst-case size needed for the dst[] buffer. | 18 returns the worst-case size needed for the dst[] buffer. |
| 19 */ | 19 */ |
| 20 static size_t ComputeMaxSize8(int count); | 20 static size_t ComputeMaxSize8(size_t srcSize); |
| 21 | 21 |
| 22 /** Write the src array into a packed format. The packing process may end | 22 /** Write the src array into a packed format. The packing process may end |
| 23 up writing more bytes than it read, so dst[] must be large enough. | 23 up writing more bytes than it read, so dst[] must be large enough. |
| 24 @param src Input array of 8bit values | 24 @param src Input array of 8bit values |
| 25 @param srcSize Number of entries in src[] | 25 @param srcSize Number of entries in src[] |
| 26 @param dst Buffer (allocated by caller) to write the packed data | 26 @param dst Buffer (allocated by caller) to write the packed data |
| 27 into | 27 into |
| 28 @param dstSize Number of bytes in the output buffer. | 28 @param dstSize Number of bytes in the output buffer. |
| 29 @return the number of bytes written to dst[] | 29 @return the number of bytes written to dst[] |
| 30 */ | 30 */ |
| 31 static size_t Pack8(const uint8_t src[], size_t srcSize, uint8_t dst[], | 31 static size_t Pack8(const uint8_t src[], size_t srcSize, uint8_t dst[], |
| 32 size_t dstSize); | 32 size_t dstSize); |
| 33 | 33 |
| 34 /** Unpack the data in src[], and expand it into dst[]. The src[] data was | 34 /** Unpack the data in src[], and expand it into dst[]. The src[] data was |
| 35 written by a previous call to Pack8. | 35 written by a previous call to Pack8. |
| 36 @param src Input data to unpack, previously created by Pack8. | 36 @param src Input data to unpack, previously created by Pack8. |
| 37 @param srcSize Number of bytes of src to unpack | 37 @param srcSize Number of bytes of src to unpack |
| 38 @param dst Buffer (allocated by caller) to expand the src[] into. | 38 @param dst Buffer (allocated by caller) to expand the src[] into. |
| 39 @param dstSize Number of bytes in the output buffer. | 39 @param dstSize Number of bytes in the output buffer. |
| 40 @return the number of bytes written into dst. | 40 @return the number of bytes written into dst. |
| 41 */ | 41 */ |
| 42 static int Unpack8(const uint8_t src[], size_t srcSize, uint8_t dst[], | 42 static int Unpack8(const uint8_t src[], size_t srcSize, uint8_t dst[], |
| 43 size_t dstSize); | 43 size_t dstSize); |
| 44 }; | 44 }; |
| 45 | 45 |
| 46 #endif | 46 #endif |
| OLD | NEW |