OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "platform/graphics/paint/ClipPathDisplayItem.h" | 6 #include "platform/graphics/paint/ClipPathDisplayItem.h" |
7 | 7 |
8 #include "platform/graphics/GraphicsContext.h" | 8 #include "platform/graphics/GraphicsContext.h" |
9 #include "platform/graphics/Path.h" | 9 #include "platform/graphics/Path.h" |
| 10 #include "platform/graphics/paint/DisplayItems.h" |
10 #include "public/platform/WebDisplayItemList.h" | 11 #include "public/platform/WebDisplayItemList.h" |
11 #include "third_party/skia/include/core/SkScalar.h" | 12 #include "third_party/skia/include/core/SkScalar.h" |
12 | 13 |
13 namespace blink { | 14 namespace blink { |
14 | 15 |
15 void BeginClipPathDisplayItem::replay(GraphicsContext& context) | 16 void BeginClipPathDisplayItem::replay(GraphicsContext& context) |
16 { | 17 { |
17 context.save(); | 18 context.save(); |
18 context.clipPath(m_clipPath, AntiAliased); | 19 context.clipPath(m_clipPath, AntiAliased); |
19 } | 20 } |
20 | 21 |
21 void BeginClipPathDisplayItem::appendToWebDisplayItemList(WebDisplayItemList* li
st) const | 22 void BeginClipPathDisplayItem::appendToWebDisplayItemList(WebDisplayItemList* li
st) const |
22 { | 23 { |
23 list->appendClipPathItem(m_clipPath, SkRegion::kIntersect_Op, true); | 24 list->appendClipPathItem(m_clipPath, SkRegion::kIntersect_Op, true); |
24 } | 25 } |
25 | 26 |
| 27 void BeginClipPathDisplayItem::appendByMoving(DisplayItems& destination) |
| 28 { |
| 29 destination.emplaceBack<BeginClipPathDisplayItem>( |
| 30 DisplayItemClientWrapperHelper(*this), m_clipPath); |
| 31 } |
| 32 |
26 void EndClipPathDisplayItem::replay(GraphicsContext& context) | 33 void EndClipPathDisplayItem::replay(GraphicsContext& context) |
27 { | 34 { |
28 context.restore(); | 35 context.restore(); |
29 } | 36 } |
30 | 37 |
31 void EndClipPathDisplayItem::appendToWebDisplayItemList(WebDisplayItemList* list
) const | 38 void EndClipPathDisplayItem::appendToWebDisplayItemList(WebDisplayItemList* list
) const |
32 { | 39 { |
33 list->appendEndClipPathItem(); | 40 list->appendEndClipPathItem(); |
34 } | 41 } |
35 | 42 |
| 43 void EndClipPathDisplayItem::appendByMoving(DisplayItems& destination) |
| 44 { |
| 45 destination.emplaceBack<EndClipPathDisplayItem>( |
| 46 DisplayItemClientWrapperHelper(*this)); |
| 47 } |
| 48 |
36 #ifndef NDEBUG | 49 #ifndef NDEBUG |
37 void BeginClipPathDisplayItem::dumpPropertiesAsDebugString(WTF::StringBuilder& s
tringBuilder) const | 50 void BeginClipPathDisplayItem::dumpPropertiesAsDebugString(WTF::StringBuilder& s
tringBuilder) const |
38 { | 51 { |
39 DisplayItem::dumpPropertiesAsDebugString(stringBuilder); | 52 DisplayItem::dumpPropertiesAsDebugString(stringBuilder); |
40 stringBuilder.append(WTF::String::format(", pathVerbs: %d, pathPoints: %d, w
indRule: \"%s\"", | 53 stringBuilder.append(WTF::String::format(", pathVerbs: %d, pathPoints: %d, w
indRule: \"%s\"", |
41 m_clipPath.countVerbs(), m_clipPath.countPoints(), | 54 m_clipPath.countVerbs(), m_clipPath.countPoints(), |
42 m_clipPath.getFillType() == SkPath::kWinding_FillType ? "nonzero" : "eve
nodd")); | 55 m_clipPath.getFillType() == SkPath::kWinding_FillType ? "nonzero" : "eve
nodd")); |
43 } | 56 } |
44 | 57 |
45 #endif | 58 #endif |
46 | 59 |
47 } // namespace blink | 60 } // namespace blink |
OLD | NEW |