| Index: cc/layers/delegated_renderer_layer_impl_unittest.cc
|
| diff --git a/cc/layers/delegated_renderer_layer_impl_unittest.cc b/cc/layers/delegated_renderer_layer_impl_unittest.cc
|
| index a2f14224aa232c162c50932d115f63a232492b67..65bdcf5e3c955c02df5ad8bb8508709045927f57 100644
|
| --- a/cc/layers/delegated_renderer_layer_impl_unittest.cc
|
| +++ b/cc/layers/delegated_renderer_layer_impl_unittest.cc
|
| @@ -245,11 +245,8 @@ TEST_F(DelegatedRendererLayerImplTestSimple,
|
| // The DelegatedRendererLayer is at position 3,3 compared to its target, and
|
| // has a translation transform of 1,1. So its root RenderPass' quads should
|
| // all be transformed by that combined amount.
|
| - // The DelegatedRendererLayer has a size of 10x10, but the root delegated
|
| - // RenderPass has a size of 8x8, so any quads should be scaled by 10/8.
|
| gfx::Transform transform;
|
| transform.Translate(4.0, 4.0);
|
| - transform.Scale(10.0 / 8.0, 10.0 / 8.0);
|
| EXPECT_TRANSFORMATION_MATRIX_EQ(
|
| transform, frame.render_passes[3]->quad_list[0]->quadTransform());
|
|
|
| @@ -280,12 +277,8 @@ TEST_F(DelegatedRendererLayerImplTestSimple, RenderPassTransformIsModified) {
|
|
|
| // The DelegatedRendererLayer is at position 9,9 compared to the root, so all
|
| // render pass' transforms to the root should be shifted by this amount.
|
| - // The DelegatedRendererLayer has a size of 10x10, but the root delegated
|
| - // RenderPass has a size of 8x8, so any render passes should be scaled by
|
| - // 10/8.
|
| gfx::Transform transform;
|
| transform.Translate(9.0, 9.0);
|
| - transform.Scale(10.0 / 8.0, 10.0 / 8.0);
|
|
|
| // The first contributing surface has a translation of 5, 6.
|
| gfx::Transform five_six(1, 0, 0, 1, 5, 6);
|
| @@ -468,12 +461,9 @@ TEST_F(DelegatedRendererLayerImplTestOwnSurface,
|
| ASSERT_EQ(6u, frame.render_passes.size());
|
|
|
| // Because the DelegatedRendererLayer owns a RenderSurfaceImpl, its root
|
| - // RenderPass' quads do not need to be translated at all. However, they are
|
| - // scaled from the frame's size (8x8) to the layer's bounds (10x10).
|
| - gfx::Transform transform;
|
| - transform.Scale(10.0 / 8.0, 10.0 / 8.0);
|
| + // RenderPass' quads do not need to be translated at all.
|
| EXPECT_TRANSFORMATION_MATRIX_EQ(
|
| - transform, frame.render_passes[3]->quad_list[0]->quadTransform());
|
| + gfx::Transform(), frame.render_passes[3]->quad_list[0]->quadTransform());
|
|
|
| // Quads from non-root RenderPasses should not be shifted either.
|
| ASSERT_EQ(2u, frame.render_passes[2]->quad_list.size());
|
| @@ -713,15 +703,10 @@ TEST_F(DelegatedRendererLayerImplTestTransform, QuadsUnclipped_NoSurface) {
|
| EXPECT_TRUE(root_delegated_shared_quad_state->is_clipped);
|
|
|
| gfx::Transform expected;
|
| - // Device scale factor is 2.
|
| - expected.Scale(2.0, 2.0);
|
| // This is the transform from the layer's space to its target.
|
| - // The position (20) - the width / scale (75 / 2) = 20 - 37.5 = -17.5
|
| - expected.Translate(-17.5, -17.5);
|
| + expected.Translate(-20, -20);
|
| expected.Scale(2.0, 2.0);
|
| expected.Translate(8.0, 8.0);
|
| - // The frame has size 100x100 but the layer's bounds are 75x75.
|
| - expected.Scale(75.0 / 100.0, 75.0 / 100.0);
|
| // This is the transform within the source frame.
|
| expected.Scale(1.5, 1.5);
|
| expected.Translate(7.0, 7.0);
|
| @@ -761,30 +746,23 @@ TEST_F(DelegatedRendererLayerImplTestTransform, QuadsClipped_NoSurface) {
|
| // Since the quads have a clip_rect it should be modified by delegated
|
| // renderer layer's draw_transform.
|
| // The position of the resulting clip_rect is:
|
| - // (clip rect position (10) * scale to layer (75/100) + translate (8)) *
|
| - // layer scale (2) + layer position (20) = 51
|
| - // But the layer is centered, so: 51 - (75 / 2) = 51 - 75 / 2 = 13.5
|
| - // The device scale is 2, so everything gets doubled, giving 27.
|
| + // (clip rect position (10) * inverse dsf (1/2) + translate (8)) *
|
| + // layer scale (2) + layer position (20) = 46
|
| + // But the layer is centered, so: 46 - (75 / 2) = 46 - 75 / 2 = 8.5
|
| + // The device scale is 2, so everything gets doubled, giving 17.
|
| //
|
| - // The size is 35x35 scaled to fit inside the layer's bounds at 75x75 from
|
| - // a frame at 100x100: 35 * 2 (device scale) * 75 / 100 = 52.5. The device
|
| - // scale doubles this to 105.
|
| - EXPECT_EQ(gfx::Rect(27, 27, 105, 105).ToString(),
|
| + // The size is 35x35 scaled by the device scale.
|
| + EXPECT_EQ(gfx::Rect(17, 17, 70, 70).ToString(),
|
| root_delegated_shared_quad_state->clip_rect.ToString());
|
|
|
| // The quads had a clip and it should be preserved.
|
| EXPECT_TRUE(root_delegated_shared_quad_state->is_clipped);
|
|
|
| gfx::Transform expected;
|
| - // Device scale factor is 2.
|
| - expected.Scale(2.0, 2.0);
|
| // This is the transform from the layer's space to its target.
|
| - // The position (20) - the width / scale (75 / 2) = 20 - 37.5 = -17.5
|
| - expected.Translate(-17.5, -17.5);
|
| + expected.Translate(-20, -20);
|
| expected.Scale(2.0, 2.0);
|
| expected.Translate(8.0, 8.0);
|
| - // The frame has size 100x100 but the layer's bounds are 75x75.
|
| - expected.Scale(75.0 / 100.0, 75.0 / 100.0);
|
| // This is the transform within the source frame.
|
| expected.Scale(1.5, 1.5);
|
| expected.Translate(7.0, 7.0);
|
| @@ -825,11 +803,7 @@ TEST_F(DelegatedRendererLayerImplTestTransform, QuadsUnclipped_Surface) {
|
|
|
| // When the layer owns a surface, then its position and translation are not
|
| // a part of its draw transform.
|
| - // The position of the resulting clip_rect is:
|
| - // (clip rect position (10) * scale to layer (75/100)) * device scale (2) = 15
|
| - // The size is 35x35 scaled to fit inside the layer's bounds at 75x75 from
|
| - // a frame at 100x100: 35 * 2 (device scale) * 75 / 100 = 52.5.
|
| - EXPECT_EQ(gfx::Rect(15, 15, 53, 53).ToString(),
|
| + EXPECT_EQ(gfx::Rect(10, 10, 35, 35).ToString(),
|
| root_delegated_shared_quad_state->clip_rect.ToString());
|
|
|
| // Since the layer owns a surface it doesn't need to clip its quads, so
|
| @@ -837,10 +811,6 @@ TEST_F(DelegatedRendererLayerImplTestTransform, QuadsUnclipped_Surface) {
|
| EXPECT_FALSE(root_delegated_shared_quad_state->is_clipped);
|
|
|
| gfx::Transform expected;
|
| - // Device scale factor is 2.
|
| - expected.Scale(2.0, 2.0);
|
| - // The frame has size 100x100 but the layer's bounds are 75x75.
|
| - expected.Scale(75.0 / 100.0, 75.0 / 100.0);
|
| // This is the transform within the source frame.
|
| expected.Scale(1.5, 1.5);
|
| expected.Translate(7.0, 7.0);
|
| @@ -880,22 +850,14 @@ TEST_F(DelegatedRendererLayerImplTestTransform, QuadsClipped_Surface) {
|
| &contrib_delegated_shared_quad_state);
|
|
|
| // When the layer owns a surface, then its position and translation are not
|
| - // a part of its draw transform.
|
| - // The position of the resulting clip_rect is:
|
| - // (clip rect position (10) * scale to layer (75/100)) * device scale (2) = 15
|
| - // The size is 35x35 scaled to fit inside the layer's bounds at 75x75 from
|
| - // a frame at 100x100: 35 * 2 (device scale) * 75 / 100 = 52.5.
|
| - EXPECT_EQ(gfx::Rect(15, 15, 53, 53).ToString(),
|
| + // a part of its draw transform. The clip_rect should be preserved.
|
| + EXPECT_EQ(gfx::Rect(10, 10, 35, 35).ToString(),
|
| root_delegated_shared_quad_state->clip_rect.ToString());
|
|
|
| // The quads had a clip and it should be preserved.
|
| EXPECT_TRUE(root_delegated_shared_quad_state->is_clipped);
|
|
|
| gfx::Transform expected;
|
| - // Device scale factor is 2.
|
| - expected.Scale(2.0, 2.0);
|
| - // The frame has size 100x100 but the layer's bounds are 75x75.
|
| - expected.Scale(75.0 / 100.0, 75.0 / 100.0);
|
| // This is the transform within the source frame.
|
| expected.Scale(1.5, 1.5);
|
| expected.Translate(7.0, 7.0);
|
|
|