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

Side by Side 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: Addressing code reviews. 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 unified diff | Download patch | Annotate | Revision Log
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/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 "cc/layer.h" 9 #include "cc/layer.h"
10 #include "cc/layer_impl.h" 10 #include "cc/layer_impl.h"
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after
251 251
252 // If the layer has a reflection. 252 // If the layer has a reflection.
253 if (layer->replicaLayer()) 253 if (layer->replicaLayer())
254 return true; 254 return true;
255 255
256 // If the layer uses a CSS filter. 256 // If the layer uses a CSS filter.
257 if (!layer->filters().isEmpty() || !layer->backgroundFilters().isEmpty() || layer->filter()) 257 if (!layer->filters().isEmpty() || !layer->backgroundFilters().isEmpty() || layer->filter())
258 return true; 258 return true;
259 259
260 // Cache this value, because otherwise it walks the entire subtree several t imes. 260 // Cache this value, because otherwise it walks the entire subtree several t imes.
261 bool descendantDrawsContent = layer->descendantDrawsContent(); 261 int descendantsDrawContent = layer->descendantsDrawContent();
262 262
263 // If the layer flattens its subtree (i.e. the layer doesn't preserve-3d), b ut it is 263 // If the layer flattens its subtree (i.e. the layer doesn't preserve-3d), b ut it is
264 // treated as a 3D object by its parent (i.e. parent does preserve-3d). 264 // treated as a 3D object by its parent (i.e. parent does preserve-3d).
265 if (layerIsInExisting3DRenderingContext(layer) && !layer->preserves3D() && d escendantDrawsContent) 265 if (layerIsInExisting3DRenderingContext(layer) && !layer->preserves3D() && d escendantsDrawContent > 0)
266 return true; 266 return true;
267 267
268 // If the layer clips its descendants but it is not axis-aligned with respec t to its parent. 268 // If the layer clips its descendants but it is not axis-aligned with respec t to its parent.
269 if (layerClipsSubtree(layer) && !axisAlignedWithRespectToParent && descendan tDrawsContent) 269 if (layerClipsSubtree(layer) && !axisAlignedWithRespectToParent && descendan tsDrawContent > 0)
270 return true; 270 return true;
271 271
272 // If the layer has opacity != 1 and does not have a preserves-3d transform style. 272 // If the layer has opacity != 1 and does not have a preserves-3d transform style.
273 if (layer->opacity() != 1 && !layer->preserves3D() && descendantDrawsContent ) 273 if (layer->opacity() != 1 && !layer->preserves3D() && descendantsDrawContent > 0
274 && (layer->drawsContent() || descendantsDrawContent > 1))
274 return true; 275 return true;
275 276
276 return false; 277 return false;
277 } 278 }
278 279
279 gfx::Transform computeScrollCompensationForThisLayer(LayerImpl* scrollingLayer, const gfx::Transform& parentMatrix) 280 gfx::Transform computeScrollCompensationForThisLayer(LayerImpl* scrollingLayer, const gfx::Transform& parentMatrix)
280 { 281 {
281 // For every layer that has non-zero scrollDelta, we have to compute a trans form that can undo the 282 // For every layer that has non-zero scrollDelta, we have to compute a trans form that can undo the
282 // scrollDelta translation. In particular, we want this matrix to premultipl y a fixed-position layer's 283 // scrollDelta translation. In particular, we want this matrix to premultipl y a fixed-position layer's
283 // parentMatrix, so we design this transform in three steps as follows. The steps described here apply 284 // parentMatrix, so we design this transform in three steps as follows. The steps described here apply
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after
488 489
489 // If we early-exit anywhere in this function, the drawableContentRect of th is subtree should be considered empty. 490 // If we early-exit anywhere in this function, the drawableContentRect of th is subtree should be considered empty.
490 drawableContentRectOfSubtree = gfx::Rect(); 491 drawableContentRectOfSubtree = gfx::Rect();
491 492
492 // The root layer cannot skip calcDrawTransforms. 493 // The root layer cannot skip calcDrawTransforms.
493 if (!isRootLayer(layer) && subtreeShouldBeSkipped(layer)) 494 if (!isRootLayer(layer) && subtreeShouldBeSkipped(layer))
494 return; 495 return;
495 496
496 gfx::Rect clipRectForSubtree; 497 gfx::Rect clipRectForSubtree;
497 bool subtreeShouldBeClipped = false; 498 bool subtreeShouldBeClipped = false;
498 499
499 float drawOpacity = layer->opacity(); 500 float drawOpacity = layer->opacity();
500 bool drawOpacityIsAnimating = layer->opacityIsAnimating(); 501 bool drawOpacityIsAnimating = layer->opacityIsAnimating();
501 if (layer->parent() && layer->parent()->preserves3D()) { 502 if (layer->parent()) {
502 drawOpacity *= layer->parent()->drawOpacity(); 503 drawOpacity *= layer->parent()->drawOpacity();
503 drawOpacityIsAnimating |= layer->parent()->drawOpacityIsAnimating(); 504 drawOpacityIsAnimating |= layer->parent()->drawOpacityIsAnimating();
504 } 505 }
505 506
506 bool animatingTransformToTarget = layer->transformIsAnimating(); 507 bool animatingTransformToTarget = layer->transformIsAnimating();
507 bool animatingTransformToScreen = animatingTransformToTarget; 508 bool animatingTransformToScreen = animatingTransformToTarget;
508 if (layer->parent()) { 509 if (layer->parent()) {
509 animatingTransformToTarget |= layer->parent()->drawTransformIsAnimating( ); 510 animatingTransformToTarget |= layer->parent()->drawTransformIsAnimating( );
510 animatingTransformToScreen |= layer->parent()->screenSpaceTransformIsAni mating(); 511 animatingTransformToScreen |= layer->parent()->screenSpaceTransformIsAni mating();
511 } 512 }
(...skipping 488 matching lines...) Expand 10 before | Expand all | Expand 10 after
1000 1001
1001 foundLayer = currentLayer; 1002 foundLayer = currentLayer;
1002 break; 1003 break;
1003 } 1004 }
1004 1005
1005 // This can potentially return 0, which means the screenSpacePoint did not s uccessfully hit test any layers, not even the root layer. 1006 // This can potentially return 0, which means the screenSpacePoint did not s uccessfully hit test any layers, not even the root layer.
1006 return foundLayer; 1007 return foundLayer;
1007 } 1008 }
1008 1009
1009 } // namespace cc 1010 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698