Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(106)

Side by Side Diff: cc/trees/layer_tree_host_common.cc

Issue 16896017: Add a hide_layer_and_subtree() flag to cc::Layer (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: hide-subtree-flag: Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « cc/layers/layer_unittest.cc ('k') | cc/trees/layer_tree_host_common_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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_common.h" 5 #include "cc/trees/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/base/math_util.h" 10 #include "cc/base/math_util.h"
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after
225 // back of the layer is known to be facing the screen. 225 // back of the layer is known to be facing the screen.
226 if (!backface_test_layer->double_sided() && 226 if (!backface_test_layer->double_sided() &&
227 TransformToScreenIsKnown(backface_test_layer) && 227 TransformToScreenIsKnown(backface_test_layer) &&
228 IsLayerBackFaceVisible(backface_test_layer)) 228 IsLayerBackFaceVisible(backface_test_layer))
229 return true; 229 return true;
230 230
231 return false; 231 return false;
232 } 232 }
233 233
234 static inline bool SubtreeShouldBeSkipped(LayerImpl* layer) { 234 static inline bool SubtreeShouldBeSkipped(LayerImpl* layer) {
235 // The embedder can request to hide the entire layer's subtree.
236 if (layer->hide_layer_and_subtree())
237 return true;
238
235 // If layer is on the pending tree and opacity is being animated then 239 // If layer is on the pending tree and opacity is being animated then
236 // this subtree can't be skipped as we need to create, prioritize and 240 // this subtree can't be skipped as we need to create, prioritize and
237 // include tiles for this layer when deciding if tree can be activated. 241 // include tiles for this layer when deciding if tree can be activated.
238 if (layer->layer_tree_impl()->IsPendingTree() && layer->OpacityIsAnimating()) 242 if (layer->layer_tree_impl()->IsPendingTree() && layer->OpacityIsAnimating())
239 return false; 243 return false;
240 244
241 // The opacity of a layer always applies to its children (either implicitly 245 // The opacity of a layer always applies to its children (either implicitly
242 // via a render surface or explicitly if the parent preserves 3D), so the 246 // via a render surface or explicitly if the parent preserves 3D), so the
243 // entire subtree can be skipped if this layer is fully transparent. 247 // entire subtree can be skipped if this layer is fully transparent.
244 return !layer->opacity(); 248 return !layer->opacity();
245 } 249 }
246 250
247 static inline bool SubtreeShouldBeSkipped(Layer* layer) { 251 static inline bool SubtreeShouldBeSkipped(Layer* layer) {
252 // The embedder can request to hide the entire layer's subtree.
253 if (layer->hide_layer_and_subtree())
254 return true;
255
248 // If the opacity is being animated then the opacity on the main thread is 256 // If the opacity is being animated then the opacity on the main thread is
249 // unreliable (since the impl thread may be using a different opacity), so it 257 // unreliable (since the impl thread may be using a different opacity), so it
250 // should not be trusted. 258 // should not be trusted.
251 // In particular, it should not cause the subtree to be skipped. 259 // In particular, it should not cause the subtree to be skipped.
252 // Similarly, for layers that might animate opacity using an impl-only 260 // Similarly, for layers that might animate opacity using an impl-only
253 // animation, their subtree should also not be skipped. 261 // animation, their subtree should also not be skipped.
254 return !layer->opacity() && !layer->OpacityIsAnimating() && 262 return !layer->opacity() && !layer->OpacityIsAnimating() &&
255 !layer->OpacityCanAnimateOnImplThread(); 263 !layer->OpacityCanAnimateOnImplThread();
256 } 264 }
257 265
(...skipping 1228 matching lines...) Expand 10 before | Expand all | Expand 10 after
1486 layer->render_surface()->screen_space_transform() * 1494 layer->render_surface()->screen_space_transform() *
1487 surface_origin_to_replica_origin_transform; 1495 surface_origin_to_replica_origin_transform;
1488 render_surface->SetReplicaScreenSpaceTransform( 1496 render_surface->SetReplicaScreenSpaceTransform(
1489 replica_screen_space_transform); 1497 replica_screen_space_transform);
1490 } 1498 }
1491 } 1499 }
1492 1500
1493 UpdateTilePrioritiesForLayer(layer); 1501 UpdateTilePrioritiesForLayer(layer);
1494 1502
1495 // If neither this layer nor any of its children were added, early out. 1503 // If neither this layer nor any of its children were added, early out.
1496 if (sorting_start_index == descendants.size()) 1504 if (!IsRootLayer(layer) && sorting_start_index == descendants.size())
enne (OOO) 2013/06/20 00:17:47 If the root layer doesn't draw, why does it need t
danakj 2013/06/20 00:20:04 Because otherwise the impl layer doesn't get the r
1497 return; 1505 return;
1498 1506
1499 // If preserves-3d then sort all the descendants in 3D so that they can be 1507 // If preserves-3d then sort all the descendants in 3D so that they can be
1500 // drawn from back to front. If the preserves-3d property is also set on the 1508 // drawn from back to front. If the preserves-3d property is also set on the
1501 // parent then skip the sorting as the parent will sort all the descendants 1509 // parent then skip the sorting as the parent will sort all the descendants
1502 // anyway. 1510 // anyway.
1503 if (layer_sorter && descendants.size() && layer->preserves_3d() && 1511 if (layer_sorter && descendants.size() && layer->preserves_3d() &&
1504 (!layer->parent() || !layer->parent()->preserves_3d())) { 1512 (!layer->parent() || !layer->parent()->preserves_3d())) {
1505 SortLayers(descendants.begin() + sorting_start_index, 1513 SortLayers(descendants.begin() + sorting_start_index,
1506 descendants.end(), 1514 descendants.end(),
(...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after
1822 // At this point, we think the point does hit the touch event handler region 1830 // At this point, we think the point does hit the touch event handler region
1823 // on the layer, but we need to walk up the parents to ensure that the layer 1831 // on the layer, but we need to walk up the parents to ensure that the layer
1824 // was not clipped in such a way that the hit point actually should not hit 1832 // was not clipped in such a way that the hit point actually should not hit
1825 // the layer. 1833 // the layer.
1826 if (PointIsClippedBySurfaceOrClipRect(screen_space_point, layer_impl)) 1834 if (PointIsClippedBySurfaceOrClipRect(screen_space_point, layer_impl))
1827 return false; 1835 return false;
1828 1836
1829 return true; 1837 return true;
1830 } 1838 }
1831 } // namespace cc 1839 } // namespace cc
OLDNEW
« no previous file with comments | « cc/layers/layer_unittest.cc ('k') | cc/trees/layer_tree_host_common_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698