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/layer_tree_impl.h" | 5 #include "cc/layer_tree_impl.h" |
6 | 6 |
7 #include "base/debug/trace_event.h" | 7 #include "base/debug/trace_event.h" |
8 #include "cc/layer_tree_host_common.h" | 8 #include "cc/layer_tree_host_common.h" |
9 #include "cc/layer_tree_host_impl.h" | 9 #include "cc/layer_tree_host_impl.h" |
10 #include "ui/gfx/vector2d_conversions.h" | 10 #include "ui/gfx/vector2d_conversions.h" |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
114 gfx::Vector2dF max_scroll = gfx::Rect(ScrollableSize()).bottom_right() - | 114 gfx::Vector2dF max_scroll = gfx::Rect(ScrollableSize()).bottom_right() - |
115 gfx::RectF(view_bounds).bottom_right(); | 115 gfx::RectF(view_bounds).bottom_right(); |
116 | 116 |
117 // The viewport may be larger than the contents in some cases, such as | 117 // The viewport may be larger than the contents in some cases, such as |
118 // having a vertical scrollbar but no horizontal overflow. | 118 // having a vertical scrollbar but no horizontal overflow. |
119 max_scroll.ClampToMin(gfx::Vector2dF()); | 119 max_scroll.ClampToMin(gfx::Vector2dF()); |
120 | 120 |
121 root_scroll_layer_->setMaxScrollOffset(gfx::ToFlooredVector2d(max_scroll)); | 121 root_scroll_layer_->setMaxScrollOffset(gfx::ToFlooredVector2d(max_scroll)); |
122 } | 122 } |
123 | 123 |
124 void LayerTreeImpl::UpdateDrawProperties() { | 124 struct UpdateTilePrioritiesForLayer { |
125 if (!needs_update_draw_properties_) | 125 void operator()(LayerImpl *layer) { |
126 layer->updateTilePriorities(); | |
127 } | |
128 }; | |
129 | |
130 void LayerTreeImpl::UpdateDrawProperties(UpdateDrawPropertiesReason reason) { | |
131 if (!needs_update_draw_properties_) { | |
132 if (reason == UPDATE_ACTIVE_TREE_FOR_DRAW && RootLayer()) | |
133 LayerTreeHostCommon::callFunctionForSubtree<UpdateTilePrioritiesForLayer>( | |
enne (OOO)
2013/01/25 20:59:10
I think this might be unneeded.
You should only n
danakj
2013/01/25 21:18:15
The idea is that if you update draw props on scrol
| |
134 RootLayer()); | |
126 return; | 135 return; |
136 } | |
127 | 137 |
128 needs_update_draw_properties_ = false; | 138 needs_update_draw_properties_ = false; |
129 render_surface_layer_list_.clear(); | 139 render_surface_layer_list_.clear(); |
130 | 140 |
131 // For maxTextureSize. | 141 // For maxTextureSize. |
132 if (!layer_tree_host_impl_->renderer()) | 142 if (!layer_tree_host_impl_->renderer()) |
133 return; | 143 return; |
134 | 144 |
135 if (!RootLayer()) | 145 if (!RootLayer()) |
136 return; | 146 return; |
137 | 147 |
138 if (root_scroll_layer_) { | 148 if (root_scroll_layer_) { |
139 root_scroll_layer_->setImplTransform( | 149 root_scroll_layer_->setImplTransform( |
140 layer_tree_host_impl_->implTransform()); | 150 layer_tree_host_impl_->implTransform()); |
141 // Setting the impl transform re-sets this. | 151 // Setting the impl transform re-sets this. |
142 needs_update_draw_properties_ = false; | 152 needs_update_draw_properties_ = false; |
143 } | 153 } |
144 | 154 |
145 { | 155 { |
146 TRACE_EVENT1("cc", "LayerTreeImpl::UpdateDrawProperties", "IsActive", IsActi veTree()); | 156 TRACE_EVENT1("cc", "LayerTreeImpl::UpdateDrawProperties", "IsActive", IsActi veTree()); |
157 bool update_tile_priorities = | |
158 reason == UPDATE_PENDING_TREE || | |
159 reason == UPDATE_ACTIVE_TREE_FOR_DRAW; | |
147 LayerTreeHostCommon::calculateDrawProperties( | 160 LayerTreeHostCommon::calculateDrawProperties( |
148 RootLayer(), | 161 RootLayer(), |
149 device_viewport_size(), | 162 device_viewport_size(), |
150 device_scale_factor(), | 163 device_scale_factor(), |
151 pinch_zoom_viewport().page_scale_factor(), | 164 pinch_zoom_viewport().page_scale_factor(), |
152 MaxTextureSize(), | 165 MaxTextureSize(), |
153 settings().canUseLCDText, | 166 settings().canUseLCDText, |
154 render_surface_layer_list_); | 167 render_surface_layer_list_, |
168 update_tile_priorities); | |
155 } | 169 } |
156 | 170 |
157 DCHECK(!needs_update_draw_properties_) << | 171 DCHECK(!needs_update_draw_properties_) << |
158 "calcDrawProperties should not set_needs_update_draw_properties()"; | 172 "calcDrawProperties should not set_needs_update_draw_properties()"; |
159 } | 173 } |
160 | 174 |
161 static void ClearRenderSurfacesOnLayerImplRecursive(LayerImpl* current) | 175 static void ClearRenderSurfacesOnLayerImplRecursive(LayerImpl* current) |
162 { | 176 { |
163 DCHECK(current); | 177 DCHECK(current); |
164 for (size_t i = 0; i < current->children().size(); ++i) | 178 for (size_t i = 0; i < current->children().size(); ++i) |
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
345 | 359 |
346 AnimationRegistrar* LayerTreeImpl::animationRegistrar() const { | 360 AnimationRegistrar* LayerTreeImpl::animationRegistrar() const { |
347 return layer_tree_host_impl_->animationRegistrar(); | 361 return layer_tree_host_impl_->animationRegistrar(); |
348 } | 362 } |
349 | 363 |
350 const PinchZoomViewport& LayerTreeImpl::pinch_zoom_viewport() const { | 364 const PinchZoomViewport& LayerTreeImpl::pinch_zoom_viewport() const { |
351 return layer_tree_host_impl_->pinchZoomViewport(); | 365 return layer_tree_host_impl_->pinchZoomViewport(); |
352 } | 366 } |
353 | 367 |
354 } // namespace cc | 368 } // namespace cc |
OLD | NEW |