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

Side by Side Diff: third_party/WebKit/Source/platform/graphics/paint/ClipPaintPropertyNode.h

Issue 2581843002: Implement merging non-composited paint property nodes in the PACompositor. (Closed)
Patch Set: none Created 3 years, 11 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 #ifndef ClipPaintPropertyNode_h 5 #ifndef ClipPaintPropertyNode_h
6 #define ClipPaintPropertyNode_h 6 #define ClipPaintPropertyNode_h
7 7
8 #include "platform/PlatformExport.h" 8 #include "platform/PlatformExport.h"
9 #include "platform/geometry/FloatRoundedRect.h" 9 #include "platform/geometry/FloatRoundedRect.h"
10 #include "platform/graphics/paint/TransformPaintPropertyNode.h" 10 #include "platform/graphics/paint/TransformPaintPropertyNode.h"
(...skipping 13 matching lines...) Expand all
24 // The clip tree is rooted at a node with no parent. This root node should 24 // The clip tree is rooted at a node with no parent. This root node should
25 // not be modified. 25 // not be modified.
26 class PLATFORM_EXPORT ClipPaintPropertyNode 26 class PLATFORM_EXPORT ClipPaintPropertyNode
27 : public RefCounted<ClipPaintPropertyNode> { 27 : public RefCounted<ClipPaintPropertyNode> {
28 public: 28 public:
29 static ClipPaintPropertyNode* root(); 29 static ClipPaintPropertyNode* root();
30 30
31 static PassRefPtr<ClipPaintPropertyNode> create( 31 static PassRefPtr<ClipPaintPropertyNode> create(
32 PassRefPtr<const ClipPaintPropertyNode> parent, 32 PassRefPtr<const ClipPaintPropertyNode> parent,
33 PassRefPtr<const TransformPaintPropertyNode> localTransformSpace, 33 PassRefPtr<const TransformPaintPropertyNode> localTransformSpace,
34 const FloatRoundedRect& clipRect) { 34 const FloatRoundedRect& clipRect,
35 CompositingReasons directCompositingReasons = CompositingReasonNone) {
35 return adoptRef(new ClipPaintPropertyNode( 36 return adoptRef(new ClipPaintPropertyNode(
36 std::move(parent), std::move(localTransformSpace), clipRect)); 37 std::move(parent), std::move(localTransformSpace), clipRect,
38 directCompositingReasons));
37 } 39 }
38 40
39 void update(PassRefPtr<const ClipPaintPropertyNode> parent, 41 void update(PassRefPtr<const ClipPaintPropertyNode> parent,
40 PassRefPtr<const TransformPaintPropertyNode> localTransformSpace, 42 PassRefPtr<const TransformPaintPropertyNode> localTransformSpace,
41 const FloatRoundedRect& clipRect) { 43 const FloatRoundedRect& clipRect) {
42 DCHECK(!isRoot()); 44 DCHECK(!isRoot());
43 DCHECK(parent != this); 45 DCHECK(parent != this);
44 m_parent = parent; 46 m_parent = parent;
45 m_localTransformSpace = localTransformSpace; 47 m_localTransformSpace = localTransformSpace;
46 m_clipRect = clipRect; 48 m_clipRect = clipRect;
47 } 49 }
48 50
49 const TransformPaintPropertyNode* localTransformSpace() const { 51 const TransformPaintPropertyNode* localTransformSpace() const {
50 return m_localTransformSpace.get(); 52 return m_localTransformSpace.get();
51 } 53 }
52 const FloatRoundedRect& clipRect() const { return m_clipRect; } 54 const FloatRoundedRect& clipRect() const { return m_clipRect; }
53 55
54 // Reference to inherited clips, or nullptr if this is the only clip. 56 // Reference to inherited clips, or nullptr if this is the only clip.
55 const ClipPaintPropertyNode* parent() const { return m_parent.get(); } 57 const ClipPaintPropertyNode* parent() const { return m_parent.get(); }
56 bool isRoot() const { return !m_parent; } 58 bool isRoot() const { return !m_parent; }
57 59
58 #if DCHECK_IS_ON() 60 #if DCHECK_IS_ON()
59 // The clone function is used by FindPropertiesNeedingUpdate.h for recording 61 // The clone function is used by FindPropertiesNeedingUpdate.h for recording
60 // a clip node before it has been updated, to later detect changes. 62 // a clip node before it has been updated, to later detect changes.
61 PassRefPtr<ClipPaintPropertyNode> clone() const { 63 PassRefPtr<ClipPaintPropertyNode> clone() const {
62 return adoptRef( 64 return adoptRef(new ClipPaintPropertyNode(m_parent, m_localTransformSpace,
63 new ClipPaintPropertyNode(m_parent, m_localTransformSpace, m_clipRect)); 65 m_clipRect,
66 m_directCompositingReasons));
64 } 67 }
65 68
66 // The equality operator is used by FindPropertiesNeedingUpdate.h for checking 69 // The equality operator is used by FindPropertiesNeedingUpdate.h for checking
67 // if a clip node has changed. 70 // if a clip node has changed.
68 bool operator==(const ClipPaintPropertyNode& o) const { 71 bool operator==(const ClipPaintPropertyNode& o) const {
69 return m_parent == o.m_parent && 72 return m_parent == o.m_parent &&
70 m_localTransformSpace == o.m_localTransformSpace && 73 m_localTransformSpace == o.m_localTransformSpace &&
71 m_clipRect == o.m_clipRect; 74 m_clipRect == o.m_clipRect;
72 } 75 }
73 #endif 76 #endif
74 77
75 String toString() const; 78 String toString() const;
76 79
80 bool hasDirectCompositingReasons() const {
81 return m_directCompositingReasons != CompositingReasonNone;
82 }
83
77 private: 84 private:
78 ClipPaintPropertyNode( 85 ClipPaintPropertyNode(
79 PassRefPtr<const ClipPaintPropertyNode> parent, 86 PassRefPtr<const ClipPaintPropertyNode> parent,
80 PassRefPtr<const TransformPaintPropertyNode> localTransformSpace, 87 PassRefPtr<const TransformPaintPropertyNode> localTransformSpace,
81 const FloatRoundedRect& clipRect) 88 const FloatRoundedRect& clipRect,
89 CompositingReasons directCompositingReasons)
82 : m_parent(parent), 90 : m_parent(parent),
83 m_localTransformSpace(localTransformSpace), 91 m_localTransformSpace(localTransformSpace),
84 m_clipRect(clipRect) {} 92 m_clipRect(clipRect),
93 m_directCompositingReasons(directCompositingReasons) {}
85 94
86 RefPtr<const ClipPaintPropertyNode> m_parent; 95 RefPtr<const ClipPaintPropertyNode> m_parent;
87 RefPtr<const TransformPaintPropertyNode> m_localTransformSpace; 96 RefPtr<const TransformPaintPropertyNode> m_localTransformSpace;
88 FloatRoundedRect m_clipRect; 97 FloatRoundedRect m_clipRect;
98 CompositingReasons m_directCompositingReasons;
89 }; 99 };
90 100
91 // Redeclared here to avoid ODR issues. 101 // Redeclared here to avoid ODR issues.
92 // See platform/testing/PaintPrinters.h. 102 // See platform/testing/PaintPrinters.h.
93 void PrintTo(const ClipPaintPropertyNode&, std::ostream*); 103 void PrintTo(const ClipPaintPropertyNode&, std::ostream*);
94 104
95 } // namespace blink 105 } // namespace blink
96 106
97 #endif // ClipPaintPropertyNode_h 107 #endif // ClipPaintPropertyNode_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698