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

Unified Diff: cc/layer_tree_host_common.cc

Issue 11567034: Changes subtreeShouldRenderToSeparateSurface logic to account for explicit clipping (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: adding a unit test and renaming adding a unit test and renaming can_clip_self" Created 8 years 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 side-by-side diff with in-line comments
Download patch
Index: cc/layer_tree_host_common.cc
diff --git a/cc/layer_tree_host_common.cc b/cc/layer_tree_host_common.cc
index 0a204ceb6914df96a5bdede2b6c8c9ee7e1c6915..37364ec7cc60b54384b8b8d8df1c5681838f1a9f 100644
--- a/cc/layer_tree_host_common.cc
+++ b/cc/layer_tree_host_common.cc
@@ -239,6 +239,7 @@ static inline void markLayerAsUpdated(Layer* layer)
{
}
+
shawnsingh 2012/12/18 19:11:00 nit: no need to add extra line here
template<typename LayerType>
static bool subtreeShouldRenderToSeparateSurface(LayerType* layer, bool axisAlignedWithRespectToParent)
{
@@ -274,7 +275,7 @@ static bool subtreeShouldRenderToSeparateSurface(LayerType* layer, bool axisAlig
return true;
// If the layer clips its descendants but it is not axis-aligned with respect to its parent.
- if (layerClipsSubtree(layer) && !axisAlignedWithRespectToParent && numDescendantsThatDrawContent > 0)
+ if (layerClipsSubtree(layer) && !axisAlignedWithRespectToParent && !layer->drawProperties().does_not_require_scissoring)
return true;
// If the layer has some translucency and does not have a preserves-3d transform style.
@@ -435,15 +436,25 @@ template<typename LayerType>
static void preCalculateMetaInformation(LayerType* layer)
{
int numDescendantsThatDrawContent = 0;
+ bool doesNotRequireScissoring = true;
+ bool sublayerXformPreventsClip = !layer->sublayerTransform().IsPositiveScaleOrTranslation();
shawnsingh 2012/12/18 19:11:00 like Dana, I also prefer Transform instead of Xfor
for (size_t i = 0; i < layer->children().size(); ++i) {
LayerType* childLayer = layer->children()[i];
preCalculateMetaInformation<LayerType>(childLayer);
+
numDescendantsThatDrawContent += childLayer->drawsContent() ? 1 : 0;
numDescendantsThatDrawContent += childLayer->drawProperties().num_descendants_that_draw_content;
+
+ if ((childLayer->drawsContent() && !childLayer->canClipSelf()) ||
+ !childLayer->drawProperties().does_not_require_scissoring ||
shawnsingh 2012/12/18 19:11:00 I feel like my proposed variable name in earlier c
+ sublayerXformPreventsClip ||
+ !childLayer->transform().IsPositiveScaleOrTranslation())
+ doesNotRequireScissoring = false;
}
layer->drawProperties().num_descendants_that_draw_content = numDescendantsThatDrawContent;
+ layer->drawProperties().does_not_require_scissoring = doesNotRequireScissoring;
}
// Recursively walks the layer tree starting at the given node and computes all the

Powered by Google App Engine
This is Rietveld 408576698