Chromium Code Reviews| 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_impl.h" | 5 #include "cc/trees/layer_tree_impl.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <limits> | 8 #include <limits> |
| 9 #include <set> | 9 #include <set> |
| 10 | 10 |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 74 gfx::ScrollOffset last_set_scroll_offset_; | 74 gfx::ScrollOffset last_set_scroll_offset_; |
| 75 }; | 75 }; |
| 76 | 76 |
| 77 LayerTreeImpl::LayerTreeImpl( | 77 LayerTreeImpl::LayerTreeImpl( |
| 78 LayerTreeHostImpl* layer_tree_host_impl, | 78 LayerTreeHostImpl* layer_tree_host_impl, |
| 79 scoped_refptr<SyncedProperty<ScaleGroup>> page_scale_factor, | 79 scoped_refptr<SyncedProperty<ScaleGroup>> page_scale_factor, |
| 80 scoped_refptr<SyncedTopControls> top_controls_shown_ratio, | 80 scoped_refptr<SyncedTopControls> top_controls_shown_ratio, |
| 81 scoped_refptr<SyncedElasticOverscroll> elastic_overscroll) | 81 scoped_refptr<SyncedElasticOverscroll> elastic_overscroll) |
| 82 : layer_tree_host_impl_(layer_tree_host_impl), | 82 : layer_tree_host_impl_(layer_tree_host_impl), |
| 83 source_frame_number_(-1), | 83 source_frame_number_(-1), |
| 84 last_update_draw_properties_frame_number_(-1), | |
| 84 hud_layer_(0), | 85 hud_layer_(0), |
| 85 currently_scrolling_layer_(NULL), | 86 currently_scrolling_layer_(NULL), |
| 86 root_layer_scroll_offset_delegate_(NULL), | 87 root_layer_scroll_offset_delegate_(NULL), |
| 87 background_color_(0), | 88 background_color_(0), |
| 88 has_transparent_background_(false), | 89 has_transparent_background_(false), |
| 89 overscroll_elasticity_layer_(NULL), | 90 overscroll_elasticity_layer_(NULL), |
| 90 page_scale_layer_(NULL), | 91 page_scale_layer_(NULL), |
| 91 inner_viewport_scroll_layer_(NULL), | 92 inner_viewport_scroll_layer_(NULL), |
| 92 outer_viewport_scroll_layer_(NULL), | 93 outer_viewport_scroll_layer_(NULL), |
| 93 page_scale_factor_(page_scale_factor), | 94 page_scale_factor_(page_scale_factor), |
| (...skipping 481 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 575 | 576 |
| 576 { | 577 { |
| 577 TRACE_EVENT2("cc", "LayerTreeImpl::UpdateDrawProperties::Occlusion", | 578 TRACE_EVENT2("cc", "LayerTreeImpl::UpdateDrawProperties::Occlusion", |
| 578 "IsActive", IsActiveTree(), "SourceFrameNumber", | 579 "IsActive", IsActiveTree(), "SourceFrameNumber", |
| 579 source_frame_number_); | 580 source_frame_number_); |
| 580 OcclusionTracker<LayerImpl> occlusion_tracker( | 581 OcclusionTracker<LayerImpl> occlusion_tracker( |
| 581 root_layer()->render_surface()->content_rect()); | 582 root_layer()->render_surface()->content_rect()); |
| 582 occlusion_tracker.set_minimum_tracking_size( | 583 occlusion_tracker.set_minimum_tracking_size( |
| 583 settings().minimum_occlusion_tracking_size); | 584 settings().minimum_occlusion_tracking_size); |
| 584 | 585 |
| 586 // It'd be ideal if this could be done earlier, but when the raster source | |
|
danakj
2015/02/18 01:25:52
Can you move this out of the ::Occlusion {}? Maybe
enne (OOO)
2015/02/18 19:43:05
Done.
| |
| 587 // is updated from the main thread during push properties, update draw | |
| 588 // properties has not occurred yet and so it's not clear whether or not the | |
| 589 // layer can or cannot use lcd text. So, this is the cleanup pass to | |
| 590 // determine if the raster source needs to be replaced with a non-lcd | |
| 591 // raster source due to draw properties. | |
| 592 // | |
| 593 // TODO(enne): Make LTHI::sync_tree return this value. | |
| 594 LayerTreeImpl* sync_tree = | |
| 595 layer_tree_host_impl_->proxy()->CommitToActiveTree() | |
| 596 ? layer_tree_host_impl_->active_tree() | |
| 597 : layer_tree_host_impl_->pending_tree(); | |
| 598 if (this == sync_tree && | |
| 599 source_frame_number_ != last_update_draw_properties_frame_number_) { | |
| 600 for (const auto& layer : picture_layers_) | |
| 601 layer->UpdateCanUseLCDText(); | |
| 602 } | |
| 603 last_update_draw_properties_frame_number_ = source_frame_number_; | |
| 604 | |
| 585 // LayerIterator is used here instead of CallFunctionForSubtree to only | 605 // LayerIterator is used here instead of CallFunctionForSubtree to only |
| 586 // UpdateTilePriorities on layers that will be visible (and thus have valid | 606 // UpdateTilePriorities on layers that will be visible (and thus have valid |
| 587 // draw properties) and not because any ordering is required. | 607 // draw properties) and not because any ordering is required. |
| 588 auto end = LayerIterator<LayerImpl>::End(&render_surface_layer_list_); | 608 auto end = LayerIterator<LayerImpl>::End(&render_surface_layer_list_); |
| 589 for (auto it = LayerIterator<LayerImpl>::Begin(&render_surface_layer_list_); | 609 for (auto it = LayerIterator<LayerImpl>::Begin(&render_surface_layer_list_); |
| 590 it != end; ++it) { | 610 it != end; ++it) { |
| 591 occlusion_tracker.EnterLayer(it); | 611 occlusion_tracker.EnterLayer(it); |
| 592 | 612 |
| 593 // There are very few render targets so this should be cheap to do for | 613 // There are very few render targets so this should be cheap to do for |
| 594 // each layer instead of something more complicated. | 614 // each layer instead of something more complicated. |
| (...skipping 1026 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1621 scoped_ptr<PendingPageScaleAnimation> pending_animation) { | 1641 scoped_ptr<PendingPageScaleAnimation> pending_animation) { |
| 1622 pending_page_scale_animation_ = pending_animation.Pass(); | 1642 pending_page_scale_animation_ = pending_animation.Pass(); |
| 1623 } | 1643 } |
| 1624 | 1644 |
| 1625 scoped_ptr<PendingPageScaleAnimation> | 1645 scoped_ptr<PendingPageScaleAnimation> |
| 1626 LayerTreeImpl::TakePendingPageScaleAnimation() { | 1646 LayerTreeImpl::TakePendingPageScaleAnimation() { |
| 1627 return pending_page_scale_animation_.Pass(); | 1647 return pending_page_scale_animation_.Pass(); |
| 1628 } | 1648 } |
| 1629 | 1649 |
| 1630 } // namespace cc | 1650 } // namespace cc |
| OLD | NEW |