| 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(clip_path_, kAntiAliased); | 17 context.ClipPath(clip_path_, kAntiAliased); |
| 18 } | 18 } |
| 19 | 19 |
| 20 void BeginClipPathDisplayItem::AppendToWebDisplayItemList( | 20 void BeginClipPathDisplayItem::AppendToWebDisplayItemList( |
| 21 const IntRect& visual_rect, | 21 const IntRect& visual_rect, |
| 22 WebDisplayItemList* list) const { | 22 WebDisplayItemList* list) const { |
| 23 list->AppendClipPathItem(clip_path_, true); | 23 list->AppendClipPathItem(clip_path_, 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& visual_rect, | 39 const IntRect& visual_rect, |
| 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& string_builder) const { | 46 WTF::StringBuilder& string_builder) const { |
| 46 DisplayItem::DumpPropertiesAsDebugString(string_builder); | 47 DisplayItem::DumpPropertiesAsDebugString(string_builder); |
| 47 string_builder.Append(WTF::String::Format( | 48 string_builder.Append(WTF::String::Format( |
| 48 ", pathVerbs: %d, pathPoints: %d, windRule: \"%s\"", | 49 ", pathVerbs: %d, pathPoints: %d, windRule: \"%s\"", |
| 49 clip_path_.countVerbs(), clip_path_.countPoints(), | 50 clip_path_.countVerbs(), clip_path_.countPoints(), |
| 50 clip_path_.getFillType() == SkPath::kWinding_FillType ? "nonzero" | 51 clip_path_.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 |