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 "platform/graphics/paint/ClipPathDisplayItem.h" | 5 #include "platform/graphics/paint/ClipPathDisplayItem.h" |
6 | 6 |
7 #include "platform/graphics/GraphicsContext.h" | 7 #include "platform/graphics/GraphicsContext.h" |
8 #include "platform/graphics/Path.h" | 8 #include "platform/graphics/Path.h" |
9 #include "public/platform/WebDisplayItemList.h" | 9 #include "public/platform/WebDisplayItemList.h" |
10 #include "third_party/skia/include/core/SkPictureAnalyzer.h" | 10 #include "third_party/skia/include/core/SkPictureAnalyzer.h" |
11 #include "third_party/skia/include/core/SkScalar.h" | 11 #include "third_party/skia/include/core/SkScalar.h" |
12 | 12 |
13 namespace blink { | 13 namespace blink { |
14 | 14 |
15 void BeginClipPathDisplayItem::replay(GraphicsContext& context) const | 15 void BeginClipPathDisplayItem::replay(GraphicsContext& context) const |
16 { | 16 { |
17 context.save(); | 17 context.save(); |
18 context.clipPath(m_clipPath, AntiAliased); | 18 context.clipPath(m_clipPath, AntiAliased); |
19 } | 19 } |
20 | 20 |
21 void BeginClipPathDisplayItem::appendToWebDisplayItemList(const IntRect& visualR
ect, WebDisplayItemList* list) const | 21 void BeginClipPathDisplayItem::appendToWebDisplayItemList(const IntRect& visualR
ect, WebDisplayItemList* list) const |
22 { | 22 { |
23 list->appendClipPathItem(visualRect, m_clipPath, SkRegion::kIntersect_Op, tr
ue); | 23 list->appendClipPathItem(m_clipPath, SkRegion::kIntersect_Op, true); |
24 } | 24 } |
25 | 25 |
26 void BeginClipPathDisplayItem::analyzeForGpuRasterization(SkPictureGpuAnalyzer&
analyzer) const | 26 void BeginClipPathDisplayItem::analyzeForGpuRasterization(SkPictureGpuAnalyzer&
analyzer) const |
27 { | 27 { |
28 // Temporarily disabled (pref regressions due to GPU veto stickiness: http:/
/crbug.com/603969). | 28 // Temporarily disabled (pref regressions due to GPU veto stickiness: http:/
/crbug.com/603969). |
29 // analyzer.analyzeClipPath(m_clipPath, SkRegion::kIntersect_Op, true); | 29 // analyzer.analyzeClipPath(m_clipPath, SkRegion::kIntersect_Op, true); |
30 } | 30 } |
31 | 31 |
32 void EndClipPathDisplayItem::replay(GraphicsContext& context) const | 32 void EndClipPathDisplayItem::replay(GraphicsContext& context) const |
33 { | 33 { |
34 context.restore(); | 34 context.restore(); |
35 } | 35 } |
36 | 36 |
37 void EndClipPathDisplayItem::appendToWebDisplayItemList(const IntRect& visualRec
t, WebDisplayItemList* list) const | 37 void EndClipPathDisplayItem::appendToWebDisplayItemList(const IntRect& visualRec
t, WebDisplayItemList* list) const |
38 { | 38 { |
39 list->appendEndClipPathItem(visualRect); | 39 list->appendEndClipPathItem(); |
40 } | 40 } |
41 | 41 |
42 #ifndef NDEBUG | 42 #ifndef NDEBUG |
43 void BeginClipPathDisplayItem::dumpPropertiesAsDebugString(WTF::StringBuilder& s
tringBuilder) const | 43 void BeginClipPathDisplayItem::dumpPropertiesAsDebugString(WTF::StringBuilder& s
tringBuilder) const |
44 { | 44 { |
45 DisplayItem::dumpPropertiesAsDebugString(stringBuilder); | 45 DisplayItem::dumpPropertiesAsDebugString(stringBuilder); |
46 stringBuilder.append(WTF::String::format(", pathVerbs: %d, pathPoints: %d, w
indRule: \"%s\"", | 46 stringBuilder.append(WTF::String::format(", pathVerbs: %d, pathPoints: %d, w
indRule: \"%s\"", |
47 m_clipPath.countVerbs(), m_clipPath.countPoints(), | 47 m_clipPath.countVerbs(), m_clipPath.countPoints(), |
48 m_clipPath.getFillType() == SkPath::kWinding_FillType ? "nonzero" : "eve
nodd")); | 48 m_clipPath.getFillType() == SkPath::kWinding_FillType ? "nonzero" : "eve
nodd")); |
49 } | 49 } |
50 | 50 |
51 #endif | 51 #endif |
52 | 52 |
53 } // namespace blink | 53 } // namespace blink |
OLD | NEW |