| 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 390 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 401 force_anti_aliasing_off); | 401 force_anti_aliasing_off); |
| 402 | 402 |
| 403 SolidColorDrawQuad* right_quad = | 403 SolidColorDrawQuad* right_quad = |
| 404 render_pass->CreateAndAppendDrawQuad<SolidColorDrawQuad>(); | 404 render_pass->CreateAndAppendDrawQuad<SolidColorDrawQuad>(); |
| 405 right_quad->SetNew(shared_quad_state, right, right, | 405 right_quad->SetNew(shared_quad_state, right, right, |
| 406 colors[i % kNumColors], force_anti_aliasing_off); | 406 colors[i % kNumColors], force_anti_aliasing_off); |
| 407 } | 407 } |
| 408 } | 408 } |
| 409 } | 409 } |
| 410 | 410 |
| 411 // TODO(danakj): crbug.com/455931 | |
| 412 static ResourceProvider::ResourceId ValidateResource( | |
| 413 ResourceProvider* provider, | |
| 414 ResourceProvider::ResourceId id) { | |
| 415 provider->ValidateResource(id); | |
| 416 return id; | |
| 417 } | |
| 418 | |
| 419 void DelegatedRendererLayerImpl::AppendRenderPassQuads( | 411 void DelegatedRendererLayerImpl::AppendRenderPassQuads( |
| 420 RenderPass* render_pass, | 412 RenderPass* render_pass, |
| 421 const RenderPass* delegated_render_pass, | 413 const RenderPass* delegated_render_pass, |
| 422 const gfx::Size& frame_size) const { | 414 const gfx::Size& frame_size) const { |
| 423 const SharedQuadState* delegated_shared_quad_state = nullptr; | 415 const SharedQuadState* delegated_shared_quad_state = nullptr; |
| 424 SharedQuadState* output_shared_quad_state = nullptr; | 416 SharedQuadState* output_shared_quad_state = nullptr; |
| 425 | 417 |
| 426 gfx::Transform delegated_frame_to_target_transform = draw_transform(); | 418 gfx::Transform delegated_frame_to_target_transform = draw_transform(); |
| 427 delegated_frame_to_target_transform.Scale(inverse_device_scale_factor_, | 419 delegated_frame_to_target_transform.Scale(inverse_device_scale_factor_, |
| 428 inverse_device_scale_factor_); | 420 inverse_device_scale_factor_); |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 480 occlusion_in_quad_space.GetUnoccludedContentRect( | 472 occlusion_in_quad_space.GetUnoccludedContentRect( |
| 481 delegated_quad->visible_rect); | 473 delegated_quad->visible_rect); |
| 482 | 474 |
| 483 if (quad_visible_rect.IsEmpty()) | 475 if (quad_visible_rect.IsEmpty()) |
| 484 continue; | 476 continue; |
| 485 | 477 |
| 486 if (delegated_quad->material != DrawQuad::RENDER_PASS) { | 478 if (delegated_quad->material != DrawQuad::RENDER_PASS) { |
| 487 DrawQuad* output_quad = render_pass->CopyFromAndAppendDrawQuad( | 479 DrawQuad* output_quad = render_pass->CopyFromAndAppendDrawQuad( |
| 488 delegated_quad, output_shared_quad_state); | 480 delegated_quad, output_shared_quad_state); |
| 489 output_quad->visible_rect = quad_visible_rect; | 481 output_quad->visible_rect = quad_visible_rect; |
| 490 // TODO(danakj): crbug.com/455931 | 482 ValidateQuadResources(output_quad); |
| 491 output_quad->IterateResources(base::Bind( | |
| 492 &ValidateResource, layer_tree_impl()->resource_provider())); | |
| 493 } else { | 483 } else { |
| 494 RenderPassId delegated_contributing_render_pass_id = | 484 RenderPassId delegated_contributing_render_pass_id = |
| 495 RenderPassDrawQuad::MaterialCast(delegated_quad)->render_pass_id; | 485 RenderPassDrawQuad::MaterialCast(delegated_quad)->render_pass_id; |
| 496 RenderPassId output_contributing_render_pass_id(-1, -1); | 486 RenderPassId output_contributing_render_pass_id(-1, -1); |
| 497 | 487 |
| 498 bool present = | 488 bool present = |
| 499 ConvertDelegatedRenderPassId(delegated_contributing_render_pass_id, | 489 ConvertDelegatedRenderPassId(delegated_contributing_render_pass_id, |
| 500 &output_contributing_render_pass_id); | 490 &output_contributing_render_pass_id); |
| 501 // |present| being false means the child compositor sent an invalid frame. | 491 // |present| being false means the child compositor sent an invalid frame. |
| 502 DCHECK(present); | 492 DCHECK(present); |
| 503 DCHECK(output_contributing_render_pass_id != render_pass->id); | 493 DCHECK(output_contributing_render_pass_id != render_pass->id); |
| 504 | 494 |
| 505 RenderPassDrawQuad* output_quad = | 495 RenderPassDrawQuad* output_quad = |
| 506 render_pass->CopyFromAndAppendRenderPassDrawQuad( | 496 render_pass->CopyFromAndAppendRenderPassDrawQuad( |
| 507 RenderPassDrawQuad::MaterialCast(delegated_quad), | 497 RenderPassDrawQuad::MaterialCast(delegated_quad), |
| 508 output_shared_quad_state, output_contributing_render_pass_id); | 498 output_shared_quad_state, output_contributing_render_pass_id); |
| 509 output_quad->visible_rect = quad_visible_rect; | 499 output_quad->visible_rect = quad_visible_rect; |
| 510 // TODO(danakj): crbug.com/455931 | 500 ValidateQuadResources(output_quad); |
| 511 output_quad->IterateResources(base::Bind( | |
| 512 &ValidateResource, layer_tree_impl()->resource_provider())); | |
| 513 } | 501 } |
| 514 } | 502 } |
| 515 } | 503 } |
| 516 | 504 |
| 517 const char* DelegatedRendererLayerImpl::LayerTypeAsString() const { | 505 const char* DelegatedRendererLayerImpl::LayerTypeAsString() const { |
| 518 return "cc::DelegatedRendererLayerImpl"; | 506 return "cc::DelegatedRendererLayerImpl"; |
| 519 } | 507 } |
| 520 | 508 |
| 521 void DelegatedRendererLayerImpl::ClearChildId() { | 509 void DelegatedRendererLayerImpl::ClearChildId() { |
| 522 if (!child_id_) | 510 if (!child_id_) |
| 523 return; | 511 return; |
| 524 | 512 |
| 525 if (own_child_id_) { | 513 if (own_child_id_) { |
| 526 ResourceProvider* provider = layer_tree_impl()->resource_provider(); | 514 ResourceProvider* provider = layer_tree_impl()->resource_provider(); |
| 527 provider->DestroyChild(child_id_); | 515 provider->DestroyChild(child_id_); |
| 528 } | 516 } |
| 529 | 517 |
| 530 resources_.clear(); | 518 resources_.clear(); |
| 531 child_id_ = 0; | 519 child_id_ = 0; |
| 532 } | 520 } |
| 533 | 521 |
| 534 } // namespace cc | 522 } // namespace cc |
| OLD | NEW |