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

Unified Diff: third_party/WebKit/Source/platform/graphics/DeferredImageDecoderTest.cpp

Issue 2756463003: Remove opaque alpha channel special case (Closed)
Patch Set: Checking if JPEGImageDecoder::OutputScanlines()'s SetHasAlpha(true) is under test Created 3 years, 7 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
« no previous file with comments | « no previous file | third_party/WebKit/Source/platform/image-decoders/ImageDecoder.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/platform/graphics/DeferredImageDecoderTest.cpp
diff --git a/third_party/WebKit/Source/platform/graphics/DeferredImageDecoderTest.cpp b/third_party/WebKit/Source/platform/graphics/DeferredImageDecoderTest.cpp
index 905b2d3830a6bff94ca44cb1de4d2cbbbd979b13..1ec9790867af662420695eb08492b8b001f23137 100644
--- a/third_party/WebKit/Source/platform/graphics/DeferredImageDecoderTest.cpp
+++ b/third_party/WebKit/Source/platform/graphics/DeferredImageDecoderTest.cpp
@@ -346,7 +346,9 @@ TEST_F(DeferredImageDecoderTest, frameOpacity) {
Vector<char> storage(size);
SkPixmap pixmap(pix_info, storage.data(), row_bytes);
- // Before decoding, the frame is not known to be opaque.
+ // Before decoding, the frame's alpha is unknown and assumed to be
+ // transparent. This works well with partial decoding, which will be
+ // transparent until the full first frame is decoded.
sk_sp<SkImage> frame = decoder->CreateFrameAtIndex(0);
ASSERT_TRUE(frame);
EXPECT_FALSE(frame->isOpaque());
@@ -354,10 +356,13 @@ TEST_F(DeferredImageDecoderTest, frameOpacity) {
// Force a lazy decode by reading pixels.
EXPECT_TRUE(frame->readPixels(pixmap, 0, 0));
- // After decoding, the frame is known to be opaque.
frame = decoder->CreateFrameAtIndex(0);
ASSERT_TRUE(frame);
- EXPECT_TRUE(frame->isOpaque());
+ // When test_gif is true, we use a GIF file which is opaque.
+ // When test_gif is false we use a PNG file instead.
+ // Our PNG handling does not check if an image may be opaque, so it is
+ // treated as transparent.
+ EXPECT_EQ(test_gif, frame->isOpaque());
// Re-generating the opaque-marked frame should not fail.
EXPECT_TRUE(frame->readPixels(pixmap, 0, 0));
« no previous file with comments | « no previous file | third_party/WebKit/Source/platform/image-decoders/ImageDecoder.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698