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