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_host_common.h" | 5 #include "cc/layer_tree_host_common.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/debug/trace_event.h" | 9 #include "base/debug/trace_event.h" |
10 #include "cc/layer.h" | 10 #include "cc/layer.h" |
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
214 return true; | 214 return true; |
215 | 215 |
216 return false; | 216 return false; |
217 } | 217 } |
218 | 218 |
219 static inline bool subtreeShouldBeSkipped(LayerImpl* layer) | 219 static inline bool subtreeShouldBeSkipped(LayerImpl* layer) |
220 { | 220 { |
221 // The opacity of a layer always applies to its children (either implicitly | 221 // The opacity of a layer always applies to its children (either implicitly |
222 // via a render surface or explicitly if the parent preserves 3D), so the | 222 // via a render surface or explicitly if the parent preserves 3D), so the |
223 // entire subtree can be skipped if this layer is fully transparent. | 223 // entire subtree can be skipped if this layer is fully transparent. |
224 return !layer->opacity(); | 224 return !layer->opacity() || !layer->visible(); |
225 } | 225 } |
226 | 226 |
227 static inline bool subtreeShouldBeSkipped(Layer* layer) | 227 static inline bool subtreeShouldBeSkipped(Layer* layer) |
228 { | 228 { |
229 // If the opacity is being animated then the opacity on the main thread is u
nreliable | 229 // If the opacity is being animated then the opacity on the main thread is u
nreliable |
230 // (since the impl thread may be using a different opacity), so it should no
t be trusted. | 230 // (since the impl thread may be using a different opacity), so it should no
t be trusted. |
231 // In particular, it should not cause the subtree to be skipped. | 231 // In particular, it should not cause the subtree to be skipped. |
232 return !layer->opacity() && !layer->opacityIsAnimating(); | 232 return (!layer->opacity() && !layer->opacityIsAnimating()) || !layer->visibl
e(); |
233 } | 233 } |
234 | 234 |
235 // Called on each layer that could be drawn after all information from | 235 // Called on each layer that could be drawn after all information from |
236 // calcDrawProperties has been updated on that layer. May have some false | 236 // calcDrawProperties has been updated on that layer. May have some false |
237 // positives (e.g. layers get this called on them but don't actually get drawn). | 237 // positives (e.g. layers get this called on them but don't actually get drawn). |
238 static inline void updateTilePrioritiesForLayer(LayerImpl* layer) | 238 static inline void updateTilePrioritiesForLayer(LayerImpl* layer) |
239 { | 239 { |
240 layer->updateTilePriorities(); | 240 layer->updateTilePriorities(); |
241 | 241 |
242 // Mask layers don't get this call, so explicitly update them so they can | 242 // Mask layers don't get this call, so explicitly update them so they can |
(...skipping 941 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1184 | 1184 |
1185 // At this point, we think the point does hit the touch event handler region o
n the layer, but we need to walk up | 1185 // At this point, we think the point does hit the touch event handler region o
n the layer, but we need to walk up |
1186 // the parents to ensure that the layer was not clipped in such a way that the | 1186 // the parents to ensure that the layer was not clipped in such a way that the |
1187 // hit point actually should not hit the layer. | 1187 // hit point actually should not hit the layer. |
1188 if (pointIsClippedBySurfaceOrClipRect(screenSpacePoint, layerImpl)) | 1188 if (pointIsClippedBySurfaceOrClipRect(screenSpacePoint, layerImpl)) |
1189 return false; | 1189 return false; |
1190 | 1190 |
1191 return true; | 1191 return true; |
1192 } | 1192 } |
1193 } // namespace cc | 1193 } // namespace cc |
OLD | NEW |