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