Chromium Code Reviews| 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/surfaces/surface_aggregator.h" | 5 #include "cc/surfaces/surface_aggregator.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/containers/hash_tables.h" | 8 #include "base/containers/hash_tables.h" |
| 9 #include "base/debug/trace_event.h" | 9 #include "base/debug/trace_event.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 181 surface->TakeCopyOutputRequests(©_requests); | 181 surface->TakeCopyOutputRequests(©_requests); |
| 182 | 182 |
| 183 bool merge_pass = copy_requests.empty(); | 183 bool merge_pass = copy_requests.empty(); |
| 184 | 184 |
| 185 const RenderPassList& referenced_passes = render_pass_list; | 185 const RenderPassList& referenced_passes = render_pass_list; |
| 186 size_t passes_to_copy = | 186 size_t passes_to_copy = |
| 187 merge_pass ? referenced_passes.size() - 1 : referenced_passes.size(); | 187 merge_pass ? referenced_passes.size() - 1 : referenced_passes.size(); |
| 188 for (size_t j = 0; j < passes_to_copy; ++j) { | 188 for (size_t j = 0; j < passes_to_copy; ++j) { |
| 189 const RenderPass& source = *referenced_passes[j]; | 189 const RenderPass& source = *referenced_passes[j]; |
| 190 | 190 |
| 191 scoped_ptr<RenderPass> copy_pass(RenderPass::Create()); | 191 size_t sqs_size = source.shared_quad_state_list.size(); |
| 192 size_t dq_size = source.quad_list.size(); | |
| 193 scoped_ptr<RenderPass> copy_pass(RenderPass::Create(sqs_size, dq_size)); | |
| 192 | 194 |
| 193 RenderPassId remapped_pass_id = RemapPassId(source.id, surface_id); | 195 RenderPassId remapped_pass_id = RemapPassId(source.id, surface_id); |
| 194 | 196 |
| 195 copy_pass->SetAll(remapped_pass_id, | 197 copy_pass->SetAll(remapped_pass_id, |
| 196 source.output_rect, | 198 source.output_rect, |
| 197 source.damage_rect, | 199 source.damage_rect, |
| 198 source.transform_to_root_target, | 200 source.transform_to_root_target, |
| 199 source.has_transparent_background); | 201 source.has_transparent_background); |
| 200 | 202 |
| 201 // Contributing passes aggregated in to the pass list need to take the | 203 // Contributing passes aggregated in to the pass list need to take the |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 277 } | 279 } |
| 278 | 280 |
| 279 void SurfaceAggregator::CopyQuadsToPass( | 281 void SurfaceAggregator::CopyQuadsToPass( |
| 280 const QuadList& source_quad_list, | 282 const QuadList& source_quad_list, |
| 281 const SharedQuadStateList& source_shared_quad_state_list, | 283 const SharedQuadStateList& source_shared_quad_state_list, |
| 282 const gfx::Transform& content_to_target_transform, | 284 const gfx::Transform& content_to_target_transform, |
| 283 RenderPass* dest_pass, | 285 RenderPass* dest_pass, |
| 284 SurfaceId surface_id) { | 286 SurfaceId surface_id) { |
| 285 const SharedQuadState* last_copied_source_shared_quad_state = NULL; | 287 const SharedQuadState* last_copied_source_shared_quad_state = NULL; |
| 286 | 288 |
| 287 size_t sqs_i = 0; | 289 SharedQuadStateList::ConstIterator sqs_iter = |
| 290 source_shared_quad_state_list.begin(); | |
| 288 for (QuadList::ConstIterator iter = source_quad_list.begin(); | 291 for (QuadList::ConstIterator iter = source_quad_list.begin(); |
| 289 iter != source_quad_list.end(); | 292 iter != source_quad_list.end(); |
| 290 ++iter) { | 293 ++iter) { |
| 291 const DrawQuad* quad = &*iter; | 294 const DrawQuad* quad = &*iter; |
| 292 while (quad->shared_quad_state != source_shared_quad_state_list[sqs_i]) { | 295 while (quad->shared_quad_state != &(*sqs_iter)) { |
|
danakj
2014/09/26 20:40:55
&*?
weiliangc
2014/10/01 23:02:00
Done.
| |
| 293 ++sqs_i; | 296 ++sqs_iter; |
| 294 DCHECK_LT(sqs_i, source_shared_quad_state_list.size()); | 297 DCHECK(sqs_iter != source_shared_quad_state_list.end()); |
| 295 } | 298 } |
| 296 DCHECK_EQ(quad->shared_quad_state, source_shared_quad_state_list[sqs_i]); | 299 DCHECK_EQ(quad->shared_quad_state, &(*sqs_iter)); |
|
danakj
2014/09/26 20:40:55
&*?
weiliangc
2014/10/01 23:02:00
Done.
| |
| 297 | 300 |
| 298 if (quad->material == DrawQuad::SURFACE_CONTENT) { | 301 if (quad->material == DrawQuad::SURFACE_CONTENT) { |
| 299 const SurfaceDrawQuad* surface_quad = SurfaceDrawQuad::MaterialCast(quad); | 302 const SurfaceDrawQuad* surface_quad = SurfaceDrawQuad::MaterialCast(quad); |
| 300 HandleSurfaceQuad(surface_quad, dest_pass); | 303 HandleSurfaceQuad(surface_quad, dest_pass); |
| 301 } else { | 304 } else { |
| 302 if (quad->shared_quad_state != last_copied_source_shared_quad_state) { | 305 if (quad->shared_quad_state != last_copied_source_shared_quad_state) { |
| 303 CopySharedQuadState( | 306 CopySharedQuadState( |
| 304 quad->shared_quad_state, content_to_target_transform, dest_pass); | 307 quad->shared_quad_state, content_to_target_transform, dest_pass); |
| 305 last_copied_source_shared_quad_state = quad->shared_quad_state; | 308 last_copied_source_shared_quad_state = quad->shared_quad_state; |
| 306 } | 309 } |
| (...skipping 14 matching lines...) Expand all Loading... | |
| 321 } | 324 } |
| 322 } | 325 } |
| 323 } | 326 } |
| 324 } | 327 } |
| 325 | 328 |
| 326 void SurfaceAggregator::CopyPasses(const RenderPassList& source_pass_list, | 329 void SurfaceAggregator::CopyPasses(const RenderPassList& source_pass_list, |
| 327 const Surface* surface) { | 330 const Surface* surface) { |
| 328 for (size_t i = 0; i < source_pass_list.size(); ++i) { | 331 for (size_t i = 0; i < source_pass_list.size(); ++i) { |
| 329 const RenderPass& source = *source_pass_list[i]; | 332 const RenderPass& source = *source_pass_list[i]; |
| 330 | 333 |
| 331 scoped_ptr<RenderPass> copy_pass(RenderPass::Create()); | 334 size_t sqs_size = source.shared_quad_state_list.size(); |
| 335 size_t dq_size = source.quad_list.size(); | |
| 336 scoped_ptr<RenderPass> copy_pass(RenderPass::Create(sqs_size, dq_size)); | |
| 332 | 337 |
| 333 RenderPassId remapped_pass_id = | 338 RenderPassId remapped_pass_id = |
| 334 RemapPassId(source.id, surface->surface_id()); | 339 RemapPassId(source.id, surface->surface_id()); |
| 335 | 340 |
| 336 copy_pass->SetAll(remapped_pass_id, | 341 copy_pass->SetAll(remapped_pass_id, |
| 337 source.output_rect, | 342 source.output_rect, |
| 338 DamageRectForSurface(surface, source), | 343 DamageRectForSurface(surface, source), |
| 339 source.transform_to_root_target, | 344 source.transform_to_root_target, |
| 340 source.has_transparent_background); | 345 source.has_transparent_background); |
| 341 | 346 |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 393 surface->TakeLatencyInfo(&frame->metadata.latency_info); | 398 surface->TakeLatencyInfo(&frame->metadata.latency_info); |
| 394 } | 399 } |
| 395 | 400 |
| 396 // TODO(jamesr): Aggregate all resource references into the returned frame's | 401 // TODO(jamesr): Aggregate all resource references into the returned frame's |
| 397 // resource list. | 402 // resource list. |
| 398 | 403 |
| 399 return frame.Pass(); | 404 return frame.Pass(); |
| 400 } | 405 } |
| 401 | 406 |
| 402 } // namespace cc | 407 } // namespace cc |
| OLD | NEW |