OLD | NEW |
---|---|
(Empty) | |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #include "config.h" | |
6 #include "core/paint/HTMLCanvasClipper.h" | |
7 | |
8 #include "core/paint/ClipRecorder.h" | |
9 #include "core/paint/ViewDisplayList.h" | |
10 #include "core/rendering/PaintInfo.h" | |
11 #include "core/rendering/RenderHTMLCanvas.h" | |
12 #include "core/rendering/RenderView.h" | |
13 #include "platform/RuntimeEnabledFeatures.h" | |
14 | |
15 namespace blink { | |
16 | |
17 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
| |
18 : m_clipRect(clipRect) | |
19 , m_paintInfo(paintInfo) | |
20 , m_canvas(canvas) | |
21 { | |
22 DisplayItem::Type type = DisplayItem::paintPhaseToClipType(paintInfo.phase); | |
23 OwnPtr<ClipDisplayItem> clipDisplayItem = adoptPtr(new ClipDisplayItem(&m_ca nvas, type, pixelSnappedIntRect(clipRect))); | |
24 | |
25 if (RuntimeEnabledFeatures::slimmingPaintEnabled()) | |
26 m_canvas.view()->viewDisplayList().add(clipDisplayItem.release()); | |
27 else | |
28 clipDisplayItem->replay(paintInfo.context); | |
29 } | |
30 | |
31 HTMLCanvasClipper::~HTMLCanvasClipper() | |
32 { | |
33 OwnPtr<EndClipDisplayItem> endClipDisplayItem = adoptPtr(new EndClipDisplayI tem(&m_canvas)); | |
34 | |
35 if (RuntimeEnabledFeatures::slimmingPaintEnabled()) { | |
36 m_canvas.view()->viewDisplayList().add(endClipDisplayItem.release()); | |
37 } else { | |
38 endClipDisplayItem->replay(m_paintInfo.context); | |
39 } | |
40 } | |
41 | |
42 } // namespace blink | |
OLD | NEW |