Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(286)

Unified Diff: tests/CodexTest.cpp

Issue 1277213002: Support more swizzles to 565 in SkCodec (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Update new 565 swizzling functions for scaling Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« src/codec/SkSwizzler.cpp ('K') | « src/codec/SkWebpCodec.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/CodexTest.cpp
diff --git a/tests/CodexTest.cpp b/tests/CodexTest.cpp
index 95cd5635445ca6fa62dd378c7893e46ad58a0996..80164b294bbc03faf31dcbc2877b78582e5a4d60 100644
--- a/tests/CodexTest.cpp
+++ b/tests/CodexTest.cpp
@@ -78,7 +78,8 @@ static void check(skiatest::Reporter* r,
const char path[],
SkISize size,
bool supportsScanlineDecoding,
- bool supportsSubsetDecoding) {
+ bool supportsSubsetDecoding,
+ bool supports565 = true) {
SkAutoTDelete<SkStream> stream(resource(path));
if (!stream) {
SkDebugf("Missing resource '%s'\n", path);
@@ -96,6 +97,15 @@ static void check(skiatest::Reporter* r,
// decodes to all possible destination color types.
SkImageInfo info = codec->getInfo().makeColorType(kN32_SkColorType);
REPORTER_ASSERT(r, info.dimensions() == size);
+
+ {
+ // Test decoding to 565
+ SkImageInfo info565 = info.makeColorType(kRGB_565_SkColorType);
+ SkCodec::Result expected = (supports565 && info.alphaType() == kOpaque_SkAlphaType) ?
+ SkCodec::kSuccess : SkCodec::kInvalidConversion;
+ test_info(r, codec, info565, expected, NULL);
+ }
+
SkBitmap bm;
bm.allocPixels(info);
SkAutoLockPixels autoLockPixels(bm);
@@ -213,7 +223,7 @@ DEF_TEST(Codec, r) {
check(r, "randPixels.gif", SkISize::Make(8, 8), false, false);
// JPG
- check(r, "CMYK.jpg", SkISize::Make(642, 516), true, false);
+ check(r, "CMYK.jpg", SkISize::Make(642, 516), true, false, false);
check(r, "color_wheel.jpg", SkISize::Make(128, 128), true, false);
check(r, "grayscale.jpg", SkISize::Make(128, 128), true, false);
check(r, "mandrill_512_q075.jpg", SkISize::Make(512, 512), true, false);
« src/codec/SkSwizzler.cpp ('K') | « src/codec/SkWebpCodec.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698