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

Unified Diff: Source/core/paint/FloatClipRecorder.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/core/paint/FloatClipRecorder.h ('k') | Source/core/paint/InlineTextBoxPainter.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/paint/FloatClipRecorder.cpp
diff --git a/Source/core/paint/FloatClipRecorder.cpp b/Source/core/paint/FloatClipRecorder.cpp
index 8797c065c2010645b3bf154ea8cc24d13bdd432e..7a77f9837b7a36736de93e6fee48423b5bd5fa0f 100644
--- a/Source/core/paint/FloatClipRecorder.cpp
+++ b/Source/core/paint/FloatClipRecorder.cpp
@@ -12,33 +12,49 @@
namespace blink {
-FloatClipRecorder::FloatClipRecorder(GraphicsContext& context, const DisplayItemClientWrapper& client, PaintPhase paintPhase, const FloatRect& clipRect)
+FloatClipRecorder::FloatClipRecorder(GraphicsContext& context, const DisplayItemClientWrapper& client, PaintPhase paintPhase)
: m_context(context)
, m_client(client)
, m_clipType(DisplayItem::paintPhaseToFloatClipType(paintPhase))
{
+}
+
+FloatClipRecorder::FloatClipRecorder(GraphicsContext& context, const DisplayItemClientWrapper& client, PaintPhase paintPhase, const FloatRect& clipRect)
+ : FloatClipRecorder(context, client, paintPhase)
+{
+ begin(clipRect);
+}
+
+FloatClipRecorder::~FloatClipRecorder()
+{
+ if (!m_engaged)
+ return;
+
+ DisplayItem::Type endType = DisplayItem::floatClipTypeToEndFloatClipType(m_clipType);
if (RuntimeEnabledFeatures::slimmingPaintEnabled()) {
ASSERT(m_context.displayItemList());
if (m_context.displayItemList()->displayItemConstructionIsDisabled())
return;
- m_context.displayItemList()->add(FloatClipDisplayItem::create(m_client, m_clipType, clipRect));
+ m_context.displayItemList()->add(EndFloatClipDisplayItem::create(m_client, endType));
} else {
- FloatClipDisplayItem clipDisplayItem(m_client, m_clipType, clipRect);
- clipDisplayItem.replay(m_context);
+ EndFloatClipDisplayItem endClipDisplayItem(m_client, endType);
+ endClipDisplayItem.replay(m_context);
}
}
-FloatClipRecorder::~FloatClipRecorder()
+void FloatClipRecorder::begin(const FloatRect& clipRect)
{
- DisplayItem::Type endType = DisplayItem::floatClipTypeToEndFloatClipType(m_clipType);
+ ASSERT(!m_engaged);
+ m_engaged = true;
+
if (RuntimeEnabledFeatures::slimmingPaintEnabled()) {
ASSERT(m_context.displayItemList());
if (m_context.displayItemList()->displayItemConstructionIsDisabled())
return;
- m_context.displayItemList()->add(EndFloatClipDisplayItem::create(m_client, endType));
+ m_context.displayItemList()->add(FloatClipDisplayItem::create(m_client, m_clipType, clipRect));
} else {
- EndFloatClipDisplayItem endClipDisplayItem(m_client, endType);
- endClipDisplayItem.replay(m_context);
+ FloatClipDisplayItem clipDisplayItem(m_client, m_clipType, clipRect);
+ clipDisplayItem.replay(m_context);
}
}
« no previous file with comments | « Source/core/paint/FloatClipRecorder.h ('k') | Source/core/paint/InlineTextBoxPainter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698