diff options
author | bungeman <bungeman@google.com> | 2016-02-23 12:55:20 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-02-23 12:55:20 -0800 |
commit | ccb74b824a16d0009f7f9ebcf2a03fb53451af9a (patch) | |
tree | 26e46706bb4f9ea577970995f39602b38e32d562 | |
parent | d936f63c35fb7dfb2b6c20802206adbfc3cc48d0 (diff) |
Move SkPackBits to src/effects.
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
-rw-r--r-- | gyp/core.gypi | 2 | ||||
-rw-r--r-- | gyp/effects.gypi | 2 | ||||
-rw-r--r-- | src/effects/SkPackBits.cpp (renamed from src/core/SkPackBits.cpp) | 10 | ||||
-rw-r--r-- | src/effects/SkPackBits.h (renamed from include/core/SkPackBits.h) | 2 |
4 files changed, 7 insertions, 9 deletions
diff --git a/gyp/core.gypi b/gyp/core.gypi index 63c94448a1..71a9d6fa4f 100644 --- a/gyp/core.gypi +++ b/gyp/core.gypi @@ -182,7 +182,6 @@ '<(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', @@ -368,7 +367,6 @@ '<(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', diff --git a/gyp/effects.gypi b/gyp/effects.gypi index 347d14055e..d319fcb157 100644 --- a/gyp/effects.gypi +++ b/gyp/effects.gypi @@ -53,6 +53,8 @@ '<(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', diff --git a/src/core/SkPackBits.cpp b/src/effects/SkPackBits.cpp index a3424e2bdc..286d9d140c 100644 --- a/src/core/SkPackBits.cpp +++ b/src/effects/SkPackBits.cpp @@ -6,14 +6,14 @@ */ #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; @@ -24,7 +24,7 @@ static uint8_t* flush_same8(uint8_t dst[], uint8_t value, size_t count) { 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; @@ -78,8 +78,6 @@ size_t SkPackBits::Pack8(const uint8_t* SK_RESTRICT src, size_t srcSize, 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; diff --git a/include/core/SkPackBits.h b/src/effects/SkPackBits.h index 1e32ee0875..f6430faadd 100644 --- a/include/core/SkPackBits.h +++ b/src/effects/SkPackBits.h @@ -17,7 +17,7 @@ public: /** 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. |