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/test/layer_test_common.h" | 5 #include "cc/test/layer_test_common.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include "cc/animation/animation_host.h" | 9 #include "cc/animation/animation_host.h" |
10 #include "cc/animation/animation_id_provider.h" | 10 #include "cc/animation/animation_id_provider.h" |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
118 | 118 |
119 LayerTestCommon::LayerImplTest::LayerImplTest() | 119 LayerTestCommon::LayerImplTest::LayerImplTest() |
120 : LayerImplTest(LayerTreeSettings()) {} | 120 : LayerImplTest(LayerTreeSettings()) {} |
121 | 121 |
122 LayerTestCommon::LayerImplTest::LayerImplTest(const LayerTreeSettings& settings) | 122 LayerTestCommon::LayerImplTest::LayerImplTest(const LayerTreeSettings& settings) |
123 : client_(FakeLayerTreeHostClient::DIRECT_3D), | 123 : client_(FakeLayerTreeHostClient::DIRECT_3D), |
124 output_surface_(FakeOutputSurface::Create3d()), | 124 output_surface_(FakeOutputSurface::Create3d()), |
125 host_(FakeLayerTreeHost::Create(&client_, &task_graph_runner_, settings)), | 125 host_(FakeLayerTreeHost::Create(&client_, &task_graph_runner_, settings)), |
126 render_pass_(RenderPass::Create()), | 126 render_pass_(RenderPass::Create()), |
127 layer_impl_id_(2) { | 127 layer_impl_id_(2) { |
128 scoped_ptr<LayerImpl> root_layer_impl = | 128 scoped_ptr<LayerImpl> root = |
129 LayerImpl::Create(host_->host_impl()->active_tree(), 1); | 129 LayerImpl::Create(host_->host_impl()->active_tree(), 1); |
130 root_layer_impl->SetHasRenderSurface(true); | 130 host_->host_impl()->active_tree()->SetRootLayer(std::move(root)); |
131 host_->host_impl()->active_tree()->SetRootLayer(std::move(root_layer_impl)); | 131 root_layer()->SetHasRenderSurface(true); |
132 host_->host_impl()->SetVisible(true); | 132 host_->host_impl()->SetVisible(true); |
133 host_->host_impl()->InitializeRenderer(output_surface_.get()); | 133 host_->host_impl()->InitializeRenderer(output_surface_.get()); |
134 | 134 |
135 const int timeline_id = AnimationIdProvider::NextTimelineId(); | 135 const int timeline_id = AnimationIdProvider::NextTimelineId(); |
136 timeline_ = AnimationTimeline::Create(timeline_id); | 136 timeline_ = AnimationTimeline::Create(timeline_id); |
137 host_->animation_host()->AddAnimationTimeline(timeline_); | 137 host_->animation_host()->AddAnimationTimeline(timeline_); |
138 // Create impl-side instance. | 138 // Create impl-side instance. |
139 host_->animation_host()->PushPropertiesTo( | 139 host_->animation_host()->PushPropertiesTo( |
140 host_->host_impl()->animation_host()); | 140 host_->host_impl()->animation_host()); |
141 timeline_impl_ = | 141 timeline_impl_ = |
142 host_->host_impl()->animation_host()->GetTimelineById(timeline_id); | 142 host_->host_impl()->animation_host()->GetTimelineById(timeline_id); |
143 } | 143 } |
144 | 144 |
145 LayerTestCommon::LayerImplTest::~LayerImplTest() { | 145 LayerTestCommon::LayerImplTest::~LayerImplTest() { |
146 host_->animation_host()->RemoveAnimationTimeline(timeline_); | 146 host_->animation_host()->RemoveAnimationTimeline(timeline_); |
147 timeline_ = nullptr; | 147 timeline_ = nullptr; |
148 } | 148 } |
149 | 149 |
150 void LayerTestCommon::LayerImplTest::CalcDrawProps( | 150 void LayerTestCommon::LayerImplTest::CalcDrawProps( |
151 const gfx::Size& viewport_size) { | 151 const gfx::Size& viewport_size) { |
152 LayerImplList layer_list; | 152 LayerImplList layer_list; |
153 host_->host_impl()->active_tree()->IncrementRenderSurfaceListIdForTesting(); | 153 host_->host_impl()->active_tree()->IncrementRenderSurfaceListIdForTesting(); |
154 LayerTreeHostCommon::CalcDrawPropsImplInputsForTesting inputs( | 154 LayerTreeHostCommon::CalcDrawPropsImplInputsForTesting inputs( |
155 host_->host_impl()->active_tree()->root_layer(), viewport_size, | 155 root_layer(), viewport_size, &layer_list, |
156 &layer_list, | |
157 host_->host_impl()->active_tree()->current_render_surface_list_id()); | 156 host_->host_impl()->active_tree()->current_render_surface_list_id()); |
158 LayerTreeHostCommon::CalculateDrawProperties(&inputs); | 157 LayerTreeHostCommon::CalculateDrawProperties(&inputs); |
159 } | 158 } |
160 | 159 |
161 void LayerTestCommon::LayerImplTest::AppendQuadsWithOcclusion( | 160 void LayerTestCommon::LayerImplTest::AppendQuadsWithOcclusion( |
162 LayerImpl* layer_impl, | 161 LayerImpl* layer_impl, |
163 const gfx::Rect& occluded) { | 162 const gfx::Rect& occluded) { |
164 AppendQuadsData data; | 163 AppendQuadsData data; |
165 | 164 |
166 render_pass_->quad_list.clear(); | 165 render_pass_->quad_list.clear(); |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
207 SimpleEnclosedRegion()), | 206 SimpleEnclosedRegion()), |
208 SK_ColorBLACK, 1.f, nullptr, &data, RenderPassId(1, 1)); | 207 SK_ColorBLACK, 1.f, nullptr, &data, RenderPassId(1, 1)); |
209 } | 208 } |
210 | 209 |
211 void EmptyCopyOutputCallback(scoped_ptr<CopyOutputResult> result) {} | 210 void EmptyCopyOutputCallback(scoped_ptr<CopyOutputResult> result) {} |
212 | 211 |
213 void LayerTestCommon::LayerImplTest::RequestCopyOfOutput() { | 212 void LayerTestCommon::LayerImplTest::RequestCopyOfOutput() { |
214 std::vector<scoped_ptr<CopyOutputRequest>> copy_requests; | 213 std::vector<scoped_ptr<CopyOutputRequest>> copy_requests; |
215 copy_requests.push_back( | 214 copy_requests.push_back( |
216 CopyOutputRequest::CreateRequest(base::Bind(&EmptyCopyOutputCallback))); | 215 CopyOutputRequest::CreateRequest(base::Bind(&EmptyCopyOutputCallback))); |
217 host_->host_impl()->active_tree()->root_layer()->PassCopyRequests( | 216 root_layer()->PassCopyRequests(©_requests); |
218 ©_requests); | |
219 } | 217 } |
220 | 218 |
221 } // namespace cc | 219 } // namespace cc |
OLD | NEW |