| OLD | NEW |
| 1 // Copyright 2011 The Chromium Authors. All rights reserved. | 1 // Copyright 2011 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/trees/layer_tree_host_impl.h" | 5 #include "cc/trees/layer_tree_host_impl.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <algorithm> | 10 #include <algorithm> |
| (...skipping 629 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 640 // surface. | 640 // surface. |
| 641 size_t render_surface_layer_list_size = render_surface_layer_list.size(); | 641 size_t render_surface_layer_list_size = render_surface_layer_list.size(); |
| 642 for (size_t i = 0; i < render_surface_layer_list_size; ++i) { | 642 for (size_t i = 0; i < render_surface_layer_list_size; ++i) { |
| 643 size_t surface_index = render_surface_layer_list_size - 1 - i; | 643 size_t surface_index = render_surface_layer_list_size - 1 - i; |
| 644 LayerImpl* render_surface_layer = render_surface_layer_list[surface_index]; | 644 LayerImpl* render_surface_layer = render_surface_layer_list[surface_index]; |
| 645 RenderSurfaceImpl* render_surface = render_surface_layer->render_surface(); | 645 RenderSurfaceImpl* render_surface = render_surface_layer->render_surface(); |
| 646 DCHECK(render_surface); | 646 DCHECK(render_surface); |
| 647 render_surface->damage_tracker()->UpdateDamageTrackingState( | 647 render_surface->damage_tracker()->UpdateDamageTrackingState( |
| 648 render_surface->layer_list(), render_surface, | 648 render_surface->layer_list(), render_surface, |
| 649 render_surface->SurfacePropertyChangedOnlyFromDescendant(), | 649 render_surface->SurfacePropertyChangedOnlyFromDescendant(), |
| 650 render_surface->content_rect(), render_surface_layer->mask_layer(), | 650 render_surface->content_rect(), render_surface->MaskLayer(), |
| 651 render_surface_layer->filters()); | 651 render_surface_layer->filters()); |
| 652 } | 652 } |
| 653 } | 653 } |
| 654 | 654 |
| 655 void LayerTreeHostImpl::FrameData::AsValueInto( | 655 void LayerTreeHostImpl::FrameData::AsValueInto( |
| 656 base::trace_event::TracedValue* value) const { | 656 base::trace_event::TracedValue* value) const { |
| 657 value->SetBoolean("has_no_damage", has_no_damage); | 657 value->SetBoolean("has_no_damage", has_no_damage); |
| 658 | 658 |
| 659 // Quad data can be quite large, so only dump render passes if we select | 659 // Quad data can be quite large, so only dump render passes if we select |
| 660 // cc.debug.quads. | 660 // cc.debug.quads. |
| (...skipping 29 matching lines...) Expand all Loading... |
| 690 static void AppendQuadsForRenderSurfaceLayer( | 690 static void AppendQuadsForRenderSurfaceLayer( |
| 691 RenderPass* target_render_pass, | 691 RenderPass* target_render_pass, |
| 692 LayerImpl* layer, | 692 LayerImpl* layer, |
| 693 const RenderPass* contributing_render_pass, | 693 const RenderPass* contributing_render_pass, |
| 694 AppendQuadsData* append_quads_data) { | 694 AppendQuadsData* append_quads_data) { |
| 695 RenderSurfaceImpl* surface = layer->render_surface(); | 695 RenderSurfaceImpl* surface = layer->render_surface(); |
| 696 const gfx::Transform& draw_transform = surface->draw_transform(); | 696 const gfx::Transform& draw_transform = surface->draw_transform(); |
| 697 const Occlusion& occlusion = surface->occlusion_in_content_space(); | 697 const Occlusion& occlusion = surface->occlusion_in_content_space(); |
| 698 SkColor debug_border_color = surface->GetDebugBorderColor(); | 698 SkColor debug_border_color = surface->GetDebugBorderColor(); |
| 699 float debug_border_width = surface->GetDebugBorderWidth(); | 699 float debug_border_width = surface->GetDebugBorderWidth(); |
| 700 LayerImpl* mask_layer = layer->mask_layer(); | 700 LayerImpl* mask_layer = surface->MaskLayer(); |
| 701 | 701 |
| 702 surface->AppendQuads(target_render_pass, draw_transform, occlusion, | 702 surface->AppendQuads(target_render_pass, draw_transform, occlusion, |
| 703 debug_border_color, debug_border_width, mask_layer, | 703 debug_border_color, debug_border_width, mask_layer, |
| 704 append_quads_data, contributing_render_pass->id); | 704 append_quads_data, contributing_render_pass->id); |
| 705 | 705 |
| 706 // Add replica after the surface so that it appears below the surface. | 706 // Add replica after the surface so that it appears below the surface. |
| 707 if (layer->has_replica()) { | 707 if (surface->HasReplica()) { |
| 708 const gfx::Transform& replica_draw_transform = | 708 const gfx::Transform& replica_draw_transform = |
| 709 surface->replica_draw_transform(); | 709 surface->replica_draw_transform(); |
| 710 Occlusion replica_occlusion = occlusion.GetOcclusionWithGivenDrawTransform( | 710 Occlusion replica_occlusion = occlusion.GetOcclusionWithGivenDrawTransform( |
| 711 surface->replica_draw_transform()); | 711 surface->replica_draw_transform()); |
| 712 SkColor replica_debug_border_color = surface->GetReplicaDebugBorderColor(); | 712 SkColor replica_debug_border_color = surface->GetReplicaDebugBorderColor(); |
| 713 float replica_debug_border_width = surface->GetReplicaDebugBorderWidth(); | 713 float replica_debug_border_width = surface->GetReplicaDebugBorderWidth(); |
| 714 // TODO(danakj): By using the same RenderSurfaceImpl for both the | 714 // TODO(danakj): By using the same RenderSurfaceImpl for both the |
| 715 // content and its reflection, it's currently not possible to apply a | 715 // content and its reflection, it's currently not possible to apply a |
| 716 // separate mask to the reflection layer or correctly handle opacity in | 716 // separate mask to the reflection layer or correctly handle opacity in |
| 717 // reflections (opacity must be applied after drawing both the layer and its | 717 // reflections (opacity must be applied after drawing both the layer and its |
| 718 // reflection). The solution is to introduce yet another RenderSurfaceImpl | 718 // reflection). The solution is to introduce yet another RenderSurfaceImpl |
| 719 // to draw the layer and its reflection in. For now we only apply a separate | 719 // to draw the layer and its reflection in. For now we only apply a separate |
| 720 // reflection mask if the contents don't have a mask of their own. | 720 // reflection mask if the contents don't have a mask of their own. |
| 721 LayerImpl* replica_mask_layer = | 721 LayerImpl* replica_mask_layer = |
| 722 mask_layer ? mask_layer : layer->replica_layer()->mask_layer(); | 722 surface->HasMask() ? surface->MaskLayer() : surface->ReplicaMaskLayer(); |
| 723 | 723 |
| 724 surface->AppendQuads(target_render_pass, replica_draw_transform, | 724 surface->AppendQuads(target_render_pass, replica_draw_transform, |
| 725 replica_occlusion, replica_debug_border_color, | 725 replica_occlusion, replica_debug_border_color, |
| 726 replica_debug_border_width, replica_mask_layer, | 726 replica_debug_border_width, replica_mask_layer, |
| 727 append_quads_data, contributing_render_pass->id); | 727 append_quads_data, contributing_render_pass->id); |
| 728 } | 728 } |
| 729 } | 729 } |
| 730 | 730 |
| 731 static void AppendQuadsToFillScreen(const gfx::Rect& root_scroll_layer_rect, | 731 static void AppendQuadsToFillScreen(const gfx::Rect& root_scroll_layer_rect, |
| 732 RenderPass* target_render_pass, | 732 RenderPass* target_render_pass, |
| (...skipping 3296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4029 const { | 4029 const { |
| 4030 return fixed_raster_scale_attempted_scale_change_history_.count() >= | 4030 return fixed_raster_scale_attempted_scale_change_history_.count() >= |
| 4031 kFixedRasterScaleAttemptedScaleChangeThreshold; | 4031 kFixedRasterScaleAttemptedScaleChangeThreshold; |
| 4032 } | 4032 } |
| 4033 | 4033 |
| 4034 void LayerTreeHostImpl::SetFixedRasterScaleAttemptedToChangeScale() { | 4034 void LayerTreeHostImpl::SetFixedRasterScaleAttemptedToChangeScale() { |
| 4035 fixed_raster_scale_attempted_scale_change_history_.set(0); | 4035 fixed_raster_scale_attempted_scale_change_history_.set(0); |
| 4036 } | 4036 } |
| 4037 | 4037 |
| 4038 } // namespace cc | 4038 } // namespace cc |
| OLD | NEW |