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