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 379 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
390 const OcclusionTracker<LayerImpl>& occlusion_tracker, | 390 const OcclusionTracker<LayerImpl>& occlusion_tracker, |
391 AppendQuadsData* append_quads_data, | 391 AppendQuadsData* append_quads_data, |
392 const RenderPass* delegated_render_pass, | 392 const RenderPass* delegated_render_pass, |
393 const gfx::Size& frame_size) const { | 393 const gfx::Size& frame_size) const { |
394 const SharedQuadState* delegated_shared_quad_state = NULL; | 394 const SharedQuadState* delegated_shared_quad_state = NULL; |
395 SharedQuadState* output_shared_quad_state = NULL; | 395 SharedQuadState* output_shared_quad_state = NULL; |
396 | 396 |
397 for (size_t i = 0; i < delegated_render_pass->quad_list.size(); ++i) { | 397 for (size_t i = 0; i < delegated_render_pass->quad_list.size(); ++i) { |
398 const DrawQuad* delegated_quad = delegated_render_pass->quad_list[i]; | 398 const DrawQuad* delegated_quad = delegated_render_pass->quad_list[i]; |
399 | 399 |
| 400 bool is_root_delegated_render_pass = |
| 401 delegated_render_pass == render_passes_in_draw_order_.back(); |
| 402 |
400 if (delegated_quad->shared_quad_state != delegated_shared_quad_state) { | 403 if (delegated_quad->shared_quad_state != delegated_shared_quad_state) { |
401 delegated_shared_quad_state = delegated_quad->shared_quad_state; | 404 delegated_shared_quad_state = delegated_quad->shared_quad_state; |
402 output_shared_quad_state = render_pass->CreateAndAppendSharedQuadState(); | 405 output_shared_quad_state = render_pass->CreateAndAppendSharedQuadState(); |
403 output_shared_quad_state->CopyFrom(delegated_shared_quad_state); | 406 output_shared_quad_state->CopyFrom(delegated_shared_quad_state); |
404 | 407 |
405 bool is_root_delegated_render_pass = | |
406 delegated_render_pass == render_passes_in_draw_order_.back(); | |
407 if (is_root_delegated_render_pass) { | 408 if (is_root_delegated_render_pass) { |
408 gfx::Transform delegated_frame_to_target_transform = draw_transform(); | 409 gfx::Transform delegated_frame_to_target_transform = draw_transform(); |
409 delegated_frame_to_target_transform.Scale(inverse_device_scale_factor_, | 410 delegated_frame_to_target_transform.Scale(inverse_device_scale_factor_, |
410 inverse_device_scale_factor_); | 411 inverse_device_scale_factor_); |
411 | 412 |
412 output_shared_quad_state->content_to_target_transform.ConcatTransform( | 413 output_shared_quad_state->content_to_target_transform.ConcatTransform( |
413 delegated_frame_to_target_transform); | 414 delegated_frame_to_target_transform); |
414 | 415 |
415 if (render_target() == this) { | 416 if (render_target() == this) { |
416 DCHECK(!is_clipped()); | 417 DCHECK(!is_clipped()); |
(...skipping 12 matching lines...) Expand all Loading... |
429 } | 430 } |
430 output_shared_quad_state->clip_rect = clip_rect; | 431 output_shared_quad_state->clip_rect = clip_rect; |
431 output_shared_quad_state->is_clipped = true; | 432 output_shared_quad_state->is_clipped = true; |
432 } | 433 } |
433 | 434 |
434 output_shared_quad_state->opacity *= draw_opacity(); | 435 output_shared_quad_state->opacity *= draw_opacity(); |
435 } | 436 } |
436 } | 437 } |
437 DCHECK(output_shared_quad_state); | 438 DCHECK(output_shared_quad_state); |
438 | 439 |
| 440 gfx::Transform quad_content_to_delegated_target_space = |
| 441 output_shared_quad_state->content_to_target_transform; |
| 442 if (!is_root_delegated_render_pass) { |
| 443 quad_content_to_delegated_target_space.ConcatTransform( |
| 444 render_pass->transform_to_root_target); |
| 445 quad_content_to_delegated_target_space.ConcatTransform(draw_transform()); |
| 446 } |
| 447 |
439 gfx::Rect quad_visible_rect = occlusion_tracker.UnoccludedContentRect( | 448 gfx::Rect quad_visible_rect = occlusion_tracker.UnoccludedContentRect( |
440 delegated_quad->visible_rect, | 449 delegated_quad->visible_rect, quad_content_to_delegated_target_space); |
441 output_shared_quad_state->content_to_target_transform); | 450 |
442 if (quad_visible_rect.IsEmpty()) | 451 if (quad_visible_rect.IsEmpty()) |
443 continue; | 452 continue; |
444 | 453 |
445 if (delegated_quad->material != DrawQuad::RENDER_PASS) { | 454 if (delegated_quad->material != DrawQuad::RENDER_PASS) { |
446 DrawQuad* output_quad = render_pass->CopyFromAndAppendDrawQuad( | 455 DrawQuad* output_quad = render_pass->CopyFromAndAppendDrawQuad( |
447 delegated_quad, output_shared_quad_state); | 456 delegated_quad, output_shared_quad_state); |
448 output_quad->visible_rect = quad_visible_rect; | 457 output_quad->visible_rect = quad_visible_rect; |
449 } else { | 458 } else { |
450 RenderPass::Id delegated_contributing_render_pass_id = | 459 RenderPass::Id delegated_contributing_render_pass_id = |
451 RenderPassDrawQuad::MaterialCast(delegated_quad)->render_pass_id; | 460 RenderPassDrawQuad::MaterialCast(delegated_quad)->render_pass_id; |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
483 if (own_child_id_) { | 492 if (own_child_id_) { |
484 ResourceProvider* provider = layer_tree_impl()->resource_provider(); | 493 ResourceProvider* provider = layer_tree_impl()->resource_provider(); |
485 provider->DestroyChild(child_id_); | 494 provider->DestroyChild(child_id_); |
486 } | 495 } |
487 | 496 |
488 resources_.clear(); | 497 resources_.clear(); |
489 child_id_ = 0; | 498 child_id_ = 0; |
490 } | 499 } |
491 | 500 |
492 } // namespace cc | 501 } // namespace cc |
OLD | NEW |