aboutsummaryrefslogtreecommitdiffhomepage
path: root/include/codec
diff options
context:
space:
mode:
authorGravatar scroggo <scroggo@google.com>2016-02-03 09:42:42 -0800
committerGravatar Commit bot <commit-bot@chromium.org>2016-02-03 09:42:42 -0800
commitc5560bef14149f4c945a4536988aeba1a16adedc (patch)
treed62cecc289bb7c0ad9083258669179a64fd87d59 /include/codec
parent8ca88e41aa76bc4da568936de9299ec3f8762d9c (diff)
Support decoding opaque to *premul
If a client requests unpremul or premul from an opaque SkCodec, support it. The opaque image can be treated as any of them, though it will be less efficient to draw than if the client had used opaque. Change the filling code (i.e. for incomplete images) to base its color on the source alpha type. Prior to adding the support to decode opaque to any, it was fine to use either source or dest (which would have yielded the same result). If the client requests non-opaque, we do not want this to switch the fill value from black to transparent. This also allows simplifying the signatures for getFillValue and onGetFillValue. In CodexTest, expect the same result when decoding opaque to *premul, and compare to the opaque version. BUG=skia:4616 GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1641273003 Review URL: https://codereview.chromium.org/1641273003
Diffstat (limited to 'include/codec')
-rw-r--r--include/codec/SkCodec.h11
1 files changed, 5 insertions, 6 deletions
diff --git a/include/codec/SkCodec.h b/include/codec/SkCodec.h
index 023ae51c49..edc8ec38fa 100644
--- a/include/codec/SkCodec.h
+++ b/include/codec/SkCodec.h
@@ -570,15 +570,14 @@ protected:
* scanlines. This allows the subclass to indicate what value to fill with.
*
* @param colorType Destination color type.
- * @param alphaType Destination alpha type.
* @return The value with which to fill uninitialized pixels.
*
* Note that we can interpret the return value as an SkPMColor, a 16-bit 565 color,
* an 8-bit gray color, or an 8-bit index into a color table, depending on the color
* type.
*/
- uint32_t getFillValue(SkColorType colorType, SkAlphaType alphaType) const {
- return this->onGetFillValue(colorType, alphaType);
+ uint32_t getFillValue(SkColorType colorType) const {
+ return this->onGetFillValue(colorType);
}
/**
@@ -586,13 +585,13 @@ protected:
* types that we support. Note that for color types that do not use the full 32-bits,
* we will simply take the low bits of the fill value.
*
- * kN32_SkColorType: Transparent or Black
+ * kN32_SkColorType: Transparent or Black, depending on the src alpha type
* kRGB_565_SkColorType: Black
* kGray_8_SkColorType: Black
* kIndex_8_SkColorType: First color in color table
*/
- virtual uint32_t onGetFillValue(SkColorType /*colorType*/, SkAlphaType alphaType) const {
- return kOpaque_SkAlphaType == alphaType ? SK_ColorBLACK : SK_ColorTRANSPARENT;
+ virtual uint32_t onGetFillValue(SkColorType /*colorType*/) const {
+ return kOpaque_SkAlphaType == fSrcInfo.alphaType() ? SK_ColorBLACK : SK_ColorTRANSPARENT;
}
/**