OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "config.h" | 5 #include "config.h" |
6 #include "core/paint/ClipRecorder.h" | 6 #include "core/paint/ClipRecorder.h" |
7 | 7 |
8 #include "core/rendering/PaintInfo.h" | 8 #include "core/rendering/PaintInfo.h" |
9 #include "core/rendering/RenderLayer.h" | 9 #include "core/rendering/RenderLayer.h" |
10 #include "core/rendering/RenderLayerModelObject.h" | 10 #include "core/rendering/RenderLayerModelObject.h" |
11 #include "core/rendering/RenderView.h" | 11 #include "core/rendering/RenderView.h" |
12 #include "platform/RuntimeEnabledFeatures.h" | 12 #include "platform/RuntimeEnabledFeatures.h" |
13 #include "platform/graphics/GraphicsLayer.h" | 13 #include "platform/graphics/GraphicsLayer.h" |
14 #include "platform/graphics/paint/ClipDisplayItem.h" | 14 #include "platform/graphics/paint/ClipDisplayItem.h" |
15 #include "platform/graphics/paint/DisplayItemList.h" | 15 #include "platform/graphics/paint/DisplayItemList.h" |
16 | 16 |
17 namespace blink { | 17 namespace blink { |
18 | 18 |
19 ClipRecorder::ClipRecorder(RenderLayerModelObject& canvas, const PaintInfo& pain
tInfo, const LayoutRect& clipRect) | 19 ClipRecorder::ClipRecorder(RenderLayerModelObject& canvas, const PaintInfo& pain
tInfo, const LayoutRect& clipRect, SkRegion::Op operation) |
20 : m_clipRect(clipRect) | 20 : m_clipRect(clipRect) |
21 , m_paintInfo(paintInfo) | 21 , m_paintInfo(paintInfo) |
22 , m_canvas(canvas) | 22 , m_canvas(canvas) |
23 { | 23 { |
24 DisplayItem::Type type = paintPhaseToClipType(paintInfo.phase); | 24 DisplayItem::Type type = paintPhaseToClipType(paintInfo.phase); |
25 OwnPtr<ClipDisplayItem> clipDisplayItem = adoptPtr(new ClipDisplayItem(m_can
vas.displayItemClient(), type, pixelSnappedIntRect(clipRect))); | 25 OwnPtr<ClipDisplayItem> clipDisplayItem = adoptPtr(new ClipDisplayItem(m_can
vas.displayItemClient(), type, pixelSnappedIntRect(clipRect), operation)); |
26 | 26 |
27 if (RuntimeEnabledFeatures::slimmingPaintEnabled()) { | 27 if (RuntimeEnabledFeatures::slimmingPaintEnabled()) { |
28 if (RenderLayer* container = m_canvas.enclosingLayer()->enclosingLayerFo
rPaintInvalidationCrossingFrameBoundaries()) | 28 if (RenderLayer* container = m_canvas.enclosingLayer()->enclosingLayerFo
rPaintInvalidationCrossingFrameBoundaries()) |
29 container->graphicsLayerBacking()->displayItemList().add(clipDisplay
Item.release()); | 29 container->graphicsLayerBacking()->displayItemList().add(clipDisplay
Item.release()); |
30 } else | 30 } else |
31 clipDisplayItem->replay(paintInfo.context); | 31 clipDisplayItem->replay(paintInfo.context); |
32 } | 32 } |
33 | 33 |
34 ClipRecorder::~ClipRecorder() | 34 ClipRecorder::~ClipRecorder() |
35 { | 35 { |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
75 case PaintPhaseBlockBackground: | 75 case PaintPhaseBlockBackground: |
76 case PaintPhaseSelfOutline: | 76 case PaintPhaseSelfOutline: |
77 case PaintPhaseMask: | 77 case PaintPhaseMask: |
78 ASSERT_NOT_REACHED(); | 78 ASSERT_NOT_REACHED(); |
79 } | 79 } |
80 // This should never happen. | 80 // This should never happen. |
81 return DisplayItem::ClipBoxForeground; | 81 return DisplayItem::ClipBoxForeground; |
82 } | 82 } |
83 | 83 |
84 } // namespace blink | 84 } // namespace blink |
OLD | NEW |