| OLD | NEW |
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 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/layers/delegated_renderer_layer_impl.h" | 5 #include "cc/layers/delegated_renderer_layer_impl.h" |
| 6 | 6 |
| 7 #include "cc/base/scoped_ptr_vector.h" | 7 #include "cc/base/scoped_ptr_vector.h" |
| 8 #include "cc/layers/solid_color_layer_impl.h" | 8 #include "cc/layers/solid_color_layer_impl.h" |
| 9 #include "cc/quads/render_pass_draw_quad.h" | 9 #include "cc/quads/render_pass_draw_quad.h" |
| 10 #include "cc/quads/solid_color_draw_quad.h" | 10 #include "cc/quads/solid_color_draw_quad.h" |
| (...skipping 751 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 762 EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame)); | 762 EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame)); |
| 763 | 763 |
| 764 const SharedQuadState* root_delegated_shared_quad_state = nullptr; | 764 const SharedQuadState* root_delegated_shared_quad_state = nullptr; |
| 765 const SharedQuadState* contrib_delegated_shared_quad_state = nullptr; | 765 const SharedQuadState* contrib_delegated_shared_quad_state = nullptr; |
| 766 VerifyRenderPasses( | 766 VerifyRenderPasses( |
| 767 frame, | 767 frame, |
| 768 3, | 768 3, |
| 769 &root_delegated_shared_quad_state, | 769 &root_delegated_shared_quad_state, |
| 770 &contrib_delegated_shared_quad_state); | 770 &contrib_delegated_shared_quad_state); |
| 771 | 771 |
| 772 // When the layer owns a surface, then its position and translation are not | 772 // When the layer owns a surface, then its translation is not part of its |
| 773 // a part of its draw transform. | 773 // draw transform, but its scale is. |
| 774 EXPECT_EQ(gfx::Rect(10, 10, 35, 35).ToString(), | 774 EXPECT_EQ(gfx::Rect(20, 20, 70, 70).ToString(), |
| 775 root_delegated_shared_quad_state->clip_rect.ToString()); | 775 root_delegated_shared_quad_state->clip_rect.ToString()); |
| 776 | 776 |
| 777 // Since the layer owns a surface it doesn't need to clip its quads, so | 777 // Since the layer owns a surface it doesn't need to clip its quads, so |
| 778 // unclipped quads remain unclipped. | 778 // unclipped quads remain unclipped. |
| 779 EXPECT_FALSE(root_delegated_shared_quad_state->is_clipped); | 779 EXPECT_FALSE(root_delegated_shared_quad_state->is_clipped); |
| 780 | 780 |
| 781 gfx::Transform expected; | 781 gfx::Transform expected; |
| 782 // This is the transform within the source frame. | 782 // This is the transform within the source frame scaled by the delegated |
| 783 expected.Scale(1.5, 1.5); | 783 // render layer transform. |
| 784 expected.Scale(3.0, 3.0); |
| 784 expected.Translate(7.0, 7.0); | 785 expected.Translate(7.0, 7.0); |
| 785 EXPECT_TRANSFORMATION_MATRIX_EQ( | 786 EXPECT_TRANSFORMATION_MATRIX_EQ( |
| 786 expected, root_delegated_shared_quad_state->content_to_target_transform); | 787 expected, root_delegated_shared_quad_state->content_to_target_transform); |
| 787 | 788 |
| 788 // The contributing render pass should not be transformed from its input. | 789 // The contributing render pass should not be transformed from its input. |
| 789 EXPECT_EQ(gfx::Rect(21, 21, 3, 3).ToString(), | 790 EXPECT_EQ(gfx::Rect(21, 21, 3, 3).ToString(), |
| 790 contrib_delegated_shared_quad_state->clip_rect.ToString()); | 791 contrib_delegated_shared_quad_state->clip_rect.ToString()); |
| 791 EXPECT_FALSE(contrib_delegated_shared_quad_state->is_clipped); | 792 EXPECT_FALSE(contrib_delegated_shared_quad_state->is_clipped); |
| 792 expected.MakeIdentity(); | 793 expected.MakeIdentity(); |
| 793 expected.Scale(0.8f, 0.8f); | 794 expected.Scale(0.8f, 0.8f); |
| (...skipping 16 matching lines...) Expand all Loading... |
| 810 EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame)); | 811 EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame)); |
| 811 | 812 |
| 812 const SharedQuadState* root_delegated_shared_quad_state = nullptr; | 813 const SharedQuadState* root_delegated_shared_quad_state = nullptr; |
| 813 const SharedQuadState* contrib_delegated_shared_quad_state = nullptr; | 814 const SharedQuadState* contrib_delegated_shared_quad_state = nullptr; |
| 814 VerifyRenderPasses( | 815 VerifyRenderPasses( |
| 815 frame, | 816 frame, |
| 816 3, | 817 3, |
| 817 &root_delegated_shared_quad_state, | 818 &root_delegated_shared_quad_state, |
| 818 &contrib_delegated_shared_quad_state); | 819 &contrib_delegated_shared_quad_state); |
| 819 | 820 |
| 820 // When the layer owns a surface, then its position and translation are not | 821 // When the layer owns a surface, then its translation is not part of its |
| 821 // a part of its draw transform. The clip_rect should be preserved. | 822 // draw transform, but its scale is. |
| 822 EXPECT_EQ(gfx::Rect(10, 10, 35, 35).ToString(), | 823 EXPECT_EQ(gfx::Rect(20, 20, 70, 70).ToString(), |
| 823 root_delegated_shared_quad_state->clip_rect.ToString()); | 824 root_delegated_shared_quad_state->clip_rect.ToString()); |
| 824 | 825 |
| 825 // The quads had a clip and it should be preserved. | 826 // The quads had a clip and it should be preserved. |
| 826 EXPECT_TRUE(root_delegated_shared_quad_state->is_clipped); | 827 EXPECT_TRUE(root_delegated_shared_quad_state->is_clipped); |
| 827 | 828 |
| 828 gfx::Transform expected; | 829 gfx::Transform expected; |
| 829 // This is the transform within the source frame. | 830 // This is the transform within the source frame scaled by the delegated |
| 830 expected.Scale(1.5, 1.5); | 831 // render layer transform. |
| 832 expected.Scale(3.0, 3.0); |
| 831 expected.Translate(7.0, 7.0); | 833 expected.Translate(7.0, 7.0); |
| 832 EXPECT_TRANSFORMATION_MATRIX_EQ( | 834 EXPECT_TRANSFORMATION_MATRIX_EQ( |
| 833 expected, root_delegated_shared_quad_state->content_to_target_transform); | 835 expected, root_delegated_shared_quad_state->content_to_target_transform); |
| 834 | 836 |
| 835 // The contributing render pass should not be transformed from its input. | 837 // The contributing render pass should not be transformed from its input. |
| 836 EXPECT_EQ(gfx::Rect(21, 21, 3, 3).ToString(), | 838 EXPECT_EQ(gfx::Rect(21, 21, 3, 3).ToString(), |
| 837 contrib_delegated_shared_quad_state->clip_rect.ToString()); | 839 contrib_delegated_shared_quad_state->clip_rect.ToString()); |
| 838 EXPECT_FALSE(contrib_delegated_shared_quad_state->is_clipped); | 840 EXPECT_FALSE(contrib_delegated_shared_quad_state->is_clipped); |
| 839 expected.MakeIdentity(); | 841 expected.MakeIdentity(); |
| 840 expected.Scale(0.8f, 0.8f); | 842 expected.Scale(0.8f, 0.8f); |
| (...skipping 685 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1526 scoped_ptr<DelegatedRendererLayerImpl> other_layer = | 1528 scoped_ptr<DelegatedRendererLayerImpl> other_layer = |
| 1527 DelegatedRendererLayerImpl::Create(host_impl_->active_tree(), 6); | 1529 DelegatedRendererLayerImpl::Create(host_impl_->active_tree(), 6); |
| 1528 | 1530 |
| 1529 delegated_renderer_layer_impl->PushPropertiesTo(other_layer.get()); | 1531 delegated_renderer_layer_impl->PushPropertiesTo(other_layer.get()); |
| 1530 | 1532 |
| 1531 EXPECT_EQ(0.5f, other_layer->inverse_device_scale_factor()); | 1533 EXPECT_EQ(0.5f, other_layer->inverse_device_scale_factor()); |
| 1532 } | 1534 } |
| 1533 | 1535 |
| 1534 } // namespace | 1536 } // namespace |
| 1535 } // namespace cc | 1537 } // namespace cc |
| OLD | NEW |