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

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

Issue 2229643002: Don't invalidate paint on background image change if it's obscured (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@BackgroundObscured
Patch Set: Rebase Created 4 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
« no previous file with comments | « third_party/WebKit/Source/core/layout/LayoutObject.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/platform/graphics/BitmapImage.cpp
diff --git a/third_party/WebKit/Source/platform/graphics/BitmapImage.cpp b/third_party/WebKit/Source/platform/graphics/BitmapImage.cpp
index 19ed900844e6134debd272d79dc5a90b4a48d498..6bd22c923ea3ab9b77ed1e4398427c6af54cfd5c 100644
--- a/third_party/WebKit/Source/platform/graphics/BitmapImage.cpp
+++ b/third_party/WebKit/Source/platform/graphics/BitmapImage.cpp
@@ -384,10 +384,17 @@ bool BitmapImage::frameHasAlphaAtIndex(size_t index)
if (m_frames.size() <= index)
return true;
+ if (m_frames[index].m_haveMetadata && !m_frames[index].m_hasAlpha)
+ return false;
+
+ // m_hasAlpha may change after m_haveMetadata is set to true, so always ask
+ // ImageSource for the value if the cached value is the default value.
+ bool hasAlpha = m_source.frameHasAlphaAtIndex(index);
+
if (m_frames[index].m_haveMetadata)
- return m_frames[index].m_hasAlpha;
+ m_frames[index].m_hasAlpha = hasAlpha;
- return m_source.frameHasAlphaAtIndex(index);
+ return hasAlpha;
}
bool BitmapImage::currentFrameKnownToBeOpaque(MetadataMode metadataMode)
« no previous file with comments | « third_party/WebKit/Source/core/layout/LayoutObject.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698