| 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 25 matching lines...) Expand all Loading... |
| 36 : proxy_(scoped_ptr<Thread>(NULL)), | 36 : proxy_(scoped_ptr<Thread>(NULL)), |
| 37 always_impl_thread_and_main_thread_blocked_(&proxy_) { | 37 always_impl_thread_and_main_thread_blocked_(&proxy_) { |
| 38 LayerTreeSettings settings; | 38 LayerTreeSettings settings; |
| 39 settings.minimum_occlusion_tracking_size = gfx::Size(); | 39 settings.minimum_occlusion_tracking_size = gfx::Size(); |
| 40 | 40 |
| 41 host_impl_ = LayerTreeHostImpl::Create(settings, | 41 host_impl_ = LayerTreeHostImpl::Create(settings, |
| 42 &client_, | 42 &client_, |
| 43 &proxy_, | 43 &proxy_, |
| 44 &stats_instrumentation_); | 44 &stats_instrumentation_); |
| 45 host_impl_->InitializeRenderer(CreateFakeOutputSurface()); | 45 host_impl_->InitializeRenderer(CreateFakeOutputSurface()); |
| 46 host_impl_->SetViewportSize(gfx::Size(10, 10), gfx::Size(10, 10)); | 46 host_impl_->SetViewportSize(gfx::Size(10, 10)); |
| 47 } | 47 } |
| 48 | 48 |
| 49 protected: | 49 protected: |
| 50 FakeProxy proxy_; | 50 FakeProxy proxy_; |
| 51 FakeLayerTreeHostImplClient client_; | 51 FakeLayerTreeHostImplClient client_; |
| 52 DebugScopedSetImplThreadAndMainThreadBlocked | 52 DebugScopedSetImplThreadAndMainThreadBlocked |
| 53 always_impl_thread_and_main_thread_blocked_; | 53 always_impl_thread_and_main_thread_blocked_; |
| 54 FakeRenderingStatsInstrumentation stats_instrumentation_; | 54 FakeRenderingStatsInstrumentation stats_instrumentation_; |
| 55 scoped_ptr<LayerTreeHostImpl> host_impl_; | 55 scoped_ptr<LayerTreeHostImpl> host_impl_; |
| 56 }; | 56 }; |
| 57 | 57 |
| 58 class DelegatedRendererLayerImplTestSimple | 58 class DelegatedRendererLayerImplTestSimple |
| 59 : public DelegatedRendererLayerImplTest { | 59 : public DelegatedRendererLayerImplTest { |
| 60 public: | 60 public: |
| 61 DelegatedRendererLayerImplTestSimple() | 61 DelegatedRendererLayerImplTestSimple() |
| 62 : DelegatedRendererLayerImplTest() { | 62 : DelegatedRendererLayerImplTest() { |
| 63 scoped_ptr<LayerImpl> root_layer = SolidColorLayerImpl::Create( | 63 scoped_ptr<LayerImpl> root_layer = SolidColorLayerImpl::Create( |
| 64 host_impl_->active_tree(), 1).PassAs<LayerImpl>(); | 64 host_impl_->active_tree(), 1).PassAs<LayerImpl>(); |
| 65 scoped_ptr<LayerImpl> layer_before = SolidColorLayerImpl::Create( | 65 scoped_ptr<LayerImpl> layer_before = SolidColorLayerImpl::Create( |
| 66 host_impl_->active_tree(), 2).PassAs<LayerImpl>(); | 66 host_impl_->active_tree(), 2).PassAs<LayerImpl>(); |
| 67 scoped_ptr<LayerImpl> layer_after = SolidColorLayerImpl::Create( | 67 scoped_ptr<LayerImpl> layer_after = SolidColorLayerImpl::Create( |
| 68 host_impl_->active_tree(), 3).PassAs<LayerImpl>(); | 68 host_impl_->active_tree(), 3).PassAs<LayerImpl>(); |
| 69 scoped_ptr<FakeDelegatedRendererLayerImpl> delegated_renderer_layer = | 69 scoped_ptr<FakeDelegatedRendererLayerImpl> delegated_renderer_layer = |
| 70 FakeDelegatedRendererLayerImpl::Create(host_impl_->active_tree(), 4); | 70 FakeDelegatedRendererLayerImpl::Create(host_impl_->active_tree(), 4); |
| 71 | 71 |
| 72 host_impl_->SetViewportSize(gfx::Size(100, 100), gfx::Size(100, 100)); | 72 host_impl_->SetViewportSize(gfx::Size(100, 100)); |
| 73 root_layer->SetBounds(gfx::Size(100, 100)); | 73 root_layer->SetBounds(gfx::Size(100, 100)); |
| 74 | 74 |
| 75 layer_before->SetPosition(gfx::Point(20, 20)); | 75 layer_before->SetPosition(gfx::Point(20, 20)); |
| 76 layer_before->SetBounds(gfx::Size(14, 14)); | 76 layer_before->SetBounds(gfx::Size(14, 14)); |
| 77 layer_before->SetContentBounds(gfx::Size(14, 14)); | 77 layer_before->SetContentBounds(gfx::Size(14, 14)); |
| 78 layer_before->SetDrawsContent(true); | 78 layer_before->SetDrawsContent(true); |
| 79 layer_before->SetForceRenderSurface(true); | 79 layer_before->SetForceRenderSurface(true); |
| 80 | 80 |
| 81 layer_after->SetPosition(gfx::Point(5, 5)); | 81 layer_after->SetPosition(gfx::Point(5, 5)); |
| 82 layer_after->SetBounds(gfx::Size(15, 15)); | 82 layer_after->SetBounds(gfx::Size(15, 15)); |
| (...skipping 376 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 459 | 459 |
| 460 class DelegatedRendererLayerImplTestTransform | 460 class DelegatedRendererLayerImplTestTransform |
| 461 : public DelegatedRendererLayerImplTest { | 461 : public DelegatedRendererLayerImplTest { |
| 462 public: | 462 public: |
| 463 void SetUpTest() { | 463 void SetUpTest() { |
| 464 scoped_ptr<LayerImpl> root_layer = LayerImpl::Create( | 464 scoped_ptr<LayerImpl> root_layer = LayerImpl::Create( |
| 465 host_impl_->active_tree(), 1); | 465 host_impl_->active_tree(), 1); |
| 466 scoped_ptr<FakeDelegatedRendererLayerImpl> delegated_renderer_layer = | 466 scoped_ptr<FakeDelegatedRendererLayerImpl> delegated_renderer_layer = |
| 467 FakeDelegatedRendererLayerImpl::Create(host_impl_->active_tree(), 2); | 467 FakeDelegatedRendererLayerImpl::Create(host_impl_->active_tree(), 2); |
| 468 | 468 |
| 469 host_impl_->SetViewportSize(gfx::Size(100, 100), gfx::Size(100, 100)); | 469 host_impl_->SetViewportSize(gfx::Size(100, 100)); |
| 470 root_layer->SetBounds(gfx::Size(100, 100)); | 470 root_layer->SetBounds(gfx::Size(100, 100)); |
| 471 | 471 |
| 472 delegated_renderer_layer->SetPosition(gfx::Point(20, 20)); | 472 delegated_renderer_layer->SetPosition(gfx::Point(20, 20)); |
| 473 delegated_renderer_layer->SetBounds(gfx::Size(30, 30)); | 473 delegated_renderer_layer->SetBounds(gfx::Size(30, 30)); |
| 474 delegated_renderer_layer->SetContentBounds(gfx::Size(30, 30)); | 474 delegated_renderer_layer->SetContentBounds(gfx::Size(30, 30)); |
| 475 delegated_renderer_layer->SetDrawsContent(true); | 475 delegated_renderer_layer->SetDrawsContent(true); |
| 476 gfx::Transform transform; | 476 gfx::Transform transform; |
| 477 transform.Scale(2.0, 2.0); | 477 transform.Scale(2.0, 2.0); |
| 478 transform.Translate(8.0, 8.0); | 478 transform.Translate(8.0, 8.0); |
| 479 delegated_renderer_layer->SetTransform(transform); | 479 delegated_renderer_layer->SetTransform(transform); |
| (...skipping 382 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 862 void SetUpTest() { | 862 void SetUpTest() { |
| 863 scoped_ptr<LayerImpl> root_layer = | 863 scoped_ptr<LayerImpl> root_layer = |
| 864 LayerImpl::Create(host_impl_->active_tree(), 1); | 864 LayerImpl::Create(host_impl_->active_tree(), 1); |
| 865 scoped_ptr<FakeDelegatedRendererLayerImpl> delegated_renderer_layer = | 865 scoped_ptr<FakeDelegatedRendererLayerImpl> delegated_renderer_layer = |
| 866 FakeDelegatedRendererLayerImpl::Create(host_impl_->active_tree(), 2); | 866 FakeDelegatedRendererLayerImpl::Create(host_impl_->active_tree(), 2); |
| 867 scoped_ptr<LayerImpl> clip_layer = | 867 scoped_ptr<LayerImpl> clip_layer = |
| 868 LayerImpl::Create(host_impl_->active_tree(), 3); | 868 LayerImpl::Create(host_impl_->active_tree(), 3); |
| 869 scoped_ptr<LayerImpl> origin_layer = | 869 scoped_ptr<LayerImpl> origin_layer = |
| 870 LayerImpl::Create(host_impl_->active_tree(), 4); | 870 LayerImpl::Create(host_impl_->active_tree(), 4); |
| 871 | 871 |
| 872 host_impl_->SetViewportSize(gfx::Size(100, 100), gfx::Size(100, 100)); | 872 host_impl_->SetViewportSize(gfx::Size(100, 100)); |
| 873 root_layer->SetBounds(gfx::Size(100, 100)); | 873 root_layer->SetBounds(gfx::Size(100, 100)); |
| 874 | 874 |
| 875 delegated_renderer_layer->SetPosition(gfx::Point(20, 20)); | 875 delegated_renderer_layer->SetPosition(gfx::Point(20, 20)); |
| 876 delegated_renderer_layer->SetBounds(gfx::Size(50, 50)); | 876 delegated_renderer_layer->SetBounds(gfx::Size(50, 50)); |
| 877 delegated_renderer_layer->SetContentBounds(gfx::Size(50, 50)); | 877 delegated_renderer_layer->SetContentBounds(gfx::Size(50, 50)); |
| 878 delegated_renderer_layer->SetDrawsContent(true); | 878 delegated_renderer_layer->SetDrawsContent(true); |
| 879 | 879 |
| 880 ScopedPtrVector<RenderPass> delegated_render_passes; | 880 ScopedPtrVector<RenderPass> delegated_render_passes; |
| 881 | 881 |
| 882 gfx::Size child_pass_content_bounds(7, 7); | 882 gfx::Size child_pass_content_bounds(7, 7); |
| (...skipping 352 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1235 root_delegated_shared_quad_state->clip_rect.ToString()); | 1235 root_delegated_shared_quad_state->clip_rect.ToString()); |
| 1236 // Quads came with a clip rect. | 1236 // Quads came with a clip rect. |
| 1237 EXPECT_TRUE(root_delegated_shared_quad_state->is_clipped); | 1237 EXPECT_TRUE(root_delegated_shared_quad_state->is_clipped); |
| 1238 | 1238 |
| 1239 host_impl_->DrawLayers(&frame, base::TimeTicks::Now()); | 1239 host_impl_->DrawLayers(&frame, base::TimeTicks::Now()); |
| 1240 host_impl_->DidDrawAllLayers(frame); | 1240 host_impl_->DidDrawAllLayers(frame); |
| 1241 } | 1241 } |
| 1242 | 1242 |
| 1243 } // namespace | 1243 } // namespace |
| 1244 } // namespace cc | 1244 } // namespace cc |
| OLD | NEW |