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

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

Issue 2596623002: Create compositor animations for effect animations in SPv2. (Closed)
Patch Set: Sync to head and add node removal test. Created 3 years, 12 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
« no previous file with comments | « third_party/WebKit/Source/core/paint/PaintPropertyTreeUpdateTests.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 EffectPaintPropertyNode_h 5 #ifndef EffectPaintPropertyNode_h
6 #define EffectPaintPropertyNode_h 6 #define EffectPaintPropertyNode_h
7 7
8 #include "cc/layers/layer.h" 8 #include "cc/layers/layer.h"
9 #include "platform/PlatformExport.h" 9 #include "platform/PlatformExport.h"
10 #include "platform/graphics/CompositorFilterOperations.h" 10 #include "platform/graphics/CompositorFilterOperations.h"
(...skipping 17 matching lines...) Expand all
28 : public RefCounted<EffectPaintPropertyNode> { 28 : public RefCounted<EffectPaintPropertyNode> {
29 public: 29 public:
30 static EffectPaintPropertyNode* root(); 30 static EffectPaintPropertyNode* root();
31 31
32 static PassRefPtr<EffectPaintPropertyNode> create( 32 static PassRefPtr<EffectPaintPropertyNode> create(
33 PassRefPtr<const EffectPaintPropertyNode> parent, 33 PassRefPtr<const EffectPaintPropertyNode> parent,
34 PassRefPtr<const TransformPaintPropertyNode> localTransformSpace, 34 PassRefPtr<const TransformPaintPropertyNode> localTransformSpace,
35 PassRefPtr<const ClipPaintPropertyNode> outputClip, 35 PassRefPtr<const ClipPaintPropertyNode> outputClip,
36 CompositorFilterOperations filter, 36 CompositorFilterOperations filter,
37 float opacity, 37 float opacity,
38 SkBlendMode blendMode) { 38 SkBlendMode blendMode,
39 CompositingReasons directCompositingReasons = CompositingReasonNone) {
39 return adoptRef(new EffectPaintPropertyNode( 40 return adoptRef(new EffectPaintPropertyNode(
40 std::move(parent), std::move(localTransformSpace), 41 std::move(parent), std::move(localTransformSpace),
41 std::move(outputClip), std::move(filter), opacity, blendMode)); 42 std::move(outputClip), std::move(filter), opacity, blendMode,
43 directCompositingReasons));
42 } 44 }
43 45
44 void update(PassRefPtr<const EffectPaintPropertyNode> parent, 46 void update(
45 PassRefPtr<const TransformPaintPropertyNode> localTransformSpace, 47 PassRefPtr<const EffectPaintPropertyNode> parent,
46 PassRefPtr<const ClipPaintPropertyNode> outputClip, 48 PassRefPtr<const TransformPaintPropertyNode> localTransformSpace,
47 CompositorFilterOperations filter, 49 PassRefPtr<const ClipPaintPropertyNode> outputClip,
48 float opacity, 50 CompositorFilterOperations filter,
49 SkBlendMode blendMode) { 51 float opacity,
52 SkBlendMode blendMode,
53 CompositingReasons directCompositingReasons = CompositingReasonNone) {
50 DCHECK(!isRoot()); 54 DCHECK(!isRoot());
51 DCHECK(parent != this); 55 DCHECK(parent != this);
52 m_parent = parent; 56 m_parent = parent;
53 m_localTransformSpace = localTransformSpace; 57 m_localTransformSpace = localTransformSpace;
54 m_outputClip = outputClip; 58 m_outputClip = outputClip;
55 m_filter = std::move(filter); 59 m_filter = std::move(filter);
56 m_opacity = opacity; 60 m_opacity = opacity;
57 m_blendMode = blendMode; 61 m_blendMode = blendMode;
62 m_directCompositingReasons = directCompositingReasons;
58 } 63 }
59 64
60 const TransformPaintPropertyNode* localTransformSpace() const { 65 const TransformPaintPropertyNode* localTransformSpace() const {
61 return m_localTransformSpace.get(); 66 return m_localTransformSpace.get();
62 } 67 }
63 const ClipPaintPropertyNode* outputClip() const { return m_outputClip.get(); } 68 const ClipPaintPropertyNode* outputClip() const { return m_outputClip.get(); }
64 69
65 SkBlendMode blendMode() const { return m_blendMode; } 70 SkBlendMode blendMode() const { return m_blendMode; }
66 float opacity() const { return m_opacity; } 71 float opacity() const { return m_opacity; }
67 const CompositorFilterOperations& filter() const { return m_filter; } 72 const CompositorFilterOperations& filter() const { return m_filter; }
68 73
69 // Parent effect or nullptr if this is the root effect. 74 // Parent effect or nullptr if this is the root effect.
70 const EffectPaintPropertyNode* parent() const { return m_parent.get(); } 75 const EffectPaintPropertyNode* parent() const { return m_parent.get(); }
71 bool isRoot() const { return !m_parent; } 76 bool isRoot() const { return !m_parent; }
72 77
73 cc::Layer* ensureDummyLayer() const; 78 cc::Layer* ensureDummyLayer() const;
74 79
75 #if DCHECK_IS_ON() 80 #if DCHECK_IS_ON()
76 // The clone function is used by FindPropertiesNeedingUpdate.h for recording 81 // The clone function is used by FindPropertiesNeedingUpdate.h for recording
77 // an effect node before it has been updated, to later detect changes. 82 // an effect node before it has been updated, to later detect changes.
78 PassRefPtr<EffectPaintPropertyNode> clone() const { 83 PassRefPtr<EffectPaintPropertyNode> clone() const {
79 return adoptRef(new EffectPaintPropertyNode(m_parent, m_localTransformSpace, 84 return adoptRef(new EffectPaintPropertyNode(
80 m_outputClip, m_filter, 85 m_parent, m_localTransformSpace, m_outputClip, m_filter, m_opacity,
81 m_opacity, m_blendMode)); 86 m_blendMode, m_directCompositingReasons));
82 } 87 }
83 88
84 // The equality operator is used by FindPropertiesNeedingUpdate.h for checking 89 // The equality operator is used by FindPropertiesNeedingUpdate.h for checking
85 // if an effect node has changed. It ignores changes of reference filters 90 // if an effect node has changed. It ignores changes of reference filters
86 // because SkImageFilter doesn't have an equality operator. 91 // because SkImageFilter doesn't have an equality operator.
87 bool operator==(const EffectPaintPropertyNode& o) const { 92 bool operator==(const EffectPaintPropertyNode& o) const {
88 return m_parent == o.m_parent && 93 return m_parent == o.m_parent &&
89 m_localTransformSpace == o.m_localTransformSpace && 94 m_localTransformSpace == o.m_localTransformSpace &&
90 m_outputClip == o.m_outputClip && m_opacity == o.m_opacity && 95 m_outputClip == o.m_outputClip && m_opacity == o.m_opacity &&
91 m_blendMode == o.m_blendMode && 96 m_blendMode == o.m_blendMode &&
92 m_filter.equalsIgnoringReferenceFilters(o.m_filter); 97 m_filter.equalsIgnoringReferenceFilters(o.m_filter);
93 } 98 }
94 #endif 99 #endif
95 100
96 String toString() const; 101 String toString() const;
97 102
103 bool hasDirectCompositingReasons() const {
104 return m_directCompositingReasons != CompositingReasonNone;
105 }
106
98 private: 107 private:
99 EffectPaintPropertyNode( 108 EffectPaintPropertyNode(
100 PassRefPtr<const EffectPaintPropertyNode> parent, 109 PassRefPtr<const EffectPaintPropertyNode> parent,
101 PassRefPtr<const TransformPaintPropertyNode> localTransformSpace, 110 PassRefPtr<const TransformPaintPropertyNode> localTransformSpace,
102 PassRefPtr<const ClipPaintPropertyNode> outputClip, 111 PassRefPtr<const ClipPaintPropertyNode> outputClip,
103 CompositorFilterOperations filter, 112 CompositorFilterOperations filter,
104 float opacity, 113 float opacity,
105 SkBlendMode blendMode) 114 SkBlendMode blendMode,
115 CompositingReasons directCompositingReasons)
106 : m_parent(parent), 116 : m_parent(parent),
107 m_localTransformSpace(localTransformSpace), 117 m_localTransformSpace(localTransformSpace),
108 m_outputClip(outputClip), 118 m_outputClip(outputClip),
109 m_filter(std::move(filter)), 119 m_filter(std::move(filter)),
110 m_opacity(opacity), 120 m_opacity(opacity),
111 m_blendMode(blendMode) {} 121 m_blendMode(blendMode),
122 m_directCompositingReasons(directCompositingReasons) {}
112 123
113 RefPtr<const EffectPaintPropertyNode> m_parent; 124 RefPtr<const EffectPaintPropertyNode> m_parent;
114 // The local transform space serves two purposes: 125 // The local transform space serves two purposes:
115 // 1. Assign a depth mapping for 3D depth sorting against other paint chunks 126 // 1. Assign a depth mapping for 3D depth sorting against other paint chunks
116 // and effects under the same parent. 127 // and effects under the same parent.
117 // 2. Some effects are spatial (namely blur filter and reflection), the 128 // 2. Some effects are spatial (namely blur filter and reflection), the
118 // effect parameters will be specified in the local space. 129 // effect parameters will be specified in the local space.
119 RefPtr<const TransformPaintPropertyNode> m_localTransformSpace; 130 RefPtr<const TransformPaintPropertyNode> m_localTransformSpace;
120 // The output of the effect can be optionally clipped when composited onto 131 // The output of the effect can be optionally clipped when composited onto
121 // the current backdrop. 132 // the current backdrop.
122 RefPtr<const ClipPaintPropertyNode> m_outputClip; 133 RefPtr<const ClipPaintPropertyNode> m_outputClip;
123 134
124 // Optionally a number of effects can be applied to the composited output. 135 // Optionally a number of effects can be applied to the composited output.
125 // The chain of effects will be applied in the following order: 136 // The chain of effects will be applied in the following order:
126 // === Begin of effects === 137 // === Begin of effects ===
127 CompositorFilterOperations m_filter; 138 CompositorFilterOperations m_filter;
128 float m_opacity; 139 float m_opacity;
129 SkBlendMode m_blendMode; 140 SkBlendMode m_blendMode;
130 // === End of effects === 141 // === End of effects ===
131 142
132 // TODO(trchen): Remove the dummy layer. 143 // TODO(trchen): Remove the dummy layer.
133 // The main purpose of the dummy layer is to maintain a permanent identity 144 // The main purpose of the dummy layer is to maintain a permanent identity
134 // to associate with cc::RenderSurfaceImpl for damage tracking. This shall 145 // to associate with cc::RenderSurfaceImpl for damage tracking. This shall
135 // be removed in favor of a stable ID once cc::LayerImpl no longer owns 146 // be removed in favor of a stable ID once cc::LayerImpl no longer owns
136 // RenderSurfaceImpl. 147 // RenderSurfaceImpl.
137 mutable scoped_refptr<cc::Layer> m_dummyLayer; 148 mutable scoped_refptr<cc::Layer> m_dummyLayer;
149
150 CompositingReasons m_directCompositingReasons;
138 }; 151 };
139 152
140 // Redeclared here to avoid ODR issues. 153 // Redeclared here to avoid ODR issues.
141 // See platform/testing/PaintPrinters.h. 154 // See platform/testing/PaintPrinters.h.
142 void PrintTo(const EffectPaintPropertyNode&, std::ostream*); 155 void PrintTo(const EffectPaintPropertyNode&, std::ostream*);
143 156
144 } // namespace blink 157 } // namespace blink
145 158
146 #endif // EffectPaintPropertyNode_h 159 #endif // EffectPaintPropertyNode_h
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/paint/PaintPropertyTreeUpdateTests.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698