| 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 int BeginClipPathDisplayItem::NumberOfSlowPaths() const { | 26 void BeginClipPathDisplayItem::AnalyzeForGpuRasterization( |
| 27 SkPictureGpuAnalyzer& analyzer) const { |
| 27 // Temporarily disabled (pref regressions due to GPU veto stickiness: | 28 // Temporarily disabled (pref regressions due to GPU veto stickiness: |
| 28 // http://crbug.com/603969). | 29 // http://crbug.com/603969). |
| 29 // analyzer.analyzeClipPath(m_clipPath, SkRegion::kIntersect_Op, true); | 30 // analyzer.analyzeClipPath(m_clipPath, SkRegion::kIntersect_Op, true); |
| 30 // TODO(enne): fixup this code to return an int. | |
| 31 return 0; | |
| 32 } | 31 } |
| 33 | 32 |
| 34 void EndClipPathDisplayItem::Replay(GraphicsContext& context) const { | 33 void EndClipPathDisplayItem::Replay(GraphicsContext& context) const { |
| 35 context.Restore(); | 34 context.Restore(); |
| 36 } | 35 } |
| 37 | 36 |
| 38 void EndClipPathDisplayItem::AppendToWebDisplayItemList( | 37 void EndClipPathDisplayItem::AppendToWebDisplayItemList( |
| 39 const IntRect& visual_rect, | 38 const IntRect& visual_rect, |
| 40 WebDisplayItemList* list) const { | 39 WebDisplayItemList* list) const { |
| 41 list->AppendEndClipPathItem(); | 40 list->AppendEndClipPathItem(); |
| 42 } | 41 } |
| 43 | 42 |
| 44 #ifndef NDEBUG | 43 #ifndef NDEBUG |
| 45 void BeginClipPathDisplayItem::DumpPropertiesAsDebugString( | 44 void BeginClipPathDisplayItem::DumpPropertiesAsDebugString( |
| 46 WTF::StringBuilder& string_builder) const { | 45 WTF::StringBuilder& string_builder) const { |
| 47 DisplayItem::DumpPropertiesAsDebugString(string_builder); | 46 DisplayItem::DumpPropertiesAsDebugString(string_builder); |
| 48 string_builder.Append(WTF::String::Format( | 47 string_builder.Append(WTF::String::Format( |
| 49 ", pathVerbs: %d, pathPoints: %d, windRule: \"%s\"", | 48 ", pathVerbs: %d, pathPoints: %d, windRule: \"%s\"", |
| 50 clip_path_.countVerbs(), clip_path_.countPoints(), | 49 clip_path_.countVerbs(), clip_path_.countPoints(), |
| 51 clip_path_.getFillType() == SkPath::kWinding_FillType ? "nonzero" | 50 clip_path_.getFillType() == SkPath::kWinding_FillType ? "nonzero" |
| 52 : "evenodd")); | 51 : "evenodd")); |
| 53 } | 52 } |
| 54 | 53 |
| 55 #endif | 54 #endif |
| 56 | 55 |
| 57 } // namespace blink | 56 } // namespace blink |
| OLD | NEW |