fix WBMP image will get null color table when draw in RGB565 Canvas

Symptom: draw Index8 to RGB565 will using SkColorTable::lock16BitCache and return a null array.
Root Cause:lock16BitCache return null pointer because default type is kPremul_SkAlphaType
Solution: WBMP color table should be kOpaque_SkAlphaType
Reproduce steps: draw a WBMP with a matrix that apply rotate and transform

This patch was proposed by arthur_hung at htc.com to the AOSP project.

R=reed@google.com, scroggo@google.com

Review URL: https://codereview.chromium.org/377443007
This commit is contained in:
Derek Sollenberger 2014-07-08 08:23:31 -04:00
parent a26bbb95a6
commit 56a6b6ba9d

View File

@ -119,7 +119,7 @@ bool SkWBMPImageDecoder::onDecode(SkStream* stream, SkBitmap* decodedBitmap,
}
const SkPMColor colors[] = { SK_ColorBLACK, SK_ColorWHITE };
SkColorTable* ct = SkNEW_ARGS(SkColorTable, (colors, 2));
SkColorTable* ct = SkNEW_ARGS(SkColorTable, (colors, 2, kOpaque_SkAlphaType));
SkAutoUnref aur(ct);
if (!this->allocPixelRef(decodedBitmap, ct)) {