| 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/append_quads_data.h" | 8 #include "cc/layers/append_quads_data.h" |
| 9 #include "cc/layers/quad_sink.h" | 9 #include "cc/layers/quad_sink.h" |
| 10 #include "cc/layers/solid_color_layer_impl.h" | 10 #include "cc/layers/solid_color_layer_impl.h" |
| (...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 269 | 269 |
| 270 host_impl_->DrawLayers(&frame, base::TimeTicks::Now()); | 270 host_impl_->DrawLayers(&frame, base::TimeTicks::Now()); |
| 271 host_impl_->DidDrawAllLayers(frame); | 271 host_impl_->DidDrawAllLayers(frame); |
| 272 } | 272 } |
| 273 | 273 |
| 274 TEST_F(DelegatedRendererLayerImplTestSimple, DoesNotOwnARenderSurface) { | 274 TEST_F(DelegatedRendererLayerImplTestSimple, DoesNotOwnARenderSurface) { |
| 275 LayerTreeHostImpl::FrameData frame; | 275 LayerTreeHostImpl::FrameData frame; |
| 276 EXPECT_TRUE(host_impl_->PrepareToDraw(&frame)); | 276 EXPECT_TRUE(host_impl_->PrepareToDraw(&frame)); |
| 277 | 277 |
| 278 // If the DelegatedRendererLayer is axis aligned and has opacity 1, then it | 278 // If the DelegatedRendererLayer is axis aligned and has opacity 1, then it |
| 279 // has no need to be a renderSurface for the quads it carries. | 279 // has no need to be a RenderSurface for the quads it carries. |
| 280 EXPECT_FALSE(delegated_renderer_layer_->render_surface()); | 280 EXPECT_FALSE(delegated_renderer_layer_->render_surface()); |
| 281 | 281 |
| 282 host_impl_->DrawLayers(&frame, base::TimeTicks::Now()); | 282 host_impl_->DrawLayers(&frame, base::TimeTicks::Now()); |
| 283 host_impl_->DidDrawAllLayers(frame); | 283 host_impl_->DidDrawAllLayers(frame); |
| 284 } | 284 } |
| 285 | 285 |
| 286 TEST_F(DelegatedRendererLayerImplTestSimple, DoesOwnARenderSurfaceForOpacity) { | 286 TEST_F(DelegatedRendererLayerImplTestSimple, DoesOwnARenderSurfaceForOpacity) { |
| 287 delegated_renderer_layer_->SetOpacity(0.5f); | 287 delegated_renderer_layer_->SetOpacity(0.5f); |
| 288 | 288 |
| 289 LayerTreeHostImpl::FrameData frame; | 289 LayerTreeHostImpl::FrameData frame; |
| (...skipping 353 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 643 | 643 |
| 644 const SharedQuadState* root_delegated_shared_quad_state = NULL; | 644 const SharedQuadState* root_delegated_shared_quad_state = NULL; |
| 645 const SharedQuadState* contrib_delegated_shared_quad_state = NULL; | 645 const SharedQuadState* contrib_delegated_shared_quad_state = NULL; |
| 646 VerifyRenderPasses( | 646 VerifyRenderPasses( |
| 647 frame, | 647 frame, |
| 648 2, | 648 2, |
| 649 &root_delegated_shared_quad_state, | 649 &root_delegated_shared_quad_state, |
| 650 &contrib_delegated_shared_quad_state); | 650 &contrib_delegated_shared_quad_state); |
| 651 | 651 |
| 652 // When the quads don't have a clip of their own, the clip rect is set to | 652 // When the quads don't have a clip of their own, the clip rect is set to |
| 653 // the drawableContentRect of the delegated renderer layer. | 653 // the drawable_content_rect of the delegated renderer layer. |
| 654 EXPECT_EQ(gfx::Rect(21, 21, 60, 60).ToString(), | 654 EXPECT_EQ(gfx::Rect(21, 21, 60, 60).ToString(), |
| 655 root_delegated_shared_quad_state->clip_rect.ToString()); | 655 root_delegated_shared_quad_state->clip_rect.ToString()); |
| 656 | 656 |
| 657 // Even though the quads in the root pass have no clip of their own, they | 657 // Even though the quads in the root pass have no clip of their own, they |
| 658 // inherit the clip rect from the delegated renderer layer if it does not | 658 // inherit the clip rect from the delegated renderer layer if it does not |
| 659 // own a surface. | 659 // own a surface. |
| 660 EXPECT_TRUE(root_delegated_shared_quad_state->is_clipped); | 660 EXPECT_TRUE(root_delegated_shared_quad_state->is_clipped); |
| 661 | 661 |
| 662 gfx::Transform expected; | 662 gfx::Transform expected; |
| 663 // This is the transform from the layer's space to its target. | 663 // This is the transform from the layer's space to its target. |
| (...skipping 354 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1018 frame.render_passes[0]->quad_list; | 1018 frame.render_passes[0]->quad_list; |
| 1019 ASSERT_EQ(2u, contrib_delegated_quad_list.size()); | 1019 ASSERT_EQ(2u, contrib_delegated_quad_list.size()); |
| 1020 const QuadList& root_delegated_quad_list = frame.render_passes[1]->quad_list; | 1020 const QuadList& root_delegated_quad_list = frame.render_passes[1]->quad_list; |
| 1021 ASSERT_EQ(5u, root_delegated_quad_list.size()); | 1021 ASSERT_EQ(5u, root_delegated_quad_list.size()); |
| 1022 const SharedQuadState* root_delegated_shared_quad_state = | 1022 const SharedQuadState* root_delegated_shared_quad_state = |
| 1023 root_delegated_quad_list[0]->shared_quad_state; | 1023 root_delegated_quad_list[0]->shared_quad_state; |
| 1024 const SharedQuadState* contrib_delegated_shared_quad_state = | 1024 const SharedQuadState* contrib_delegated_shared_quad_state = |
| 1025 contrib_delegated_quad_list[0]->shared_quad_state; | 1025 contrib_delegated_quad_list[0]->shared_quad_state; |
| 1026 | 1026 |
| 1027 // When the quads don't have a clip of their own, the clip rect is set to | 1027 // When the quads don't have a clip of their own, the clip rect is set to |
| 1028 // the drawableContentRect of the delegated renderer layer. | 1028 // the drawable_content_rect of the delegated renderer layer. |
| 1029 EXPECT_EQ(gfx::Rect(20, 20, 50, 50).ToString(), | 1029 EXPECT_EQ(gfx::Rect(20, 20, 50, 50).ToString(), |
| 1030 root_delegated_shared_quad_state->clip_rect.ToString()); | 1030 root_delegated_shared_quad_state->clip_rect.ToString()); |
| 1031 // Quads are clipped to the delegated renderer layer. | 1031 // Quads are clipped to the delegated renderer layer. |
| 1032 EXPECT_TRUE(root_delegated_shared_quad_state->is_clipped); | 1032 EXPECT_TRUE(root_delegated_shared_quad_state->is_clipped); |
| 1033 | 1033 |
| 1034 host_impl_->DrawLayers(&frame, base::TimeTicks::Now()); | 1034 host_impl_->DrawLayers(&frame, base::TimeTicks::Now()); |
| 1035 host_impl_->DidDrawAllLayers(frame); | 1035 host_impl_->DidDrawAllLayers(frame); |
| 1036 } | 1036 } |
| 1037 | 1037 |
| 1038 TEST_F(DelegatedRendererLayerImplTestClip, | 1038 TEST_F(DelegatedRendererLayerImplTestClip, |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1080 frame.render_passes[0]->quad_list; | 1080 frame.render_passes[0]->quad_list; |
| 1081 ASSERT_EQ(2u, contrib_delegated_quad_list.size()); | 1081 ASSERT_EQ(2u, contrib_delegated_quad_list.size()); |
| 1082 const QuadList& root_delegated_quad_list = frame.render_passes[1]->quad_list; | 1082 const QuadList& root_delegated_quad_list = frame.render_passes[1]->quad_list; |
| 1083 ASSERT_EQ(5u, root_delegated_quad_list.size()); | 1083 ASSERT_EQ(5u, root_delegated_quad_list.size()); |
| 1084 const SharedQuadState* root_delegated_shared_quad_state = | 1084 const SharedQuadState* root_delegated_shared_quad_state = |
| 1085 root_delegated_quad_list[0]->shared_quad_state; | 1085 root_delegated_quad_list[0]->shared_quad_state; |
| 1086 const SharedQuadState* contrib_delegated_shared_quad_state = | 1086 const SharedQuadState* contrib_delegated_shared_quad_state = |
| 1087 contrib_delegated_quad_list[0]->shared_quad_state; | 1087 contrib_delegated_quad_list[0]->shared_quad_state; |
| 1088 | 1088 |
| 1089 // When the quads don't have a clip of their own, the clip rect is set to | 1089 // When the quads don't have a clip of their own, the clip rect is set to |
| 1090 // the drawableContentRect of the delegated renderer layer. When the layer | 1090 // the drawable_content_rect of the delegated renderer layer. When the layer |
| 1091 // is clipped, that should be seen in the quads' clip_rect. | 1091 // is clipped, that should be seen in the quads' clip_rect. |
| 1092 EXPECT_EQ(gfx::Rect(21, 27, 23, 21).ToString(), | 1092 EXPECT_EQ(gfx::Rect(21, 27, 23, 21).ToString(), |
| 1093 root_delegated_shared_quad_state->clip_rect.ToString()); | 1093 root_delegated_shared_quad_state->clip_rect.ToString()); |
| 1094 // Quads are clipped to the delegated renderer layer. | 1094 // Quads are clipped to the delegated renderer layer. |
| 1095 EXPECT_TRUE(root_delegated_shared_quad_state->is_clipped); | 1095 EXPECT_TRUE(root_delegated_shared_quad_state->is_clipped); |
| 1096 | 1096 |
| 1097 host_impl_->DrawLayers(&frame, base::TimeTicks::Now()); | 1097 host_impl_->DrawLayers(&frame, base::TimeTicks::Now()); |
| 1098 host_impl_->DidDrawAllLayers(frame); | 1098 host_impl_->DidDrawAllLayers(frame); |
| 1099 } | 1099 } |
| 1100 | 1100 |
| (...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1251 root_delegated_shared_quad_state->clip_rect.ToString()); | 1251 root_delegated_shared_quad_state->clip_rect.ToString()); |
| 1252 // Quads came with a clip rect. | 1252 // Quads came with a clip rect. |
| 1253 EXPECT_TRUE(root_delegated_shared_quad_state->is_clipped); | 1253 EXPECT_TRUE(root_delegated_shared_quad_state->is_clipped); |
| 1254 | 1254 |
| 1255 host_impl_->DrawLayers(&frame, base::TimeTicks::Now()); | 1255 host_impl_->DrawLayers(&frame, base::TimeTicks::Now()); |
| 1256 host_impl_->DidDrawAllLayers(frame); | 1256 host_impl_->DidDrawAllLayers(frame); |
| 1257 } | 1257 } |
| 1258 | 1258 |
| 1259 } // namespace | 1259 } // namespace |
| 1260 } // namespace cc | 1260 } // namespace cc |
| OLD | NEW |