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

Side by Side Diff: cc/layers/layer_impl_unittest.cc

Issue 23455060: mix-blend-mode implementation for accelerated layers (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: unittests fixed Created 7 years 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 | « cc/layers/layer_impl.cc ('k') | cc/layers/layer_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2011 The Chromium Authors. All rights reserved. 1 // Copyright 2011 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 "cc/layers/layer_impl.h" 5 #include "cc/layers/layer_impl.h"
6 6
7 #include "cc/output/filter_operation.h" 7 #include "cc/output/filter_operation.h"
8 #include "cc/output/filter_operations.h" 8 #include "cc/output/filter_operations.h"
9 #include "cc/test/fake_impl_proxy.h" 9 #include "cc/test/fake_impl_proxy.h"
10 #include "cc/test/fake_layer_tree_host_impl.h" 10 #include "cc/test/fake_layer_tree_host_impl.h"
(...skipping 22 matching lines...) Expand all
33 EXPECT_FALSE(child->LayerPropertyChanged()); \ 33 EXPECT_FALSE(child->LayerPropertyChanged()); \
34 EXPECT_FALSE(grand_child->LayerPropertyChanged()); 34 EXPECT_FALSE(grand_child->LayerPropertyChanged());
35 35
36 #define EXECUTE_AND_VERIFY_ONLY_LAYER_CHANGED(code_to_test) \ 36 #define EXECUTE_AND_VERIFY_ONLY_LAYER_CHANGED(code_to_test) \
37 root->ResetAllChangeTrackingForSubtree(); \ 37 root->ResetAllChangeTrackingForSubtree(); \
38 code_to_test; \ 38 code_to_test; \
39 EXPECT_TRUE(root->LayerPropertyChanged()); \ 39 EXPECT_TRUE(root->LayerPropertyChanged()); \
40 EXPECT_FALSE(child->LayerPropertyChanged()); \ 40 EXPECT_FALSE(child->LayerPropertyChanged()); \
41 EXPECT_FALSE(grand_child->LayerPropertyChanged()); 41 EXPECT_FALSE(grand_child->LayerPropertyChanged());
42 42
43 #define EXECUTE_AND_VERIFY_ONLY_DESCENDANTS_CHANGED(code_to_test) \
44 root->ResetAllChangeTrackingForSubtree(); \
45 code_to_test; \
46 EXPECT_FALSE(root->LayerPropertyChanged()); \
47 EXPECT_TRUE(child->LayerPropertyChanged()); \
48 EXPECT_TRUE(grand_child->LayerPropertyChanged());
49
43 #define VERIFY_NEEDS_UPDATE_DRAW_PROPERTIES(code_to_test) \ 50 #define VERIFY_NEEDS_UPDATE_DRAW_PROPERTIES(code_to_test) \
44 root->ResetAllChangeTrackingForSubtree(); \ 51 root->ResetAllChangeTrackingForSubtree(); \
45 host_impl.ForcePrepareToDraw(); \ 52 host_impl.ForcePrepareToDraw(); \
46 EXPECT_FALSE(host_impl.active_tree()->needs_update_draw_properties()); \ 53 EXPECT_FALSE(host_impl.active_tree()->needs_update_draw_properties()); \
47 code_to_test; \ 54 code_to_test; \
48 EXPECT_TRUE(host_impl.active_tree()->needs_update_draw_properties()); 55 EXPECT_TRUE(host_impl.active_tree()->needs_update_draw_properties());
49 56
50 #define VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES(code_to_test) \ 57 #define VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES(code_to_test) \
51 root->ResetAllChangeTrackingForSubtree(); \ 58 root->ResetAllChangeTrackingForSubtree(); \
52 host_impl.ForcePrepareToDraw(); \ 59 host_impl.ForcePrepareToDraw(); \
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 gfx::Point arbitrary_point = gfx::Point(333, 444); 91 gfx::Point arbitrary_point = gfx::Point(333, 444);
85 gfx::Vector2d arbitrary_vector2d = gfx::Vector2d(111, 222); 92 gfx::Vector2d arbitrary_vector2d = gfx::Vector2d(111, 222);
86 gfx::Rect arbitrary_rect = gfx::Rect(arbitrary_point, arbitrary_size); 93 gfx::Rect arbitrary_rect = gfx::Rect(arbitrary_point, arbitrary_size);
87 gfx::RectF arbitrary_rect_f = 94 gfx::RectF arbitrary_rect_f =
88 gfx::RectF(arbitrary_point_f, gfx::SizeF(1.234f, 5.678f)); 95 gfx::RectF(arbitrary_point_f, gfx::SizeF(1.234f, 5.678f));
89 SkColor arbitrary_color = SkColorSetRGB(10, 20, 30); 96 SkColor arbitrary_color = SkColorSetRGB(10, 20, 30);
90 gfx::Transform arbitrary_transform; 97 gfx::Transform arbitrary_transform;
91 arbitrary_transform.Scale3d(0.1f, 0.2f, 0.3f); 98 arbitrary_transform.Scale3d(0.1f, 0.2f, 0.3f);
92 FilterOperations arbitrary_filters; 99 FilterOperations arbitrary_filters;
93 arbitrary_filters.Append(FilterOperation::CreateOpacityFilter(0.5f)); 100 arbitrary_filters.Append(FilterOperation::CreateOpacityFilter(0.5f));
101 SkXfermode::Mode arbitrary_blend_mode = SkXfermode::kMultiply_Mode;
94 102
95 // These properties are internal, and should not be considered "change" when 103 // These properties are internal, and should not be considered "change" when
96 // they are used. 104 // they are used.
97 EXECUTE_AND_VERIFY_SUBTREE_DID_NOT_CHANGE( 105 EXECUTE_AND_VERIFY_SUBTREE_DID_NOT_CHANGE(
98 root->set_update_rect(arbitrary_rect_f)); 106 root->set_update_rect(arbitrary_rect_f));
99 EXECUTE_AND_VERIFY_SUBTREE_DID_NOT_CHANGE( 107 EXECUTE_AND_VERIFY_SUBTREE_DID_NOT_CHANGE(
100 root->SetMaxScrollOffset(arbitrary_vector2d)); 108 root->SetMaxScrollOffset(arbitrary_vector2d));
101 109
102 // Changing these properties affects the entire subtree of layers. 110 // Changing these properties affects the entire subtree of layers.
103 EXECUTE_AND_VERIFY_SUBTREE_CHANGED(root->SetAnchorPoint(arbitrary_point_f)); 111 EXECUTE_AND_VERIFY_SUBTREE_CHANGED(root->SetAnchorPoint(arbitrary_point_f));
104 EXECUTE_AND_VERIFY_SUBTREE_CHANGED(root->SetAnchorPointZ(arbitrary_number)); 112 EXECUTE_AND_VERIFY_SUBTREE_CHANGED(root->SetAnchorPointZ(arbitrary_number));
105 EXECUTE_AND_VERIFY_SUBTREE_CHANGED(root->SetFilters(arbitrary_filters)); 113 EXECUTE_AND_VERIFY_SUBTREE_CHANGED(root->SetFilters(arbitrary_filters));
106 EXECUTE_AND_VERIFY_SUBTREE_CHANGED(root->SetFilters(FilterOperations())); 114 EXECUTE_AND_VERIFY_SUBTREE_CHANGED(root->SetFilters(FilterOperations()));
107 EXECUTE_AND_VERIFY_SUBTREE_CHANGED( 115 EXECUTE_AND_VERIFY_SUBTREE_CHANGED(
108 root->SetMaskLayer(LayerImpl::Create(host_impl.active_tree(), 4))); 116 root->SetMaskLayer(LayerImpl::Create(host_impl.active_tree(), 4)));
109 EXECUTE_AND_VERIFY_SUBTREE_CHANGED(root->SetMasksToBounds(true)); 117 EXECUTE_AND_VERIFY_SUBTREE_CHANGED(root->SetMasksToBounds(true));
110 EXECUTE_AND_VERIFY_SUBTREE_CHANGED(root->SetContentsOpaque(true)); 118 EXECUTE_AND_VERIFY_SUBTREE_CHANGED(root->SetContentsOpaque(true));
111 EXECUTE_AND_VERIFY_SUBTREE_CHANGED( 119 EXECUTE_AND_VERIFY_SUBTREE_CHANGED(
112 root->SetReplicaLayer(LayerImpl::Create(host_impl.active_tree(), 5))); 120 root->SetReplicaLayer(LayerImpl::Create(host_impl.active_tree(), 5)));
113 EXECUTE_AND_VERIFY_SUBTREE_CHANGED(root->SetPosition(arbitrary_point_f)); 121 EXECUTE_AND_VERIFY_SUBTREE_CHANGED(root->SetPosition(arbitrary_point_f));
114 EXECUTE_AND_VERIFY_SUBTREE_CHANGED(root->SetPreserves3d(true)); 122 EXECUTE_AND_VERIFY_SUBTREE_CHANGED(root->SetPreserves3d(true));
115 EXECUTE_AND_VERIFY_SUBTREE_CHANGED( 123 EXECUTE_AND_VERIFY_SUBTREE_CHANGED(
116 root->SetDoubleSided(false)); // constructor initializes it to "true". 124 root->SetDoubleSided(false)); // constructor initializes it to "true".
117 EXECUTE_AND_VERIFY_SUBTREE_CHANGED(root->ScrollBy(arbitrary_vector2d)); 125 EXECUTE_AND_VERIFY_SUBTREE_CHANGED(root->ScrollBy(arbitrary_vector2d));
118 EXECUTE_AND_VERIFY_SUBTREE_CHANGED(root->SetScrollDelta(gfx::Vector2d())); 126 EXECUTE_AND_VERIFY_SUBTREE_CHANGED(root->SetScrollDelta(gfx::Vector2d()));
119 EXECUTE_AND_VERIFY_SUBTREE_CHANGED(root->SetScrollOffset(arbitrary_vector2d)); 127 EXECUTE_AND_VERIFY_SUBTREE_CHANGED(root->SetScrollOffset(arbitrary_vector2d));
120 EXECUTE_AND_VERIFY_SUBTREE_CHANGED(root->SetHideLayerAndSubtree(true)); 128 EXECUTE_AND_VERIFY_SUBTREE_CHANGED(root->SetHideLayerAndSubtree(true));
121 EXECUTE_AND_VERIFY_SUBTREE_CHANGED(root->SetOpacity(arbitrary_number)); 129 EXECUTE_AND_VERIFY_SUBTREE_CHANGED(root->SetOpacity(arbitrary_number));
130 EXECUTE_AND_VERIFY_SUBTREE_CHANGED(root->SetBlendMode(arbitrary_blend_mode));
122 EXECUTE_AND_VERIFY_SUBTREE_CHANGED(root->SetTransform(arbitrary_transform)); 131 EXECUTE_AND_VERIFY_SUBTREE_CHANGED(root->SetTransform(arbitrary_transform));
123 132
124 // Changing these properties only affects the layer itself. 133 // Changing these properties only affects the layer itself.
125 EXECUTE_AND_VERIFY_ONLY_LAYER_CHANGED(root->SetContentBounds(arbitrary_size)); 134 EXECUTE_AND_VERIFY_ONLY_LAYER_CHANGED(root->SetContentBounds(arbitrary_size));
126 EXECUTE_AND_VERIFY_ONLY_LAYER_CHANGED( 135 EXECUTE_AND_VERIFY_ONLY_LAYER_CHANGED(
127 root->SetContentsScale(arbitrary_number, arbitrary_number)); 136 root->SetContentsScale(arbitrary_number, arbitrary_number));
128 EXECUTE_AND_VERIFY_ONLY_LAYER_CHANGED(root->SetDrawsContent(true)); 137 EXECUTE_AND_VERIFY_ONLY_LAYER_CHANGED(root->SetDrawsContent(true));
129 EXECUTE_AND_VERIFY_ONLY_LAYER_CHANGED( 138 EXECUTE_AND_VERIFY_ONLY_LAYER_CHANGED(
130 root->SetBackgroundColor(arbitrary_color)); 139 root->SetBackgroundColor(arbitrary_color));
131 EXECUTE_AND_VERIFY_ONLY_LAYER_CHANGED( 140 EXECUTE_AND_VERIFY_ONLY_LAYER_CHANGED(
132 root->SetBackgroundFilters(arbitrary_filters)); 141 root->SetBackgroundFilters(arbitrary_filters));
133 142
134 // Special case: check that sublayer transform changes all layer's 143 // Changing these properties affects all layer's descendants,
135 // descendants, but not the layer itself. 144 // but not the layer itself.
136 root->ResetAllChangeTrackingForSubtree(); 145 EXECUTE_AND_VERIFY_ONLY_DESCENDANTS_CHANGED(
137 root->SetSublayerTransform(arbitrary_transform); 146 root->SetSublayerTransform(arbitrary_transform));
138 EXPECT_FALSE(root->LayerPropertyChanged());
139 EXPECT_TRUE(child->LayerPropertyChanged());
140 EXPECT_TRUE(grand_child->LayerPropertyChanged());
141 147
142 // Special case: check that SetBounds changes behavior depending on 148 // Special case: check that SetBounds changes behavior depending on
143 // masksToBounds. 149 // masksToBounds.
144 root->SetMasksToBounds(false); 150 root->SetMasksToBounds(false);
145 EXECUTE_AND_VERIFY_ONLY_LAYER_CHANGED(root->SetBounds(gfx::Size(135, 246))); 151 EXECUTE_AND_VERIFY_ONLY_LAYER_CHANGED(root->SetBounds(gfx::Size(135, 246)));
146 root->SetMasksToBounds(true); 152 root->SetMasksToBounds(true);
147 // Should be a different size than previous call, to ensure it marks tree 153 // Should be a different size than previous call, to ensure it marks tree
148 // changed. 154 // changed.
149 EXECUTE_AND_VERIFY_SUBTREE_CHANGED(root->SetBounds(arbitrary_size)); 155 EXECUTE_AND_VERIFY_SUBTREE_CHANGED(root->SetBounds(arbitrary_size));
150 156
157 EXECUTE_AND_VERIFY_SUBTREE_DID_NOT_CHANGE(
158 root->SetIsRootForIsolatedGroup(true));
159
151 // After setting all these properties already, setting to the exact same 160 // After setting all these properties already, setting to the exact same
152 // values again should not cause any change. 161 // values again should not cause any change.
153 EXECUTE_AND_VERIFY_SUBTREE_DID_NOT_CHANGE( 162 EXECUTE_AND_VERIFY_SUBTREE_DID_NOT_CHANGE(
154 root->SetAnchorPoint(arbitrary_point_f)); 163 root->SetAnchorPoint(arbitrary_point_f));
155 EXECUTE_AND_VERIFY_SUBTREE_DID_NOT_CHANGE( 164 EXECUTE_AND_VERIFY_SUBTREE_DID_NOT_CHANGE(
156 root->SetAnchorPointZ(arbitrary_number)); 165 root->SetAnchorPointZ(arbitrary_number));
157 EXECUTE_AND_VERIFY_SUBTREE_DID_NOT_CHANGE(root->SetMasksToBounds(true)); 166 EXECUTE_AND_VERIFY_SUBTREE_DID_NOT_CHANGE(root->SetMasksToBounds(true));
158 EXECUTE_AND_VERIFY_SUBTREE_DID_NOT_CHANGE( 167 EXECUTE_AND_VERIFY_SUBTREE_DID_NOT_CHANGE(
159 root->SetPosition(arbitrary_point_f)); 168 root->SetPosition(arbitrary_point_f));
160 EXECUTE_AND_VERIFY_SUBTREE_DID_NOT_CHANGE(root->SetPreserves3d(true)); 169 EXECUTE_AND_VERIFY_SUBTREE_DID_NOT_CHANGE(root->SetPreserves3d(true));
161 EXECUTE_AND_VERIFY_SUBTREE_DID_NOT_CHANGE( 170 EXECUTE_AND_VERIFY_SUBTREE_DID_NOT_CHANGE(
162 root->SetTransform(arbitrary_transform)); 171 root->SetTransform(arbitrary_transform));
163 EXECUTE_AND_VERIFY_SUBTREE_DID_NOT_CHANGE( 172 EXECUTE_AND_VERIFY_SUBTREE_DID_NOT_CHANGE(
164 root->SetDoubleSided(false)); // constructor initializes it to "true". 173 root->SetDoubleSided(false)); // constructor initializes it to "true".
165 EXECUTE_AND_VERIFY_SUBTREE_DID_NOT_CHANGE( 174 EXECUTE_AND_VERIFY_SUBTREE_DID_NOT_CHANGE(
166 root->SetScrollDelta(gfx::Vector2d())); 175 root->SetScrollDelta(gfx::Vector2d()));
167 EXECUTE_AND_VERIFY_SUBTREE_DID_NOT_CHANGE( 176 EXECUTE_AND_VERIFY_SUBTREE_DID_NOT_CHANGE(
168 root->SetScrollOffset(arbitrary_vector2d)); 177 root->SetScrollOffset(arbitrary_vector2d));
169 EXECUTE_AND_VERIFY_SUBTREE_DID_NOT_CHANGE( 178 EXECUTE_AND_VERIFY_SUBTREE_DID_NOT_CHANGE(
170 root->SetContentBounds(arbitrary_size)); 179 root->SetContentBounds(arbitrary_size));
171 EXECUTE_AND_VERIFY_SUBTREE_DID_NOT_CHANGE( 180 EXECUTE_AND_VERIFY_SUBTREE_DID_NOT_CHANGE(
172 root->SetContentsScale(arbitrary_number, arbitrary_number)); 181 root->SetContentsScale(arbitrary_number, arbitrary_number));
173 EXECUTE_AND_VERIFY_SUBTREE_DID_NOT_CHANGE(root->SetContentsOpaque(true)); 182 EXECUTE_AND_VERIFY_SUBTREE_DID_NOT_CHANGE(root->SetContentsOpaque(true));
174 EXECUTE_AND_VERIFY_SUBTREE_DID_NOT_CHANGE(root->SetOpacity(arbitrary_number)); 183 EXECUTE_AND_VERIFY_SUBTREE_DID_NOT_CHANGE(root->SetOpacity(arbitrary_number));
184 EXECUTE_AND_VERIFY_SUBTREE_DID_NOT_CHANGE(
185 root->SetBlendMode(arbitrary_blend_mode));
186 EXECUTE_AND_VERIFY_SUBTREE_DID_NOT_CHANGE(
187 root->SetIsRootForIsolatedGroup(true));
175 EXECUTE_AND_VERIFY_SUBTREE_DID_NOT_CHANGE(root->SetDrawsContent(true)); 188 EXECUTE_AND_VERIFY_SUBTREE_DID_NOT_CHANGE(root->SetDrawsContent(true));
176 EXECUTE_AND_VERIFY_SUBTREE_DID_NOT_CHANGE( 189 EXECUTE_AND_VERIFY_SUBTREE_DID_NOT_CHANGE(
177 root->SetSublayerTransform(arbitrary_transform)); 190 root->SetSublayerTransform(arbitrary_transform));
178 EXECUTE_AND_VERIFY_SUBTREE_DID_NOT_CHANGE(root->SetBounds(arbitrary_size)); 191 EXECUTE_AND_VERIFY_SUBTREE_DID_NOT_CHANGE(root->SetBounds(arbitrary_size));
179 } 192 }
180 193
181 TEST(LayerImplTest, VerifyNeedsUpdateDrawProperties) { 194 TEST(LayerImplTest, VerifyNeedsUpdateDrawProperties) {
182 FakeImplProxy proxy; 195 FakeImplProxy proxy;
183 FakeLayerTreeHostImpl host_impl(&proxy); 196 FakeLayerTreeHostImpl host_impl(&proxy);
184 EXPECT_TRUE(host_impl.InitializeRenderer(CreateFakeOutputSurface())); 197 EXPECT_TRUE(host_impl.InitializeRenderer(CreateFakeOutputSurface()));
185 scoped_ptr<LayerImpl> root = LayerImpl::Create(host_impl.active_tree(), 1); 198 scoped_ptr<LayerImpl> root = LayerImpl::Create(host_impl.active_tree(), 1);
186 root->SetScrollable(true); 199 root->SetScrollable(true);
187 200
188 gfx::PointF arbitrary_point_f = gfx::PointF(0.125f, 0.25f); 201 gfx::PointF arbitrary_point_f = gfx::PointF(0.125f, 0.25f);
189 float arbitrary_number = 0.352f; 202 float arbitrary_number = 0.352f;
190 gfx::Size arbitrary_size = gfx::Size(111, 222); 203 gfx::Size arbitrary_size = gfx::Size(111, 222);
191 gfx::Point arbitrary_point = gfx::Point(333, 444); 204 gfx::Point arbitrary_point = gfx::Point(333, 444);
192 gfx::Vector2d arbitrary_vector2d = gfx::Vector2d(111, 222); 205 gfx::Vector2d arbitrary_vector2d = gfx::Vector2d(111, 222);
193 gfx::Vector2d large_vector2d = gfx::Vector2d(1000, 1000); 206 gfx::Vector2d large_vector2d = gfx::Vector2d(1000, 1000);
194 gfx::Rect arbitrary_rect = gfx::Rect(arbitrary_point, arbitrary_size); 207 gfx::Rect arbitrary_rect = gfx::Rect(arbitrary_point, arbitrary_size);
195 gfx::RectF arbitrary_rect_f = 208 gfx::RectF arbitrary_rect_f =
196 gfx::RectF(arbitrary_point_f, gfx::SizeF(1.234f, 5.678f)); 209 gfx::RectF(arbitrary_point_f, gfx::SizeF(1.234f, 5.678f));
197 SkColor arbitrary_color = SkColorSetRGB(10, 20, 30); 210 SkColor arbitrary_color = SkColorSetRGB(10, 20, 30);
198 gfx::Transform arbitrary_transform; 211 gfx::Transform arbitrary_transform;
199 arbitrary_transform.Scale3d(0.1f, 0.2f, 0.3f); 212 arbitrary_transform.Scale3d(0.1f, 0.2f, 0.3f);
200 FilterOperations arbitrary_filters; 213 FilterOperations arbitrary_filters;
201 arbitrary_filters.Append(FilterOperation::CreateOpacityFilter(0.5f)); 214 arbitrary_filters.Append(FilterOperation::CreateOpacityFilter(0.5f));
215 SkXfermode::Mode arbitrary_blend_mode = SkXfermode::kMultiply_Mode;
202 216
203 // Related filter functions. 217 // Related filter functions.
204 VERIFY_NEEDS_UPDATE_DRAW_PROPERTIES(root->SetFilters(arbitrary_filters)); 218 VERIFY_NEEDS_UPDATE_DRAW_PROPERTIES(root->SetFilters(arbitrary_filters));
205 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES(root->SetFilters(arbitrary_filters)); 219 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES(root->SetFilters(arbitrary_filters));
206 VERIFY_NEEDS_UPDATE_DRAW_PROPERTIES(root->SetFilters(FilterOperations())); 220 VERIFY_NEEDS_UPDATE_DRAW_PROPERTIES(root->SetFilters(FilterOperations()));
207 VERIFY_NEEDS_UPDATE_DRAW_PROPERTIES(root->SetFilters(arbitrary_filters)); 221 VERIFY_NEEDS_UPDATE_DRAW_PROPERTIES(root->SetFilters(arbitrary_filters));
208 222
209 // Related scrolling functions. 223 // Related scrolling functions.
210 VERIFY_NEEDS_UPDATE_DRAW_PROPERTIES(root->SetMaxScrollOffset(large_vector2d)); 224 VERIFY_NEEDS_UPDATE_DRAW_PROPERTIES(root->SetMaxScrollOffset(large_vector2d));
211 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES( 225 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES(
(...skipping 24 matching lines...) Expand all
236 root->SetDoubleSided(false)); // constructor initializes it to "true". 250 root->SetDoubleSided(false)); // constructor initializes it to "true".
237 VERIFY_NEEDS_UPDATE_DRAW_PROPERTIES(root->SetContentBounds(arbitrary_size)); 251 VERIFY_NEEDS_UPDATE_DRAW_PROPERTIES(root->SetContentBounds(arbitrary_size));
238 VERIFY_NEEDS_UPDATE_DRAW_PROPERTIES( 252 VERIFY_NEEDS_UPDATE_DRAW_PROPERTIES(
239 root->SetContentsScale(arbitrary_number, arbitrary_number)); 253 root->SetContentsScale(arbitrary_number, arbitrary_number));
240 VERIFY_NEEDS_UPDATE_DRAW_PROPERTIES(root->SetDrawsContent(true)); 254 VERIFY_NEEDS_UPDATE_DRAW_PROPERTIES(root->SetDrawsContent(true));
241 VERIFY_NEEDS_UPDATE_DRAW_PROPERTIES( 255 VERIFY_NEEDS_UPDATE_DRAW_PROPERTIES(
242 root->SetBackgroundColor(arbitrary_color)); 256 root->SetBackgroundColor(arbitrary_color));
243 VERIFY_NEEDS_UPDATE_DRAW_PROPERTIES( 257 VERIFY_NEEDS_UPDATE_DRAW_PROPERTIES(
244 root->SetBackgroundFilters(arbitrary_filters)); 258 root->SetBackgroundFilters(arbitrary_filters));
245 VERIFY_NEEDS_UPDATE_DRAW_PROPERTIES(root->SetOpacity(arbitrary_number)); 259 VERIFY_NEEDS_UPDATE_DRAW_PROPERTIES(root->SetOpacity(arbitrary_number));
260 VERIFY_NEEDS_UPDATE_DRAW_PROPERTIES(root->SetBlendMode(arbitrary_blend_mode));
246 VERIFY_NEEDS_UPDATE_DRAW_PROPERTIES(root->SetTransform(arbitrary_transform)); 261 VERIFY_NEEDS_UPDATE_DRAW_PROPERTIES(root->SetTransform(arbitrary_transform));
247 VERIFY_NEEDS_UPDATE_DRAW_PROPERTIES( 262 VERIFY_NEEDS_UPDATE_DRAW_PROPERTIES(
248 root->SetSublayerTransform(arbitrary_transform)); 263 root->SetSublayerTransform(arbitrary_transform));
249 VERIFY_NEEDS_UPDATE_DRAW_PROPERTIES(root->SetBounds(arbitrary_size)); 264 VERIFY_NEEDS_UPDATE_DRAW_PROPERTIES(root->SetBounds(arbitrary_size));
250 265
251 // Unrelated functions, set to the same values, no needs update. 266 // Unrelated functions, set to the same values, no needs update.
252 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES( 267 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES(
253 root->SetAnchorPointZ(arbitrary_number)); 268 root->SetAnchorPointZ(arbitrary_number));
269 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES(root->SetIsRootForIsolatedGroup(true));
254 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES(root->SetFilters(arbitrary_filters)); 270 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES(root->SetFilters(arbitrary_filters));
255 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES(root->SetMasksToBounds(true)); 271 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES(root->SetMasksToBounds(true));
256 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES(root->SetContentsOpaque(true)); 272 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES(root->SetContentsOpaque(true));
257 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES(root->SetPosition(arbitrary_point_f)); 273 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES(root->SetPosition(arbitrary_point_f));
258 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES(root->SetPreserves3d(true)); 274 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES(root->SetPreserves3d(true));
259 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES( 275 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES(
260 root->SetDoubleSided(false)); // constructor initializes it to "true". 276 root->SetDoubleSided(false)); // constructor initializes it to "true".
261 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES( 277 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES(
262 root->SetContentBounds(arbitrary_size)); 278 root->SetContentBounds(arbitrary_size));
263 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES( 279 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES(
264 root->SetContentsScale(arbitrary_number, arbitrary_number)); 280 root->SetContentsScale(arbitrary_number, arbitrary_number));
265 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES(root->SetDrawsContent(true)); 281 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES(root->SetDrawsContent(true));
266 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES( 282 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES(
267 root->SetBackgroundColor(arbitrary_color)); 283 root->SetBackgroundColor(arbitrary_color));
268 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES( 284 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES(
269 root->SetBackgroundFilters(arbitrary_filters)); 285 root->SetBackgroundFilters(arbitrary_filters));
270 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES(root->SetOpacity(arbitrary_number)); 286 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES(root->SetOpacity(arbitrary_number));
271 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES( 287 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES(
288 root->SetBlendMode(arbitrary_blend_mode));
289 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES(root->SetIsRootForIsolatedGroup(true));
290 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES(
272 root->SetTransform(arbitrary_transform)); 291 root->SetTransform(arbitrary_transform));
273 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES( 292 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES(
274 root->SetSublayerTransform(arbitrary_transform)); 293 root->SetSublayerTransform(arbitrary_transform));
275 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES(root->SetBounds(arbitrary_size)); 294 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES(root->SetBounds(arbitrary_size));
276 } 295 }
277 296
278 TEST(LayerImplTest, SafeOpaqueBackgroundColor) { 297 TEST(LayerImplTest, SafeOpaqueBackgroundColor) {
279 FakeImplProxy proxy; 298 FakeImplProxy proxy;
280 FakeLayerTreeHostImpl host_impl(&proxy); 299 FakeLayerTreeHostImpl host_impl(&proxy);
281 EXPECT_TRUE(host_impl.InitializeRenderer(CreateFakeOutputSurface())); 300 EXPECT_TRUE(host_impl.InitializeRenderer(CreateFakeOutputSurface()));
(...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after
556 layer()->SetMaxScrollOffset(max_scroll_offset); 575 layer()->SetMaxScrollOffset(max_scroll_offset);
557 layer()->SetScrollOffset(scroll_offset); 576 layer()->SetScrollOffset(scroll_offset);
558 gfx::Vector2dF unscrolled = layer()->ScrollBy(scroll_delta); 577 gfx::Vector2dF unscrolled = layer()->ScrollBy(scroll_delta);
559 578
560 EXPECT_VECTOR_EQ(gfx::Vector2dF(0, 8.5f), unscrolled); 579 EXPECT_VECTOR_EQ(gfx::Vector2dF(0, 8.5f), unscrolled);
561 EXPECT_VECTOR_EQ(gfx::Vector2dF(30.5f, 5), layer()->TotalScrollOffset()); 580 EXPECT_VECTOR_EQ(gfx::Vector2dF(30.5f, 5), layer()->TotalScrollOffset());
562 } 581 }
563 582
564 } // namespace 583 } // namespace
565 } // namespace cc 584 } // namespace cc
OLDNEW
« no previous file with comments | « cc/layers/layer_impl.cc ('k') | cc/layers/layer_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698