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

Unified Diff: Source/platform/graphics/BitmapImageTest.cpp

Issue 352873002: [wip] image color correction (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 6 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
Index: Source/platform/graphics/BitmapImageTest.cpp
diff --git a/Source/platform/graphics/BitmapImageTest.cpp b/Source/platform/graphics/BitmapImageTest.cpp
index 1fa2ea249cdcaa0a08e9caf506530d881d77b890..b8e5e8eb2ae3ad962541cd5e6c84bdc6b6bea44e 100644
--- a/Source/platform/graphics/BitmapImageTest.cpp
+++ b/Source/platform/graphics/BitmapImageTest.cpp
@@ -72,6 +72,7 @@ public:
void setCurrentFrame(size_t frame) { m_image->m_currentFrame = frame; }
size_t frameDecodedSize(size_t frame) { return m_image->m_frames[frame].m_frameBytes; }
size_t decodedFramesCount() const { return m_image->m_frames.size(); }
+ void resetDecoder() { return m_image->resetDecoder(); }
void loadImage(const char* fileName)
{
@@ -185,21 +186,48 @@ TEST_F(BitmapImageTest, jpegHasColorProfile)
{
loadImage("/LayoutTests/fast/images/resources/icc-v2-gbr.jpg");
EXPECT_EQ(1u, decodedFramesCount());
+ EXPECT_EQ(227700u, decodedSize());
EXPECT_TRUE(m_image->hasColorProfile());
+
+ resetDecoder();
+ destroyDecodedData(true);
+
+ loadImage("/LayoutTests/fast/images/resources/green.jpg");
+ EXPECT_EQ(1u, decodedFramesCount());
+ EXPECT_EQ(1024u, decodedSize());
+ EXPECT_FALSE(m_image->hasColorProfile());
}
TEST_F(BitmapImageTest, pngHasColorProfile)
{
loadImage("/LayoutTests/fast/images/resources/palatted-color-png-gamma-one-color-profile.png");
EXPECT_EQ(1u, decodedFramesCount());
+ EXPECT_EQ(65536u, decodedSize());
EXPECT_TRUE(m_image->hasColorProfile());
+
+ resetDecoder();
+ destroyDecodedData(true);
+
+ loadImage("/LayoutTests/fast/images/resources/green.jpg");
+ EXPECT_EQ(1u, decodedFramesCount());
+ EXPECT_EQ(1024u, decodedSize());
+ EXPECT_FALSE(m_image->hasColorProfile());
}
TEST_F(BitmapImageTest, webpHasColorProfile)
{
loadImage("/LayoutTests/fast/images/resources/webp-color-profile-lossy.webp");
EXPECT_EQ(1u, decodedFramesCount());
+ EXPECT_EQ(2560000u, decodedSize());
EXPECT_TRUE(m_image->hasColorProfile());
+
+ destroyDecodedData(true);
+ resetDecoder();
+
+ loadImage("/LayoutTests/fast/images/resources/test.webp");
+ EXPECT_EQ(1u, decodedFramesCount());
+ EXPECT_EQ(65536u, decodedSize());
+ EXPECT_FALSE(m_image->hasColorProfile());
}
#endif // USE(QCMSLIB)

Powered by Google App Engine
This is Rietveld 408576698