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/layers/delegated_renderer_layer_impl.h" | 5 #include "cc/layers/delegated_renderer_layer_impl.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 424 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
435 } | 435 } |
436 } | 436 } |
437 DCHECK(output_shared_quad_state); | 437 DCHECK(output_shared_quad_state); |
438 | 438 |
439 gfx::Rect quad_visible_rect = occlusion_tracker.UnoccludedContentRect( | 439 gfx::Rect quad_visible_rect = occlusion_tracker.UnoccludedContentRect( |
440 delegated_quad->visible_rect, | 440 delegated_quad->visible_rect, |
441 output_shared_quad_state->content_to_target_transform); | 441 output_shared_quad_state->content_to_target_transform); |
442 if (quad_visible_rect.IsEmpty()) | 442 if (quad_visible_rect.IsEmpty()) |
443 continue; | 443 continue; |
444 | 444 |
445 scoped_ptr<DrawQuad> output_quad; | |
446 if (delegated_quad->material != DrawQuad::RENDER_PASS) { | 445 if (delegated_quad->material != DrawQuad::RENDER_PASS) { |
447 output_quad = delegated_quad->Copy(output_shared_quad_state); | 446 DrawQuad* output_quad = render_pass->CopyFromAndAppendDrawQuad( |
| 447 delegated_quad, output_shared_quad_state); |
448 output_quad->visible_rect = quad_visible_rect; | 448 output_quad->visible_rect = quad_visible_rect; |
449 } else { | 449 } else { |
450 RenderPass::Id delegated_contributing_render_pass_id = | 450 RenderPass::Id delegated_contributing_render_pass_id = |
451 RenderPassDrawQuad::MaterialCast(delegated_quad)->render_pass_id; | 451 RenderPassDrawQuad::MaterialCast(delegated_quad)->render_pass_id; |
452 RenderPass::Id output_contributing_render_pass_id(-1, -1); | 452 RenderPass::Id output_contributing_render_pass_id(-1, -1); |
453 | 453 |
454 bool present = | 454 bool present = |
455 ConvertDelegatedRenderPassId(delegated_contributing_render_pass_id, | 455 ConvertDelegatedRenderPassId(delegated_contributing_render_pass_id, |
456 &output_contributing_render_pass_id); | 456 &output_contributing_render_pass_id); |
457 | 457 |
458 // The frame may have a RenderPassDrawQuad that points to a RenderPass not | 458 // The frame may have a RenderPassDrawQuad that points to a RenderPass not |
459 // part of the frame. Just ignore these quads. | 459 // part of the frame. Just ignore these quads. |
460 if (present) { | 460 if (present) { |
461 DCHECK(output_contributing_render_pass_id != | 461 DCHECK(output_contributing_render_pass_id != |
462 append_quads_data->render_pass_id); | 462 append_quads_data->render_pass_id); |
463 | 463 |
464 output_quad = RenderPassDrawQuad::MaterialCast(delegated_quad)->Copy( | 464 RenderPassDrawQuad* output_quad = |
465 output_shared_quad_state, | 465 render_pass->CopyFromAndAppendRenderPassDrawQuad( |
466 output_contributing_render_pass_id).PassAs<DrawQuad>(); | 466 RenderPassDrawQuad::MaterialCast(delegated_quad), |
| 467 output_shared_quad_state, |
| 468 output_contributing_render_pass_id); |
467 output_quad->visible_rect = quad_visible_rect; | 469 output_quad->visible_rect = quad_visible_rect; |
468 } | 470 } |
469 } | 471 } |
470 | |
471 if (output_quad) | |
472 render_pass->quad_list.push_back(output_quad.Pass()); | |
473 } | 472 } |
474 } | 473 } |
475 | 474 |
476 const char* DelegatedRendererLayerImpl::LayerTypeAsString() const { | 475 const char* DelegatedRendererLayerImpl::LayerTypeAsString() const { |
477 return "cc::DelegatedRendererLayerImpl"; | 476 return "cc::DelegatedRendererLayerImpl"; |
478 } | 477 } |
479 | 478 |
480 void DelegatedRendererLayerImpl::ClearChildId() { | 479 void DelegatedRendererLayerImpl::ClearChildId() { |
481 if (!child_id_) | 480 if (!child_id_) |
482 return; | 481 return; |
483 | 482 |
484 if (own_child_id_) { | 483 if (own_child_id_) { |
485 ResourceProvider* provider = layer_tree_impl()->resource_provider(); | 484 ResourceProvider* provider = layer_tree_impl()->resource_provider(); |
486 provider->DestroyChild(child_id_); | 485 provider->DestroyChild(child_id_); |
487 } | 486 } |
488 | 487 |
489 resources_.clear(); | 488 resources_.clear(); |
490 child_id_ = 0; | 489 child_id_ = 0; |
491 } | 490 } |
492 | 491 |
493 } // namespace cc | 492 } // namespace cc |
OLD | NEW |