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

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

Issue 2354753003: cc : Compute visible rects dynamically (2) (Closed)
Patch Set: rename ExecuteCalculateDrawPropertiesWithProeprtyTrees Created 4 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/layer_tree_impl.h" 5 #include "cc/trees/layer_tree_impl.h"
6 6
7 #include "base/macros.h" 7 #include "base/macros.h"
8 #include "cc/animation/mutable_properties.h" 8 #include "cc/animation/mutable_properties.h"
9 #include "cc/layers/heads_up_display_layer_impl.h" 9 #include "cc/layers/heads_up_display_layer_impl.h"
10 #include "cc/test/fake_layer_tree_host_impl.h" 10 #include "cc/test/fake_layer_tree_host_impl.h"
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after
237 uninvertible_transform.matrix().set(2, 2, 0.0); 237 uninvertible_transform.matrix().set(2, 2, 0.0);
238 uninvertible_transform.matrix().set(3, 3, 0.0); 238 uninvertible_transform.matrix().set(3, 3, 0.0);
239 ASSERT_FALSE(uninvertible_transform.IsInvertible()); 239 ASSERT_FALSE(uninvertible_transform.IsInvertible());
240 240
241 LayerImpl* root = root_layer(); 241 LayerImpl* root = root_layer();
242 root->test_properties()->transform = uninvertible_transform; 242 root->test_properties()->transform = uninvertible_transform;
243 root->SetBounds(gfx::Size(100, 100)); 243 root->SetBounds(gfx::Size(100, 100));
244 root->SetDrawsContent(true); 244 root->SetDrawsContent(true);
245 245
246 host_impl().SetViewportSize(root->bounds()); 246 host_impl().SetViewportSize(root->bounds());
247 host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree(); 247 // While computing visible rects by combining clips in screen space, we set
248 // the entire layer as visible if the screen space transform is singular. This
249 // is not always true when we combine clips in target space because if the
250 // intersection of combined_clip in taret space with layer_rect projected to
251 // target space is empty, we set it to an empty rect.
252 bool skip_verify_visible_rect_calculations = true;
253 host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree(
254 skip_verify_visible_rect_calculations);
248 // Sanity check the scenario we just created. 255 // Sanity check the scenario we just created.
249 ASSERT_EQ(1u, RenderSurfaceLayerList().size()); 256 ASSERT_EQ(1u, RenderSurfaceLayerList().size());
250 ASSERT_EQ(1u, root_layer()->render_surface()->layer_list().size()); 257 ASSERT_EQ(1u, root_layer()->render_surface()->layer_list().size());
251 ASSERT_FALSE(root_layer()->ScreenSpaceTransform().IsInvertible()); 258 ASSERT_FALSE(root_layer()->ScreenSpaceTransform().IsInvertible());
252 259
253 // Hit testing any point should not hit the layer. If the invertible matrix is 260 // Hit testing any point should not hit the layer. If the invertible matrix is
254 // accidentally ignored and treated like an identity, then the hit testing 261 // accidentally ignored and treated like an identity, then the hit testing
255 // will incorrectly hit the layer when it shouldn't. 262 // will incorrectly hit the layer when it shouldn't.
256 gfx::PointF test_point(1.f, 1.f); 263 gfx::PointF test_point(1.f, 1.f);
257 LayerImpl* result_layer = 264 LayerImpl* result_layer =
(...skipping 1068 matching lines...) Expand 10 before | Expand all | Expand 10 after
1326 1333
1327 Region touch_handler_region(gfx::Rect(10, 10, 50, 50)); 1334 Region touch_handler_region(gfx::Rect(10, 10, 50, 50));
1328 1335
1329 LayerImpl* root = root_layer(); 1336 LayerImpl* root = root_layer();
1330 root->test_properties()->transform = uninvertible_transform; 1337 root->test_properties()->transform = uninvertible_transform;
1331 root->SetBounds(gfx::Size(100, 100)); 1338 root->SetBounds(gfx::Size(100, 100));
1332 root->SetDrawsContent(true); 1339 root->SetDrawsContent(true);
1333 root->SetTouchEventHandlerRegion(touch_handler_region); 1340 root->SetTouchEventHandlerRegion(touch_handler_region);
1334 1341
1335 host_impl().SetViewportSize(root->bounds()); 1342 host_impl().SetViewportSize(root->bounds());
1336 host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree(); 1343 // While computing visible rects by combining clips in screen space, we set
1344 // the entire layer as visible if the screen space transform is singular. This
1345 // is not always true when we combine clips in target space because if the
1346 // intersection of combined_clip in taret space with layer_rect projected to
1347 // target space is empty, we set it to an empty rect.
1348 bool skip_verify_visible_rect_calculations = true;
1349 host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree(
1350 skip_verify_visible_rect_calculations);
1337 1351
1338 // Sanity check the scenario we just created. 1352 // Sanity check the scenario we just created.
1339 ASSERT_EQ(1u, RenderSurfaceLayerList().size()); 1353 ASSERT_EQ(1u, RenderSurfaceLayerList().size());
1340 ASSERT_EQ(1u, root->render_surface()->layer_list().size()); 1354 ASSERT_EQ(1u, root->render_surface()->layer_list().size());
1341 ASSERT_FALSE(root->ScreenSpaceTransform().IsInvertible()); 1355 ASSERT_FALSE(root->ScreenSpaceTransform().IsInvertible());
1342 1356
1343 // Hit checking any point should not hit the touch handler region on the 1357 // Hit checking any point should not hit the touch handler region on the
1344 // layer. If the invertible matrix is accidentally ignored and treated like an 1358 // layer. If the invertible matrix is accidentally ignored and treated like an
1345 // identity, then the hit testing will incorrectly hit the layer when it 1359 // identity, then the hit testing will incorrectly hit the layer when it
1346 // shouldn't. 1360 // shouldn't.
(...skipping 1033 matching lines...) Expand 10 before | Expand all | Expand 10 after
2380 auto weak_promise = promise->AsWeakPtr(); 2394 auto weak_promise = promise->AsWeakPtr();
2381 host_impl().active_tree()->QueueSwapPromise(std::move(promise)); 2395 host_impl().active_tree()->QueueSwapPromise(std::move(promise));
2382 host_impl().active_tree()->BreakSwapPromises( 2396 host_impl().active_tree()->BreakSwapPromises(
2383 SwapPromise::DidNotSwapReason::SWAP_FAILS); 2397 SwapPromise::DidNotSwapReason::SWAP_FAILS);
2384 EXPECT_FALSE(weak_promise); 2398 EXPECT_FALSE(weak_promise);
2385 } 2399 }
2386 } 2400 }
2387 2401
2388 } // namespace 2402 } // namespace
2389 } // namespace cc 2403 } // namespace cc
OLDNEW
« cc/trees/layer_tree_host_common_unittest.cc ('K') | « cc/trees/layer_tree_host_common_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698