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

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

Issue 2269143003: cc : Add OnTransformAnimated to transform tree (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase 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
« no previous file with comments | « cc/layers/layer_impl_unittest.cc ('k') | cc/trees/layer_tree_host_common_unittest.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 447 matching lines...) Expand 10 before | Expand all | Expand 10 after
458 458
459 // Sanity check that the layer actually moved to (85, 85), damaging its old 459 // Sanity check that the layer actually moved to (85, 85), damaging its old
460 // location and new location. 460 // location and new location.
461 gfx::Rect root_damage_rect = 461 gfx::Rect root_damage_rect =
462 root->render_surface()->damage_tracker()->current_damage_rect(); 462 root->render_surface()->damage_tracker()->current_damage_rect();
463 EXPECT_EQ(gfx::Rect(85, 85, 45, 45).ToString(), root_damage_rect.ToString()); 463 EXPECT_EQ(gfx::Rect(85, 85, 45, 45).ToString(), root_damage_rect.ToString());
464 464
465 // With the anchor on the layer's center, now we can test the rotation more 465 // With the anchor on the layer's center, now we can test the rotation more
466 // intuitively, since it applies about the layer's anchor. 466 // intuitively, since it applies about the layer's anchor.
467 ClearDamageForAllSurfaces(root); 467 ClearDamageForAllSurfaces(root);
468 child->OnTransformAnimated(rotation); 468 root->layer_tree_impl()->property_trees()->transform_tree.OnTransformAnimated(
469 rotation, child->transform_tree_index(), root->layer_tree_impl());
469 EmulateDrawingOneFrame(root); 470 EmulateDrawingOneFrame(root);
470 471
471 // Since the child layer is square, rotation by 45 degrees about the center 472 // Since the child layer is square, rotation by 45 degrees about the center
472 // should increase the size of the expected rect by sqrt(2), centered around 473 // should increase the size of the expected rect by sqrt(2), centered around
473 // (100, 100). The old exposed region should be fully contained in the new 474 // (100, 100). The old exposed region should be fully contained in the new
474 // region. 475 // region.
475 float expected_width = 30.f * sqrt(2.f); 476 float expected_width = 30.f * sqrt(2.f);
476 float expected_position = 100.f - 0.5f * expected_width; 477 float expected_position = 100.f - 0.5f * expected_width;
477 gfx::Rect expected_rect = gfx::ToEnclosingRect(gfx::RectF( 478 gfx::Rect expected_rect = gfx::ToEnclosingRect(gfx::RectF(
478 expected_position, expected_position, expected_width, expected_width)); 479 expected_position, expected_position, expected_width, expected_width));
(...skipping 1194 matching lines...) Expand 10 before | Expand all | Expand 10 after
1673 gfx::Rect root_damage_rect = 1674 gfx::Rect root_damage_rect =
1674 root->render_surface()->damage_tracker()->current_damage_rect(); 1675 root->render_surface()->damage_tracker()->current_damage_rect();
1675 gfx::Rect damage_we_care_about = gfx::Rect(i, i); 1676 gfx::Rect damage_we_care_about = gfx::Rect(i, i);
1676 EXPECT_LE(damage_we_care_about.right(), root_damage_rect.right()); 1677 EXPECT_LE(damage_we_care_about.right(), root_damage_rect.right());
1677 EXPECT_LE(damage_we_care_about.bottom(), root_damage_rect.bottom()); 1678 EXPECT_LE(damage_we_care_about.bottom(), root_damage_rect.bottom());
1678 } 1679 }
1679 } 1680 }
1680 1681
1681 } // namespace 1682 } // namespace
1682 } // namespace cc 1683 } // namespace cc
OLDNEW
« no previous file with comments | « cc/layers/layer_impl_unittest.cc ('k') | cc/trees/layer_tree_host_common_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698