| 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 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 80 force_anti_aliasing_off); | 80 force_anti_aliasing_off); |
| 81 | 81 |
| 82 scoped_ptr<DelegatedFrameData> delegated_frame_data(new DelegatedFrameData); | 82 scoped_ptr<DelegatedFrameData> delegated_frame_data(new DelegatedFrameData); |
| 83 delegated_frame_data->render_pass_list.push_back(pass.Pass()); | 83 delegated_frame_data->render_pass_list.push_back(pass.Pass()); |
| 84 | 84 |
| 85 scoped_ptr<CompositorFrame> root_frame(new CompositorFrame); | 85 scoped_ptr<CompositorFrame> root_frame(new CompositorFrame); |
| 86 root_frame->delegated_frame_data = delegated_frame_data.Pass(); | 86 root_frame->delegated_frame_data = delegated_frame_data.Pass(); |
| 87 | 87 |
| 88 SurfaceId root_surface_id = allocator_.GenerateId(); | 88 SurfaceId root_surface_id = allocator_.GenerateId(); |
| 89 factory_.Create(root_surface_id, device_viewport_size_); | 89 factory_.Create(root_surface_id, device_viewport_size_); |
| 90 factory_.SubmitFrame(root_surface_id, root_frame.Pass()); | 90 factory_.SubmitFrame(root_surface_id, root_frame.Pass(), base::Closure()); |
| 91 | 91 |
| 92 SurfaceAggregator aggregator(&manager_, resource_provider_.get()); | 92 SurfaceAggregator aggregator(&manager_, resource_provider_.get()); |
| 93 std::set<SurfaceId> surface_set; | 93 std::set<SurfaceId> surface_set; |
| 94 scoped_ptr<CompositorFrame> aggregated_frame = | 94 scoped_ptr<CompositorFrame> aggregated_frame = |
| 95 aggregator.Aggregate(root_surface_id, &surface_set); | 95 aggregator.Aggregate(root_surface_id, &surface_set); |
| 96 factory_.Destroy(root_surface_id); | 96 factory_.Destroy(root_surface_id); |
| 97 | 97 |
| 98 bool discard_alpha = false; | 98 bool discard_alpha = false; |
| 99 ExactPixelComparator pixel_comparator(discard_alpha); | 99 ExactPixelComparator pixel_comparator(discard_alpha); |
| 100 RenderPassList* pass_list = | 100 RenderPassList* pass_list = |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 135 rect, | 135 rect, |
| 136 SK_ColorYELLOW, | 136 SK_ColorYELLOW, |
| 137 force_anti_aliasing_off); | 137 force_anti_aliasing_off); |
| 138 | 138 |
| 139 scoped_ptr<DelegatedFrameData> delegated_frame_data(new DelegatedFrameData); | 139 scoped_ptr<DelegatedFrameData> delegated_frame_data(new DelegatedFrameData); |
| 140 delegated_frame_data->render_pass_list.push_back(pass.Pass()); | 140 delegated_frame_data->render_pass_list.push_back(pass.Pass()); |
| 141 | 141 |
| 142 scoped_ptr<CompositorFrame> root_frame(new CompositorFrame); | 142 scoped_ptr<CompositorFrame> root_frame(new CompositorFrame); |
| 143 root_frame->delegated_frame_data = delegated_frame_data.Pass(); | 143 root_frame->delegated_frame_data = delegated_frame_data.Pass(); |
| 144 | 144 |
| 145 factory_.SubmitFrame(root_surface_id, root_frame.Pass()); | 145 factory_.SubmitFrame(root_surface_id, root_frame.Pass(), base::Closure()); |
| 146 } | 146 } |
| 147 | 147 |
| 148 { | 148 { |
| 149 gfx::Rect rect(child_size); | 149 gfx::Rect rect(child_size); |
| 150 RenderPass::Id id(1, 1); | 150 RenderPass::Id id(1, 1); |
| 151 scoped_ptr<RenderPass> pass = RenderPass::Create(); | 151 scoped_ptr<RenderPass> pass = RenderPass::Create(); |
| 152 pass->SetNew(id, rect, rect, gfx::Transform()); | 152 pass->SetNew(id, rect, rect, gfx::Transform()); |
| 153 | 153 |
| 154 CreateAndAppendTestSharedQuadState( | 154 CreateAndAppendTestSharedQuadState( |
| 155 pass.get(), gfx::Transform(), child_size); | 155 pass.get(), gfx::Transform(), child_size); |
| 156 | 156 |
| 157 SolidColorDrawQuad* color_quad = | 157 SolidColorDrawQuad* color_quad = |
| 158 pass->CreateAndAppendDrawQuad<SolidColorDrawQuad>(); | 158 pass->CreateAndAppendDrawQuad<SolidColorDrawQuad>(); |
| 159 bool force_anti_aliasing_off = false; | 159 bool force_anti_aliasing_off = false; |
| 160 color_quad->SetNew(pass->shared_quad_state_list.back(), | 160 color_quad->SetNew(pass->shared_quad_state_list.back(), |
| 161 rect, | 161 rect, |
| 162 rect, | 162 rect, |
| 163 SK_ColorBLUE, | 163 SK_ColorBLUE, |
| 164 force_anti_aliasing_off); | 164 force_anti_aliasing_off); |
| 165 | 165 |
| 166 scoped_ptr<DelegatedFrameData> delegated_frame_data(new DelegatedFrameData); | 166 scoped_ptr<DelegatedFrameData> delegated_frame_data(new DelegatedFrameData); |
| 167 delegated_frame_data->render_pass_list.push_back(pass.Pass()); | 167 delegated_frame_data->render_pass_list.push_back(pass.Pass()); |
| 168 | 168 |
| 169 scoped_ptr<CompositorFrame> child_frame(new CompositorFrame); | 169 scoped_ptr<CompositorFrame> child_frame(new CompositorFrame); |
| 170 child_frame->delegated_frame_data = delegated_frame_data.Pass(); | 170 child_frame->delegated_frame_data = delegated_frame_data.Pass(); |
| 171 | 171 |
| 172 factory_.SubmitFrame(child_surface_id, child_frame.Pass()); | 172 factory_.SubmitFrame(child_surface_id, child_frame.Pass(), base::Closure()); |
| 173 } | 173 } |
| 174 | 174 |
| 175 SurfaceAggregator aggregator(&manager_, resource_provider_.get()); | 175 SurfaceAggregator aggregator(&manager_, resource_provider_.get()); |
| 176 std::set<SurfaceId> surface_set; | 176 std::set<SurfaceId> surface_set; |
| 177 scoped_ptr<CompositorFrame> aggregated_frame = | 177 scoped_ptr<CompositorFrame> aggregated_frame = |
| 178 aggregator.Aggregate(root_surface_id, &surface_set); | 178 aggregator.Aggregate(root_surface_id, &surface_set); |
| 179 | 179 |
| 180 bool discard_alpha = false; | 180 bool discard_alpha = false; |
| 181 ExactPixelComparator pixel_comparator(discard_alpha); | 181 ExactPixelComparator pixel_comparator(discard_alpha); |
| 182 RenderPassList* pass_list = | 182 RenderPassList* pass_list = |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 233 gfx::Rect(child_size), | 233 gfx::Rect(child_size), |
| 234 gfx::Rect(child_size), | 234 gfx::Rect(child_size), |
| 235 right_child_id); | 235 right_child_id); |
| 236 | 236 |
| 237 scoped_ptr<DelegatedFrameData> delegated_frame_data(new DelegatedFrameData); | 237 scoped_ptr<DelegatedFrameData> delegated_frame_data(new DelegatedFrameData); |
| 238 delegated_frame_data->render_pass_list.push_back(pass.Pass()); | 238 delegated_frame_data->render_pass_list.push_back(pass.Pass()); |
| 239 | 239 |
| 240 scoped_ptr<CompositorFrame> root_frame(new CompositorFrame); | 240 scoped_ptr<CompositorFrame> root_frame(new CompositorFrame); |
| 241 root_frame->delegated_frame_data = delegated_frame_data.Pass(); | 241 root_frame->delegated_frame_data = delegated_frame_data.Pass(); |
| 242 | 242 |
| 243 factory_.SubmitFrame(root_surface_id, root_frame.Pass()); | 243 factory_.SubmitFrame(root_surface_id, root_frame.Pass(), base::Closure()); |
| 244 } | 244 } |
| 245 | 245 |
| 246 { | 246 { |
| 247 gfx::Rect rect(child_size); | 247 gfx::Rect rect(child_size); |
| 248 RenderPass::Id id(1, 1); | 248 RenderPass::Id id(1, 1); |
| 249 scoped_ptr<RenderPass> pass = RenderPass::Create(); | 249 scoped_ptr<RenderPass> pass = RenderPass::Create(); |
| 250 pass->SetNew(id, rect, rect, gfx::Transform()); | 250 pass->SetNew(id, rect, rect, gfx::Transform()); |
| 251 | 251 |
| 252 CreateAndAppendTestSharedQuadState( | 252 CreateAndAppendTestSharedQuadState( |
| 253 pass.get(), gfx::Transform(), child_size); | 253 pass.get(), gfx::Transform(), child_size); |
| (...skipping 14 matching lines...) Expand all Loading... |
| 268 gfx::Rect(0, 100, 100, 100), | 268 gfx::Rect(0, 100, 100, 100), |
| 269 SK_ColorBLUE, | 269 SK_ColorBLUE, |
| 270 force_anti_aliasing_off); | 270 force_anti_aliasing_off); |
| 271 | 271 |
| 272 scoped_ptr<DelegatedFrameData> delegated_frame_data(new DelegatedFrameData); | 272 scoped_ptr<DelegatedFrameData> delegated_frame_data(new DelegatedFrameData); |
| 273 delegated_frame_data->render_pass_list.push_back(pass.Pass()); | 273 delegated_frame_data->render_pass_list.push_back(pass.Pass()); |
| 274 | 274 |
| 275 scoped_ptr<CompositorFrame> child_frame(new CompositorFrame); | 275 scoped_ptr<CompositorFrame> child_frame(new CompositorFrame); |
| 276 child_frame->delegated_frame_data = delegated_frame_data.Pass(); | 276 child_frame->delegated_frame_data = delegated_frame_data.Pass(); |
| 277 | 277 |
| 278 factory_.SubmitFrame(left_child_id, child_frame.Pass()); | 278 factory_.SubmitFrame(left_child_id, child_frame.Pass(), base::Closure()); |
| 279 } | 279 } |
| 280 | 280 |
| 281 { | 281 { |
| 282 gfx::Rect rect(child_size); | 282 gfx::Rect rect(child_size); |
| 283 RenderPass::Id id(1, 1); | 283 RenderPass::Id id(1, 1); |
| 284 scoped_ptr<RenderPass> pass = RenderPass::Create(); | 284 scoped_ptr<RenderPass> pass = RenderPass::Create(); |
| 285 pass->SetNew(id, rect, rect, gfx::Transform()); | 285 pass->SetNew(id, rect, rect, gfx::Transform()); |
| 286 | 286 |
| 287 CreateAndAppendTestSharedQuadState( | 287 CreateAndAppendTestSharedQuadState( |
| 288 pass.get(), gfx::Transform(), child_size); | 288 pass.get(), gfx::Transform(), child_size); |
| (...skipping 14 matching lines...) Expand all Loading... |
| 303 gfx::Rect(0, 100, 100, 100), | 303 gfx::Rect(0, 100, 100, 100), |
| 304 SK_ColorGREEN, | 304 SK_ColorGREEN, |
| 305 force_anti_aliasing_off); | 305 force_anti_aliasing_off); |
| 306 | 306 |
| 307 scoped_ptr<DelegatedFrameData> delegated_frame_data(new DelegatedFrameData); | 307 scoped_ptr<DelegatedFrameData> delegated_frame_data(new DelegatedFrameData); |
| 308 delegated_frame_data->render_pass_list.push_back(pass.Pass()); | 308 delegated_frame_data->render_pass_list.push_back(pass.Pass()); |
| 309 | 309 |
| 310 scoped_ptr<CompositorFrame> child_frame(new CompositorFrame); | 310 scoped_ptr<CompositorFrame> child_frame(new CompositorFrame); |
| 311 child_frame->delegated_frame_data = delegated_frame_data.Pass(); | 311 child_frame->delegated_frame_data = delegated_frame_data.Pass(); |
| 312 | 312 |
| 313 factory_.SubmitFrame(right_child_id, child_frame.Pass()); | 313 factory_.SubmitFrame(right_child_id, child_frame.Pass(), base::Closure()); |
| 314 } | 314 } |
| 315 | 315 |
| 316 SurfaceAggregator aggregator(&manager_, resource_provider_.get()); | 316 SurfaceAggregator aggregator(&manager_, resource_provider_.get()); |
| 317 std::set<SurfaceId> surface_set; | 317 std::set<SurfaceId> surface_set; |
| 318 scoped_ptr<CompositorFrame> aggregated_frame = | 318 scoped_ptr<CompositorFrame> aggregated_frame = |
| 319 aggregator.Aggregate(root_surface_id, &surface_set); | 319 aggregator.Aggregate(root_surface_id, &surface_set); |
| 320 | 320 |
| 321 bool discard_alpha = false; | 321 bool discard_alpha = false; |
| 322 ExactPixelComparator pixel_comparator(discard_alpha); | 322 ExactPixelComparator pixel_comparator(discard_alpha); |
| 323 RenderPassList* pass_list = | 323 RenderPassList* pass_list = |
| 324 &aggregated_frame->delegated_frame_data->render_pass_list; | 324 &aggregated_frame->delegated_frame_data->render_pass_list; |
| 325 EXPECT_TRUE(RunPixelTest( | 325 EXPECT_TRUE(RunPixelTest( |
| 326 pass_list, | 326 pass_list, |
| 327 base::FilePath(FILE_PATH_LITERAL("four_blue_green_checkers.png")), | 327 base::FilePath(FILE_PATH_LITERAL("four_blue_green_checkers.png")), |
| 328 pixel_comparator)); | 328 pixel_comparator)); |
| 329 | 329 |
| 330 factory_.Destroy(root_surface_id); | 330 factory_.Destroy(root_surface_id); |
| 331 factory_.Destroy(left_child_id); | 331 factory_.Destroy(left_child_id); |
| 332 factory_.Destroy(right_child_id); | 332 factory_.Destroy(right_child_id); |
| 333 } | 333 } |
| 334 | 334 |
| 335 } // namespace | 335 } // namespace |
| 336 } // namespace cc | 336 } // namespace cc |
| 337 | 337 |
| 338 #endif // !defined(OS_ANDROID) | 338 #endif // !defined(OS_ANDROID) |
| OLD | NEW |