Chromium Code Reviews| 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 |