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

Unified Diff: third_party/WebKit/Source/platform/image-decoders/gif/GIFImageReader.cpp

Issue 1647703006: Track positions of dimensions in image files (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Updated GIF dimensions UMA logic Created 4 years, 11 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: third_party/WebKit/Source/platform/image-decoders/gif/GIFImageReader.cpp
diff --git a/third_party/WebKit/Source/platform/image-decoders/gif/GIFImageReader.cpp b/third_party/WebKit/Source/platform/image-decoders/gif/GIFImageReader.cpp
index 4c6631dfe2b4ea139902f443fdf716cde83a9c68..727bcf12513958e19467d3fd1843017c11c5b92e 100644
--- a/third_party/WebKit/Source/platform/image-decoders/gif/GIFImageReader.cpp
+++ b/third_party/WebKit/Source/platform/image-decoders/gif/GIFImageReader.cpp
@@ -463,7 +463,7 @@ bool GIFImageReader::parseData(size_t dataPosition, size_t len, GIFImageDecoder:
// change after we read the first frame's image header.
m_screenWidth = GETINT16(currentComponent);
m_screenHeight = GETINT16(currentComponent + 2);
-
+ m_client->setSizeOffsetOptimized(currentComponentPosition + 4);
const size_t globalColorMapColors = 2 << (currentComponent[4] & 0x07);
if ((currentComponent[4] & 0x80) && globalColorMapColors > 0) { /* global map */
@@ -689,6 +689,10 @@ bool GIFImageReader::parseData(size_t dataPosition, size_t len, GIFImageDecoder:
// set to zero, since usually the first frame completely fills
// the image.
if (currentFrameIsFirstFrame()) {
+ bool updated = (m_screenHeight < yOffset + height || m_screenWidth < yOffset + width);
+ if (updated)
+ m_client->setSizeOffsetOptimized(0);
+ m_client->setSizeOffset(currentComponentPosition + 8);
m_screenHeight = std::max(m_screenHeight, yOffset + height);
m_screenWidth = std::max(m_screenWidth, xOffset + width);
}

Powered by Google App Engine
This is Rietveld 408576698