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>
This commit is contained in:
Hal Canary 2017-05-25 16:21:06 -04:00 committed by Skia Commit-Bot
parent b2ef4d6d15
commit 5b474d3623

View File

@ -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);