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

Unified Diff: cc/trees/layer_tree_host_common_unittest.cc

Issue 885443002: Roll Chrome into Mojo. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Rebase to ToT mojo 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « cc/trees/layer_tree_host_common.cc ('k') | cc/trees/layer_tree_host_impl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/trees/layer_tree_host_common_unittest.cc
diff --git a/cc/trees/layer_tree_host_common_unittest.cc b/cc/trees/layer_tree_host_common_unittest.cc
index 01941c1364a37436f78657504adf8bd18ace9268..238c3cb28a9e30fbb9e8018d7a61a774c8ca2dec 100644
--- a/cc/trees/layer_tree_host_common_unittest.cc
+++ b/cc/trees/layer_tree_host_common_unittest.cc
@@ -5157,75 +5157,81 @@ TEST_F(LayerTreeHostCommonTest,
EXPECT_FLOAT_EQ(initial_parent_scale,
parent->draw_transform().matrix().get(1, 1));
- // The child surface is scaled up during draw since its subtree is not scaled
+ // The child surface is not scaled up during draw since its subtree is scaled
// by the transform hierarchy.
EXPECT_FLOAT_EQ(
- initial_parent_scale * initial_child_scale,
+ 1.f,
surface_scale->render_surface()->draw_transform().matrix().get(0, 0));
EXPECT_FLOAT_EQ(
- initial_parent_scale * initial_child_scale,
+ 1.f,
surface_scale->render_surface()->draw_transform().matrix().get(1, 1));
- // The surface_scale's RenderSurface is scaled during draw, so the layer does
- // not need to be scaled when drawing into its surface.
- EXPECT_FLOAT_EQ(1.0, surface_scale->draw_transform().matrix().get(0, 0));
- EXPECT_FLOAT_EQ(1.0, surface_scale->draw_transform().matrix().get(1, 1));
+ // The surface_scale's RenderSurface is not scaled during draw, so the layer
+ // needs to be scaled when drawing into its surface.
+ EXPECT_FLOAT_EQ(initial_parent_scale * initial_child_scale,
+ surface_scale->draw_transform().matrix().get(0, 0));
+ EXPECT_FLOAT_EQ(initial_parent_scale * initial_child_scale,
+ surface_scale->draw_transform().matrix().get(1, 1));
- // The surface_scale_child_scale is scaled when drawing into its surface,
- // since its content bounds are not scaled by the transform hierarchy.
+ // The surface_scale_child_scale is not scaled when drawing into its surface,
+ // since its content bounds are scaled by the transform hierarchy.
EXPECT_FLOAT_EQ(
- initial_child_scale,
+ initial_child_scale * initial_child_scale * initial_parent_scale,
surface_scale_child_scale->draw_transform().matrix().get(0, 0));
EXPECT_FLOAT_EQ(
- initial_child_scale,
+ initial_child_scale * initial_child_scale * initial_parent_scale,
surface_scale_child_scale->draw_transform().matrix().get(1, 1));
- // The surface_scale_child_no_scale has a fixed contents scale of 1, so it
- // needs to be scaled by the device and page scale factors, along with the
- // transform hierarchy.
+ // The surface_scale_child_no_scale is scaled by the device scale, page scale
+ // and transform hierarchy.
EXPECT_FLOAT_EQ(
- device_scale_factor * page_scale_factor * initial_child_scale,
+ device_scale_factor * page_scale_factor * initial_parent_scale *
+ initial_child_scale * initial_child_scale,
surface_scale_child_no_scale->draw_transform().matrix().get(0, 0));
EXPECT_FLOAT_EQ(
- device_scale_factor * page_scale_factor * initial_child_scale,
+ device_scale_factor * page_scale_factor * initial_parent_scale *
+ initial_child_scale * initial_child_scale,
surface_scale_child_no_scale->draw_transform().matrix().get(1, 1));
- // The child surface is scaled up during draw since its subtree is not scaled
+ // The child surface is not scaled up during draw since its subtree is scaled
// by the transform hierarchy.
EXPECT_FLOAT_EQ(
- initial_parent_scale * initial_child_scale,
+ 1.f,
surface_no_scale->render_surface()->draw_transform().matrix().get(0, 0));
EXPECT_FLOAT_EQ(
- initial_parent_scale * initial_child_scale,
+ 1.f,
surface_no_scale->render_surface()->draw_transform().matrix().get(1, 1));
// The surface_no_scale layer has a fixed contents scale of 1, so it needs to
// be scaled by the device and page scale factors. Its surface is already
// scaled by the transform hierarchy so those don't need to scale the layer's
// drawing.
- EXPECT_FLOAT_EQ(device_scale_factor * page_scale_factor,
+ EXPECT_FLOAT_EQ(initial_parent_scale * initial_child_scale *
+ device_scale_factor * page_scale_factor,
surface_no_scale->draw_transform().matrix().get(0, 0));
- EXPECT_FLOAT_EQ(device_scale_factor * page_scale_factor,
+ EXPECT_FLOAT_EQ(initial_parent_scale * initial_child_scale *
+ device_scale_factor * page_scale_factor,
surface_no_scale->draw_transform().matrix().get(1, 1));
// The surface_no_scale_child_scale has its contents scaled by the page and
// device scale factors, but needs to be scaled by the transform hierarchy
// when drawing.
EXPECT_FLOAT_EQ(
- initial_child_scale,
+ initial_parent_scale * initial_child_scale * initial_child_scale,
surface_no_scale_child_scale->draw_transform().matrix().get(0, 0));
EXPECT_FLOAT_EQ(
- initial_child_scale,
+ initial_parent_scale * initial_child_scale * initial_child_scale,
surface_no_scale_child_scale->draw_transform().matrix().get(1, 1));
- // The surface_no_scale_child_no_scale has a fixed contents scale of 1, so it
- // needs to be scaled by the device and page scale factors. It also needs to
- // be scaled by any transform heirarchy below its target surface.
+ // The surface_no_scale_child_no_scale needs to be scaled by the device and
+ // page scale factors and by any transform heirarchy below its target surface.
EXPECT_FLOAT_EQ(
- device_scale_factor * page_scale_factor * initial_child_scale,
+ device_scale_factor * page_scale_factor * initial_parent_scale *
+ initial_child_scale * initial_child_scale,
surface_no_scale_child_no_scale->draw_transform().matrix().get(0, 0));
EXPECT_FLOAT_EQ(
- device_scale_factor * page_scale_factor * initial_child_scale,
+ device_scale_factor * page_scale_factor * initial_parent_scale *
+ initial_child_scale * initial_child_scale,
surface_no_scale_child_no_scale->draw_transform().matrix().get(1, 1));
}
« no previous file with comments | « cc/trees/layer_tree_host_common.cc ('k') | cc/trees/layer_tree_host_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698