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

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

Issue 1908593002: cc : Stop pushing transform origin from Layer and LayerImpl. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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/test/layer_tree_host_common_test.cc ('k') | cc/trees/draw_property_utils.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/trees/damage_tracker.h" 5 #include "cc/trees/damage_tracker.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include "cc/base/math_util.h" 9 #include "cc/base/math_util.h"
10 #include "cc/layers/layer_impl.h" 10 #include "cc/layers/layer_impl.h"
(...skipping 416 matching lines...) Expand 10 before | Expand all | Expand 10 after
427 // transformed layer. 427 // transformed layer.
428 428
429 LayerImpl* root = CreateAndSetUpTestTreeWithOneSurface(); 429 LayerImpl* root = CreateAndSetUpTestTreeWithOneSurface();
430 LayerImpl* child = root->children()[0]; 430 LayerImpl* child = root->children()[0];
431 child->SetForceRenderSurface(true); 431 child->SetForceRenderSurface(true);
432 432
433 gfx::Transform rotation; 433 gfx::Transform rotation;
434 rotation.Rotate(45.0); 434 rotation.Rotate(45.0);
435 435
436 ClearDamageForAllSurfaces(root); 436 ClearDamageForAllSurfaces(root);
437 child->SetTransformOrigin(gfx::Point3F( 437 child->test_properties()->transform_origin = gfx::Point3F(
438 child->bounds().width() * 0.5f, child->bounds().height() * 0.5f, 0.f)); 438 child->bounds().width() * 0.5f, child->bounds().height() * 0.5f, 0.f);
439 child->SetPosition(gfx::PointF(85.f, 85.f)); 439 child->SetPosition(gfx::PointF(85.f, 85.f));
440 child->NoteLayerPropertyChanged(); 440 child->NoteLayerPropertyChanged();
441 root->layer_tree_impl()->property_trees()->needs_rebuild = true; 441 root->layer_tree_impl()->property_trees()->needs_rebuild = true;
442 EmulateDrawingOneFrame(root); 442 EmulateDrawingOneFrame(root);
443 443
444 // Sanity check that the layer actually moved to (85, 85), damaging its old 444 // Sanity check that the layer actually moved to (85, 85), damaging its old
445 // location and new location. 445 // location and new location.
446 gfx::Rect root_damage_rect = 446 gfx::Rect root_damage_rect =
447 root->render_surface()->damage_tracker()->current_damage_rect(); 447 root->render_surface()->damage_tracker()->current_damage_rect();
448 EXPECT_EQ(gfx::Rect(85, 85, 45, 45).ToString(), root_damage_rect.ToString()); 448 EXPECT_EQ(gfx::Rect(85, 85, 45, 45).ToString(), root_damage_rect.ToString());
(...skipping 922 matching lines...) Expand 10 before | Expand all | Expand 10 after
1371 LayerImpl* child1 = root->children()[0]; 1371 LayerImpl* child1 = root->children()[0];
1372 LayerImpl* grand_child1 = child1->children()[0]; 1372 LayerImpl* grand_child1 = child1->children()[0];
1373 1373
1374 // Verify that the correct replica_origin_transform is used for the 1374 // Verify that the correct replica_origin_transform is used for the
1375 // replica_mask. 1375 // replica_mask.
1376 ClearDamageForAllSurfaces(root); 1376 ClearDamageForAllSurfaces(root);
1377 1377
1378 // This is not actually the transform origin point being tested, but by 1378 // This is not actually the transform origin point being tested, but by
1379 // convention its 1379 // convention its
1380 // expected to be the same as the replica's anchor point. 1380 // expected to be the same as the replica's anchor point.
1381 grand_child1->SetTransformOrigin( 1381 grand_child1->test_properties()->transform_origin =
1382 gfx::Point3F(grand_child1->bounds().width(), 0.f, 0.f)); 1382 gfx::Point3F(grand_child1->bounds().width(), 0.f, 0.f);
1383 1383
1384 { 1384 {
1385 std::unique_ptr<LayerImpl> grand_child1_replica = 1385 std::unique_ptr<LayerImpl> grand_child1_replica =
1386 LayerImpl::Create(host_impl_.active_tree(), 6); 1386 LayerImpl::Create(host_impl_.active_tree(), 6);
1387 grand_child1_replica->SetPosition(gfx::PointF()); 1387 grand_child1_replica->SetPosition(gfx::PointF());
1388 1388
1389 // This is the anchor being tested. 1389 // This is the anchor being tested.
1390 grand_child1_replica->SetTransformOrigin( 1390 grand_child1_replica->test_properties()->transform_origin =
1391 gfx::Point3F(grand_child1->bounds().width(), 0.f, 0.f)); 1391 gfx::Point3F(grand_child1->bounds().width(), 0.f, 0.f);
1392 gfx::Transform reflection; 1392 gfx::Transform reflection;
1393 reflection.Scale3d(-1.0, 1.0, 1.0); 1393 reflection.Scale3d(-1.0, 1.0, 1.0);
1394 grand_child1_replica->SetTransform(reflection); 1394 grand_child1_replica->SetTransform(reflection);
1395 // We need to set parent on replica layer for property tree building. 1395 // We need to set parent on replica layer for property tree building.
1396 grand_child1_replica->SetParent(grand_child1); 1396 grand_child1_replica->SetParent(grand_child1);
1397 grand_child1->SetReplicaLayer(std::move(grand_child1_replica)); 1397 grand_child1->SetReplicaLayer(std::move(grand_child1_replica));
1398 grand_child1->SetForceRenderSurface(true); 1398 grand_child1->SetForceRenderSurface(true);
1399 } 1399 }
1400 LayerImpl* grand_child1_replica = grand_child1->replica_layer(); 1400 LayerImpl* grand_child1_replica = grand_child1->replica_layer();
1401 1401
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
1554 gfx::Rect root_damage_rect = 1554 gfx::Rect root_damage_rect =
1555 root->render_surface()->damage_tracker()->current_damage_rect(); 1555 root->render_surface()->damage_tracker()->current_damage_rect();
1556 gfx::Rect damage_we_care_about = gfx::Rect(i, i); 1556 gfx::Rect damage_we_care_about = gfx::Rect(i, i);
1557 EXPECT_LE(damage_we_care_about.right(), root_damage_rect.right()); 1557 EXPECT_LE(damage_we_care_about.right(), root_damage_rect.right());
1558 EXPECT_LE(damage_we_care_about.bottom(), root_damage_rect.bottom()); 1558 EXPECT_LE(damage_we_care_about.bottom(), root_damage_rect.bottom());
1559 } 1559 }
1560 } 1560 }
1561 1561
1562 } // namespace 1562 } // namespace
1563 } // namespace cc 1563 } // namespace cc
OLDNEW
« no previous file with comments | « cc/test/layer_tree_host_common_test.cc ('k') | cc/trees/draw_property_utils.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698