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

Side by Side Diff: cc/layer_tree_host_common.cc

Issue 12224113: [cc] Apply sublayer transform about anchor instead of about layer center. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 10 months 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 | cc/layer_tree_host_common_unittest.cc » ('j') | 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 <algorithm> 7 #include <algorithm>
8 8
9 #include "base/debug/trace_event.h" 9 #include "base/debug/trace_event.h"
10 #include "cc/layer.h" 10 #include "cc/layer.h"
(...skipping 849 matching lines...) Expand 10 before | Expand all | Expand 10 after
860 clipRectForSubtree = clipRectFromAncestor; 860 clipRectForSubtree = clipRectFromAncestor;
861 clipRectForSubtree.Intersect(rectInTargetSpace); 861 clipRectForSubtree.Intersect(rectInTargetSpace);
862 } else 862 } else
863 clipRectForSubtree = rectInTargetSpace; 863 clipRectForSubtree = rectInTargetSpace;
864 } 864 }
865 865
866 // Flatten to 2D if the layer doesn't preserve 3D. 866 // Flatten to 2D if the layer doesn't preserve 3D.
867 if (!layer->preserves3D()) 867 if (!layer->preserves3D())
868 sublayerMatrix.FlattenTo2d(); 868 sublayerMatrix.FlattenTo2d();
869 869
870 // Apply the sublayer transform at the center of the layer. 870 // Apply the sublayer transform at the center of the layer.
danakj 2013/02/12 00:58:23 This comment is wrong now.
871 if (!layer->sublayerTransform().IsIdentity()) { 871 if (!layer->sublayerTransform().IsIdentity()) {
872 sublayerMatrix.Translate(0.5 * bounds.width(), 0.5 * bounds.height()); 872 sublayerMatrix.Translate(layer->anchorPoint().x() * bounds.width(), laye r->anchorPoint().y() * bounds.height());
873 sublayerMatrix.PreconcatTransform(layer->sublayerTransform()); 873 sublayerMatrix.PreconcatTransform(layer->sublayerTransform());
874 sublayerMatrix.Translate(-0.5 * bounds.width(), -0.5 * bounds.height()); 874 sublayerMatrix.Translate(-layer->anchorPoint().x() * bounds.width(), -la yer->anchorPoint().y() * bounds.height());
875 } 875 }
876 876
877 LayerList& descendants = (layer->renderSurface() ? layer->renderSurface()->l ayerList() : layerList); 877 LayerList& descendants = (layer->renderSurface() ? layer->renderSurface()->l ayerList() : layerList);
878 878
879 // Any layers that are appended after this point are in the layer's subtree and should be included in the sorting process. 879 // Any layers that are appended after this point are in the layer's subtree and should be included in the sorting process.
880 unsigned sortingStartIndex = descendants.size(); 880 unsigned sortingStartIndex = descendants.size();
881 881
882 if (!layerShouldBeSkipped(layer)) 882 if (!layerShouldBeSkipped(layer))
883 descendants.push_back(layer); 883 descendants.push_back(layer);
884 884
(...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after
1198 1198
1199 // At this point, we think the point does hit the touch event handler region o n the layer, but we need to walk up 1199 // At this point, we think the point does hit the touch event handler region o n the layer, but we need to walk up
1200 // the parents to ensure that the layer was not clipped in such a way that the 1200 // the parents to ensure that the layer was not clipped in such a way that the
1201 // hit point actually should not hit the layer. 1201 // hit point actually should not hit the layer.
1202 if (pointIsClippedBySurfaceOrClipRect(screenSpacePoint, layerImpl)) 1202 if (pointIsClippedBySurfaceOrClipRect(screenSpacePoint, layerImpl))
1203 return false; 1203 return false;
1204 1204
1205 return true; 1205 return true;
1206 } 1206 }
1207 } // namespace cc 1207 } // namespace cc
OLDNEW
« no previous file with comments | « no previous file | cc/layer_tree_host_common_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698