OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/output/compositor_frame.h" | 5 #include "cc/output/compositor_frame.h" |
6 #include "cc/quads/render_pass.h" | 6 #include "cc/quads/render_pass.h" |
7 #include "cc/quads/solid_color_draw_quad.h" | 7 #include "cc/quads/solid_color_draw_quad.h" |
8 #include "cc/quads/surface_draw_quad.h" | 8 #include "cc/quads/surface_draw_quad.h" |
9 #include "cc/surfaces/surface.h" | 9 #include "cc/surfaces/surface.h" |
10 #include "cc/surfaces/surface_aggregator.h" | 10 #include "cc/surfaces/surface_aggregator.h" |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 SolidColorDrawQuad* color_quad = | 74 SolidColorDrawQuad* color_quad = |
75 pass->CreateAndAppendDrawQuad<SolidColorDrawQuad>(); | 75 pass->CreateAndAppendDrawQuad<SolidColorDrawQuad>(); |
76 bool force_anti_aliasing_off = false; | 76 bool force_anti_aliasing_off = false; |
77 color_quad->SetNew(pass->shared_quad_state_list.back(), | 77 color_quad->SetNew(pass->shared_quad_state_list.back(), |
78 rect, | 78 rect, |
79 rect, | 79 rect, |
80 SK_ColorGREEN, | 80 SK_ColorGREEN, |
81 force_anti_aliasing_off); | 81 force_anti_aliasing_off); |
82 | 82 |
83 scoped_ptr<DelegatedFrameData> delegated_frame_data(new DelegatedFrameData); | 83 scoped_ptr<DelegatedFrameData> delegated_frame_data(new DelegatedFrameData); |
84 delegated_frame_data->render_pass_list.push_back(pass.Pass()); | 84 delegated_frame_data->render_pass_list.push_back(std::move(pass)); |
85 | 85 |
86 scoped_ptr<CompositorFrame> root_frame(new CompositorFrame); | 86 scoped_ptr<CompositorFrame> root_frame(new CompositorFrame); |
87 root_frame->delegated_frame_data = delegated_frame_data.Pass(); | 87 root_frame->delegated_frame_data = std::move(delegated_frame_data); |
88 | 88 |
89 SurfaceId root_surface_id = allocator_.GenerateId(); | 89 SurfaceId root_surface_id = allocator_.GenerateId(); |
90 factory_.Create(root_surface_id); | 90 factory_.Create(root_surface_id); |
91 factory_.SubmitCompositorFrame(root_surface_id, root_frame.Pass(), | 91 factory_.SubmitCompositorFrame(root_surface_id, std::move(root_frame), |
92 SurfaceFactory::DrawCallback()); | 92 SurfaceFactory::DrawCallback()); |
93 | 93 |
94 EmptySurfaceAggregatorClient surface_aggregator_client; | 94 EmptySurfaceAggregatorClient surface_aggregator_client; |
95 SurfaceAggregator aggregator(&surface_aggregator_client, &manager_, | 95 SurfaceAggregator aggregator(&surface_aggregator_client, &manager_, |
96 resource_provider_.get(), true); | 96 resource_provider_.get(), true); |
97 scoped_ptr<CompositorFrame> aggregated_frame = | 97 scoped_ptr<CompositorFrame> aggregated_frame = |
98 aggregator.Aggregate(root_surface_id); | 98 aggregator.Aggregate(root_surface_id); |
99 factory_.Destroy(root_surface_id); | 99 factory_.Destroy(root_surface_id); |
100 | 100 |
101 bool discard_alpha = false; | 101 bool discard_alpha = false; |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
133 SolidColorDrawQuad* color_quad = | 133 SolidColorDrawQuad* color_quad = |
134 pass->CreateAndAppendDrawQuad<SolidColorDrawQuad>(); | 134 pass->CreateAndAppendDrawQuad<SolidColorDrawQuad>(); |
135 bool force_anti_aliasing_off = false; | 135 bool force_anti_aliasing_off = false; |
136 color_quad->SetNew(pass->shared_quad_state_list.back(), | 136 color_quad->SetNew(pass->shared_quad_state_list.back(), |
137 rect, | 137 rect, |
138 rect, | 138 rect, |
139 SK_ColorYELLOW, | 139 SK_ColorYELLOW, |
140 force_anti_aliasing_off); | 140 force_anti_aliasing_off); |
141 | 141 |
142 scoped_ptr<DelegatedFrameData> delegated_frame_data(new DelegatedFrameData); | 142 scoped_ptr<DelegatedFrameData> delegated_frame_data(new DelegatedFrameData); |
143 delegated_frame_data->render_pass_list.push_back(pass.Pass()); | 143 delegated_frame_data->render_pass_list.push_back(std::move(pass)); |
144 | 144 |
145 scoped_ptr<CompositorFrame> root_frame(new CompositorFrame); | 145 scoped_ptr<CompositorFrame> root_frame(new CompositorFrame); |
146 root_frame->delegated_frame_data = delegated_frame_data.Pass(); | 146 root_frame->delegated_frame_data = std::move(delegated_frame_data); |
147 | 147 |
148 factory_.SubmitCompositorFrame(root_surface_id, root_frame.Pass(), | 148 factory_.SubmitCompositorFrame(root_surface_id, std::move(root_frame), |
149 SurfaceFactory::DrawCallback()); | 149 SurfaceFactory::DrawCallback()); |
150 } | 150 } |
151 | 151 |
152 { | 152 { |
153 gfx::Rect rect(child_size); | 153 gfx::Rect rect(child_size); |
154 RenderPassId id(1, 1); | 154 RenderPassId id(1, 1); |
155 scoped_ptr<RenderPass> pass = RenderPass::Create(); | 155 scoped_ptr<RenderPass> pass = RenderPass::Create(); |
156 pass->SetNew(id, rect, rect, gfx::Transform()); | 156 pass->SetNew(id, rect, rect, gfx::Transform()); |
157 | 157 |
158 CreateAndAppendTestSharedQuadState( | 158 CreateAndAppendTestSharedQuadState( |
159 pass.get(), gfx::Transform(), child_size); | 159 pass.get(), gfx::Transform(), child_size); |
160 | 160 |
161 SolidColorDrawQuad* color_quad = | 161 SolidColorDrawQuad* color_quad = |
162 pass->CreateAndAppendDrawQuad<SolidColorDrawQuad>(); | 162 pass->CreateAndAppendDrawQuad<SolidColorDrawQuad>(); |
163 bool force_anti_aliasing_off = false; | 163 bool force_anti_aliasing_off = false; |
164 color_quad->SetNew(pass->shared_quad_state_list.back(), | 164 color_quad->SetNew(pass->shared_quad_state_list.back(), |
165 rect, | 165 rect, |
166 rect, | 166 rect, |
167 SK_ColorBLUE, | 167 SK_ColorBLUE, |
168 force_anti_aliasing_off); | 168 force_anti_aliasing_off); |
169 | 169 |
170 scoped_ptr<DelegatedFrameData> delegated_frame_data(new DelegatedFrameData); | 170 scoped_ptr<DelegatedFrameData> delegated_frame_data(new DelegatedFrameData); |
171 delegated_frame_data->render_pass_list.push_back(pass.Pass()); | 171 delegated_frame_data->render_pass_list.push_back(std::move(pass)); |
172 | 172 |
173 scoped_ptr<CompositorFrame> child_frame(new CompositorFrame); | 173 scoped_ptr<CompositorFrame> child_frame(new CompositorFrame); |
174 child_frame->delegated_frame_data = delegated_frame_data.Pass(); | 174 child_frame->delegated_frame_data = std::move(delegated_frame_data); |
175 | 175 |
176 factory_.SubmitCompositorFrame(child_surface_id, child_frame.Pass(), | 176 factory_.SubmitCompositorFrame(child_surface_id, std::move(child_frame), |
177 SurfaceFactory::DrawCallback()); | 177 SurfaceFactory::DrawCallback()); |
178 } | 178 } |
179 | 179 |
180 EmptySurfaceAggregatorClient surface_aggregator_client; | 180 EmptySurfaceAggregatorClient surface_aggregator_client; |
181 SurfaceAggregator aggregator(&surface_aggregator_client, &manager_, | 181 SurfaceAggregator aggregator(&surface_aggregator_client, &manager_, |
182 resource_provider_.get(), true); | 182 resource_provider_.get(), true); |
183 scoped_ptr<CompositorFrame> aggregated_frame = | 183 scoped_ptr<CompositorFrame> aggregated_frame = |
184 aggregator.Aggregate(root_surface_id); | 184 aggregator.Aggregate(root_surface_id); |
185 | 185 |
186 bool discard_alpha = false; | 186 bool discard_alpha = false; |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
234 pass.get(), surface_transform, device_viewport_size_); | 234 pass.get(), surface_transform, device_viewport_size_); |
235 | 235 |
236 SurfaceDrawQuad* right_surface_quad = | 236 SurfaceDrawQuad* right_surface_quad = |
237 pass->CreateAndAppendDrawQuad<SurfaceDrawQuad>(); | 237 pass->CreateAndAppendDrawQuad<SurfaceDrawQuad>(); |
238 right_surface_quad->SetNew(pass->shared_quad_state_list.back(), | 238 right_surface_quad->SetNew(pass->shared_quad_state_list.back(), |
239 gfx::Rect(child_size), | 239 gfx::Rect(child_size), |
240 gfx::Rect(child_size), | 240 gfx::Rect(child_size), |
241 right_child_id); | 241 right_child_id); |
242 | 242 |
243 scoped_ptr<DelegatedFrameData> delegated_frame_data(new DelegatedFrameData); | 243 scoped_ptr<DelegatedFrameData> delegated_frame_data(new DelegatedFrameData); |
244 delegated_frame_data->render_pass_list.push_back(pass.Pass()); | 244 delegated_frame_data->render_pass_list.push_back(std::move(pass)); |
245 | 245 |
246 scoped_ptr<CompositorFrame> root_frame(new CompositorFrame); | 246 scoped_ptr<CompositorFrame> root_frame(new CompositorFrame); |
247 root_frame->delegated_frame_data = delegated_frame_data.Pass(); | 247 root_frame->delegated_frame_data = std::move(delegated_frame_data); |
248 | 248 |
249 factory_.SubmitCompositorFrame(root_surface_id, root_frame.Pass(), | 249 factory_.SubmitCompositorFrame(root_surface_id, std::move(root_frame), |
250 SurfaceFactory::DrawCallback()); | 250 SurfaceFactory::DrawCallback()); |
251 } | 251 } |
252 | 252 |
253 { | 253 { |
254 gfx::Rect rect(child_size); | 254 gfx::Rect rect(child_size); |
255 RenderPassId id(1, 1); | 255 RenderPassId id(1, 1); |
256 scoped_ptr<RenderPass> pass = RenderPass::Create(); | 256 scoped_ptr<RenderPass> pass = RenderPass::Create(); |
257 pass->SetNew(id, rect, rect, gfx::Transform()); | 257 pass->SetNew(id, rect, rect, gfx::Transform()); |
258 | 258 |
259 CreateAndAppendTestSharedQuadState( | 259 CreateAndAppendTestSharedQuadState( |
(...skipping 10 matching lines...) Expand all Loading... |
270 | 270 |
271 SolidColorDrawQuad* bottom_color_quad = | 271 SolidColorDrawQuad* bottom_color_quad = |
272 pass->CreateAndAppendDrawQuad<SolidColorDrawQuad>(); | 272 pass->CreateAndAppendDrawQuad<SolidColorDrawQuad>(); |
273 bottom_color_quad->SetNew(pass->shared_quad_state_list.back(), | 273 bottom_color_quad->SetNew(pass->shared_quad_state_list.back(), |
274 gfx::Rect(0, 100, 100, 100), | 274 gfx::Rect(0, 100, 100, 100), |
275 gfx::Rect(0, 100, 100, 100), | 275 gfx::Rect(0, 100, 100, 100), |
276 SK_ColorBLUE, | 276 SK_ColorBLUE, |
277 force_anti_aliasing_off); | 277 force_anti_aliasing_off); |
278 | 278 |
279 scoped_ptr<DelegatedFrameData> delegated_frame_data(new DelegatedFrameData); | 279 scoped_ptr<DelegatedFrameData> delegated_frame_data(new DelegatedFrameData); |
280 delegated_frame_data->render_pass_list.push_back(pass.Pass()); | 280 delegated_frame_data->render_pass_list.push_back(std::move(pass)); |
281 | 281 |
282 scoped_ptr<CompositorFrame> child_frame(new CompositorFrame); | 282 scoped_ptr<CompositorFrame> child_frame(new CompositorFrame); |
283 child_frame->delegated_frame_data = delegated_frame_data.Pass(); | 283 child_frame->delegated_frame_data = std::move(delegated_frame_data); |
284 | 284 |
285 factory_.SubmitCompositorFrame(left_child_id, child_frame.Pass(), | 285 factory_.SubmitCompositorFrame(left_child_id, std::move(child_frame), |
286 SurfaceFactory::DrawCallback()); | 286 SurfaceFactory::DrawCallback()); |
287 } | 287 } |
288 | 288 |
289 { | 289 { |
290 gfx::Rect rect(child_size); | 290 gfx::Rect rect(child_size); |
291 RenderPassId id(1, 1); | 291 RenderPassId id(1, 1); |
292 scoped_ptr<RenderPass> pass = RenderPass::Create(); | 292 scoped_ptr<RenderPass> pass = RenderPass::Create(); |
293 pass->SetNew(id, rect, rect, gfx::Transform()); | 293 pass->SetNew(id, rect, rect, gfx::Transform()); |
294 | 294 |
295 CreateAndAppendTestSharedQuadState( | 295 CreateAndAppendTestSharedQuadState( |
(...skipping 10 matching lines...) Expand all Loading... |
306 | 306 |
307 SolidColorDrawQuad* bottom_color_quad = | 307 SolidColorDrawQuad* bottom_color_quad = |
308 pass->CreateAndAppendDrawQuad<SolidColorDrawQuad>(); | 308 pass->CreateAndAppendDrawQuad<SolidColorDrawQuad>(); |
309 bottom_color_quad->SetNew(pass->shared_quad_state_list.back(), | 309 bottom_color_quad->SetNew(pass->shared_quad_state_list.back(), |
310 gfx::Rect(0, 100, 100, 100), | 310 gfx::Rect(0, 100, 100, 100), |
311 gfx::Rect(0, 100, 100, 100), | 311 gfx::Rect(0, 100, 100, 100), |
312 SK_ColorGREEN, | 312 SK_ColorGREEN, |
313 force_anti_aliasing_off); | 313 force_anti_aliasing_off); |
314 | 314 |
315 scoped_ptr<DelegatedFrameData> delegated_frame_data(new DelegatedFrameData); | 315 scoped_ptr<DelegatedFrameData> delegated_frame_data(new DelegatedFrameData); |
316 delegated_frame_data->render_pass_list.push_back(pass.Pass()); | 316 delegated_frame_data->render_pass_list.push_back(std::move(pass)); |
317 | 317 |
318 scoped_ptr<CompositorFrame> child_frame(new CompositorFrame); | 318 scoped_ptr<CompositorFrame> child_frame(new CompositorFrame); |
319 child_frame->delegated_frame_data = delegated_frame_data.Pass(); | 319 child_frame->delegated_frame_data = std::move(delegated_frame_data); |
320 | 320 |
321 factory_.SubmitCompositorFrame(right_child_id, child_frame.Pass(), | 321 factory_.SubmitCompositorFrame(right_child_id, std::move(child_frame), |
322 SurfaceFactory::DrawCallback()); | 322 SurfaceFactory::DrawCallback()); |
323 } | 323 } |
324 | 324 |
325 EmptySurfaceAggregatorClient surface_aggregator_client; | 325 EmptySurfaceAggregatorClient surface_aggregator_client; |
326 SurfaceAggregator aggregator(&surface_aggregator_client, &manager_, | 326 SurfaceAggregator aggregator(&surface_aggregator_client, &manager_, |
327 resource_provider_.get(), true); | 327 resource_provider_.get(), true); |
328 scoped_ptr<CompositorFrame> aggregated_frame = | 328 scoped_ptr<CompositorFrame> aggregated_frame = |
329 aggregator.Aggregate(root_surface_id); | 329 aggregator.Aggregate(root_surface_id); |
330 | 330 |
331 bool discard_alpha = false; | 331 bool discard_alpha = false; |
332 ExactPixelComparator pixel_comparator(discard_alpha); | 332 ExactPixelComparator pixel_comparator(discard_alpha); |
333 RenderPassList* pass_list = | 333 RenderPassList* pass_list = |
334 &aggregated_frame->delegated_frame_data->render_pass_list; | 334 &aggregated_frame->delegated_frame_data->render_pass_list; |
335 EXPECT_TRUE(RunPixelTest( | 335 EXPECT_TRUE(RunPixelTest( |
336 pass_list, | 336 pass_list, |
337 base::FilePath(FILE_PATH_LITERAL("four_blue_green_checkers.png")), | 337 base::FilePath(FILE_PATH_LITERAL("four_blue_green_checkers.png")), |
338 pixel_comparator)); | 338 pixel_comparator)); |
339 | 339 |
340 factory_.Destroy(root_surface_id); | 340 factory_.Destroy(root_surface_id); |
341 factory_.Destroy(left_child_id); | 341 factory_.Destroy(left_child_id); |
342 factory_.Destroy(right_child_id); | 342 factory_.Destroy(right_child_id); |
343 } | 343 } |
344 | 344 |
345 } // namespace | 345 } // namespace |
346 } // namespace cc | 346 } // namespace cc |
347 | 347 |
348 #endif // !defined(OS_ANDROID) | 348 #endif // !defined(OS_ANDROID) |
OLD | NEW |