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
diff --git a/src/images/SkImageDecoder_wbmp.cpp b/src/images/SkImageDecoder_wbmp.cpp index 0bf1389..ddb7c3d 100644 --- a/src/images/SkImageDecoder_wbmp.cpp +++ b/src/images/SkImageDecoder_wbmp.cpp
@@ -119,7 +119,7 @@ } 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)) {