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 411 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
422 inverse_device_scale_factor_); | 422 inverse_device_scale_factor_); |
423 bool is_root_delegated_render_pass = | 423 bool is_root_delegated_render_pass = |
424 delegated_render_pass == render_passes_in_draw_order_.back(); | 424 delegated_render_pass == render_passes_in_draw_order_.back(); |
425 for (const auto& delegated_quad : delegated_render_pass->quad_list) { | 425 for (const auto& delegated_quad : delegated_render_pass->quad_list) { |
426 if (delegated_quad->shared_quad_state != delegated_shared_quad_state) { | 426 if (delegated_quad->shared_quad_state != delegated_shared_quad_state) { |
427 delegated_shared_quad_state = delegated_quad->shared_quad_state; | 427 delegated_shared_quad_state = delegated_quad->shared_quad_state; |
428 output_shared_quad_state = render_pass->CreateAndAppendSharedQuadState(); | 428 output_shared_quad_state = render_pass->CreateAndAppendSharedQuadState(); |
429 output_shared_quad_state->CopyFrom(delegated_shared_quad_state); | 429 output_shared_quad_state->CopyFrom(delegated_shared_quad_state); |
430 | 430 |
431 if (is_root_delegated_render_pass) { | 431 if (is_root_delegated_render_pass) { |
432 output_shared_quad_state->content_to_target_transform.ConcatTransform( | 432 output_shared_quad_state->quad_to_target_transform.ConcatTransform( |
433 delegated_frame_to_target_transform); | 433 delegated_frame_to_target_transform); |
434 | 434 |
435 if (render_target() == this) { | 435 if (render_target() == this) { |
436 DCHECK(!is_clipped()); | 436 DCHECK(!is_clipped()); |
437 DCHECK(render_surface()); | 437 DCHECK(render_surface()); |
438 DCHECK_EQ(0u, num_unclipped_descendants()); | 438 DCHECK_EQ(0u, num_unclipped_descendants()); |
439 output_shared_quad_state->clip_rect = | 439 output_shared_quad_state->clip_rect = |
440 MathUtil::MapEnclosingClippedRect( | 440 MathUtil::MapEnclosingClippedRect( |
441 delegated_frame_to_target_transform, | 441 delegated_frame_to_target_transform, |
442 output_shared_quad_state->clip_rect); | 442 output_shared_quad_state->clip_rect); |
443 } else { | 443 } else { |
444 gfx::Rect clip_rect = drawable_content_rect(); | 444 gfx::Rect clip_rect = drawable_content_rect(); |
445 if (output_shared_quad_state->is_clipped) { | 445 if (output_shared_quad_state->is_clipped) { |
446 clip_rect.Intersect(MathUtil::MapEnclosingClippedRect( | 446 clip_rect.Intersect(MathUtil::MapEnclosingClippedRect( |
447 delegated_frame_to_target_transform, | 447 delegated_frame_to_target_transform, |
448 output_shared_quad_state->clip_rect)); | 448 output_shared_quad_state->clip_rect)); |
449 } | 449 } |
450 output_shared_quad_state->clip_rect = clip_rect; | 450 output_shared_quad_state->clip_rect = clip_rect; |
451 output_shared_quad_state->is_clipped = true; | 451 output_shared_quad_state->is_clipped = true; |
452 } | 452 } |
453 | 453 |
454 output_shared_quad_state->opacity *= draw_opacity(); | 454 output_shared_quad_state->opacity *= draw_opacity(); |
455 } | 455 } |
456 } | 456 } |
457 DCHECK(output_shared_quad_state); | 457 DCHECK(output_shared_quad_state); |
458 | 458 |
459 gfx::Transform quad_content_to_delegated_target_space = | 459 gfx::Transform quad_content_to_delegated_target_space = |
460 output_shared_quad_state->content_to_target_transform; | 460 output_shared_quad_state->quad_to_target_transform; |
461 if (!is_root_delegated_render_pass) { | 461 if (!is_root_delegated_render_pass) { |
462 quad_content_to_delegated_target_space.ConcatTransform( | 462 quad_content_to_delegated_target_space.ConcatTransform( |
463 delegated_render_pass->transform_to_root_target); | 463 delegated_render_pass->transform_to_root_target); |
464 quad_content_to_delegated_target_space.ConcatTransform( | 464 quad_content_to_delegated_target_space.ConcatTransform( |
465 delegated_frame_to_target_transform); | 465 delegated_frame_to_target_transform); |
466 } | 466 } |
467 | 467 |
468 Occlusion occlusion_in_quad_space = | 468 Occlusion occlusion_in_quad_space = |
469 draw_properties() | 469 draw_properties() |
470 .occlusion_in_content_space.GetOcclusionWithGivenDrawTransform( | 470 .occlusion_in_content_space.GetOcclusionWithGivenDrawTransform( |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
515 if (own_child_id_) { | 515 if (own_child_id_) { |
516 ResourceProvider* provider = layer_tree_impl()->resource_provider(); | 516 ResourceProvider* provider = layer_tree_impl()->resource_provider(); |
517 provider->DestroyChild(child_id_); | 517 provider->DestroyChild(child_id_); |
518 } | 518 } |
519 | 519 |
520 resources_.clear(); | 520 resources_.clear(); |
521 child_id_ = 0; | 521 child_id_ = 0; |
522 } | 522 } |
523 | 523 |
524 } // namespace cc | 524 } // namespace cc |
OLD | NEW |