diff options
author | Mike Reed <reed@google.com> | 2017-07-12 22:10:29 -0400 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2017-07-13 10:44:42 +0000 |
commit | 580501382fb1418fff7acc63680f3a9a6bf3938c (patch) | |
tree | 16a93a72852e282b1f520dcc947985e2190a45bf /include/core/SkBitmap.h | |
parent | 4d41b8f2fdae21a6ed16fca6242d53e7c08349d0 (diff) |
Guard to remove kIndex_8_SkColorType
Bug: skia:6828
Change-Id: Ia942a36abb18213184f8d436555a658270d97d47
Reviewed-on: https://skia-review.googlesource.com/22721
Commit-Queue: Mike Reed <reed@google.com>
Reviewed-by: Florin Malita <fmalita@chromium.org>
Reviewed-by: Herb Derby <herb@google.com>
Diffstat (limited to 'include/core/SkBitmap.h')
-rw-r--r-- | include/core/SkBitmap.h | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/include/core/SkBitmap.h b/include/core/SkBitmap.h index 7a0130eb7a..10d1c251bd 100644 --- a/include/core/SkBitmap.h +++ b/include/core/SkBitmap.h @@ -121,7 +121,12 @@ public: /** Return true iff drawing this bitmap has no effect. */ bool drawsNothing() const { - return this->colorType() == kIndex_8_SkColorType || this->empty() || this->isNull(); +#ifdef SK_SUPPORT_LEGACY_INDEX_8_COLORTYPE + if (this->colorType() == kIndex_8_SkColorType) { + return true; + } +#endif + return this->empty() || this->isNull(); } /** Return the number of bytes between subsequent rows of the bitmap. */ @@ -424,8 +429,12 @@ public: non-null colortable. Returns true if all of the above are met. */ bool readyToDraw() const { - return this->getPixels() != NULL && - (this->colorType() != kIndex_8_SkColorType || this->getColorTable()); +#ifdef SK_SUPPORT_LEGACY_INDEX_8_COLORTYPE + if (this->colorType() == kIndex_8_SkColorType) { + return false; + } +#endif + return this->getPixels() != NULL; } /** Return the bitmap's colortable, if it uses one (i.e. colorType is @@ -725,6 +734,7 @@ inline uint8_t* SkBitmap::getAddr8(int x, int y) const { return (uint8_t*)fPixels + y * fRowBytes + x; } +#ifdef SK_SUPPORT_LEGACY_INDEX_8_COLORTYPE inline SkPMColor SkBitmap::getIndex8Color(int x, int y) const { SkASSERT(fPixels); SkASSERT(kIndex_8_SkColorType == this->colorType()); @@ -732,5 +742,6 @@ inline SkPMColor SkBitmap::getIndex8Color(int x, int y) const { SkASSERT(this->getColorTable()); return (*this->getColorTable())[*((const uint8_t*)fPixels + y * fRowBytes + x)]; } +#endif #endif |