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

Unified Diff: Source/platform/graphics/paint/ClipRecorder.cpp

Issue 1144203004: Allow certain SP recorder classes to defer their "begin" operation. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 7 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/platform/graphics/paint/ClipRecorder.h ('k') | Source/platform/graphics/paint/DrawingRecorder.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/platform/graphics/paint/ClipRecorder.cpp
diff --git a/Source/platform/graphics/paint/ClipRecorder.cpp b/Source/platform/graphics/paint/ClipRecorder.cpp
index 89471735da5e17201d0753c382e0102209552f18..9dd25b5806f85c4e9791da779e02f3df9399a9dc 100644
--- a/Source/platform/graphics/paint/ClipRecorder.cpp
+++ b/Source/platform/graphics/paint/ClipRecorder.cpp
@@ -12,33 +12,50 @@
namespace blink {
-ClipRecorder::ClipRecorder(GraphicsContext& context, const DisplayItemClientWrapper& client, DisplayItem::Type type, const LayoutRect& clipRect, SkRegion::Op operation)
+ClipRecorder::ClipRecorder(GraphicsContext& context, const DisplayItemClientWrapper& client, DisplayItem::Type type)
: m_client(client)
, m_context(context)
, m_type(type)
+ , m_engaged(false)
+{
+}
+
+ClipRecorder::ClipRecorder(GraphicsContext& context, const DisplayItemClientWrapper& client, DisplayItem::Type type, const LayoutRect& clipRect, SkRegion::Op operation)
+ : ClipRecorder(context, client, type)
{
+ begin(clipRect, operation);
+}
+
+ClipRecorder::~ClipRecorder()
+{
+ if (!m_engaged)
+ return;
+
+ DisplayItem::Type endType = DisplayItem::clipTypeToEndClipType(m_type);
if (RuntimeEnabledFeatures::slimmingPaintEnabled()) {
ASSERT(m_context.displayItemList());
if (m_context.displayItemList()->displayItemConstructionIsDisabled())
return;
- m_context.displayItemList()->add(ClipDisplayItem::create(m_client, type, pixelSnappedIntRect(clipRect), operation));
+ m_context.displayItemList()->add(EndClipDisplayItem::create(m_client, endType));
} else {
- ClipDisplayItem clipDisplayItem(m_client, type, pixelSnappedIntRect(clipRect), operation);
- clipDisplayItem.replay(m_context);
+ EndClipDisplayItem endClipDisplayItem(m_client, endType);
+ endClipDisplayItem.replay(m_context);
}
}
-ClipRecorder::~ClipRecorder()
+void ClipRecorder::begin(const LayoutRect& clipRect, SkRegion::Op operation)
{
- DisplayItem::Type endType = DisplayItem::clipTypeToEndClipType(m_type);
+ ASSERT(!m_engaged);
+ m_engaged = true;
+
if (RuntimeEnabledFeatures::slimmingPaintEnabled()) {
ASSERT(m_context.displayItemList());
if (m_context.displayItemList()->displayItemConstructionIsDisabled())
return;
- m_context.displayItemList()->add(EndClipDisplayItem::create(m_client, endType));
+ m_context.displayItemList()->add(ClipDisplayItem::create(m_client, m_type, pixelSnappedIntRect(clipRect), operation));
} else {
- EndClipDisplayItem endClipDisplayItem(m_client, endType);
- endClipDisplayItem.replay(m_context);
+ ClipDisplayItem clipDisplayItem(m_client, m_type, pixelSnappedIntRect(clipRect), operation);
+ clipDisplayItem.replay(m_context);
}
}
« no previous file with comments | « Source/platform/graphics/paint/ClipRecorder.h ('k') | Source/platform/graphics/paint/DrawingRecorder.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698