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

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

Issue 817653003: Update from https://crrev.com/309717 (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 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
« no previous file with comments | « cc/trees/occlusion_tracker_perftest.cc ('k') | cc/trees/property_tree_builder.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 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 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
120 static ContentLayerPtrType CreateContentLayer(HostType* host) { 120 static ContentLayerPtrType CreateContentLayer(HostType* host) {
121 return make_scoped_refptr(new ContentLayerType()); 121 return make_scoped_refptr(new ContentLayerType());
122 } 122 }
123 123
124 template <typename T> 124 template <typename T>
125 static LayerPtrType PassLayerPtr(T* layer) { 125 static LayerPtrType PassLayerPtr(T* layer) {
126 LayerPtrType ref(*layer); 126 LayerPtrType ref(*layer);
127 *layer = NULL; 127 *layer = NULL;
128 return ref; 128 return ref;
129 } 129 }
130 static void SetForceRenderSurface(LayerType* layer, bool force) {
131 layer->SetForceRenderSurface(force);
132 }
130 133
131 static void DestroyLayer(LayerPtrType* layer) { *layer = NULL; } 134 static void DestroyLayer(LayerPtrType* layer) { *layer = NULL; }
132 135
133 static void RecursiveUpdateNumChildren(LayerType* layerType) {} 136 static void RecursiveUpdateNumChildren(LayerType* layerType) {}
134 }; 137 };
135 138
136 struct OcclusionTrackerTestImplThreadTypes { 139 struct OcclusionTrackerTestImplThreadTypes {
137 typedef LayerImpl LayerType; 140 typedef LayerImpl LayerType;
138 typedef LayerTreeImpl HostType; 141 typedef LayerTreeImpl HostType;
139 typedef RenderSurfaceImpl RenderSurfaceType; 142 typedef RenderSurfaceImpl RenderSurfaceType;
140 typedef TestContentLayerImpl ContentLayerType; 143 typedef TestContentLayerImpl ContentLayerType;
141 typedef scoped_ptr<LayerImpl> LayerPtrType; 144 typedef scoped_ptr<LayerImpl> LayerPtrType;
142 typedef scoped_ptr<ContentLayerType> ContentLayerPtrType; 145 typedef scoped_ptr<ContentLayerType> ContentLayerPtrType;
143 typedef LayerIterator<LayerImpl> TestLayerIterator; 146 typedef LayerIterator<LayerImpl> TestLayerIterator;
144 typedef OcclusionTracker<LayerImpl> OcclusionTrackerType; 147 typedef OcclusionTracker<LayerImpl> OcclusionTrackerType;
145 148
146 static LayerPtrType CreateLayer(HostType* host) { 149 static LayerPtrType CreateLayer(HostType* host) {
147 return LayerImpl::Create(host, next_layer_impl_id++); 150 return LayerImpl::Create(host, next_layer_impl_id++);
148 } 151 }
149 static ContentLayerPtrType CreateContentLayer(HostType* host) { 152 static ContentLayerPtrType CreateContentLayer(HostType* host) {
150 return make_scoped_ptr(new ContentLayerType(host, next_layer_impl_id++)); 153 return make_scoped_ptr(new ContentLayerType(host, next_layer_impl_id++));
151 } 154 }
152 static int next_layer_impl_id; 155 static int next_layer_impl_id;
153 156
154 template <typename T> 157 template <typename T>
155 static LayerPtrType PassLayerPtr(T* layer) { 158 static LayerPtrType PassLayerPtr(T* layer) {
156 return layer->Pass(); 159 return layer->Pass();
157 } 160 }
158 161
162 static void SetForceRenderSurface(LayerType* layer, bool force) {
163 layer->SetHasRenderSurface(force);
164 }
159 static void DestroyLayer(LayerPtrType* layer) { layer->reset(); } 165 static void DestroyLayer(LayerPtrType* layer) { layer->reset(); }
160 166
161 static void RecursiveUpdateNumChildren(LayerType* layer) { 167 static void RecursiveUpdateNumChildren(LayerType* layer) {
162 FakeLayerTreeHostImpl::RecursiveUpdateNumChildren(layer); 168 FakeLayerTreeHostImpl::RecursiveUpdateNumChildren(layer);
163 } 169 }
164 }; 170 };
165 171
166 int OcclusionTrackerTestImplThreadTypes::next_layer_impl_id = 1; 172 int OcclusionTrackerTestImplThreadTypes::next_layer_impl_id = 1;
167 173
168 template <typename Types> class OcclusionTrackerTest : public testing::Test { 174 template <typename Types> class OcclusionTrackerTest : public testing::Test {
(...skipping 13 matching lines...) Expand all
182 const gfx::PointF& position, 188 const gfx::PointF& position,
183 const gfx::Size& bounds) { 189 const gfx::Size& bounds) {
184 typename Types::ContentLayerPtrType layer( 190 typename Types::ContentLayerPtrType layer(
185 Types::CreateContentLayer(GetHost())); 191 Types::CreateContentLayer(GetHost()));
186 typename Types::ContentLayerType* layer_ptr = layer.get(); 192 typename Types::ContentLayerType* layer_ptr = layer.get();
187 SetProperties(layer_ptr, transform, position, bounds); 193 SetProperties(layer_ptr, transform, position, bounds);
188 194
189 DCHECK(!root_.get()); 195 DCHECK(!root_.get());
190 root_ = Types::PassLayerPtr(&layer); 196 root_ = Types::PassLayerPtr(&layer);
191 197
198 Types::SetForceRenderSurface(layer_ptr, true);
192 SetRootLayerOnMainThread(layer_ptr); 199 SetRootLayerOnMainThread(layer_ptr);
193 200
194 return layer_ptr; 201 return layer_ptr;
195 } 202 }
196 203
197 typename Types::LayerType* CreateLayer(typename Types::LayerType* parent, 204 typename Types::LayerType* CreateLayer(typename Types::LayerType* parent,
198 const gfx::Transform& transform, 205 const gfx::Transform& transform,
199 const gfx::PointF& position, 206 const gfx::PointF& position,
200 const gfx::Size& bounds) { 207 const gfx::Size& bounds) {
201 typename Types::LayerPtrType layer(Types::CreateLayer(GetHost())); 208 typename Types::LayerPtrType layer(Types::CreateLayer(GetHost()));
202 typename Types::LayerType* layer_ptr = layer.get(); 209 typename Types::LayerType* layer_ptr = layer.get();
203 SetProperties(layer_ptr, transform, position, bounds); 210 SetProperties(layer_ptr, transform, position, bounds);
204 parent->AddChild(Types::PassLayerPtr(&layer)); 211 parent->AddChild(Types::PassLayerPtr(&layer));
205 return layer_ptr; 212 return layer_ptr;
206 } 213 }
207 214
208 typename Types::LayerType* CreateSurface(typename Types::LayerType* parent, 215 typename Types::LayerType* CreateSurface(typename Types::LayerType* parent,
209 const gfx::Transform& transform, 216 const gfx::Transform& transform,
210 const gfx::PointF& position, 217 const gfx::PointF& position,
211 const gfx::Size& bounds) { 218 const gfx::Size& bounds) {
212 typename Types::LayerType* layer = 219 typename Types::LayerType* layer =
213 CreateLayer(parent, transform, position, bounds); 220 CreateLayer(parent, transform, position, bounds);
214 layer->SetForceRenderSurface(true); 221 Types::SetForceRenderSurface(layer, true);
215 return layer; 222 return layer;
216 } 223 }
217 224
218 typename Types::ContentLayerType* CreateDrawingLayer( 225 typename Types::ContentLayerType* CreateDrawingLayer(
219 typename Types::LayerType* parent, 226 typename Types::LayerType* parent,
220 const gfx::Transform& transform, 227 const gfx::Transform& transform,
221 const gfx::PointF& position, 228 const gfx::PointF& position,
222 const gfx::Size& bounds, 229 const gfx::Size& bounds,
223 bool opaque) { 230 bool opaque) {
224 typename Types::ContentLayerPtrType layer( 231 typename Types::ContentLayerPtrType layer(
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
265 } 272 }
266 273
267 typename Types::ContentLayerType* CreateDrawingSurface( 274 typename Types::ContentLayerType* CreateDrawingSurface(
268 typename Types::LayerType* parent, 275 typename Types::LayerType* parent,
269 const gfx::Transform& transform, 276 const gfx::Transform& transform,
270 const gfx::PointF& position, 277 const gfx::PointF& position,
271 const gfx::Size& bounds, 278 const gfx::Size& bounds,
272 bool opaque) { 279 bool opaque) {
273 typename Types::ContentLayerType* layer = 280 typename Types::ContentLayerType* layer =
274 CreateDrawingLayer(parent, transform, position, bounds, opaque); 281 CreateDrawingLayer(parent, transform, position, bounds, opaque);
275 layer->SetForceRenderSurface(true); 282 Types::SetForceRenderSurface(layer, true);
276 return layer; 283 return layer;
277 } 284 }
278 285
279 void DestroyLayers() { 286 void DestroyLayers() {
280 Types::DestroyLayer(&root_); 287 Types::DestroyLayer(&root_);
281 render_surface_layer_list_ = nullptr; 288 render_surface_layer_list_ = nullptr;
282 render_surface_layer_list_impl_.clear(); 289 render_surface_layer_list_impl_.clear();
283 replica_layers_.clear(); 290 replica_layers_.clear();
284 mask_layers_.clear(); 291 mask_layers_.clear();
285 ResetLayerIterator(); 292 ResetLayerIterator();
286 } 293 }
287 294
288 void CopyOutputCallback(scoped_ptr<CopyOutputResult> result) {} 295 void CopyOutputCallback(scoped_ptr<CopyOutputResult> result) {}
289 296
290 void AddCopyRequest(Layer* layer) { 297 void AddCopyRequest(Layer* layer) {
291 layer->RequestCopyOfOutput( 298 layer->RequestCopyOfOutput(
292 CopyOutputRequest::CreateBitmapRequest(base::Bind( 299 CopyOutputRequest::CreateBitmapRequest(base::Bind(
293 &OcclusionTrackerTest<Types>::CopyOutputCallback, 300 &OcclusionTrackerTest<Types>::CopyOutputCallback,
294 base::Unretained(this)))); 301 base::Unretained(this))));
295 } 302 }
296 303
297 void AddCopyRequest(LayerImpl* layer) { 304 void AddCopyRequest(LayerImpl* layer) {
298 ScopedPtrVector<CopyOutputRequest> requests; 305 ScopedPtrVector<CopyOutputRequest> requests;
299 requests.push_back( 306 requests.push_back(
300 CopyOutputRequest::CreateBitmapRequest(base::Bind( 307 CopyOutputRequest::CreateBitmapRequest(base::Bind(
301 &OcclusionTrackerTest<Types>::CopyOutputCallback, 308 &OcclusionTrackerTest<Types>::CopyOutputCallback,
302 base::Unretained(this)))); 309 base::Unretained(this))));
310 layer->SetHasRenderSurface(true);
303 layer->PassCopyRequests(&requests); 311 layer->PassCopyRequests(&requests);
304 } 312 }
305 313
306 void CalcDrawEtc(TestContentLayerImpl* root) { 314 void CalcDrawEtc(TestContentLayerImpl* root) {
307 DCHECK(root == root_.get()); 315 DCHECK(root == root_.get());
308 DCHECK(!root->render_surface());
309 316
310 Types::RecursiveUpdateNumChildren(root); 317 Types::RecursiveUpdateNumChildren(root);
311 LayerTreeHostCommon::CalcDrawPropsImplInputsForTesting inputs( 318 LayerTreeHostCommon::CalcDrawPropsImplInputsForTesting inputs(
312 root, root->bounds(), &render_surface_layer_list_impl_); 319 root, root->bounds(), &render_surface_layer_list_impl_);
313 inputs.can_adjust_raster_scales = true; 320 inputs.can_adjust_raster_scales = true;
314 LayerTreeHostCommon::CalculateDrawProperties(&inputs); 321 LayerTreeHostCommon::CalculateDrawProperties(&inputs);
315 322
316 layer_iterator_ = layer_iterator_begin_ = 323 layer_iterator_ = layer_iterator_begin_ =
317 Types::TestLayerIterator::Begin(&render_surface_layer_list_impl_); 324 Types::TestLayerIterator::Begin(&render_surface_layer_list_impl_);
318 } 325 }
(...skipping 408 matching lines...) Expand 10 before | Expand all | Expand 10 after
727 : OcclusionTrackerTest<Types>(opaque_layers) {} 734 : OcclusionTrackerTest<Types>(opaque_layers) {}
728 735
729 void RunMyTest() override { 736 void RunMyTest() override {
730 typename Types::ContentLayerType* parent = this->CreateRoot( 737 typename Types::ContentLayerType* parent = this->CreateRoot(
731 this->identity_matrix, gfx::PointF(), gfx::Size(200, 200)); 738 this->identity_matrix, gfx::PointF(), gfx::Size(200, 200));
732 739
733 gfx::Transform layer1_matrix; 740 gfx::Transform layer1_matrix;
734 layer1_matrix.Scale(2.0, 2.0); 741 layer1_matrix.Scale(2.0, 2.0);
735 typename Types::ContentLayerType* layer1 = this->CreateDrawingLayer( 742 typename Types::ContentLayerType* layer1 = this->CreateDrawingLayer(
736 parent, layer1_matrix, gfx::PointF(), gfx::Size(100, 100), true); 743 parent, layer1_matrix, gfx::PointF(), gfx::Size(100, 100), true);
737 layer1->SetForceRenderSurface(true); 744 Types::SetForceRenderSurface(layer1, true);
738 745
739 gfx::Transform layer2_matrix; 746 gfx::Transform layer2_matrix;
740 layer2_matrix.Translate(25.0, 25.0); 747 layer2_matrix.Translate(25.0, 25.0);
741 typename Types::ContentLayerType* layer2 = this->CreateDrawingLayer( 748 typename Types::ContentLayerType* layer2 = this->CreateDrawingLayer(
742 layer1, layer2_matrix, gfx::PointF(), gfx::Size(50, 50), true); 749 layer1, layer2_matrix, gfx::PointF(), gfx::Size(50, 50), true);
743 typename Types::ContentLayerType* occluder = 750 typename Types::ContentLayerType* occluder =
744 this->CreateDrawingLayer(parent, 751 this->CreateDrawingLayer(parent,
745 this->identity_matrix, 752 this->identity_matrix,
746 gfx::PointF(100.f, 100.f), 753 gfx::PointF(100.f, 100.f),
747 gfx::Size(500, 500), 754 gfx::Size(500, 500),
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
841 child_transform.Rotate(95.0); 848 child_transform.Rotate(95.0);
842 child_transform.Translate(-250.0, -250.0); 849 child_transform.Translate(-250.0, -250.0);
843 850
844 gfx::Transform layer_transform; 851 gfx::Transform layer_transform;
845 layer_transform.Translate(10.0, 10.0); 852 layer_transform.Translate(10.0, 10.0);
846 853
847 typename Types::ContentLayerType* root = this->CreateRoot( 854 typename Types::ContentLayerType* root = this->CreateRoot(
848 this->identity_matrix, gfx::PointF(), gfx::Size(1000, 1000)); 855 this->identity_matrix, gfx::PointF(), gfx::Size(1000, 1000));
849 typename Types::ContentLayerType* parent = this->CreateDrawingLayer( 856 typename Types::ContentLayerType* parent = this->CreateDrawingLayer(
850 root, this->identity_matrix, gfx::PointF(), gfx::Size(100, 100), true); 857 root, this->identity_matrix, gfx::PointF(), gfx::Size(100, 100), true);
851 typename Types::LayerType* child = this->CreateLayer( 858 typename Types::LayerType* child = this->CreateSurface(
852 parent, child_transform, gfx::PointF(30.f, 30.f), gfx::Size(500, 500)); 859 parent, child_transform, gfx::PointF(30.f, 30.f), gfx::Size(500, 500));
853 child->SetMasksToBounds(true);
854 typename Types::ContentLayerType* layer = this->CreateDrawingLayer( 860 typename Types::ContentLayerType* layer = this->CreateDrawingLayer(
855 child, layer_transform, gfx::PointF(), gfx::Size(500, 500), true); 861 child, layer_transform, gfx::PointF(), gfx::Size(500, 500), true);
856 this->CalcDrawEtc(root); 862 this->CalcDrawEtc(root);
857 863
858 TestOcclusionTrackerWithClip<typename Types::LayerType> occlusion( 864 TestOcclusionTrackerWithClip<typename Types::LayerType> occlusion(
859 gfx::Rect(0, 0, 1000, 1000)); 865 gfx::Rect(0, 0, 1000, 1000));
860 866
861 gfx::Rect clipped_layer_in_child = MathUtil::MapEnclosingClippedRect( 867 gfx::Rect clipped_layer_in_child = MathUtil::MapEnclosingClippedRect(
862 layer_transform, layer->visible_content_rect()); 868 layer_transform, layer->visible_content_rect());
863 869
(...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after
1162 gfx::PointF(30.f, 30.f), 1168 gfx::PointF(30.f, 30.f),
1163 gfx::Size(500, 500), 1169 gfx::Size(500, 500),
1164 true); 1170 true);
1165 typename Types::ContentLayerType* opacity_layer = 1171 typename Types::ContentLayerType* opacity_layer =
1166 this->CreateDrawingLayer(parent, 1172 this->CreateDrawingLayer(parent,
1167 layer_transform, 1173 layer_transform,
1168 gfx::PointF(30.f, 30.f), 1174 gfx::PointF(30.f, 30.f),
1169 gfx::Size(500, 500), 1175 gfx::Size(500, 500),
1170 true); 1176 true);
1171 1177
1178 Types::SetForceRenderSurface(blur_layer, true);
1172 FilterOperations filters; 1179 FilterOperations filters;
1173 filters.Append(FilterOperation::CreateBlurFilter(10.f)); 1180 filters.Append(FilterOperation::CreateBlurFilter(10.f));
1174 blur_layer->SetFilters(filters); 1181 blur_layer->SetFilters(filters);
1175 1182
1183 Types::SetForceRenderSurface(opaque_layer, true);
1176 filters.Clear(); 1184 filters.Clear();
1177 filters.Append(FilterOperation::CreateGrayscaleFilter(0.5f)); 1185 filters.Append(FilterOperation::CreateGrayscaleFilter(0.5f));
1178 opaque_layer->SetFilters(filters); 1186 opaque_layer->SetFilters(filters);
1179 1187
1188 Types::SetForceRenderSurface(opacity_layer, true);
1180 filters.Clear(); 1189 filters.Clear();
1181 filters.Append(FilterOperation::CreateOpacityFilter(0.5f)); 1190 filters.Append(FilterOperation::CreateOpacityFilter(0.5f));
1182 opacity_layer->SetFilters(filters); 1191 opacity_layer->SetFilters(filters);
1183 1192
1184 this->CalcDrawEtc(parent); 1193 this->CalcDrawEtc(parent);
1185 1194
1186 TestOcclusionTrackerWithClip<typename Types::LayerType> occlusion( 1195 TestOcclusionTrackerWithClip<typename Types::LayerType> occlusion(
1187 gfx::Rect(0, 0, 1000, 1000)); 1196 gfx::Rect(0, 0, 1000, 1000));
1188 1197
1189 // Opacity layer won't contribute to occlusion. 1198 // Opacity layer won't contribute to occlusion.
(...skipping 1032 matching lines...) Expand 10 before | Expand all | Expand 10 after
2222 // surface is scaled to test that the pixel moving is done in the target 2231 // surface is scaled to test that the pixel moving is done in the target
2223 // space, where the background filter is applied. 2232 // space, where the background filter is applied.
2224 typename Types::ContentLayerType* parent = this->CreateRoot( 2233 typename Types::ContentLayerType* parent = this->CreateRoot(
2225 this->identity_matrix, gfx::PointF(), gfx::Size(200, 200)); 2234 this->identity_matrix, gfx::PointF(), gfx::Size(200, 200));
2226 typename Types::LayerType* filtered_surface = 2235 typename Types::LayerType* filtered_surface =
2227 this->CreateDrawingLayer(parent, 2236 this->CreateDrawingLayer(parent,
2228 scale_by_half, 2237 scale_by_half,
2229 gfx::PointF(50.f, 50.f), 2238 gfx::PointF(50.f, 50.f),
2230 gfx::Size(100, 100), 2239 gfx::Size(100, 100),
2231 false); 2240 false);
2241 Types::SetForceRenderSurface(filtered_surface, true);
2232 filtered_surface->SetBackgroundFilters(filters); 2242 filtered_surface->SetBackgroundFilters(filters);
2233
2234 gfx::Rect occlusion_rect; 2243 gfx::Rect occlusion_rect;
2235 switch (i) { 2244 switch (i) {
2236 case LEFT: 2245 case LEFT:
2237 occlusion_rect = gfx::Rect(0, 0, 50, 200); 2246 occlusion_rect = gfx::Rect(0, 0, 50, 200);
2238 break; 2247 break;
2239 case RIGHT: 2248 case RIGHT:
2240 occlusion_rect = gfx::Rect(100, 0, 50, 200); 2249 occlusion_rect = gfx::Rect(100, 0, 50, 200);
2241 break; 2250 break;
2242 case TOP: 2251 case TOP:
2243 occlusion_rect = gfx::Rect(0, 0, 200, 50); 2252 occlusion_rect = gfx::Rect(0, 0, 200, 50);
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
2334 typename Types::LayerType* filtered_surface2 = this->CreateDrawingLayer( 2343 typename Types::LayerType* filtered_surface2 = this->CreateDrawingLayer(
2335 parent, scale_by_half, gfx::PointF(), gfx::Size(300, 300), false); 2344 parent, scale_by_half, gfx::PointF(), gfx::Size(300, 300), false);
2336 typename Types::LayerType* occluding_layer_above = 2345 typename Types::LayerType* occluding_layer_above =
2337 this->CreateDrawingLayer(parent, 2346 this->CreateDrawingLayer(parent,
2338 this->identity_matrix, 2347 this->identity_matrix,
2339 gfx::PointF(100.f, 100.f), 2348 gfx::PointF(100.f, 100.f),
2340 gfx::Size(50, 50), 2349 gfx::Size(50, 50),
2341 true); 2350 true);
2342 2351
2343 // Filters make the layers own surfaces. 2352 // Filters make the layers own surfaces.
2353 Types::SetForceRenderSurface(filtered_surface1, true);
2354 Types::SetForceRenderSurface(filtered_surface2, true);
2344 FilterOperations filters; 2355 FilterOperations filters;
2345 filters.Append(FilterOperation::CreateBlurFilter(1.f)); 2356 filters.Append(FilterOperation::CreateBlurFilter(1.f));
2346 filtered_surface1->SetBackgroundFilters(filters); 2357 filtered_surface1->SetBackgroundFilters(filters);
2347 filtered_surface2->SetBackgroundFilters(filters); 2358 filtered_surface2->SetBackgroundFilters(filters);
2348 2359
2349 // Save the distance of influence for the blur effect. 2360 // Save the distance of influence for the blur effect.
2350 int outset_top, outset_right, outset_bottom, outset_left; 2361 int outset_top, outset_right, outset_bottom, outset_left;
2351 filters.GetOutsets( 2362 filters.GetOutsets(
2352 &outset_top, &outset_right, &outset_bottom, &outset_left); 2363 &outset_top, &outset_right, &outset_bottom, &outset_left);
2353 2364
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
2420 scale_by_half, 2431 scale_by_half,
2421 gfx::PointF(50.f, 50.f), 2432 gfx::PointF(50.f, 50.f),
2422 gfx::Size(100, 100), 2433 gfx::Size(100, 100),
2423 false); 2434 false);
2424 this->CreateReplicaLayer(filtered_surface, 2435 this->CreateReplicaLayer(filtered_surface,
2425 this->identity_matrix, 2436 this->identity_matrix,
2426 gfx::PointF(300.f, 0.f), 2437 gfx::PointF(300.f, 0.f),
2427 gfx::Size()); 2438 gfx::Size());
2428 2439
2429 // Filters make the layer own a surface. 2440 // Filters make the layer own a surface.
2441 Types::SetForceRenderSurface(filtered_surface, true);
2430 FilterOperations filters; 2442 FilterOperations filters;
2431 filters.Append(FilterOperation::CreateBlurFilter(3.f)); 2443 filters.Append(FilterOperation::CreateBlurFilter(3.f));
2432 filtered_surface->SetBackgroundFilters(filters); 2444 filtered_surface->SetBackgroundFilters(filters);
2433 2445
2434 this->CalcDrawEtc(parent); 2446 this->CalcDrawEtc(parent);
2435 2447
2436 TestOcclusionTrackerWithClip<typename Types::LayerType> occlusion( 2448 TestOcclusionTrackerWithClip<typename Types::LayerType> occlusion(
2437 gfx::Rect(0, 0, 1000, 1000)); 2449 gfx::Rect(0, 0, 1000, 1000));
2438 2450
2439 // The surface has a background blur, so it blurs non-opaque pixels below 2451 // The surface has a background blur, so it blurs non-opaque pixels below
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
2494 gfx::Size(100, 100), 2506 gfx::Size(100, 100),
2495 false); 2507 false);
2496 typename Types::LayerType* occluding_layer = 2508 typename Types::LayerType* occluding_layer =
2497 this->CreateDrawingLayer(parent, 2509 this->CreateDrawingLayer(parent,
2498 this->identity_matrix, 2510 this->identity_matrix,
2499 gfx::PointF(50.f, 50.f), 2511 gfx::PointF(50.f, 50.f),
2500 gfx::Size(50, 50), 2512 gfx::Size(50, 50),
2501 true); 2513 true);
2502 2514
2503 // Filters make the layer own a surface. 2515 // Filters make the layer own a surface.
2516 Types::SetForceRenderSurface(filtered_surface, true);
2504 FilterOperations filters; 2517 FilterOperations filters;
2505 filters.Append(FilterOperation::CreateBlurFilter(3.f)); 2518 filters.Append(FilterOperation::CreateBlurFilter(3.f));
2506 filtered_surface->SetBackgroundFilters(filters); 2519 filtered_surface->SetBackgroundFilters(filters);
2507 2520
2508 this->CalcDrawEtc(parent); 2521 this->CalcDrawEtc(parent);
2509 2522
2510 TestOcclusionTrackerWithClip<typename Types::LayerType> occlusion( 2523 TestOcclusionTrackerWithClip<typename Types::LayerType> occlusion(
2511 gfx::Rect(0, 0, 1000, 1000)); 2524 gfx::Rect(0, 0, 1000, 1000));
2512 2525
2513 this->VisitLayer(occluding_layer, &occlusion); 2526 this->VisitLayer(occluding_layer, &occlusion);
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
2590 gfx::Size(10, 10), 2603 gfx::Size(10, 10),
2591 true); 2604 true);
2592 typename Types::LayerType* beside_replica_layer = 2605 typename Types::LayerType* beside_replica_layer =
2593 this->CreateDrawingLayer(parent, 2606 this->CreateDrawingLayer(parent,
2594 this->identity_matrix, 2607 this->identity_matrix,
2595 gfx::PointF(200.f, 40.f), 2608 gfx::PointF(200.f, 40.f),
2596 gfx::Size(10, 10), 2609 gfx::Size(10, 10),
2597 true); 2610 true);
2598 2611
2599 // Filters make the layer own a surface. 2612 // Filters make the layer own a surface.
2613 Types::SetForceRenderSurface(filtered_surface, true);
2600 FilterOperations filters; 2614 FilterOperations filters;
2601 filters.Append(FilterOperation::CreateBlurFilter(3.f)); 2615 filters.Append(FilterOperation::CreateBlurFilter(3.f));
2602 filtered_surface->SetBackgroundFilters(filters); 2616 filtered_surface->SetBackgroundFilters(filters);
2603 2617
2604 // Save the distance of influence for the blur effect. 2618 // Save the distance of influence for the blur effect.
2605 int outset_top, outset_right, outset_bottom, outset_left; 2619 int outset_top, outset_right, outset_bottom, outset_left;
2606 filters.GetOutsets( 2620 filters.GetOutsets(
2607 &outset_top, &outset_right, &outset_bottom, &outset_left); 2621 &outset_top, &outset_right, &outset_bottom, &outset_left);
2608 2622
2609 this->CalcDrawEtc(parent); 2623 this->CalcDrawEtc(parent);
(...skipping 691 matching lines...) Expand 10 before | Expand all | Expand 10 after
3301 EXPECT_EQ(gfx::Rect(), 3315 EXPECT_EQ(gfx::Rect(),
3302 occlusion.UnoccludedSurfaceContentRect( 3316 occlusion.UnoccludedSurfaceContentRect(
3303 surface, gfx::Rect(80, 70, 50, 50))); 3317 surface, gfx::Rect(80, 70, 50, 50)));
3304 } 3318 }
3305 }; 3319 };
3306 3320
3307 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestUnoccludedSurfaceQuery) 3321 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestUnoccludedSurfaceQuery)
3308 3322
3309 } // namespace 3323 } // namespace
3310 } // namespace cc 3324 } // namespace cc
OLDNEW
« no previous file with comments | « cc/trees/occlusion_tracker_perftest.cc ('k') | cc/trees/property_tree_builder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698