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

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

Issue 1441973003: Use recomputed interest rect only if it changed enough (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix release builds Created 5 years, 1 month 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/graphics/GraphicsLayer.cpp
diff --git a/third_party/WebKit/Source/platform/graphics/GraphicsLayer.cpp b/third_party/WebKit/Source/platform/graphics/GraphicsLayer.cpp
index 4d51cb8a53798cfdf7b835e5a4b01253204fe94c..6dadd47098015f513919193337e3c42d26a1e977 100644
--- a/third_party/WebKit/Source/platform/graphics/GraphicsLayer.cpp
+++ b/third_party/WebKit/Source/platform/graphics/GraphicsLayer.cpp
@@ -293,9 +293,9 @@ void GraphicsLayer::setOffsetDoubleFromLayoutObject(const DoubleSize& offset, Sh
setNeedsDisplay();
}
-void GraphicsLayer::paint(GraphicsContext& context, const IntRect* clip)
+void GraphicsLayer::paint(GraphicsContext& context, const IntRect* interestRect)
{
- ASSERT(clip || RuntimeEnabledFeatures::slimmingPaintSynchronizedPaintingEnabled());
+ ASSERT(interestRect || RuntimeEnabledFeatures::slimmingPaintSynchronizedPaintingEnabled());
ASSERT(drawsContent());
if (!m_client)
@@ -312,8 +312,22 @@ void GraphicsLayer::paint(GraphicsContext& context, const IntRect* clip)
}
}
#endif
- m_client->paintContents(this, context, m_paintingPhase, clip);
+
+ IntRect newInterestRect;
+ if (RuntimeEnabledFeatures::slimmingPaintSynchronizedPaintingEnabled()) {
+ if (!interestRect) {
+ newInterestRect = m_client->computeInterestRect(this, m_previousInterestRect);
+ interestRect = &newInterestRect;
+ }
+ if (!m_client->needsRepaint() && !paintController()->cacheIsEmpty() && m_previousInterestRect == *interestRect) {
+ paintController()->createAndAppend<CachedDisplayItem>(*this, DisplayItem::CachedDisplayItemList);
+ return;
+ }
+ }
+
+ m_client->paintContents(this, context, m_paintingPhase, *interestRect);
notifyFirstPaintToClient();
+ m_previousInterestRect = *interestRect;
}
void GraphicsLayer::notifyFirstPaintToClient()

Powered by Google App Engine
This is Rietveld 408576698