aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests
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 /tests
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 'tests')
-rw-r--r--tests/CodexTest.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/tests/CodexTest.cpp b/tests/CodexTest.cpp
index b6b5d8276d..1f6b7ac4c1 100644
--- a/tests/CodexTest.cpp
+++ b/tests/CodexTest.cpp
@@ -130,9 +130,9 @@ static void test_codec(skiatest::Reporter* r, SkCodec* codec, SkBitmap& bm, cons
// Check alpha type conversions
if (info.alphaType() == kOpaque_SkAlphaType) {
test_info(r, codec, info.makeAlphaType(kUnpremul_SkAlphaType),
- SkCodec::kInvalidConversion, nullptr);
+ expectedResult, digest);
test_info(r, codec, info.makeAlphaType(kPremul_SkAlphaType),
- SkCodec::kInvalidConversion, nullptr);
+ expectedResult, digest);
} else {
// Decoding to opaque should fail
test_info(r, codec, info.makeAlphaType(kOpaque_SkAlphaType),
@@ -183,9 +183,9 @@ static void test_android_codec(skiatest::Reporter* r, SkAndroidCodec* codec, SkB
// Check alpha type conversions
if (info.alphaType() == kOpaque_SkAlphaType) {
test_android_info(r, codec, info.makeAlphaType(kUnpremul_SkAlphaType),
- SkCodec::kInvalidConversion, nullptr);
+ expectedResult, digest);
test_android_info(r, codec, info.makeAlphaType(kPremul_SkAlphaType),
- SkCodec::kInvalidConversion, nullptr);
+ expectedResult, digest);
} else {
// Decoding to opaque should fail
test_android_info(r, codec, info.makeAlphaType(kOpaque_SkAlphaType),