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

Unified Diff: Source/core/paint/TransparencyDisplayItem.cpp

Issue 744163002: Enable fast/images with slimming paint (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: ToT-ed with enum. Created 6 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: Source/core/paint/TransparencyDisplayItem.cpp
diff --git a/Source/core/paint/TransparencyDisplayItem.cpp b/Source/core/paint/TransparencyDisplayItem.cpp
index 77605749f74b035fee3a09e5c0dd1def7c8bb693..bae051acd5de09e6926b37b365916cb705bb5b27 100644
--- a/Source/core/paint/TransparencyDisplayItem.cpp
+++ b/Source/core/paint/TransparencyDisplayItem.cpp
@@ -5,14 +5,19 @@
#include "config.h"
#include "core/paint/TransparencyDisplayItem.h"
+#include "core/rendering/RenderObject.h"
+#include "core/rendering/RenderView.h"
+#include "platform/RuntimeEnabledFeatures.h"
#include "platform/graphics/GraphicsContext.h"
namespace blink {
void BeginTransparencyDisplayItem::replay(GraphicsContext* context)
{
- context->save();
- context->clip(m_clipRect);
+ if (m_clipBehavior == ClipToRect) {
chrishtr 2014/11/21 20:09:02 Should we just create an extra ClipDisplayItem rat
+ context->save();
+ context->clip(m_clipRect);
+ }
bool hasBlendMode = this->hasBlendMode();
if (hasBlendMode)
@@ -40,7 +45,8 @@ WTF::String BeginTransparencyDisplayItem::asDebugString() const
void EndTransparencyDisplayItem::replay(GraphicsContext* context)
{
context->endLayer();
- context->restore();
+ if (m_clipBehavior == ClipToRect)
+ context->restore();
}
#ifndef NDEBUG
@@ -51,4 +57,26 @@ WTF::String EndTransparencyDisplayItem::asDebugString() const
}
#endif
+TransparencyRecorder::TransparencyRecorder(GraphicsContext* graphicsContext, const RenderObject* renderer, DisplayItem::Type type, const LayoutRect& clipRect, const WebBlendMode& blendMode, const float opacity, TransparencyClipBehavior clipBehavior)
+ : m_renderer(renderer)
+ , m_type(type)
+ , m_graphicsContext(graphicsContext)
+ , m_clipBehavior(clipBehavior)
+{
+ OwnPtr<BeginTransparencyDisplayItem> beginTransparencyDisplayItem = adoptPtr(new BeginTransparencyDisplayItem(renderer, type, clipRect, blendMode, opacity, clipBehavior));
+ if (RuntimeEnabledFeatures::slimmingPaintEnabled())
+ renderer->view()->viewDisplayList().add(beginTransparencyDisplayItem.release());
+ else
+ beginTransparencyDisplayItem->replay(graphicsContext);
+}
+
+TransparencyRecorder::~TransparencyRecorder()
+{
+ OwnPtr<EndTransparencyDisplayItem> endTransparencyDisplayItem = adoptPtr(new EndTransparencyDisplayItem(m_renderer, m_type, m_clipBehavior));
+ if (RuntimeEnabledFeatures::slimmingPaintEnabled())
+ m_renderer->view()->viewDisplayList().add(endTransparencyDisplayItem.release());
+ else
+ endTransparencyDisplayItem->replay(m_graphicsContext);
+}
+
} // namespace blink
« Source/core/paint/LayerPainter.cpp ('K') | « Source/core/paint/TransparencyDisplayItem.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698