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

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: 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 layer->SetHasRenderSurface(force);
171 }
166 static void DestroyLayer(LayerPtrType* layer) { layer->reset(); } 172 static void DestroyLayer(LayerPtrType* layer) { layer->reset(); }
167 173
168 static void RecursiveUpdateNumChildren(LayerType* layer) { 174 static void RecursiveUpdateNumChildren(LayerType* layer) {
169 FakeLayerTreeHostImpl::RecursiveUpdateNumChildren(layer); 175 FakeLayerTreeHostImpl::RecursiveUpdateNumChildren(layer);
170 } 176 }
171 }; 177 };
172 178
173 int OcclusionTrackerTestImplThreadTypes::next_layer_impl_id = 1; 179 int OcclusionTrackerTestImplThreadTypes::next_layer_impl_id = 1;
174 180
175 template <typename Types> class OcclusionTrackerTest : public testing::Test { 181 template <typename Types> class OcclusionTrackerTest : public testing::Test {
(...skipping 11 matching lines...) Expand all
187 const gfx::PointF& position, 193 const gfx::PointF& position,
188 const gfx::Size& bounds) { 194 const gfx::Size& bounds) {
189 typename Types::ContentLayerPtrType layer( 195 typename Types::ContentLayerPtrType layer(
190 Types::CreateContentLayer(GetHost())); 196 Types::CreateContentLayer(GetHost()));
191 typename Types::ContentLayerType* layer_ptr = layer.get(); 197 typename Types::ContentLayerType* layer_ptr = layer.get();
192 SetProperties(layer_ptr, transform, position, bounds); 198 SetProperties(layer_ptr, transform, position, bounds);
193 199
194 DCHECK(!root_.get()); 200 DCHECK(!root_.get());
195 root_ = Types::PassLayerPtr(&layer); 201 root_ = Types::PassLayerPtr(&layer);
196 202
203 Types::SetForceRenderSurface(layer_ptr, true);
197 SetRootLayerOnMainThread(layer_ptr); 204 SetRootLayerOnMainThread(layer_ptr);
198 205
199 return layer_ptr; 206 return layer_ptr;
200 } 207 }
201 208
202 typename Types::LayerType* CreateLayer(typename Types::LayerType* parent, 209 typename Types::LayerType* CreateLayer(typename Types::LayerType* parent,
203 const gfx::Transform& transform, 210 const gfx::Transform& transform,
204 const gfx::PointF& position, 211 const gfx::PointF& position,
205 const gfx::Size& bounds) { 212 const gfx::Size& bounds) {
206 typename Types::LayerPtrType layer(Types::CreateLayer(GetHost())); 213 typename Types::LayerPtrType layer(Types::CreateLayer(GetHost()));
207 typename Types::LayerType* layer_ptr = layer.get(); 214 typename Types::LayerType* layer_ptr = layer.get();
208 SetProperties(layer_ptr, transform, position, bounds); 215 SetProperties(layer_ptr, transform, position, bounds);
209 parent->AddChild(Types::PassLayerPtr(&layer)); 216 parent->AddChild(Types::PassLayerPtr(&layer));
210 return layer_ptr; 217 return layer_ptr;
211 } 218 }
212 219
213 typename Types::LayerType* CreateSurface(typename Types::LayerType* parent, 220 typename Types::LayerType* CreateSurface(typename Types::LayerType* parent,
214 const gfx::Transform& transform, 221 const gfx::Transform& transform,
215 const gfx::PointF& position, 222 const gfx::PointF& position,
216 const gfx::Size& bounds) { 223 const gfx::Size& bounds) {
217 typename Types::LayerType* layer = 224 typename Types::LayerType* layer =
218 CreateLayer(parent, transform, position, bounds); 225 CreateLayer(parent, transform, position, bounds);
219 layer->SetForceRenderSurface(true); 226 Types::SetForceRenderSurface(layer, true);
220 return layer; 227 return layer;
221 } 228 }
222 229
223 typename Types::ContentLayerType* CreateDrawingLayer( 230 typename Types::ContentLayerType* CreateDrawingLayer(
224 typename Types::LayerType* parent, 231 typename Types::LayerType* parent,
225 const gfx::Transform& transform, 232 const gfx::Transform& transform,
226 const gfx::PointF& position, 233 const gfx::PointF& position,
227 const gfx::Size& bounds, 234 const gfx::Size& bounds,
228 bool opaque) { 235 bool opaque) {
229 typename Types::ContentLayerPtrType layer( 236 typename Types::ContentLayerPtrType layer(
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
270 } 277 }
271 278
272 typename Types::ContentLayerType* CreateDrawingSurface( 279 typename Types::ContentLayerType* CreateDrawingSurface(
273 typename Types::LayerType* parent, 280 typename Types::LayerType* parent,
274 const gfx::Transform& transform, 281 const gfx::Transform& transform,
275 const gfx::PointF& position, 282 const gfx::PointF& position,
276 const gfx::Size& bounds, 283 const gfx::Size& bounds,
277 bool opaque) { 284 bool opaque) {
278 typename Types::ContentLayerType* layer = 285 typename Types::ContentLayerType* layer =
279 CreateDrawingLayer(parent, transform, position, bounds, opaque); 286 CreateDrawingLayer(parent, transform, position, bounds, opaque);
280 layer->SetForceRenderSurface(true); 287 Types::SetForceRenderSurface(layer, true);
281 return layer; 288 return layer;
282 } 289 }
283 290
284 void DestroyLayers() { 291 void DestroyLayers() {
285 Types::DestroyLayer(&root_); 292 Types::DestroyLayer(&root_);
286 render_surface_layer_list_.reset(); 293 render_surface_layer_list_.reset();
287 render_surface_layer_list_impl_.clear(); 294 render_surface_layer_list_impl_.clear();
288 replica_layers_.clear(); 295 replica_layers_.clear();
289 mask_layers_.clear(); 296 mask_layers_.clear();
290 ResetLayerIterator(); 297 ResetLayerIterator();
291 } 298 }
292 299
293 void CopyOutputCallback(scoped_ptr<CopyOutputResult> result) {} 300 void CopyOutputCallback(scoped_ptr<CopyOutputResult> result) {}
294 301
295 void AddCopyRequest(Layer* layer) { 302 void AddCopyRequest(Layer* layer) {
296 layer->RequestCopyOfOutput( 303 layer->RequestCopyOfOutput(
297 CopyOutputRequest::CreateBitmapRequest(base::Bind( 304 CopyOutputRequest::CreateBitmapRequest(base::Bind(
298 &OcclusionTrackerTest<Types>::CopyOutputCallback, 305 &OcclusionTrackerTest<Types>::CopyOutputCallback,
299 base::Unretained(this)))); 306 base::Unretained(this))));
300 } 307 }
301 308
302 void AddCopyRequest(LayerImpl* layer) { 309 void AddCopyRequest(LayerImpl* layer) {
303 ScopedPtrVector<CopyOutputRequest> requests; 310 ScopedPtrVector<CopyOutputRequest> requests;
304 requests.push_back( 311 requests.push_back(
305 CopyOutputRequest::CreateBitmapRequest(base::Bind( 312 CopyOutputRequest::CreateBitmapRequest(base::Bind(
306 &OcclusionTrackerTest<Types>::CopyOutputCallback, 313 &OcclusionTrackerTest<Types>::CopyOutputCallback,
307 base::Unretained(this)))); 314 base::Unretained(this))));
315 layer->SetHasRenderSurface(true);
308 layer->PassCopyRequests(&requests); 316 layer->PassCopyRequests(&requests);
309 } 317 }
310 318
311 void CalcDrawEtc(TestContentLayerImpl* root) { 319 void CalcDrawEtc(TestContentLayerImpl* root) {
312 DCHECK(root == root_.get()); 320 DCHECK(root == root_.get());
313 DCHECK(!root->render_surface());
314 321
315 Types::RecursiveUpdateNumChildren(root); 322 Types::RecursiveUpdateNumChildren(root);
316 LayerTreeHostCommon::CalcDrawPropsImplInputsForTesting inputs( 323 LayerTreeHostCommon::CalcDrawPropsImplInputsForTesting inputs(
317 root, root->bounds(), &render_surface_layer_list_impl_); 324 root, root->bounds(), &render_surface_layer_list_impl_);
318 inputs.can_adjust_raster_scales = true; 325 inputs.can_adjust_raster_scales = true;
319 LayerTreeHostCommon::CalculateDrawProperties(&inputs); 326 LayerTreeHostCommon::CalculateDrawProperties(&inputs);
320 327
321 layer_iterator_ = layer_iterator_begin_ = 328 layer_iterator_ = layer_iterator_begin_ =
322 Types::TestLayerIterator::Begin(&render_surface_layer_list_impl_); 329 Types::TestLayerIterator::Begin(&render_surface_layer_list_impl_);
323 } 330 }
(...skipping 407 matching lines...) Expand 10 before | Expand all | Expand 10 after
731 : OcclusionTrackerTest<Types>(opaque_layers) {} 738 : OcclusionTrackerTest<Types>(opaque_layers) {}
732 739
733 void RunMyTest() { 740 void RunMyTest() {
734 typename Types::ContentLayerType* parent = this->CreateRoot( 741 typename Types::ContentLayerType* parent = this->CreateRoot(
735 this->identity_matrix, gfx::PointF(), gfx::Size(200, 200)); 742 this->identity_matrix, gfx::PointF(), gfx::Size(200, 200));
736 743
737 gfx::Transform layer1_matrix; 744 gfx::Transform layer1_matrix;
738 layer1_matrix.Scale(2.0, 2.0); 745 layer1_matrix.Scale(2.0, 2.0);
739 typename Types::ContentLayerType* layer1 = this->CreateDrawingLayer( 746 typename Types::ContentLayerType* layer1 = this->CreateDrawingLayer(
740 parent, layer1_matrix, gfx::PointF(), gfx::Size(100, 100), true); 747 parent, layer1_matrix, gfx::PointF(), gfx::Size(100, 100), true);
741 layer1->SetForceRenderSurface(true); 748 Types::SetForceRenderSurface(layer1, true);
742 749
743 gfx::Transform layer2_matrix; 750 gfx::Transform layer2_matrix;
744 layer2_matrix.Translate(25.0, 25.0); 751 layer2_matrix.Translate(25.0, 25.0);
745 typename Types::ContentLayerType* layer2 = this->CreateDrawingLayer( 752 typename Types::ContentLayerType* layer2 = this->CreateDrawingLayer(
746 layer1, layer2_matrix, gfx::PointF(), gfx::Size(50, 50), true); 753 layer1, layer2_matrix, gfx::PointF(), gfx::Size(50, 50), true);
747 typename Types::ContentLayerType* occluder = 754 typename Types::ContentLayerType* occluder =
748 this->CreateDrawingLayer(parent, 755 this->CreateDrawingLayer(parent,
749 this->identity_matrix, 756 this->identity_matrix,
750 gfx::PointF(100.f, 100.f), 757 gfx::PointF(100.f, 100.f),
751 gfx::Size(500, 500), 758 gfx::Size(500, 500),
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
845 child_transform.Rotate(95.0); 852 child_transform.Rotate(95.0);
846 child_transform.Translate(-250.0, -250.0); 853 child_transform.Translate(-250.0, -250.0);
847 854
848 gfx::Transform layer_transform; 855 gfx::Transform layer_transform;
849 layer_transform.Translate(10.0, 10.0); 856 layer_transform.Translate(10.0, 10.0);
850 857
851 typename Types::ContentLayerType* root = this->CreateRoot( 858 typename Types::ContentLayerType* root = this->CreateRoot(
852 this->identity_matrix, gfx::PointF(), gfx::Size(1000, 1000)); 859 this->identity_matrix, gfx::PointF(), gfx::Size(1000, 1000));
853 typename Types::ContentLayerType* parent = this->CreateDrawingLayer( 860 typename Types::ContentLayerType* parent = this->CreateDrawingLayer(
854 root, this->identity_matrix, gfx::PointF(), gfx::Size(100, 100), true); 861 root, this->identity_matrix, gfx::PointF(), gfx::Size(100, 100), true);
855 typename Types::LayerType* child = this->CreateLayer( 862 typename Types::LayerType* child = this->CreateSurface(
856 parent, child_transform, gfx::PointF(30.f, 30.f), gfx::Size(500, 500)); 863 parent, child_transform, gfx::PointF(30.f, 30.f), gfx::Size(500, 500));
857 child->SetMasksToBounds(true);
858 typename Types::ContentLayerType* layer = this->CreateDrawingLayer( 864 typename Types::ContentLayerType* layer = this->CreateDrawingLayer(
859 child, layer_transform, gfx::PointF(), gfx::Size(500, 500), true); 865 child, layer_transform, gfx::PointF(), gfx::Size(500, 500), true);
860 this->CalcDrawEtc(root); 866 this->CalcDrawEtc(root);
861 867
862 TestOcclusionTrackerWithClip<typename Types::LayerType> occlusion( 868 TestOcclusionTrackerWithClip<typename Types::LayerType> occlusion(
863 gfx::Rect(0, 0, 1000, 1000)); 869 gfx::Rect(0, 0, 1000, 1000));
864 870
865 gfx::Rect clipped_layer_in_child = MathUtil::MapEnclosingClippedRect( 871 gfx::Rect clipped_layer_in_child = MathUtil::MapEnclosingClippedRect(
866 layer_transform, layer->visible_content_rect()); 872 layer_transform, layer->visible_content_rect());
867 873
(...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after
1169 typename Types::ContentLayerType* opacity_layer = 1175 typename Types::ContentLayerType* opacity_layer =
1170 this->CreateDrawingLayer(parent, 1176 this->CreateDrawingLayer(parent,
1171 layer_transform, 1177 layer_transform,
1172 gfx::PointF(30.f, 30.f), 1178 gfx::PointF(30.f, 30.f),
1173 gfx::Size(500, 500), 1179 gfx::Size(500, 500),
1174 true); 1180 true);
1175 1181
1176 FilterOperations filters; 1182 FilterOperations filters;
1177 filters.Append(FilterOperation::CreateBlurFilter(10.f)); 1183 filters.Append(FilterOperation::CreateBlurFilter(10.f));
1178 blur_layer->SetFilters(filters); 1184 blur_layer->SetFilters(filters);
1185 Types::SetForceRenderSurface(blur_layer, true);
1179 1186
1180 filters.Clear(); 1187 filters.Clear();
1181 filters.Append(FilterOperation::CreateGrayscaleFilter(0.5f)); 1188 filters.Append(FilterOperation::CreateGrayscaleFilter(0.5f));
1182 opaque_layer->SetFilters(filters); 1189 opaque_layer->SetFilters(filters);
1190 Types::SetForceRenderSurface(opaque_layer, true);
1183 1191
1184 filters.Clear(); 1192 filters.Clear();
1185 filters.Append(FilterOperation::CreateOpacityFilter(0.5f)); 1193 filters.Append(FilterOperation::CreateOpacityFilter(0.5f));
1186 opacity_layer->SetFilters(filters); 1194 opacity_layer->SetFilters(filters);
1195 Types::SetForceRenderSurface(opacity_layer, true);
1187 1196
1188 this->CalcDrawEtc(parent); 1197 this->CalcDrawEtc(parent);
1189 1198
1190 TestOcclusionTrackerWithClip<typename Types::LayerType> occlusion( 1199 TestOcclusionTrackerWithClip<typename Types::LayerType> occlusion(
1191 gfx::Rect(0, 0, 1000, 1000)); 1200 gfx::Rect(0, 0, 1000, 1000));
1192 1201
1193 // Opacity layer won't contribute to occlusion. 1202 // Opacity layer won't contribute to occlusion.
1194 this->VisitLayer(opacity_layer, &occlusion); 1203 this->VisitLayer(opacity_layer, &occlusion);
1195 this->EnterContributingSurface(opacity_layer, &occlusion); 1204 this->EnterContributingSurface(opacity_layer, &occlusion);
1196 1205
(...skipping 1030 matching lines...) Expand 10 before | Expand all | Expand 10 after
2227 // space, where the background filter is applied. 2236 // space, where the background filter is applied.
2228 typename Types::ContentLayerType* parent = this->CreateRoot( 2237 typename Types::ContentLayerType* parent = this->CreateRoot(
2229 this->identity_matrix, gfx::PointF(), gfx::Size(200, 200)); 2238 this->identity_matrix, gfx::PointF(), gfx::Size(200, 200));
2230 typename Types::LayerType* filtered_surface = 2239 typename Types::LayerType* filtered_surface =
2231 this->CreateDrawingLayer(parent, 2240 this->CreateDrawingLayer(parent,
2232 scale_by_half, 2241 scale_by_half,
2233 gfx::PointF(50.f, 50.f), 2242 gfx::PointF(50.f, 50.f),
2234 gfx::Size(100, 100), 2243 gfx::Size(100, 100),
2235 false); 2244 false);
2236 filtered_surface->SetBackgroundFilters(filters); 2245 filtered_surface->SetBackgroundFilters(filters);
2237 2246 Types::SetForceRenderSurface(filtered_surface, true);
2238 gfx::Rect occlusion_rect; 2247 gfx::Rect occlusion_rect;
2239 switch (i) { 2248 switch (i) {
2240 case LEFT: 2249 case LEFT:
2241 occlusion_rect = gfx::Rect(0, 0, 50, 200); 2250 occlusion_rect = gfx::Rect(0, 0, 50, 200);
2242 break; 2251 break;
2243 case RIGHT: 2252 case RIGHT:
2244 occlusion_rect = gfx::Rect(100, 0, 50, 200); 2253 occlusion_rect = gfx::Rect(100, 0, 50, 200);
2245 break; 2254 break;
2246 case TOP: 2255 case TOP:
2247 occlusion_rect = gfx::Rect(0, 0, 200, 50); 2256 occlusion_rect = gfx::Rect(0, 0, 200, 50);
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
2342 this->identity_matrix, 2351 this->identity_matrix,
2343 gfx::PointF(100.f, 100.f), 2352 gfx::PointF(100.f, 100.f),
2344 gfx::Size(50, 50), 2353 gfx::Size(50, 50),
2345 true); 2354 true);
2346 2355
2347 // Filters make the layers own surfaces. 2356 // Filters make the layers own surfaces.
2348 FilterOperations filters; 2357 FilterOperations filters;
2349 filters.Append(FilterOperation::CreateBlurFilter(1.f)); 2358 filters.Append(FilterOperation::CreateBlurFilter(1.f));
2350 filtered_surface1->SetBackgroundFilters(filters); 2359 filtered_surface1->SetBackgroundFilters(filters);
2351 filtered_surface2->SetBackgroundFilters(filters); 2360 filtered_surface2->SetBackgroundFilters(filters);
2361 Types::SetForceRenderSurface(filtered_surface1, true);
2362 Types::SetForceRenderSurface(filtered_surface2, true);
2352 2363
2353 // Save the distance of influence for the blur effect. 2364 // Save the distance of influence for the blur effect.
2354 int outset_top, outset_right, outset_bottom, outset_left; 2365 int outset_top, outset_right, outset_bottom, outset_left;
2355 filters.GetOutsets( 2366 filters.GetOutsets(
2356 &outset_top, &outset_right, &outset_bottom, &outset_left); 2367 &outset_top, &outset_right, &outset_bottom, &outset_left);
2357 2368
2358 this->CalcDrawEtc(root); 2369 this->CalcDrawEtc(root);
2359 2370
2360 TestOcclusionTrackerWithClip<typename Types::LayerType> occlusion( 2371 TestOcclusionTrackerWithClip<typename Types::LayerType> occlusion(
2361 gfx::Rect(0, 0, 1000, 1000)); 2372 gfx::Rect(0, 0, 1000, 1000));
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
2428 this->CreateReplicaLayer(filtered_surface, 2439 this->CreateReplicaLayer(filtered_surface,
2429 this->identity_matrix, 2440 this->identity_matrix,
2430 gfx::PointF(300.f, 0.f), 2441 gfx::PointF(300.f, 0.f),
2431 gfx::Size()); 2442 gfx::Size());
2432 2443
2433 // Filters make the layer own a surface. 2444 // Filters make the layer own a surface.
2434 FilterOperations filters; 2445 FilterOperations filters;
2435 filters.Append(FilterOperation::CreateBlurFilter(3.f)); 2446 filters.Append(FilterOperation::CreateBlurFilter(3.f));
2436 filtered_surface->SetBackgroundFilters(filters); 2447 filtered_surface->SetBackgroundFilters(filters);
2437 2448
2449 Types::SetForceRenderSurface(filtered_surface, true);
danakj 2014/09/25 16:02:12 nit: move right beside SetBGFilters, whitespace be
awoloszyn 2014/11/25 15:48:47 Done.
2438 this->CalcDrawEtc(parent); 2450 this->CalcDrawEtc(parent);
2439 2451
2440 TestOcclusionTrackerWithClip<typename Types::LayerType> occlusion( 2452 TestOcclusionTrackerWithClip<typename Types::LayerType> occlusion(
2441 gfx::Rect(0, 0, 1000, 1000)); 2453 gfx::Rect(0, 0, 1000, 1000));
2442 2454
2443 // The surface has a background blur, so it blurs non-opaque pixels below 2455 // The surface has a background blur, so it blurs non-opaque pixels below
2444 // it. 2456 // it.
2445 this->VisitLayer(filtered_surface, &occlusion); 2457 this->VisitLayer(filtered_surface, &occlusion);
2446 this->VisitContributingSurface(filtered_surface, &occlusion); 2458 this->VisitContributingSurface(filtered_surface, &occlusion);
2447 2459
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
2501 this->CreateDrawingLayer(parent, 2513 this->CreateDrawingLayer(parent,
2502 this->identity_matrix, 2514 this->identity_matrix,
2503 gfx::PointF(50.f, 50.f), 2515 gfx::PointF(50.f, 50.f),
2504 gfx::Size(50, 50), 2516 gfx::Size(50, 50),
2505 true); 2517 true);
2506 2518
2507 // Filters make the layer own a surface. 2519 // Filters make the layer own a surface.
2508 FilterOperations filters; 2520 FilterOperations filters;
2509 filters.Append(FilterOperation::CreateBlurFilter(3.f)); 2521 filters.Append(FilterOperation::CreateBlurFilter(3.f));
2510 filtered_surface->SetBackgroundFilters(filters); 2522 filtered_surface->SetBackgroundFilters(filters);
2523 Types::SetForceRenderSurface(filtered_surface, true);
2511 2524
2512 this->CalcDrawEtc(parent); 2525 this->CalcDrawEtc(parent);
2513 2526
2514 TestOcclusionTrackerWithClip<typename Types::LayerType> occlusion( 2527 TestOcclusionTrackerWithClip<typename Types::LayerType> occlusion(
2515 gfx::Rect(0, 0, 1000, 1000)); 2528 gfx::Rect(0, 0, 1000, 1000));
2516 2529
2517 this->VisitLayer(occluding_layer, &occlusion); 2530 this->VisitLayer(occluding_layer, &occlusion);
2518 2531
2519 this->VisitLayer(filtered_surface, &occlusion); 2532 this->VisitLayer(filtered_surface, &occlusion);
2520 { 2533 {
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
2597 this->CreateDrawingLayer(parent, 2610 this->CreateDrawingLayer(parent,
2598 this->identity_matrix, 2611 this->identity_matrix,
2599 gfx::PointF(200.f, 40.f), 2612 gfx::PointF(200.f, 40.f),
2600 gfx::Size(10, 10), 2613 gfx::Size(10, 10),
2601 true); 2614 true);
2602 2615
2603 // Filters make the layer own a surface. 2616 // Filters make the layer own a surface.
2604 FilterOperations filters; 2617 FilterOperations filters;
2605 filters.Append(FilterOperation::CreateBlurFilter(3.f)); 2618 filters.Append(FilterOperation::CreateBlurFilter(3.f));
2606 filtered_surface->SetBackgroundFilters(filters); 2619 filtered_surface->SetBackgroundFilters(filters);
2620 Types::SetForceRenderSurface(filtered_surface, true);
2607 2621
2608 // Save the distance of influence for the blur effect. 2622 // Save the distance of influence for the blur effect.
2609 int outset_top, outset_right, outset_bottom, outset_left; 2623 int outset_top, outset_right, outset_bottom, outset_left;
2610 filters.GetOutsets( 2624 filters.GetOutsets(
2611 &outset_top, &outset_right, &outset_bottom, &outset_left); 2625 &outset_top, &outset_right, &outset_bottom, &outset_left);
2612 2626
2613 this->CalcDrawEtc(parent); 2627 this->CalcDrawEtc(parent);
2614 2628
2615 TestOcclusionTrackerWithClip<typename Types::LayerType> occlusion( 2629 TestOcclusionTrackerWithClip<typename Types::LayerType> occlusion(
2616 gfx::Rect(0, 0, 1000, 1000)); 2630 gfx::Rect(0, 0, 1000, 1000));
(...skipping 688 matching lines...) Expand 10 before | Expand all | Expand 10 after
3305 EXPECT_EQ(gfx::Rect(), 3319 EXPECT_EQ(gfx::Rect(),
3306 occlusion.UnoccludedSurfaceContentRect( 3320 occlusion.UnoccludedSurfaceContentRect(
3307 surface, gfx::Rect(80, 70, 50, 50))); 3321 surface, gfx::Rect(80, 70, 50, 50)));
3308 } 3322 }
3309 }; 3323 };
3310 3324
3311 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestUnoccludedSurfaceQuery) 3325 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestUnoccludedSurfaceQuery)
3312 3326
3313 } // namespace 3327 } // namespace
3314 } // namespace cc 3328 } // namespace cc
OLDNEW
« cc/trees/layer_tree_host_common.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