diff options
author | Hal Canary <halcanary@google.com> | 2016-12-07 14:59:27 -0500 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2016-12-07 20:43:26 +0000 |
commit | 4cba3fe576de7f48edd0271498745462564fdd6d (patch) | |
tree | 642bccf350276393192eaa05935c77cce6ec348c /src/core/SkPixmap.cpp | |
parent | 1e41f4a111e5b19e55d688033e7b857caef658e6 (diff) |
SkBitmap::ComputeIsOpaque and SkBitmap::eraseColor support F16
Also add a unit test.
Change-Id: I9b6635ce9dd504788ca36b3246eaac2b37c2f3a6
Reviewed-on: https://skia-review.googlesource.com/5443
Commit-Queue: Hal Canary <halcanary@google.com>
Reviewed-by: Mike Reed <reed@google.com>
Diffstat (limited to 'src/core/SkPixmap.cpp')
-rw-r--r-- | src/core/SkPixmap.cpp | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/src/core/SkPixmap.cpp b/src/core/SkPixmap.cpp index 0a1a24f8bf..c73b918f1c 100644 --- a/src/core/SkPixmap.cpp +++ b/src/core/SkPixmap.cpp @@ -5,13 +5,18 @@ * found in the LICENSE file. */ +#include "SkBitmap.h" +#include "SkCanvas.h" #include "SkColorPriv.h" #include "SkConfig8888.h" #include "SkData.h" +#include "SkHalf.h" #include "SkMask.h" +#include "SkNx.h" +#include "SkPM4f.h" #include "SkPixmap.h" +#include "SkSurface.h" #include "SkUtils.h" -#include "SkPM4f.h" void SkAutoPixmapUnlock::reset(const SkPixmap& pm, void (*unlock)(void*), void* ctx) { SkASSERT(pm.addr() != nullptr); @@ -206,15 +211,19 @@ bool SkPixmap::erase(SkColor color, const SkIRect& inArea) const { } break; } + case kRGBA_F16_SkColorType: + // The colorspace is unspecified, so assume linear just like getColor(). + this->erase(SkColor4f{(1 / 255.0f) * r, + (1 / 255.0f) * g, + (1 / 255.0f) * b, + (1 / 255.0f) * a}, &area); + break; default: return false; // no change, so don't call notifyPixelsChanged() } return true; } -#include "SkNx.h" -#include "SkHalf.h" - bool SkPixmap::erase(const SkColor4f& origColor, const SkIRect* subset) const { SkPixmap pm; if (subset) { @@ -238,10 +247,6 @@ bool SkPixmap::erase(const SkColor4f& origColor, const SkIRect* subset) const { return true; } -#include "SkBitmap.h" -#include "SkCanvas.h" -#include "SkSurface.h" - bool SkPixmap::scalePixels(const SkPixmap& dst, SkFilterQuality quality) const { // Can't do anthing with empty src or dst if (this->width() <= 0 || this->height() <= 0 || dst.width() <= 0 || dst.height() <= 0) { |