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

Side by Side Diff: cc/layer_tree_host_common.cc

Issue 11774005: Migrate more functions from MathUtil to gfx::Transform (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: try to fix double/float conversion errors Created 7 years, 11 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 | « cc/layer_sorter_unittest.cc ('k') | 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 673 matching lines...) Expand 10 before | Expand all | Expand 10 after
684 684
685 // The drawTransform that gets computed below is effectively the layer's dra wTransform, unless 685 // The drawTransform that gets computed below is effectively the layer's dra wTransform, unless
686 // the layer itself creates a renderSurface. In that case, the renderSurface re-parents the transforms. 686 // the layer itself creates a renderSurface. In that case, the renderSurface re-parents the transforms.
687 layerDrawProperties.target_space_transform = combinedTransform; 687 layerDrawProperties.target_space_transform = combinedTransform;
688 // M[draw] = M[parent] * LT * S[layer2content] 688 // M[draw] = M[parent] * LT * S[layer2content]
689 layerDrawProperties.target_space_transform.Scale(1.0 / layer->contentsScaleX (), 1.0 / layer->contentsScaleY()); 689 layerDrawProperties.target_space_transform.Scale(1.0 / layer->contentsScaleX (), 1.0 / layer->contentsScaleY());
690 690
691 // layerScreenSpaceTransform represents the transform between root layer's " screen space" and local content space. 691 // layerScreenSpaceTransform represents the transform between root layer's " screen space" and local content space.
692 layerDrawProperties.screen_space_transform = fullHierarchyMatrix; 692 layerDrawProperties.screen_space_transform = fullHierarchyMatrix;
693 if (!layer->preserves3D()) 693 if (!layer->preserves3D())
694 MathUtil::flattenTransformTo2d(layerDrawProperties.screen_space_transfor m); 694 layerDrawProperties.screen_space_transform.FlattenTo2d();
695 layerDrawProperties.screen_space_transform.PreconcatTransform(layerDrawPrope rties.target_space_transform); 695 layerDrawProperties.screen_space_transform.PreconcatTransform(layerDrawPrope rties.target_space_transform);
696 696
697 // Adjusting text AA method during animation may cause repaints, which in-tu rn causes jank. 697 // Adjusting text AA method during animation may cause repaints, which in-tu rn causes jank.
698 bool adjustTextAA = !animatingOpacityToScreen && !animatingTransformToScreen ; 698 bool adjustTextAA = !animatingOpacityToScreen && !animatingTransformToScreen ;
699 // To avoid color fringing, LCD text should only be used on opaque layers wi th just integral translation. 699 // To avoid color fringing, LCD text should only be used on opaque layers wi th just integral translation.
700 bool layerCanUseLCDText = subtreeCanUseLCDText && 700 bool layerCanUseLCDText = subtreeCanUseLCDText &&
701 (accumulatedDrawOpacity == 1.0) && 701 (accumulatedDrawOpacity == 1.0) &&
702 layerDrawProperties.target_space_transform.IsIdent ityOrIntegerTranslation(); 702 layerDrawProperties.target_space_transform.IsIdent ityOrIntegerTranslation();
703 703
704 gfx::RectF contentRect(gfx::PointF(), layer->contentBounds()); 704 gfx::RectF contentRect(gfx::PointF(), layer->contentBounds());
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
838 subtreeShouldBeClipped = true; 838 subtreeShouldBeClipped = true;
839 if (ancestorClipsSubtree && !layer->renderSurface()) { 839 if (ancestorClipsSubtree && !layer->renderSurface()) {
840 clipRectForSubtree = clipRectFromAncestor; 840 clipRectForSubtree = clipRectFromAncestor;
841 clipRectForSubtree.Intersect(rectInTargetSpace); 841 clipRectForSubtree.Intersect(rectInTargetSpace);
842 } else 842 } else
843 clipRectForSubtree = rectInTargetSpace; 843 clipRectForSubtree = rectInTargetSpace;
844 } 844 }
845 845
846 // Flatten to 2D if the layer doesn't preserve 3D. 846 // Flatten to 2D if the layer doesn't preserve 3D.
847 if (!layer->preserves3D()) 847 if (!layer->preserves3D())
848 MathUtil::flattenTransformTo2d(sublayerMatrix); 848 sublayerMatrix.FlattenTo2d();
849 849
850 // Apply the sublayer transform at the center of the layer. 850 // Apply the sublayer transform at the center of the layer.
851 if (!layer->sublayerTransform().IsIdentity()) { 851 if (!layer->sublayerTransform().IsIdentity()) {
852 sublayerMatrix.Translate(0.5 * bounds.width(), 0.5 * bounds.height()); 852 sublayerMatrix.Translate(0.5 * bounds.width(), 0.5 * bounds.height());
853 sublayerMatrix.PreconcatTransform(layer->sublayerTransform()); 853 sublayerMatrix.PreconcatTransform(layer->sublayerTransform());
854 sublayerMatrix.Translate(-0.5 * bounds.width(), -0.5 * bounds.height()); 854 sublayerMatrix.Translate(-0.5 * bounds.width(), -0.5 * bounds.height());
855 } 855 }
856 856
857 LayerList& descendants = (layer->renderSurface() ? layer->renderSurface()->l ayerList() : layerList); 857 LayerList& descendants = (layer->renderSurface() ? layer->renderSurface()->l ayerList() : layerList);
858 858
(...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after
1174 1174
1175 // At this point, we think the point does hit the touch event handler region o n the layer, but we need to walk up 1175 // At this point, we think the point does hit the touch event handler region o n the layer, but we need to walk up
1176 // the parents to ensure that the layer was not clipped in such a way that the 1176 // the parents to ensure that the layer was not clipped in such a way that the
1177 // hit point actually should not hit the layer. 1177 // hit point actually should not hit the layer.
1178 if (pointIsClippedBySurfaceOrClipRect(screenSpacePoint, layerImpl)) 1178 if (pointIsClippedBySurfaceOrClipRect(screenSpacePoint, layerImpl))
1179 return false; 1179 return false;
1180 1180
1181 return true; 1181 return true;
1182 } 1182 }
1183 } // namespace cc 1183 } // namespace cc
OLDNEW
« no previous file with comments | « cc/layer_sorter_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