Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(59)

Side by Side Diff: third_party/WebKit/Source/platform/graphics/paint/ClipPathDisplayItem.cpp

Issue 2013723002: Consider ClipPathDisplayItems for GPU veto. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix unit test asserts Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/SkScalar.h" 11 #include "third_party/skia/include/core/SkScalar.h"
11 12
12 namespace blink { 13 namespace blink {
13 14
14 void BeginClipPathDisplayItem::replay(GraphicsContext& context) const 15 void BeginClipPathDisplayItem::replay(GraphicsContext& context) const
15 { 16 {
16 context.save(); 17 context.save();
17 context.clipPath(m_clipPath, AntiAliased); 18 context.clipPath(m_clipPath, AntiAliased);
18 } 19 }
19 20
20 void BeginClipPathDisplayItem::appendToWebDisplayItemList(const IntRect& visualR ect, WebDisplayItemList* list) const 21 void BeginClipPathDisplayItem::appendToWebDisplayItemList(const IntRect& visualR ect, WebDisplayItemList* list) const
21 { 22 {
22 list->appendClipPathItem(visualRect, m_clipPath, SkRegion::kIntersect_Op, tr ue); 23 list->appendClipPathItem(visualRect, m_clipPath, SkRegion::kIntersect_Op, tr ue);
23 } 24 }
24 25
26 void BeginClipPathDisplayItem::analyzeForGpuRasterization(SkPictureGpuAnalyzer& analyzer) const
27 {
28 analyzer.analyzeClipPath(m_clipPath, SkRegion::kIntersect_Op, true);
29 }
30
25 void EndClipPathDisplayItem::replay(GraphicsContext& context) const 31 void EndClipPathDisplayItem::replay(GraphicsContext& context) const
26 { 32 {
27 context.restore(); 33 context.restore();
28 } 34 }
29 35
30 void EndClipPathDisplayItem::appendToWebDisplayItemList(const IntRect& visualRec t, WebDisplayItemList* list) const 36 void EndClipPathDisplayItem::appendToWebDisplayItemList(const IntRect& visualRec t, WebDisplayItemList* list) const
31 { 37 {
32 list->appendEndClipPathItem(visualRect); 38 list->appendEndClipPathItem(visualRect);
33 } 39 }
34 40
35 #ifndef NDEBUG 41 #ifndef NDEBUG
36 void BeginClipPathDisplayItem::dumpPropertiesAsDebugString(WTF::StringBuilder& s tringBuilder) const 42 void BeginClipPathDisplayItem::dumpPropertiesAsDebugString(WTF::StringBuilder& s tringBuilder) const
37 { 43 {
38 DisplayItem::dumpPropertiesAsDebugString(stringBuilder); 44 DisplayItem::dumpPropertiesAsDebugString(stringBuilder);
39 stringBuilder.append(WTF::String::format(", pathVerbs: %d, pathPoints: %d, w indRule: \"%s\"", 45 stringBuilder.append(WTF::String::format(", pathVerbs: %d, pathPoints: %d, w indRule: \"%s\"",
40 m_clipPath.countVerbs(), m_clipPath.countPoints(), 46 m_clipPath.countVerbs(), m_clipPath.countPoints(),
41 m_clipPath.getFillType() == SkPath::kWinding_FillType ? "nonzero" : "eve nodd")); 47 m_clipPath.getFillType() == SkPath::kWinding_FillType ? "nonzero" : "eve nodd"));
42 } 48 }
43 49
44 #endif 50 #endif
45 51
46 } // namespace blink 52 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698