| 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 <algorithm> | 7 #include <algorithm> |
| 8 #include <limits> | 8 #include <limits> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 #include "cc/debug/paint_time_counter.h" | 25 #include "cc/debug/paint_time_counter.h" |
| 26 #include "cc/debug/rendering_stats_instrumentation.h" | 26 #include "cc/debug/rendering_stats_instrumentation.h" |
| 27 #include "cc/debug/traced_value.h" | 27 #include "cc/debug/traced_value.h" |
| 28 #include "cc/input/page_scale_animation.h" | 28 #include "cc/input/page_scale_animation.h" |
| 29 #include "cc/input/top_controls_manager.h" | 29 #include "cc/input/top_controls_manager.h" |
| 30 #include "cc/layers/append_quads_data.h" | 30 #include "cc/layers/append_quads_data.h" |
| 31 #include "cc/layers/heads_up_display_layer_impl.h" | 31 #include "cc/layers/heads_up_display_layer_impl.h" |
| 32 #include "cc/layers/layer_impl.h" | 32 #include "cc/layers/layer_impl.h" |
| 33 #include "cc/layers/layer_iterator.h" | 33 #include "cc/layers/layer_iterator.h" |
| 34 #include "cc/layers/painted_scrollbar_layer_impl.h" | 34 #include "cc/layers/painted_scrollbar_layer_impl.h" |
| 35 #include "cc/layers/quad_sink.h" |
| 35 #include "cc/layers/render_surface_impl.h" | 36 #include "cc/layers/render_surface_impl.h" |
| 36 #include "cc/layers/scrollbar_layer_impl_base.h" | 37 #include "cc/layers/scrollbar_layer_impl_base.h" |
| 37 #include "cc/output/compositor_frame_metadata.h" | 38 #include "cc/output/compositor_frame_metadata.h" |
| 38 #include "cc/output/copy_output_request.h" | 39 #include "cc/output/copy_output_request.h" |
| 39 #include "cc/output/delegating_renderer.h" | 40 #include "cc/output/delegating_renderer.h" |
| 40 #include "cc/output/gl_renderer.h" | 41 #include "cc/output/gl_renderer.h" |
| 41 #include "cc/output/software_renderer.h" | 42 #include "cc/output/software_renderer.h" |
| 42 #include "cc/quads/render_pass_draw_quad.h" | 43 #include "cc/quads/render_pass_draw_quad.h" |
| 43 #include "cc/quads/shared_quad_state.h" | 44 #include "cc/quads/shared_quad_state.h" |
| 44 #include "cc/quads/solid_color_draw_quad.h" | 45 #include "cc/quads/solid_color_draw_quad.h" |
| 45 #include "cc/quads/texture_draw_quad.h" | 46 #include "cc/quads/texture_draw_quad.h" |
| 46 #include "cc/resources/direct_raster_worker_pool.h" | 47 #include "cc/resources/direct_raster_worker_pool.h" |
| 47 #include "cc/resources/image_copy_raster_worker_pool.h" | 48 #include "cc/resources/image_copy_raster_worker_pool.h" |
| 48 #include "cc/resources/image_raster_worker_pool.h" | 49 #include "cc/resources/image_raster_worker_pool.h" |
| 49 #include "cc/resources/memory_history.h" | 50 #include "cc/resources/memory_history.h" |
| 50 #include "cc/resources/picture_layer_tiling.h" | 51 #include "cc/resources/picture_layer_tiling.h" |
| 51 #include "cc/resources/pixel_buffer_raster_worker_pool.h" | 52 #include "cc/resources/pixel_buffer_raster_worker_pool.h" |
| 52 #include "cc/resources/prioritized_resource_manager.h" | 53 #include "cc/resources/prioritized_resource_manager.h" |
| 53 #include "cc/resources/raster_worker_pool.h" | 54 #include "cc/resources/raster_worker_pool.h" |
| 54 #include "cc/resources/resource_pool.h" | 55 #include "cc/resources/resource_pool.h" |
| 55 #include "cc/resources/texture_mailbox_deleter.h" | 56 #include "cc/resources/texture_mailbox_deleter.h" |
| 56 #include "cc/resources/ui_resource_bitmap.h" | 57 #include "cc/resources/ui_resource_bitmap.h" |
| 57 #include "cc/scheduler/delay_based_time_source.h" | 58 #include "cc/scheduler/delay_based_time_source.h" |
| 58 #include "cc/trees/damage_tracker.h" | 59 #include "cc/trees/damage_tracker.h" |
| 59 #include "cc/trees/layer_tree_host.h" | 60 #include "cc/trees/layer_tree_host.h" |
| 60 #include "cc/trees/layer_tree_host_common.h" | 61 #include "cc/trees/layer_tree_host_common.h" |
| 61 #include "cc/trees/layer_tree_impl.h" | 62 #include "cc/trees/layer_tree_impl.h" |
| 62 #include "cc/trees/occlusion_tracker.h" | 63 #include "cc/trees/occlusion_tracker.h" |
| 63 #include "cc/trees/quad_culler.h" | |
| 64 #include "cc/trees/single_thread_proxy.h" | 64 #include "cc/trees/single_thread_proxy.h" |
| 65 #include "cc/trees/tree_synchronizer.h" | 65 #include "cc/trees/tree_synchronizer.h" |
| 66 #include "gpu/GLES2/gl2extchromium.h" | 66 #include "gpu/GLES2/gl2extchromium.h" |
| 67 #include "ui/gfx/frame_time.h" | 67 #include "ui/gfx/frame_time.h" |
| 68 #include "ui/gfx/size_conversions.h" | 68 #include "ui/gfx/size_conversions.h" |
| 69 #include "ui/gfx/vector2d_conversions.h" | 69 #include "ui/gfx/vector2d_conversions.h" |
| 70 | 70 |
| 71 namespace { | 71 namespace { |
| 72 | 72 |
| 73 void DidVisibilityChange(cc::LayerTreeHostImpl* id, bool visible) { | 73 void DidVisibilityChange(cc::LayerTreeHostImpl* id, bool visible) { |
| (...skipping 508 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 582 << output_surface->capabilities().deferred_gl_initialization; | 582 << output_surface->capabilities().deferred_gl_initialization; |
| 583 return DRAW_MODE_SOFTWARE; | 583 return DRAW_MODE_SOFTWARE; |
| 584 } | 584 } |
| 585 } | 585 } |
| 586 | 586 |
| 587 static void AppendQuadsForLayer( | 587 static void AppendQuadsForLayer( |
| 588 RenderPass* target_render_pass, | 588 RenderPass* target_render_pass, |
| 589 LayerImpl* layer, | 589 LayerImpl* layer, |
| 590 const OcclusionTracker<LayerImpl>& occlusion_tracker, | 590 const OcclusionTracker<LayerImpl>& occlusion_tracker, |
| 591 AppendQuadsData* append_quads_data) { | 591 AppendQuadsData* append_quads_data) { |
| 592 QuadCuller quad_culler(target_render_pass, layer, occlusion_tracker); | 592 QuadSink quad_culler(target_render_pass, &occlusion_tracker); |
| 593 layer->AppendQuads(&quad_culler, append_quads_data); | 593 layer->AppendQuads(&quad_culler, append_quads_data); |
| 594 } | 594 } |
| 595 | 595 |
| 596 static void AppendQuadsForRenderSurfaceLayer( | 596 static void AppendQuadsForRenderSurfaceLayer( |
| 597 RenderPass* target_render_pass, | 597 RenderPass* target_render_pass, |
| 598 LayerImpl* layer, | 598 LayerImpl* layer, |
| 599 const RenderPass* contributing_render_pass, | 599 const RenderPass* contributing_render_pass, |
| 600 const OcclusionTracker<LayerImpl>& occlusion_tracker, | 600 const OcclusionTracker<LayerImpl>& occlusion_tracker, |
| 601 AppendQuadsData* append_quads_data) { | 601 AppendQuadsData* append_quads_data) { |
| 602 QuadCuller quad_culler(target_render_pass, layer, occlusion_tracker); | 602 QuadSink quad_culler(target_render_pass, &occlusion_tracker); |
| 603 | 603 |
| 604 bool is_replica = false; | 604 bool is_replica = false; |
| 605 layer->render_surface()->AppendQuads(&quad_culler, | 605 layer->render_surface()->AppendQuads(&quad_culler, |
| 606 append_quads_data, | 606 append_quads_data, |
| 607 is_replica, | 607 is_replica, |
| 608 contributing_render_pass->id); | 608 contributing_render_pass->id); |
| 609 | 609 |
| 610 // Add replica after the surface so that it appears below the surface. | 610 // Add replica after the surface so that it appears below the surface. |
| 611 if (layer->has_replica()) { | 611 if (layer->has_replica()) { |
| 612 is_replica = true; | 612 is_replica = true; |
| (...skipping 22 matching lines...) Expand all Loading... |
| 635 // Divide the fill region into the part to be filled with the overhang | 635 // Divide the fill region into the part to be filled with the overhang |
| 636 // resource and the part to be filled with the background color. | 636 // resource and the part to be filled with the background color. |
| 637 Region screen_background_color_region = fill_region; | 637 Region screen_background_color_region = fill_region; |
| 638 Region overhang_region; | 638 Region overhang_region; |
| 639 if (overhang_resource_id) { | 639 if (overhang_resource_id) { |
| 640 overhang_region = fill_region; | 640 overhang_region = fill_region; |
| 641 overhang_region.Subtract(root_scroll_layer_rect); | 641 overhang_region.Subtract(root_scroll_layer_rect); |
| 642 screen_background_color_region.Intersect(root_scroll_layer_rect); | 642 screen_background_color_region.Intersect(root_scroll_layer_rect); |
| 643 } | 643 } |
| 644 | 644 |
| 645 QuadCuller quad_culler(target_render_pass, root_layer, occlusion_tracker); | 645 QuadSink quad_culler(target_render_pass, &occlusion_tracker); |
| 646 | 646 |
| 647 // Manually create the quad state for the gutter quads, as the root layer | 647 // Manually create the quad state for the gutter quads, as the root layer |
| 648 // doesn't have any bounds and so can't generate this itself. | 648 // doesn't have any bounds and so can't generate this itself. |
| 649 // TODO(danakj): Make the gutter quads generated by the solid color layer | 649 // TODO(danakj): Make the gutter quads generated by the solid color layer |
| 650 // (make it smarter about generating quads to fill unoccluded areas). | 650 // (make it smarter about generating quads to fill unoccluded areas). |
| 651 | 651 |
| 652 gfx::Rect root_target_rect = root_layer->render_surface()->content_rect(); | 652 gfx::Rect root_target_rect = root_layer->render_surface()->content_rect(); |
| 653 float opacity = 1.f; | 653 float opacity = 1.f; |
| 654 SharedQuadState* shared_quad_state = quad_culler.CreateSharedQuadState(); | 654 SharedQuadState* shared_quad_state = quad_culler.CreateSharedQuadState(); |
| 655 shared_quad_state->SetAll(gfx::Transform(), | 655 shared_quad_state->SetAll(gfx::Transform(), |
| (...skipping 2495 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3151 } | 3151 } |
| 3152 | 3152 |
| 3153 void LayerTreeHostImpl::UnregisterPictureLayerImpl(PictureLayerImpl* layer) { | 3153 void LayerTreeHostImpl::UnregisterPictureLayerImpl(PictureLayerImpl* layer) { |
| 3154 std::vector<PictureLayerImpl*>::iterator it = | 3154 std::vector<PictureLayerImpl*>::iterator it = |
| 3155 std::find(picture_layers_.begin(), picture_layers_.end(), layer); | 3155 std::find(picture_layers_.begin(), picture_layers_.end(), layer); |
| 3156 DCHECK(it != picture_layers_.end()); | 3156 DCHECK(it != picture_layers_.end()); |
| 3157 picture_layers_.erase(it); | 3157 picture_layers_.erase(it); |
| 3158 } | 3158 } |
| 3159 | 3159 |
| 3160 } // namespace cc | 3160 } // namespace cc |
| OLD | NEW |