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

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: Reworking the test for creating a layer, should work correctly now. 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..eb801d7e5b51039ca25597cd9dd69ec08d05e721 100644
--- a/cc/layer_tree_host_common.cc
+++ b/cc/layer_tree_host_common.cc
@@ -267,6 +267,7 @@ static bool subtreeShouldRenderToSeparateSurface(LayerType* layer, bool axisAlig
return true;
int numDescendantsThatDrawContent = layer->drawProperties().num_descendants_that_draw_content;
+ int numDescendantsThatDrawContentAndCantClipThemselves = layer->drawProperties().num_descendants_that_draw_content_and_cant_clip_themselves;
// If the layer flattens its subtree (i.e. the layer doesn't preserve-3d), but it is
// treated as a 3D object by its parent (i.e. parent does preserve-3d).
@@ -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 && numDescendantsThatDrawContentAndCantClipThemselves > 0)
return true;
// If the layer has some translucency and does not have a preserves-3d transform style.
@@ -429,21 +430,41 @@ static inline void removeSurfaceForEarlyExit(LayerType* layerToRemove, LayerList
layerToRemove->clearRenderSurface();
}
+inline bool isPositiveScaleOrTranslation(const gfx::Transform& xform)
jamesr 2012/12/14 21:48:54 is there a caller to this function? I can't find i
whunt 2012/12/14 22:12:20 This function is no longer used due to the relianc
+{
+ if (!xform.IsScaleOrTranslation())
+ return false;
+
+ // Grab our scale and make sure it's positive.
+ double x_scale = xform.matrix().getDouble(0,0);
jamesr 2012/12/14 21:48:54 nit: space after the comma
+ double y_scale = xform.matrix().getDouble(1,1);
+ if (x_scale <= 0.0f || y_scale <= 0.0f)
jamesr 2012/12/14 21:48:54 nit: "0.0", not "0.0f" since it's a double-double
+ return false;
+
+ return true;
+}
+
// Recursively walks the layer tree to compute any information that is needed
// before doing the main recursion.
template<typename LayerType>
static void preCalculateMetaInformation(LayerType* layer)
{
int numDescendantsThatDrawContent = 0;
+ int numDescendantsThatDrawContentAndCantClipThemsleves = 0;
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;
+
+ numDescendantsThatDrawContentAndCantClipThemsleves += childLayer->drawsContent() && !childLayer->CanClipSelf() ? 1 : 0;
+ numDescendantsThatDrawContentAndCantClipThemsleves += childLayer->drawProperties().num_descendants_that_draw_content_and_cant_clip_themselves;
}
layer->drawProperties().num_descendants_that_draw_content = numDescendantsThatDrawContent;
+ layer->drawProperties().num_descendants_that_draw_content_and_cant_clip_themselves = numDescendantsThatDrawContentAndCantClipThemsleves;
}
// Recursively walks the layer tree starting at the given node and computes all the
« cc/draw_properties.h ('K') | « cc/layer_impl.h ('k') | cc/texture_layer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698