From 5b474d36238e38642add8d4b54cb9ac80935262b Mon Sep 17 00:00:00 2001 From: Hal Canary Date: Thu, 25 May 2017 16:21:06 -0400 Subject: [PATCH] SkPDF: assert premultiplied bitmaps are valid in debug. Change-Id: I5feeee9a02199c6f4aa91c67e19844e022175d23 Reviewed-on: https://skia-review.googlesource.com/17993 Reviewed-by: Herb Derby Commit-Queue: Hal Canary --- src/pdf/SkPDFBitmap.cpp | 2 ++ 1 file changed, 2 insertions(+) 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);