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

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 review. 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
« no previous file with comments | « no previous file | no next file » | 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/layer_tree_host_common.h" 5 #include "cc/layer_tree_host_common.h"
6 6
7 #include "cc/layer.h" 7 #include "cc/layer.h"
8 #include "cc/layer_impl.h" 8 #include "cc/layer_impl.h"
9 #include "cc/layer_iterator.h" 9 #include "cc/layer_iterator.h"
10 #include "cc/layer_sorter.h" 10 #include "cc/layer_sorter.h"
(...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after
252 // If the layer flattens its subtree (i.e. the layer doesn't preserve-3d), b ut it is 252 // If the layer flattens its subtree (i.e. the layer doesn't preserve-3d), b ut it is
253 // treated as a 3D object by its parent (i.e. parent does preserve-3d). 253 // treated as a 3D object by its parent (i.e. parent does preserve-3d).
254 if (layerIsInExisting3DRenderingContext(layer) && !layer->preserves3D() && d escendantDrawsContent) 254 if (layerIsInExisting3DRenderingContext(layer) && !layer->preserves3D() && d escendantDrawsContent)
255 return true; 255 return true;
256 256
257 // If the layer clips its descendants but it is not axis-aligned with respec t to its parent. 257 // If the layer clips its descendants but it is not axis-aligned with respec t to its parent.
258 if (layerClipsSubtree(layer) && !axisAlignedWithRespectToParent && descendan tDrawsContent) 258 if (layerClipsSubtree(layer) && !axisAlignedWithRespectToParent && descendan tDrawsContent)
259 return true; 259 return true;
260 260
261 // If the layer has opacity != 1 and does not have a preserves-3d transform style. 261 // If the layer has opacity != 1 and does not have a preserves-3d transform style.
262 if (layer->opacity() != 1 && !layer->preserves3D() && descendantDrawsContent ) 262 if (layer->opacity() != 1 && !layer->preserves3D() && layer->drawsContent() && descendantDrawsContent)
263 return true; 263 return true;
264 264
265 return false; 265 return false;
266 } 266 }
267 267
268 WebTransformationMatrix computeScrollCompensationForThisLayer(LayerImpl* scrolli ngLayer, const WebTransformationMatrix& parentMatrix) 268 WebTransformationMatrix computeScrollCompensationForThisLayer(LayerImpl* scrolli ngLayer, const WebTransformationMatrix& parentMatrix)
269 { 269 {
270 // For every layer that has non-zero scrollDelta, we have to compute a trans form that can undo the 270 // For every layer that has non-zero scrollDelta, we have to compute a trans form that can undo the
271 // scrollDelta translation. In particular, we want this matrix to premultipl y a fixed-position layer's 271 // scrollDelta translation. In particular, we want this matrix to premultipl y a fixed-position layer's
272 // parentMatrix, so we design this transform in three steps as follows. The steps described here apply 272 // 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
477 477
478 // If we early-exit anywhere in this function, the drawableContentRect of th is subtree should be considered empty. 478 // If we early-exit anywhere in this function, the drawableContentRect of th is subtree should be considered empty.
479 drawableContentRectOfSubtree = gfx::Rect(); 479 drawableContentRectOfSubtree = gfx::Rect();
480 480
481 // The root layer cannot skip calcDrawTransforms. 481 // The root layer cannot skip calcDrawTransforms.
482 if (!isRootLayer(layer) && subtreeShouldBeSkipped(layer)) 482 if (!isRootLayer(layer) && subtreeShouldBeSkipped(layer))
483 return; 483 return;
484 484
485 gfx::Rect clipRectForSubtree; 485 gfx::Rect clipRectForSubtree;
486 bool subtreeShouldBeClipped = false; 486 bool subtreeShouldBeClipped = false;
487 487
488 float drawOpacity = layer->opacity(); 488 float drawOpacity = layer->opacity();
489 bool drawOpacityIsAnimating = layer->opacityIsAnimating(); 489 bool drawOpacityIsAnimating = layer->opacityIsAnimating();
490 if (layer->parent() && layer->parent()->preserves3D()) { 490 if (layer->parent()) {
491 drawOpacity *= layer->parent()->drawOpacity(); 491 drawOpacity *= layer->parent()->drawOpacity();
492 drawOpacityIsAnimating |= layer->parent()->drawOpacityIsAnimating(); 492 drawOpacityIsAnimating |= layer->parent()->drawOpacityIsAnimating();
493 } 493 }
494 494
495 bool animatingTransformToTarget = layer->transformIsAnimating(); 495 bool animatingTransformToTarget = layer->transformIsAnimating();
496 bool animatingTransformToScreen = animatingTransformToTarget; 496 bool animatingTransformToScreen = animatingTransformToTarget;
497 if (layer->parent()) { 497 if (layer->parent() && !layer->parent()->renderSurface()) {
shawnsingh 2012/11/26 19:03:08 I think our discussion also applies to this if-sta
danakj 2012/11/26 19:09:44 Yes, the check was added to the wrong if statement
498 animatingTransformToTarget |= layer->parent()->drawTransformIsAnimating( ); 498 animatingTransformToTarget |= layer->parent()->drawTransformIsAnimating( );
499 animatingTransformToScreen |= layer->parent()->screenSpaceTransformIsAni mating(); 499 animatingTransformToScreen |= layer->parent()->screenSpaceTransformIsAni mating();
500 } 500 }
501 501
502 gfx::Size bounds = layer->bounds(); 502 gfx::Size bounds = layer->bounds();
503 gfx::PointF anchorPoint = layer->anchorPoint(); 503 gfx::PointF anchorPoint = layer->anchorPoint();
504 gfx::PointF position = layer->position() - layer->scrollDelta(); 504 gfx::PointF position = layer->position() - layer->scrollDelta();
505 505
506 WebTransformationMatrix layerLocalTransform; 506 WebTransformationMatrix layerLocalTransform;
507 // LT = Tr[origin] * Tr[origin2anchor] 507 // LT = Tr[origin] * Tr[origin2anchor]
(...skipping 479 matching lines...) Expand 10 before | Expand all | Expand 10 after
987 987
988 foundLayer = currentLayer; 988 foundLayer = currentLayer;
989 break; 989 break;
990 } 990 }
991 991
992 // This can potentially return 0, which means the screenSpacePoint did not s uccessfully hit test any layers, not even the root layer. 992 // This can potentially return 0, which means the screenSpacePoint did not s uccessfully hit test any layers, not even the root layer.
993 return foundLayer; 993 return foundLayer;
994 } 994 }
995 995
996 } // namespace cc 996 } // namespace cc
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698