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

Unified Diff: Source/core/paint/LayoutObjectDrawingRecorder.h

Issue 1315993004: Implement a paint offset cache for slimming paint v2 (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rebase more (world moved in the past hour) Created 5 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 | « Source/core/paint/LayerClipRecorderTest.cpp ('k') | Source/core/paint/LayoutObjectDrawingRecorderTest.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/paint/LayoutObjectDrawingRecorder.h
diff --git a/Source/core/paint/LayoutObjectDrawingRecorder.h b/Source/core/paint/LayoutObjectDrawingRecorder.h
index fe1627f8de2fe3ea95601558698815afb5f435db..d2d455598c7e7e8db597f4de936b8c6f1daa6fc2 100644
--- a/Source/core/paint/LayoutObjectDrawingRecorder.h
+++ b/Source/core/paint/LayoutObjectDrawingRecorder.h
@@ -7,6 +7,7 @@
#include "core/layout/LayoutObject.h"
#include "core/paint/PaintPhase.h"
+#include "platform/geometry/LayoutPoint.h"
#include "platform/geometry/LayoutRect.h"
#include "platform/graphics/paint/DisplayItemCacheSkipper.h"
#include "platform/graphics/paint/DrawingRecorder.h"
@@ -21,36 +22,50 @@ class GraphicsContext;
class LayoutObjectDrawingRecorder final {
ALLOW_ONLY_INLINE_ALLOCATION();
public:
- static bool useCachedDrawingIfPossible(GraphicsContext& context, const LayoutObject& layoutObject, DisplayItem::Type displayItemType)
+ static bool useCachedDrawingIfPossible(GraphicsContext& context, const LayoutObject& layoutObject, DisplayItem::Type displayItemType, const LayoutPoint& paintOffset)
{
+ // TODO(pdr): The paint offset cache should be stored on LayoutObject but is temporarily on the DisplayItemList.
+ if (RuntimeEnabledFeatures::slimmingPaintV2Enabled() && !context.displayItemList()->paintOffsetIsUnchanged(layoutObject.displayItemClient(), paintOffset))
+ return false;
if (layoutObject.fullPaintInvalidationReason() == PaintInvalidationDelayedFull)
return false;
return DrawingRecorder::useCachedDrawingIfPossible(context, layoutObject, displayItemType);
}
- static bool useCachedDrawingIfPossible(GraphicsContext& context, const LayoutObject& layoutObject, PaintPhase phase)
+ static bool useCachedDrawingIfPossible(GraphicsContext& context, const LayoutObject& layoutObject, PaintPhase phase, const LayoutPoint& paintOffset)
{
- return useCachedDrawingIfPossible(context, layoutObject, DisplayItem::paintPhaseToDrawingType(phase));
+ return useCachedDrawingIfPossible(context, layoutObject, DisplayItem::paintPhaseToDrawingType(phase), paintOffset);
}
- LayoutObjectDrawingRecorder(GraphicsContext& context, const LayoutObject& layoutObject, DisplayItem::Type displayItemType, const FloatRect& clip)
+ LayoutObjectDrawingRecorder(GraphicsContext& context, const LayoutObject& layoutObject, DisplayItem::Type displayItemType, const FloatRect& clip, const LayoutPoint& paintOffset)
{
+ if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) {
+ // TODO(pdr): The paint offset cache should be stored on LayoutObject but is temporarily on the DisplayItemList.
+ if (!context.displayItemList()->paintOffsetIsUnchanged(layoutObject.displayItemClient(), paintOffset)) {
+ context.displayItemList()->recordPaintOffset(layoutObject.displayItemClient(), paintOffset);
+ context.displayItemList()->invalidatePaintOffset(layoutObject.displayItemClient());
+ } else {
+ ASSERT(!context.displayItemList()->paintOffsetWasInvalidated(layoutObject.displayItemClient()) || !context.displayItemList()->clientCacheIsValid(layoutObject.displayItemClient()));
+ }
+ }
+
// We may paint a delayed-invalidation object before it's actually invalidated.
if (layoutObject.fullPaintInvalidationReason() == PaintInvalidationDelayedFull)
m_cacheSkipper.emplace(context);
m_drawingRecorder.emplace(context, layoutObject, displayItemType, clip);
}
- LayoutObjectDrawingRecorder(GraphicsContext& context, const LayoutObject& layoutObject, DisplayItem::Type displayItemType, const LayoutRect& clip)
- : LayoutObjectDrawingRecorder(context, layoutObject, displayItemType, FloatRect(clip)) { }
- LayoutObjectDrawingRecorder(GraphicsContext& context, const LayoutObject& layoutObject, PaintPhase phase, const FloatRect& clip)
- : LayoutObjectDrawingRecorder(context, layoutObject, DisplayItem::paintPhaseToDrawingType(phase), clip) { }
+ LayoutObjectDrawingRecorder(GraphicsContext& context, const LayoutObject& layoutObject, DisplayItem::Type displayItemType, const LayoutRect& clip, const LayoutPoint& paintOffset)
+ : LayoutObjectDrawingRecorder(context, layoutObject, displayItemType, FloatRect(clip), paintOffset) { }
+
+ LayoutObjectDrawingRecorder(GraphicsContext& context, const LayoutObject& layoutObject, PaintPhase phase, const FloatRect& clip, const LayoutPoint& paintOffset)
+ : LayoutObjectDrawingRecorder(context, layoutObject, DisplayItem::paintPhaseToDrawingType(phase), clip, paintOffset) { }
- LayoutObjectDrawingRecorder(GraphicsContext& context, const LayoutObject& layoutObject, PaintPhase phase, const LayoutRect& clip)
- : LayoutObjectDrawingRecorder(context, layoutObject, DisplayItem::paintPhaseToDrawingType(phase), FloatRect(clip)) { }
+ LayoutObjectDrawingRecorder(GraphicsContext& context, const LayoutObject& layoutObject, PaintPhase phase, const LayoutRect& clip, const LayoutPoint& paintOffset)
+ : LayoutObjectDrawingRecorder(context, layoutObject, DisplayItem::paintPhaseToDrawingType(phase), FloatRect(clip), paintOffset) { }
- LayoutObjectDrawingRecorder(GraphicsContext& context, const LayoutObject& layoutObject, PaintPhase phase, const IntRect& clip)
- : LayoutObjectDrawingRecorder(context, layoutObject, DisplayItem::paintPhaseToDrawingType(phase), FloatRect(clip)) { }
+ LayoutObjectDrawingRecorder(GraphicsContext& context, const LayoutObject& layoutObject, PaintPhase phase, const IntRect& clip, const LayoutPoint& paintOffset)
+ : LayoutObjectDrawingRecorder(context, layoutObject, DisplayItem::paintPhaseToDrawingType(phase), FloatRect(clip), paintOffset) { }
#if ENABLE(ASSERT)
void setUnderInvalidationCheckingMode(DrawingDisplayItem::UnderInvalidationCheckingMode mode) { m_drawingRecorder->setUnderInvalidationCheckingMode(mode); }
« no previous file with comments | « Source/core/paint/LayerClipRecorderTest.cpp ('k') | Source/core/paint/LayoutObjectDrawingRecorderTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698