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 710 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
721 DrawMode LayerTreeHostImpl::GetDrawMode() const { | 721 DrawMode LayerTreeHostImpl::GetDrawMode() const { |
722 if (resourceless_software_draw_) { | 722 if (resourceless_software_draw_) { |
723 return DRAW_MODE_RESOURCELESS_SOFTWARE; | 723 return DRAW_MODE_RESOURCELESS_SOFTWARE; |
724 } else if (compositor_frame_sink_->context_provider()) { | 724 } else if (compositor_frame_sink_->context_provider()) { |
725 return DRAW_MODE_HARDWARE; | 725 return DRAW_MODE_HARDWARE; |
726 } else { | 726 } else { |
727 return DRAW_MODE_SOFTWARE; | 727 return DRAW_MODE_SOFTWARE; |
728 } | 728 } |
729 } | 729 } |
730 | 730 |
731 static void AppendQuadsToFillScreen(const gfx::Rect& root_scroll_layer_rect, | 731 static void AppendQuadsToFillScreen( |
732 RenderPass* target_render_pass, | 732 const gfx::Rect& root_scroll_layer_rect, |
733 RenderSurfaceImpl* root_render_surface, | 733 RenderPass* target_render_pass, |
734 SkColor screen_background_color, | 734 const RenderSurfaceImpl* root_render_surface, |
735 const Region& fill_region) { | 735 SkColor screen_background_color, |
| 736 const Region& fill_region) { |
736 if (!root_render_surface || !SkColorGetA(screen_background_color)) | 737 if (!root_render_surface || !SkColorGetA(screen_background_color)) |
737 return; | 738 return; |
738 if (fill_region.IsEmpty()) | 739 if (fill_region.IsEmpty()) |
739 return; | 740 return; |
740 | 741 |
741 // Manually create the quad state for the gutter quads, as the root layer | 742 // Manually create the quad state for the gutter quads, as the root layer |
742 // doesn't have any bounds and so can't generate this itself. | 743 // doesn't have any bounds and so can't generate this itself. |
743 // TODO(danakj): Make the gutter quads generated by the solid color layer | 744 // TODO(danakj): Make the gutter quads generated by the solid color layer |
744 // (make it smarter about generating quads to fill unoccluded areas). | 745 // (make it smarter about generating quads to fill unoccluded areas). |
745 | 746 |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
779 | 780 |
780 // For now, we use damage tracking to compute a global scissor. To do this, we | 781 // For now, we use damage tracking to compute a global scissor. To do this, we |
781 // must compute all damage tracking before drawing anything, so that we know | 782 // must compute all damage tracking before drawing anything, so that we know |
782 // the root damage rect. The root damage rect is then used to scissor each | 783 // the root damage rect. The root damage rect is then used to scissor each |
783 // surface. | 784 // surface. |
784 DamageTracker::UpdateDamageTracking(active_tree_.get(), | 785 DamageTracker::UpdateDamageTracking(active_tree_.get(), |
785 active_tree_->GetRenderSurfaceList()); | 786 active_tree_->GetRenderSurfaceList()); |
786 | 787 |
787 // If the root render surface has no visible damage, then don't generate a | 788 // If the root render surface has no visible damage, then don't generate a |
788 // frame at all. | 789 // frame at all. |
789 RenderSurfaceImpl* root_surface = active_tree_->RootRenderSurface(); | 790 const RenderSurfaceImpl* root_surface = active_tree_->RootRenderSurface(); |
790 bool root_surface_has_no_visible_damage = | 791 bool root_surface_has_no_visible_damage = |
791 !root_surface->GetDamageRect().Intersects(root_surface->content_rect()); | 792 !root_surface->GetDamageRect().Intersects(root_surface->content_rect()); |
792 bool root_surface_has_contributing_layers = | 793 bool root_surface_has_contributing_layers = |
793 !!root_surface->num_contributors(); | 794 !!root_surface->num_contributors(); |
794 bool hud_wants_to_draw_ = active_tree_->hud_layer() && | 795 bool hud_wants_to_draw_ = active_tree_->hud_layer() && |
795 active_tree_->hud_layer()->IsAnimatingHUDContents(); | 796 active_tree_->hud_layer()->IsAnimatingHUDContents(); |
796 bool must_always_swap = | 797 bool must_always_swap = |
797 compositor_frame_sink_->capabilities().must_always_swap; | 798 compositor_frame_sink_->capabilities().must_always_swap; |
798 // When touch handle visibility changes there is no visible damage | 799 // When touch handle visibility changes there is no visible damage |
799 // because touch handles are composited in the browser. However we | 800 // because touch handles are composited in the browser. However we |
(...skipping 3491 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4291 | 4292 |
4292 void LayerTreeHostImpl::ShowScrollbarsForImplScroll(ElementId element_id) { | 4293 void LayerTreeHostImpl::ShowScrollbarsForImplScroll(ElementId element_id) { |
4293 if (!element_id) | 4294 if (!element_id) |
4294 return; | 4295 return; |
4295 if (ScrollbarAnimationController* animation_controller = | 4296 if (ScrollbarAnimationController* animation_controller = |
4296 ScrollbarAnimationControllerForElementId(element_id)) | 4297 ScrollbarAnimationControllerForElementId(element_id)) |
4297 animation_controller->DidScrollUpdate(); | 4298 animation_controller->DidScrollUpdate(); |
4298 } | 4299 } |
4299 | 4300 |
4300 } // namespace cc | 4301 } // namespace cc |
OLD | NEW |