aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Hal Canary <halcanary@google.com>2017-05-25 16:21:06 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-05-25 22:18:19 +0000
commit5b474d36238e38642add8d4b54cb9ac80935262b (patch)
tree577e07bdf138ef2f327106d4b5ac6f70bf586a0a
parentb2ef4d6d152300f8a1148aff8a673036b676be33 (diff)
SkPDF: assert premultiplied bitmaps are valid in debug.
Change-Id: I5feeee9a02199c6f4aa91c67e19844e022175d23 Reviewed-on: https://skia-review.googlesource.com/17993 Reviewed-by: Herb Derby <herb@google.com> Commit-Queue: Hal Canary <halcanary@google.com>
-rw-r--r--src/pdf/SkPDFBitmap.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/pdf/SkPDFBitmap.cpp b/src/pdf/SkPDFBitmap.cpp
index d5eb19e552..fa09be33e6 100644
--- a/src/pdf/SkPDFBitmap.cpp
+++ b/src/pdf/SkPDFBitmap.cpp
@@ -93,6 +93,7 @@ static U8CPU SkGetB32Component(uint32_t value, SkColorType ct) {
// unpremultiply and extract R, G, B components.
static void pmcolor_to_rgb24(uint32_t color, uint8_t* rgb, SkColorType ct) {
+ SkPMColorAssert(color);
uint32_t s = SkUnPreMultiply::GetScale(SkGetA32Component(color, ct));
rgb[0] = SkUnPreMultiply::ApplyScale(s, SkGetR32Component(color, ct));
rgb[1] = SkUnPreMultiply::ApplyScale(s, SkGetG32Component(color, ct));
@@ -123,6 +124,7 @@ static void get_neighbor_avg_color(const SkBitmap& bm,
uint32_t* scanline = bm.getAddr32(0, y);
for (int x = xmin; x <= xmax; ++x) {
uint32_t color = scanline[x];
+ SkPMColorAssert(color);
a += SkGetA32Component(color, ct);
r += SkGetR32Component(color, ct);
g += SkGetG32Component(color, ct);