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

Unified Diff: cc/layer_tree_host_common.cc

Issue 11316171: Don't create render passes for transparent images. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase. Created 8 years, 1 month 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
« no previous file with comments | « cc/layer_iterator_unittest.cc ('k') | cc/layer_tree_host_common_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/layer_tree_host_common.cc
diff --git a/cc/layer_tree_host_common.cc b/cc/layer_tree_host_common.cc
index 0d6909cd9c0ae3b7ecd6734e1610ad3f08e23614..8aff2029e27fd339917cf9b5afdec7beac69b28e 100644
--- a/cc/layer_tree_host_common.cc
+++ b/cc/layer_tree_host_common.cc
@@ -250,19 +250,20 @@ static bool subtreeShouldRenderToSeparateSurface(LayerType* layer, bool axisAlig
return true;
// Cache this value, because otherwise it walks the entire subtree several times.
- bool descendantDrawsContent = layer->descendantDrawsContent();
+ int descendantsDrawContent = layer->descendantsDrawContent();
// 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).
- if (layerIsInExisting3DRenderingContext(layer) && !layer->preserves3D() && descendantDrawsContent)
+ if (layerIsInExisting3DRenderingContext(layer) && !layer->preserves3D() && descendantsDrawContent > 0)
return true;
// If the layer clips its descendants but it is not axis-aligned with respect to its parent.
- if (layerClipsSubtree(layer) && !axisAlignedWithRespectToParent && descendantDrawsContent)
+ if (layerClipsSubtree(layer) && !axisAlignedWithRespectToParent && descendantsDrawContent > 0)
return true;
// If the layer has opacity != 1 and does not have a preserves-3d transform style.
- if (layer->opacity() != 1 && !layer->preserves3D() && descendantDrawsContent)
+ if (layer->opacity() != 1 && !layer->preserves3D() && descendantsDrawContent > 0
+ && (layer->drawsContent() || descendantsDrawContent > 1))
return true;
return false;
@@ -487,10 +488,10 @@ static void calculateDrawTransformsInternal(LayerType* layer, const gfx::Transfo
gfx::Rect clipRectForSubtree;
bool subtreeShouldBeClipped = false;
-
+
float drawOpacity = layer->opacity();
bool drawOpacityIsAnimating = layer->opacityIsAnimating();
- if (layer->parent() && layer->parent()->preserves3D()) {
+ if (layer->parent()) {
drawOpacity *= layer->parent()->drawOpacity();
drawOpacityIsAnimating |= layer->parent()->drawOpacityIsAnimating();
}
« no previous file with comments | « cc/layer_iterator_unittest.cc ('k') | cc/layer_tree_host_common_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698