Prior to this change SkPackBits.h was in include/core and SkPackBits.cpp
in src/core. However, SkPackBits appears to have been written
specifically as an implementation detail of the SkTableColorFilter
effect. This change moves SkPackBits out of core and into effects, which
is the only current user.
Review URL: https://codereview.chromium.org/
1722173003
'<(skia_src_path)/core/SkOpts.cpp',
'<(skia_src_path)/core/SkOpts.h',
'<(skia_src_path)/core/SkOrderedReadBuffer.h',
- '<(skia_src_path)/core/SkPackBits.cpp',
'<(skia_src_path)/core/SkPaint.cpp',
'<(skia_src_path)/core/SkPaintDefaults.h',
'<(skia_src_path)/core/SkPaintPriv.cpp',
'<(skia_include_path)/core/SkMetaData.h',
'<(skia_include_path)/core/SkMultiPictureDraw.h',
'<(skia_include_path)/core/SkOSFile.h',
- '<(skia_include_path)/core/SkPackBits.h',
'<(skia_include_path)/core/SkPaint.h',
'<(skia_include_path)/core/SkPath.h',
'<(skia_include_path)/core/SkPathEffect.h',
'<(skia_src_path)/effects/SkMergeImageFilter.cpp',
'<(skia_src_path)/effects/SkMorphologyImageFilter.cpp',
'<(skia_src_path)/effects/SkOffsetImageFilter.cpp',
+ '<(skia_src_path)/effects/SkPackBits.cpp',
+ '<(skia_src_path)/effects/SkPackBits.h',
'<(skia_src_path)/effects/SkPaintFlagsDrawFilter.cpp',
'<(skia_src_path)/effects/SkPaintImageFilter.cpp',
'<(skia_src_path)/effects/SkPerlinNoiseShader.cpp',
*/
#include "SkPackBits.h"
-size_t SkPackBits::ComputeMaxSize8(int count) {
+size_t SkPackBits::ComputeMaxSize8(size_t srcSize) {
// worst case is the number of 8bit values + 1 byte per (up to) 128 entries.
- return ((count + 127) >> 7) + count;
+ return ((srcSize + 127) >> 7) + srcSize;
}
static uint8_t* flush_same8(uint8_t dst[], uint8_t value, size_t count) {
while (count > 0) {
- int n = count > 128 ? 128 : count;
+ size_t n = count > 128 ? 128 : count;
*dst++ = (uint8_t)(n - 1);
*dst++ = (uint8_t)value;
count -= n;
static uint8_t* flush_diff8(uint8_t* SK_RESTRICT dst,
const uint8_t* SK_RESTRICT src, size_t count) {
while (count > 0) {
- int n = count > 128 ? 128 : count;
+ size_t n = count > 128 ? 128 : count;
*dst++ = (uint8_t)(n + 127);
memcpy(dst, src, n);
src += n;
return dst - origDst;
}
-#include "SkUtils.h"
-
int SkPackBits::Unpack8(const uint8_t* SK_RESTRICT src, size_t srcSize,
uint8_t* SK_RESTRICT dst, size_t dstSize) {
uint8_t* const origDst = dst;
/** Given the number of 8bit values that will be passed to Pack8,
returns the worst-case size needed for the dst[] buffer.
*/
- static size_t ComputeMaxSize8(int count);
+ static size_t ComputeMaxSize8(size_t srcSize);
/** Write the src array into a packed format. The packing process may end
up writing more bytes than it read, so dst[] must be large enough.