OLD | NEW |
1 // Copyright 2011 The Chromium Authors. All rights reserved. | 1 // Copyright 2011 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/trees/layer_tree_host_impl.h" | 5 #include "cc/trees/layer_tree_host_impl.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <cmath> | 8 #include <cmath> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
172 } | 172 } |
173 | 173 |
174 virtual bool CreateHostImpl(const LayerTreeSettings& settings, | 174 virtual bool CreateHostImpl(const LayerTreeSettings& settings, |
175 scoped_ptr<OutputSurface> output_surface) { | 175 scoped_ptr<OutputSurface> output_surface) { |
176 host_impl_ = LayerTreeHostImpl::Create( | 176 host_impl_ = LayerTreeHostImpl::Create( |
177 settings, this, &proxy_, &stats_instrumentation_, | 177 settings, this, &proxy_, &stats_instrumentation_, |
178 shared_bitmap_manager_.get(), gpu_memory_buffer_manager_.get(), | 178 shared_bitmap_manager_.get(), gpu_memory_buffer_manager_.get(), |
179 task_graph_runner_.get(), 0); | 179 task_graph_runner_.get(), 0); |
180 bool init = host_impl_->InitializeRenderer(output_surface.Pass()); | 180 bool init = host_impl_->InitializeRenderer(output_surface.Pass()); |
181 host_impl_->SetViewportSize(gfx::Size(10, 10)); | 181 host_impl_->SetViewportSize(gfx::Size(10, 10)); |
| 182 // Set the BeginFrameArgs so that methods which use it are able to. |
| 183 host_impl_->WillBeginImplFrame( |
| 184 CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE)); |
182 return init; | 185 return init; |
183 } | 186 } |
184 | 187 |
185 void SetupRootLayerImpl(scoped_ptr<LayerImpl> root) { | 188 void SetupRootLayerImpl(scoped_ptr<LayerImpl> root) { |
186 root->SetPosition(gfx::PointF()); | 189 root->SetPosition(gfx::PointF()); |
187 root->SetBounds(gfx::Size(10, 10)); | 190 root->SetBounds(gfx::Size(10, 10)); |
188 root->SetContentBounds(gfx::Size(10, 10)); | 191 root->SetContentBounds(gfx::Size(10, 10)); |
189 root->SetDrawsContent(true); | 192 root->SetDrawsContent(true); |
190 root->draw_properties().visible_content_rect = gfx::Rect(0, 0, 10, 10); | 193 root->draw_properties().visible_content_rect = gfx::Rect(0, 0, 10, 10); |
191 root->SetHasRenderSurface(true); | 194 root->SetHasRenderSurface(true); |
(...skipping 4850 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5042 | 5045 |
5043 // This test creates its own LayerTreeHostImpl, so | 5046 // This test creates its own LayerTreeHostImpl, so |
5044 // that we can force partial swap enabled. | 5047 // that we can force partial swap enabled. |
5045 LayerTreeSettings settings; | 5048 LayerTreeSettings settings; |
5046 settings.renderer_settings.partial_swap_enabled = true; | 5049 settings.renderer_settings.partial_swap_enabled = true; |
5047 scoped_ptr<LayerTreeHostImpl> layer_tree_host_impl = | 5050 scoped_ptr<LayerTreeHostImpl> layer_tree_host_impl = |
5048 LayerTreeHostImpl::Create( | 5051 LayerTreeHostImpl::Create( |
5049 settings, this, &proxy_, &stats_instrumentation_, | 5052 settings, this, &proxy_, &stats_instrumentation_, |
5050 shared_bitmap_manager_.get(), NULL, task_graph_runner_.get(), 0); | 5053 shared_bitmap_manager_.get(), NULL, task_graph_runner_.get(), 0); |
5051 layer_tree_host_impl->InitializeRenderer(output_surface.Pass()); | 5054 layer_tree_host_impl->InitializeRenderer(output_surface.Pass()); |
| 5055 layer_tree_host_impl->WillBeginImplFrame( |
| 5056 CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE)); |
5052 layer_tree_host_impl->SetViewportSize(gfx::Size(500, 500)); | 5057 layer_tree_host_impl->SetViewportSize(gfx::Size(500, 500)); |
5053 | 5058 |
5054 scoped_ptr<LayerImpl> root = | 5059 scoped_ptr<LayerImpl> root = |
5055 FakeDrawableLayerImpl::Create(layer_tree_host_impl->active_tree(), 1); | 5060 FakeDrawableLayerImpl::Create(layer_tree_host_impl->active_tree(), 1); |
5056 root->SetHasRenderSurface(true); | 5061 root->SetHasRenderSurface(true); |
5057 scoped_ptr<LayerImpl> child = | 5062 scoped_ptr<LayerImpl> child = |
5058 FakeDrawableLayerImpl::Create(layer_tree_host_impl->active_tree(), 2); | 5063 FakeDrawableLayerImpl::Create(layer_tree_host_impl->active_tree(), 2); |
5059 child->SetPosition(gfx::PointF(12.f, 13.f)); | 5064 child->SetPosition(gfx::PointF(12.f, 13.f)); |
5060 child->SetBounds(gfx::Size(14, 15)); | 5065 child->SetBounds(gfx::Size(14, 15)); |
5061 child->SetContentBounds(gfx::Size(14, 15)); | 5066 child->SetContentBounds(gfx::Size(14, 15)); |
(...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5330 scoped_ptr<OutputSurface> output_surface( | 5335 scoped_ptr<OutputSurface> output_surface( |
5331 FakeOutputSurface::Create3d(provider)); | 5336 FakeOutputSurface::Create3d(provider)); |
5332 provider->BindToCurrentThread(); | 5337 provider->BindToCurrentThread(); |
5333 provider->TestContext3d()->set_have_post_sub_buffer(true); | 5338 provider->TestContext3d()->set_have_post_sub_buffer(true); |
5334 | 5339 |
5335 LayerTreeSettings settings; | 5340 LayerTreeSettings settings; |
5336 settings.renderer_settings.partial_swap_enabled = partial_swap; | 5341 settings.renderer_settings.partial_swap_enabled = partial_swap; |
5337 scoped_ptr<LayerTreeHostImpl> my_host_impl = LayerTreeHostImpl::Create( | 5342 scoped_ptr<LayerTreeHostImpl> my_host_impl = LayerTreeHostImpl::Create( |
5338 settings, client, proxy, stats_instrumentation, manager, NULL, NULL, 0); | 5343 settings, client, proxy, stats_instrumentation, manager, NULL, NULL, 0); |
5339 my_host_impl->InitializeRenderer(output_surface.Pass()); | 5344 my_host_impl->InitializeRenderer(output_surface.Pass()); |
| 5345 my_host_impl->WillBeginImplFrame( |
| 5346 CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE)); |
5340 my_host_impl->SetViewportSize(gfx::Size(100, 100)); | 5347 my_host_impl->SetViewportSize(gfx::Size(100, 100)); |
5341 | 5348 |
5342 /* | 5349 /* |
5343 Layers are created as follows: | 5350 Layers are created as follows: |
5344 | 5351 |
5345 +--------------------+ | 5352 +--------------------+ |
5346 | 1 | | 5353 | 1 | |
5347 | +-----------+ | | 5354 | +-----------+ | |
5348 | | 2 | | | 5355 | | 2 | | |
5349 | | +-------------------+ | 5356 | | +-------------------+ |
(...skipping 2531 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7881 EXPECT_FALSE(frame.render_passes_by_id[RenderPassId(2, 0)]); | 7888 EXPECT_FALSE(frame.render_passes_by_id[RenderPassId(2, 0)]); |
7882 EXPECT_FALSE(frame.render_passes_by_id[RenderPassId(3, 0)]); | 7889 EXPECT_FALSE(frame.render_passes_by_id[RenderPassId(3, 0)]); |
7883 EXPECT_EQ(1u, frame.render_passes.size()); | 7890 EXPECT_EQ(1u, frame.render_passes.size()); |
7884 EXPECT_EQ(RenderPassId(1, 0), frame.render_passes[0]->id); | 7891 EXPECT_EQ(RenderPassId(1, 0), frame.render_passes[0]->id); |
7885 // The RenderPassDrawQuad should be removed from pass1. | 7892 // The RenderPassDrawQuad should be removed from pass1. |
7886 EXPECT_EQ(0u, pass1->quad_list.size()); | 7893 EXPECT_EQ(0u, pass1->quad_list.size()); |
7887 } | 7894 } |
7888 | 7895 |
7889 } // namespace | 7896 } // namespace |
7890 } // namespace cc | 7897 } // namespace cc |
OLD | NEW |