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

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

Issue 744163002: Enable fast/images with slimming paint (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Fix VirtualTestSuites. 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/HTMLCanvasClipper.cpp
diff --git a/Source/core/paint/HTMLCanvasClipper.cpp b/Source/core/paint/HTMLCanvasClipper.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..340a662cbe8e56d0698e74db7cd77219e859eeb9
--- /dev/null
+++ b/Source/core/paint/HTMLCanvasClipper.cpp
@@ -0,0 +1,42 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "config.h"
+#include "core/paint/HTMLCanvasClipper.h"
+
+#include "core/paint/ClipRecorder.h"
+#include "core/paint/ViewDisplayList.h"
+#include "core/rendering/PaintInfo.h"
+#include "core/rendering/RenderHTMLCanvas.h"
+#include "core/rendering/RenderView.h"
+#include "platform/RuntimeEnabledFeatures.h"
+
+namespace blink {
+
+HTMLCanvasClipper::HTMLCanvasClipper(RenderHTMLCanvas& canvas, const PaintInfo& paintInfo, const LayoutRect& clipRect)
chrishtr 2014/11/25 00:29:58 Can this be easily unified with BoxClipper now tha
+ : m_clipRect(clipRect)
+ , m_paintInfo(paintInfo)
+ , m_canvas(canvas)
+{
+ DisplayItem::Type type = DisplayItem::paintPhaseToClipType(paintInfo.phase);
+ OwnPtr<ClipDisplayItem> clipDisplayItem = adoptPtr(new ClipDisplayItem(&m_canvas, type, pixelSnappedIntRect(clipRect)));
+
+ if (RuntimeEnabledFeatures::slimmingPaintEnabled())
+ m_canvas.view()->viewDisplayList().add(clipDisplayItem.release());
+ else
+ clipDisplayItem->replay(paintInfo.context);
+}
+
+HTMLCanvasClipper::~HTMLCanvasClipper()
+{
+ OwnPtr<EndClipDisplayItem> endClipDisplayItem = adoptPtr(new EndClipDisplayItem(&m_canvas));
+
+ if (RuntimeEnabledFeatures::slimmingPaintEnabled()) {
+ m_canvas.view()->viewDisplayList().add(endClipDisplayItem.release());
+ } else {
+ endClipDisplayItem->replay(m_paintInfo.context);
+ }
+}
+
+} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698