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

Side by Side Diff: cc/trees/occlusion_tracker_unittest.cc

Issue 465853004: Moving RenderSurface creation outside of CalcDrawProps (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Updated unit tests Created 6 years, 3 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 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 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/trees/occlusion_tracker.h" 5 #include "cc/trees/occlusion_tracker.h"
6 6
7 #include "cc/animation/layer_animation_controller.h" 7 #include "cc/animation/layer_animation_controller.h"
8 #include "cc/base/math_util.h" 8 #include "cc/base/math_util.h"
9 #include "cc/layers/layer.h" 9 #include "cc/layers/layer.h"
10 #include "cc/layers/layer_impl.h" 10 #include "cc/layers/layer_impl.h"
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
124 LayerPtrType ref(*layer); 124 LayerPtrType ref(*layer);
125 *layer = NULL; 125 *layer = NULL;
126 return ref; 126 return ref;
127 } 127 }
128 128
129 static LayerPtrType PassLayerPtr(LayerPtrType* layer) { 129 static LayerPtrType PassLayerPtr(LayerPtrType* layer) {
130 LayerPtrType ref(*layer); 130 LayerPtrType ref(*layer);
131 *layer = NULL; 131 *layer = NULL;
132 return ref; 132 return ref;
133 } 133 }
134 static void SetForceRenderSurface(LayerType* layer, bool force) {
135 layer->SetForceRenderSurface(force);
136 }
134 137
135 static void DestroyLayer(LayerPtrType* layer) { *layer = NULL; } 138 static void DestroyLayer(LayerPtrType* layer) { *layer = NULL; }
136 139
137 static void RecursiveUpdateNumChildren(LayerType* layerType) {} 140 static void RecursiveUpdateNumChildren(LayerType* layerType) {}
138 }; 141 };
139 142
140 struct OcclusionTrackerTestImplThreadTypes { 143 struct OcclusionTrackerTestImplThreadTypes {
141 typedef LayerImpl LayerType; 144 typedef LayerImpl LayerType;
142 typedef LayerTreeImpl HostType; 145 typedef LayerTreeImpl HostType;
143 typedef RenderSurfaceImpl RenderSurfaceType; 146 typedef RenderSurfaceImpl RenderSurfaceType;
(...skipping 12 matching lines...) Expand all
156 static int next_layer_impl_id; 159 static int next_layer_impl_id;
157 160
158 static LayerPtrType PassLayerPtr(LayerPtrType* layer) { 161 static LayerPtrType PassLayerPtr(LayerPtrType* layer) {
159 return layer->Pass(); 162 return layer->Pass();
160 } 163 }
161 164
162 static LayerPtrType PassLayerPtr(ContentLayerPtrType* layer) { 165 static LayerPtrType PassLayerPtr(ContentLayerPtrType* layer) {
163 return layer->PassAs<LayerType>(); 166 return layer->PassAs<LayerType>();
164 } 167 }
165 168
169 static void SetForceRenderSurface(LayerType* layer, bool force) {
170 if (force) {
171 layer->CreateRenderSurface();
172 } else {
173 layer->ClearRenderSurface();
174 }
175 }
166 static void DestroyLayer(LayerPtrType* layer) { layer->reset(); } 176 static void DestroyLayer(LayerPtrType* layer) { layer->reset(); }
167 177
168 static void RecursiveUpdateNumChildren(LayerType* layer) { 178 static void RecursiveUpdateNumChildren(LayerType* layer) {
169 FakeLayerTreeHostImpl::RecursiveUpdateNumChildren(layer); 179 FakeLayerTreeHostImpl::RecursiveUpdateNumChildren(layer);
170 } 180 }
171 }; 181 };
172 182
173 int OcclusionTrackerTestImplThreadTypes::next_layer_impl_id = 1; 183 int OcclusionTrackerTestImplThreadTypes::next_layer_impl_id = 1;
174 184
175 template <typename Types> class OcclusionTrackerTest : public testing::Test { 185 template <typename Types> class OcclusionTrackerTest : public testing::Test {
(...skipping 11 matching lines...) Expand all
187 const gfx::PointF& position, 197 const gfx::PointF& position,
188 const gfx::Size& bounds) { 198 const gfx::Size& bounds) {
189 typename Types::ContentLayerPtrType layer( 199 typename Types::ContentLayerPtrType layer(
190 Types::CreateContentLayer(GetHost())); 200 Types::CreateContentLayer(GetHost()));
191 typename Types::ContentLayerType* layer_ptr = layer.get(); 201 typename Types::ContentLayerType* layer_ptr = layer.get();
192 SetProperties(layer_ptr, transform, position, bounds); 202 SetProperties(layer_ptr, transform, position, bounds);
193 203
194 DCHECK(!root_.get()); 204 DCHECK(!root_.get());
195 root_ = Types::PassLayerPtr(&layer); 205 root_ = Types::PassLayerPtr(&layer);
196 206
207 CreateRenderSurfaceOnImplThread(layer_ptr);
197 SetRootLayerOnMainThread(layer_ptr); 208 SetRootLayerOnMainThread(layer_ptr);
198 209
199 return layer_ptr; 210 return layer_ptr;
200 } 211 }
201 212
202 typename Types::LayerType* CreateLayer(typename Types::LayerType* parent, 213 typename Types::LayerType* CreateLayer(typename Types::LayerType* parent,
203 const gfx::Transform& transform, 214 const gfx::Transform& transform,
204 const gfx::PointF& position, 215 const gfx::PointF& position,
205 const gfx::Size& bounds) { 216 const gfx::Size& bounds) {
206 typename Types::LayerPtrType layer(Types::CreateLayer(GetHost())); 217 typename Types::LayerPtrType layer(Types::CreateLayer(GetHost()));
207 typename Types::LayerType* layer_ptr = layer.get(); 218 typename Types::LayerType* layer_ptr = layer.get();
208 SetProperties(layer_ptr, transform, position, bounds); 219 SetProperties(layer_ptr, transform, position, bounds);
209 parent->AddChild(Types::PassLayerPtr(&layer)); 220 parent->AddChild(Types::PassLayerPtr(&layer));
210 return layer_ptr; 221 return layer_ptr;
211 } 222 }
212 223
213 typename Types::LayerType* CreateSurface(typename Types::LayerType* parent, 224 typename Types::LayerType* CreateSurface(typename Types::LayerType* parent,
214 const gfx::Transform& transform, 225 const gfx::Transform& transform,
215 const gfx::PointF& position, 226 const gfx::PointF& position,
216 const gfx::Size& bounds) { 227 const gfx::Size& bounds) {
217 typename Types::LayerType* layer = 228 typename Types::LayerType* layer =
218 CreateLayer(parent, transform, position, bounds); 229 CreateLayer(parent, transform, position, bounds);
219 layer->SetForceRenderSurface(true); 230 Types::SetForceRenderSurface(layer, true);
220 return layer; 231 return layer;
221 } 232 }
222 233
223 typename Types::ContentLayerType* CreateDrawingLayer( 234 typename Types::ContentLayerType* CreateDrawingLayer(
224 typename Types::LayerType* parent, 235 typename Types::LayerType* parent,
225 const gfx::Transform& transform, 236 const gfx::Transform& transform,
226 const gfx::PointF& position, 237 const gfx::PointF& position,
227 const gfx::Size& bounds, 238 const gfx::Size& bounds,
228 bool opaque) { 239 bool opaque) {
229 typename Types::ContentLayerPtrType layer( 240 typename Types::ContentLayerPtrType layer(
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
270 } 281 }
271 282
272 typename Types::ContentLayerType* CreateDrawingSurface( 283 typename Types::ContentLayerType* CreateDrawingSurface(
273 typename Types::LayerType* parent, 284 typename Types::LayerType* parent,
274 const gfx::Transform& transform, 285 const gfx::Transform& transform,
275 const gfx::PointF& position, 286 const gfx::PointF& position,
276 const gfx::Size& bounds, 287 const gfx::Size& bounds,
277 bool opaque) { 288 bool opaque) {
278 typename Types::ContentLayerType* layer = 289 typename Types::ContentLayerType* layer =
279 CreateDrawingLayer(parent, transform, position, bounds, opaque); 290 CreateDrawingLayer(parent, transform, position, bounds, opaque);
280 layer->SetForceRenderSurface(true); 291 Types::SetForceRenderSurface(layer, true);
281 return layer; 292 return layer;
282 } 293 }
283 294
284 void DestroyLayers() { 295 void DestroyLayers() {
285 Types::DestroyLayer(&root_); 296 Types::DestroyLayer(&root_);
286 render_surface_layer_list_.reset(); 297 render_surface_layer_list_.reset();
287 render_surface_layer_list_impl_.clear(); 298 render_surface_layer_list_impl_.clear();
288 replica_layers_.clear(); 299 replica_layers_.clear();
289 mask_layers_.clear(); 300 mask_layers_.clear();
290 ResetLayerIterator(); 301 ResetLayerIterator();
291 } 302 }
292 303
293 void CopyOutputCallback(scoped_ptr<CopyOutputResult> result) {} 304 void CopyOutputCallback(scoped_ptr<CopyOutputResult> result) {}
294 305
295 void AddCopyRequest(Layer* layer) { 306 void AddCopyRequest(Layer* layer) {
296 layer->RequestCopyOfOutput( 307 layer->RequestCopyOfOutput(
297 CopyOutputRequest::CreateBitmapRequest(base::Bind( 308 CopyOutputRequest::CreateBitmapRequest(base::Bind(
298 &OcclusionTrackerTest<Types>::CopyOutputCallback, 309 &OcclusionTrackerTest<Types>::CopyOutputCallback,
299 base::Unretained(this)))); 310 base::Unretained(this))));
300 } 311 }
301 312
302 void AddCopyRequest(LayerImpl* layer) { 313 void AddCopyRequest(LayerImpl* layer) {
303 ScopedPtrVector<CopyOutputRequest> requests; 314 ScopedPtrVector<CopyOutputRequest> requests;
304 requests.push_back( 315 requests.push_back(
305 CopyOutputRequest::CreateBitmapRequest(base::Bind( 316 CopyOutputRequest::CreateBitmapRequest(base::Bind(
306 &OcclusionTrackerTest<Types>::CopyOutputCallback, 317 &OcclusionTrackerTest<Types>::CopyOutputCallback,
307 base::Unretained(this)))); 318 base::Unretained(this))));
319 layer->CreateRenderSurface();
308 layer->PassCopyRequests(&requests); 320 layer->PassCopyRequests(&requests);
309 } 321 }
310 322
311 void CalcDrawEtc(TestContentLayerImpl* root) { 323 void CalcDrawEtc(TestContentLayerImpl* root) {
312 DCHECK(root == root_.get()); 324 DCHECK(root == root_.get());
313 DCHECK(!root->render_surface());
314 325
315 Types::RecursiveUpdateNumChildren(root); 326 Types::RecursiveUpdateNumChildren(root);
316 LayerTreeHostCommon::CalcDrawPropsImplInputsForTesting inputs( 327 LayerTreeHostCommon::CalcDrawPropsImplInputsForTesting inputs(
317 root, root->bounds(), &render_surface_layer_list_impl_); 328 root, root->bounds(), &render_surface_layer_list_impl_);
318 inputs.can_adjust_raster_scales = true; 329 inputs.can_adjust_raster_scales = true;
319 LayerTreeHostCommon::CalculateDrawProperties(&inputs); 330 LayerTreeHostCommon::CalculateDrawProperties(&inputs);
320 331
321 layer_iterator_ = layer_iterator_begin_ = 332 layer_iterator_ = layer_iterator_begin_ =
322 Types::TestLayerIterator::Begin(&render_surface_layer_list_impl_); 333 Types::TestLayerIterator::Begin(&render_surface_layer_list_impl_);
323 } 334 }
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
382 typename Types::LayerType* layer, 393 typename Types::LayerType* layer,
383 typename Types::OcclusionTrackerType* occlusion) { 394 typename Types::OcclusionTrackerType* occlusion) {
384 EnterContributingSurface(layer, occlusion); 395 EnterContributingSurface(layer, occlusion);
385 LeaveContributingSurface(layer, occlusion); 396 LeaveContributingSurface(layer, occlusion);
386 } 397 }
387 398
388 void ResetLayerIterator() { layer_iterator_ = layer_iterator_begin_; } 399 void ResetLayerIterator() { layer_iterator_ = layer_iterator_begin_; }
389 400
390 const gfx::Transform identity_matrix; 401 const gfx::Transform identity_matrix;
391 402
403 void CreateRenderSurfaceOnImplThread(Layer* root) {}
404 void CreateRenderSurfaceOnImplThread(LayerImpl* root) {
405 root->CreateRenderSurface();
406 }
407
392 private: 408 private:
393 void SetRootLayerOnMainThread(Layer* root) { 409 void SetRootLayerOnMainThread(Layer* root) {
394 host_->SetRootLayer(scoped_refptr<Layer>(root)); 410 host_->SetRootLayer(scoped_refptr<Layer>(root));
395 } 411 }
396 412
397 void SetRootLayerOnMainThread(LayerImpl* root) {} 413 void SetRootLayerOnMainThread(LayerImpl* root) {}
398 414
399 void SetBaseProperties(typename Types::LayerType* layer, 415 void SetBaseProperties(typename Types::LayerType* layer,
400 const gfx::Transform& transform, 416 const gfx::Transform& transform,
401 const gfx::PointF& position, 417 const gfx::PointF& position,
(...skipping 329 matching lines...) Expand 10 before | Expand all | Expand 10 after
731 : OcclusionTrackerTest<Types>(opaque_layers) {} 747 : OcclusionTrackerTest<Types>(opaque_layers) {}
732 748
733 void RunMyTest() { 749 void RunMyTest() {
734 typename Types::ContentLayerType* parent = this->CreateRoot( 750 typename Types::ContentLayerType* parent = this->CreateRoot(
735 this->identity_matrix, gfx::PointF(), gfx::Size(200, 200)); 751 this->identity_matrix, gfx::PointF(), gfx::Size(200, 200));
736 752
737 gfx::Transform layer1_matrix; 753 gfx::Transform layer1_matrix;
738 layer1_matrix.Scale(2.0, 2.0); 754 layer1_matrix.Scale(2.0, 2.0);
739 typename Types::ContentLayerType* layer1 = this->CreateDrawingLayer( 755 typename Types::ContentLayerType* layer1 = this->CreateDrawingLayer(
740 parent, layer1_matrix, gfx::PointF(), gfx::Size(100, 100), true); 756 parent, layer1_matrix, gfx::PointF(), gfx::Size(100, 100), true);
741 layer1->SetForceRenderSurface(true); 757 Types::SetForceRenderSurface(layer1, true);
742 758
743 gfx::Transform layer2_matrix; 759 gfx::Transform layer2_matrix;
744 layer2_matrix.Translate(25.0, 25.0); 760 layer2_matrix.Translate(25.0, 25.0);
745 typename Types::ContentLayerType* layer2 = this->CreateDrawingLayer( 761 typename Types::ContentLayerType* layer2 = this->CreateDrawingLayer(
746 layer1, layer2_matrix, gfx::PointF(), gfx::Size(50, 50), true); 762 layer1, layer2_matrix, gfx::PointF(), gfx::Size(50, 50), true);
747 typename Types::ContentLayerType* occluder = 763 typename Types::ContentLayerType* occluder =
748 this->CreateDrawingLayer(parent, 764 this->CreateDrawingLayer(parent,
749 this->identity_matrix, 765 this->identity_matrix,
750 gfx::PointF(100.f, 100.f), 766 gfx::PointF(100.f, 100.f),
751 gfx::Size(500, 500), 767 gfx::Size(500, 500),
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
848 gfx::Transform layer_transform; 864 gfx::Transform layer_transform;
849 layer_transform.Translate(10.0, 10.0); 865 layer_transform.Translate(10.0, 10.0);
850 866
851 typename Types::ContentLayerType* root = this->CreateRoot( 867 typename Types::ContentLayerType* root = this->CreateRoot(
852 this->identity_matrix, gfx::PointF(), gfx::Size(1000, 1000)); 868 this->identity_matrix, gfx::PointF(), gfx::Size(1000, 1000));
853 typename Types::ContentLayerType* parent = this->CreateDrawingLayer( 869 typename Types::ContentLayerType* parent = this->CreateDrawingLayer(
854 root, this->identity_matrix, gfx::PointF(), gfx::Size(100, 100), true); 870 root, this->identity_matrix, gfx::PointF(), gfx::Size(100, 100), true);
855 typename Types::LayerType* child = this->CreateLayer( 871 typename Types::LayerType* child = this->CreateLayer(
856 parent, child_transform, gfx::PointF(30.f, 30.f), gfx::Size(500, 500)); 872 parent, child_transform, gfx::PointF(30.f, 30.f), gfx::Size(500, 500));
857 child->SetMasksToBounds(true); 873 child->SetMasksToBounds(true);
874 this->CreateRenderSurfaceOnImplThread(child);
858 typename Types::ContentLayerType* layer = this->CreateDrawingLayer( 875 typename Types::ContentLayerType* layer = this->CreateDrawingLayer(
859 child, layer_transform, gfx::PointF(), gfx::Size(500, 500), true); 876 child, layer_transform, gfx::PointF(), gfx::Size(500, 500), true);
860 this->CalcDrawEtc(root); 877 this->CalcDrawEtc(root);
861 878
862 TestOcclusionTrackerWithClip<typename Types::LayerType> occlusion( 879 TestOcclusionTrackerWithClip<typename Types::LayerType> occlusion(
863 gfx::Rect(0, 0, 1000, 1000)); 880 gfx::Rect(0, 0, 1000, 1000));
864 881
865 gfx::Rect clipped_layer_in_child = MathUtil::MapEnclosingClippedRect( 882 gfx::Rect clipped_layer_in_child = MathUtil::MapEnclosingClippedRect(
866 layer_transform, layer->visible_content_rect()); 883 layer_transform, layer->visible_content_rect());
867 884
(...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after
1165 layer_transform, 1182 layer_transform,
1166 gfx::PointF(30.f, 30.f), 1183 gfx::PointF(30.f, 30.f),
1167 gfx::Size(500, 500), 1184 gfx::Size(500, 500),
1168 true); 1185 true);
1169 typename Types::ContentLayerType* opacity_layer = 1186 typename Types::ContentLayerType* opacity_layer =
1170 this->CreateDrawingLayer(parent, 1187 this->CreateDrawingLayer(parent,
1171 layer_transform, 1188 layer_transform,
1172 gfx::PointF(30.f, 30.f), 1189 gfx::PointF(30.f, 30.f),
1173 gfx::Size(500, 500), 1190 gfx::Size(500, 500),
1174 true); 1191 true);
1192 this->CreateRenderSurfaceOnImplThread(blur_layer);
1193 this->CreateRenderSurfaceOnImplThread(opacity_layer);
1194 this->CreateRenderSurfaceOnImplThread(opaque_layer);
1175 1195
1176 FilterOperations filters; 1196 FilterOperations filters;
1177 filters.Append(FilterOperation::CreateBlurFilter(10.f)); 1197 filters.Append(FilterOperation::CreateBlurFilter(10.f));
1178 blur_layer->SetFilters(filters); 1198 blur_layer->SetFilters(filters);
1179 1199
1180 filters.Clear(); 1200 filters.Clear();
1181 filters.Append(FilterOperation::CreateGrayscaleFilter(0.5f)); 1201 filters.Append(FilterOperation::CreateGrayscaleFilter(0.5f));
1182 opaque_layer->SetFilters(filters); 1202 opaque_layer->SetFilters(filters);
1183 1203
1184 filters.Clear(); 1204 filters.Clear();
(...skipping 1042 matching lines...) Expand 10 before | Expand all | Expand 10 after
2227 // space, where the background filter is applied. 2247 // space, where the background filter is applied.
2228 typename Types::ContentLayerType* parent = this->CreateRoot( 2248 typename Types::ContentLayerType* parent = this->CreateRoot(
2229 this->identity_matrix, gfx::PointF(), gfx::Size(200, 200)); 2249 this->identity_matrix, gfx::PointF(), gfx::Size(200, 200));
2230 typename Types::LayerType* filtered_surface = 2250 typename Types::LayerType* filtered_surface =
2231 this->CreateDrawingLayer(parent, 2251 this->CreateDrawingLayer(parent,
2232 scale_by_half, 2252 scale_by_half,
2233 gfx::PointF(50.f, 50.f), 2253 gfx::PointF(50.f, 50.f),
2234 gfx::Size(100, 100), 2254 gfx::Size(100, 100),
2235 false); 2255 false);
2236 filtered_surface->SetBackgroundFilters(filters); 2256 filtered_surface->SetBackgroundFilters(filters);
2237 2257 Types::SetForceRenderSurface(filtered_surface, true);
2238 gfx::Rect occlusion_rect; 2258 gfx::Rect occlusion_rect;
2239 switch (i) { 2259 switch (i) {
2240 case LEFT: 2260 case LEFT:
2241 occlusion_rect = gfx::Rect(0, 0, 50, 200); 2261 occlusion_rect = gfx::Rect(0, 0, 50, 200);
2242 break; 2262 break;
2243 case RIGHT: 2263 case RIGHT:
2244 occlusion_rect = gfx::Rect(100, 0, 50, 200); 2264 occlusion_rect = gfx::Rect(100, 0, 50, 200);
2245 break; 2265 break;
2246 case TOP: 2266 case TOP:
2247 occlusion_rect = gfx::Rect(0, 0, 200, 50); 2267 occlusion_rect = gfx::Rect(0, 0, 200, 50);
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
2342 this->identity_matrix, 2362 this->identity_matrix,
2343 gfx::PointF(100.f, 100.f), 2363 gfx::PointF(100.f, 100.f),
2344 gfx::Size(50, 50), 2364 gfx::Size(50, 50),
2345 true); 2365 true);
2346 2366
2347 // Filters make the layers own surfaces. 2367 // Filters make the layers own surfaces.
2348 FilterOperations filters; 2368 FilterOperations filters;
2349 filters.Append(FilterOperation::CreateBlurFilter(1.f)); 2369 filters.Append(FilterOperation::CreateBlurFilter(1.f));
2350 filtered_surface1->SetBackgroundFilters(filters); 2370 filtered_surface1->SetBackgroundFilters(filters);
2351 filtered_surface2->SetBackgroundFilters(filters); 2371 filtered_surface2->SetBackgroundFilters(filters);
2372 this->CreateRenderSurfaceOnImplThread(filtered_surface1);
2373 this->CreateRenderSurfaceOnImplThread(filtered_surface2);
2352 2374
2353 // Save the distance of influence for the blur effect. 2375 // Save the distance of influence for the blur effect.
2354 int outset_top, outset_right, outset_bottom, outset_left; 2376 int outset_top, outset_right, outset_bottom, outset_left;
2355 filters.GetOutsets( 2377 filters.GetOutsets(
2356 &outset_top, &outset_right, &outset_bottom, &outset_left); 2378 &outset_top, &outset_right, &outset_bottom, &outset_left);
2357 2379
2358 this->CalcDrawEtc(root); 2380 this->CalcDrawEtc(root);
2359 2381
2360 TestOcclusionTrackerWithClip<typename Types::LayerType> occlusion( 2382 TestOcclusionTrackerWithClip<typename Types::LayerType> occlusion(
2361 gfx::Rect(0, 0, 1000, 1000)); 2383 gfx::Rect(0, 0, 1000, 1000));
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
2427 false); 2449 false);
2428 this->CreateReplicaLayer(filtered_surface, 2450 this->CreateReplicaLayer(filtered_surface,
2429 this->identity_matrix, 2451 this->identity_matrix,
2430 gfx::PointF(300.f, 0.f), 2452 gfx::PointF(300.f, 0.f),
2431 gfx::Size()); 2453 gfx::Size());
2432 2454
2433 // Filters make the layer own a surface. 2455 // Filters make the layer own a surface.
2434 FilterOperations filters; 2456 FilterOperations filters;
2435 filters.Append(FilterOperation::CreateBlurFilter(3.f)); 2457 filters.Append(FilterOperation::CreateBlurFilter(3.f));
2436 filtered_surface->SetBackgroundFilters(filters); 2458 filtered_surface->SetBackgroundFilters(filters);
2437 2459 this->CreateRenderSurfaceOnImplThread(filtered_surface);
2438 this->CalcDrawEtc(parent); 2460 this->CalcDrawEtc(parent);
2439 2461
2440 TestOcclusionTrackerWithClip<typename Types::LayerType> occlusion( 2462 TestOcclusionTrackerWithClip<typename Types::LayerType> occlusion(
2441 gfx::Rect(0, 0, 1000, 1000)); 2463 gfx::Rect(0, 0, 1000, 1000));
2442 2464
2443 // The surface has a background blur, so it blurs non-opaque pixels below 2465 // The surface has a background blur, so it blurs non-opaque pixels below
2444 // it. 2466 // it.
2445 this->VisitLayer(filtered_surface, &occlusion); 2467 this->VisitLayer(filtered_surface, &occlusion);
2446 this->VisitContributingSurface(filtered_surface, &occlusion); 2468 this->VisitContributingSurface(filtered_surface, &occlusion);
2447 2469
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
2501 this->CreateDrawingLayer(parent, 2523 this->CreateDrawingLayer(parent,
2502 this->identity_matrix, 2524 this->identity_matrix,
2503 gfx::PointF(50.f, 50.f), 2525 gfx::PointF(50.f, 50.f),
2504 gfx::Size(50, 50), 2526 gfx::Size(50, 50),
2505 true); 2527 true);
2506 2528
2507 // Filters make the layer own a surface. 2529 // Filters make the layer own a surface.
2508 FilterOperations filters; 2530 FilterOperations filters;
2509 filters.Append(FilterOperation::CreateBlurFilter(3.f)); 2531 filters.Append(FilterOperation::CreateBlurFilter(3.f));
2510 filtered_surface->SetBackgroundFilters(filters); 2532 filtered_surface->SetBackgroundFilters(filters);
2533 this->CreateRenderSurfaceOnImplThread(filtered_surface);
2511 2534
2512 this->CalcDrawEtc(parent); 2535 this->CalcDrawEtc(parent);
2513 2536
2514 TestOcclusionTrackerWithClip<typename Types::LayerType> occlusion( 2537 TestOcclusionTrackerWithClip<typename Types::LayerType> occlusion(
2515 gfx::Rect(0, 0, 1000, 1000)); 2538 gfx::Rect(0, 0, 1000, 1000));
2516 2539
2517 this->VisitLayer(occluding_layer, &occlusion); 2540 this->VisitLayer(occluding_layer, &occlusion);
2518 2541
2519 this->VisitLayer(filtered_surface, &occlusion); 2542 this->VisitLayer(filtered_surface, &occlusion);
2520 { 2543 {
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
2597 this->CreateDrawingLayer(parent, 2620 this->CreateDrawingLayer(parent,
2598 this->identity_matrix, 2621 this->identity_matrix,
2599 gfx::PointF(200.f, 40.f), 2622 gfx::PointF(200.f, 40.f),
2600 gfx::Size(10, 10), 2623 gfx::Size(10, 10),
2601 true); 2624 true);
2602 2625
2603 // Filters make the layer own a surface. 2626 // Filters make the layer own a surface.
2604 FilterOperations filters; 2627 FilterOperations filters;
2605 filters.Append(FilterOperation::CreateBlurFilter(3.f)); 2628 filters.Append(FilterOperation::CreateBlurFilter(3.f));
2606 filtered_surface->SetBackgroundFilters(filters); 2629 filtered_surface->SetBackgroundFilters(filters);
2630 this->CreateRenderSurfaceOnImplThread(filtered_surface);
2607 2631
2608 // Save the distance of influence for the blur effect. 2632 // Save the distance of influence for the blur effect.
2609 int outset_top, outset_right, outset_bottom, outset_left; 2633 int outset_top, outset_right, outset_bottom, outset_left;
2610 filters.GetOutsets( 2634 filters.GetOutsets(
2611 &outset_top, &outset_right, &outset_bottom, &outset_left); 2635 &outset_top, &outset_right, &outset_bottom, &outset_left);
2612 2636
2613 this->CalcDrawEtc(parent); 2637 this->CalcDrawEtc(parent);
2614 2638
2615 TestOcclusionTrackerWithClip<typename Types::LayerType> occlusion( 2639 TestOcclusionTrackerWithClip<typename Types::LayerType> occlusion(
2616 gfx::Rect(0, 0, 1000, 1000)); 2640 gfx::Rect(0, 0, 1000, 1000));
(...skipping 688 matching lines...) Expand 10 before | Expand all | Expand 10 after
3305 EXPECT_EQ(gfx::Rect(), 3329 EXPECT_EQ(gfx::Rect(),
3306 occlusion.UnoccludedSurfaceContentRect( 3330 occlusion.UnoccludedSurfaceContentRect(
3307 surface, gfx::Rect(80, 70, 50, 50))); 3331 surface, gfx::Rect(80, 70, 50, 50)));
3308 } 3332 }
3309 }; 3333 };
3310 3334
3311 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestUnoccludedSurfaceQuery) 3335 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestUnoccludedSurfaceQuery)
3312 3336
3313 } // namespace 3337 } // namespace
3314 } // namespace cc 3338 } // namespace cc
OLDNEW
« cc/trees/layer_tree_impl_unittest.cc ('K') | « cc/trees/layer_tree_impl_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698