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 context.save(); | 16 context.save(); |
17 context.clipPath(m_clipPath, AntiAliased); | 17 context.clipPath(m_clipPath, AntiAliased); |
18 } | 18 } |
19 | 19 |
20 void BeginClipPathDisplayItem::appendToWebDisplayItemList( | 20 void BeginClipPathDisplayItem::appendToWebDisplayItemList( |
21 const IntRect& visualRect, | 21 const IntRect& visualRect, |
22 WebDisplayItemList* list) const { | 22 WebDisplayItemList* list) const { |
23 list->appendClipPathItem(m_clipPath, true); | 23 list->appendClipPathItem(m_clipPath, true); |
24 } | 24 } |
25 | 25 |
26 void BeginClipPathDisplayItem::analyzeForGpuRasterization( | 26 int BeginClipPathDisplayItem::numberOfSlowPaths() const { |
27 SkPictureGpuAnalyzer& analyzer) const { | |
28 // Temporarily disabled (pref regressions due to GPU veto stickiness: | 27 // Temporarily disabled (pref regressions due to GPU veto stickiness: |
29 // http://crbug.com/603969). | 28 // http://crbug.com/603969). |
30 // analyzer.analyzeClipPath(m_clipPath, SkRegion::kIntersect_Op, true); | 29 // analyzer.analyzeClipPath(m_clipPath, SkRegion::kIntersect_Op, true); |
| 30 // TODO(enne): fixup this code to return an int. |
| 31 return 0; |
31 } | 32 } |
32 | 33 |
33 void EndClipPathDisplayItem::replay(GraphicsContext& context) const { | 34 void EndClipPathDisplayItem::replay(GraphicsContext& context) const { |
34 context.restore(); | 35 context.restore(); |
35 } | 36 } |
36 | 37 |
37 void EndClipPathDisplayItem::appendToWebDisplayItemList( | 38 void EndClipPathDisplayItem::appendToWebDisplayItemList( |
38 const IntRect& visualRect, | 39 const IntRect& visualRect, |
39 WebDisplayItemList* list) const { | 40 WebDisplayItemList* list) const { |
40 list->appendEndClipPathItem(); | 41 list->appendEndClipPathItem(); |
41 } | 42 } |
42 | 43 |
43 #ifndef NDEBUG | 44 #ifndef NDEBUG |
44 void BeginClipPathDisplayItem::dumpPropertiesAsDebugString( | 45 void BeginClipPathDisplayItem::dumpPropertiesAsDebugString( |
45 WTF::StringBuilder& stringBuilder) const { | 46 WTF::StringBuilder& stringBuilder) const { |
46 DisplayItem::dumpPropertiesAsDebugString(stringBuilder); | 47 DisplayItem::dumpPropertiesAsDebugString(stringBuilder); |
47 stringBuilder.append(WTF::String::format( | 48 stringBuilder.append(WTF::String::format( |
48 ", pathVerbs: %d, pathPoints: %d, windRule: \"%s\"", | 49 ", pathVerbs: %d, pathPoints: %d, windRule: \"%s\"", |
49 m_clipPath.countVerbs(), m_clipPath.countPoints(), | 50 m_clipPath.countVerbs(), m_clipPath.countPoints(), |
50 m_clipPath.getFillType() == SkPath::kWinding_FillType ? "nonzero" | 51 m_clipPath.getFillType() == SkPath::kWinding_FillType ? "nonzero" |
51 : "evenodd")); | 52 : "evenodd")); |
52 } | 53 } |
53 | 54 |
54 #endif | 55 #endif |
55 | 56 |
56 } // namespace blink | 57 } // namespace blink |
OLD | NEW |