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

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: Addressed reviewers feedback 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
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 662 matching lines...) Expand 10 before | Expand all | Expand 10 after
673 673
674 // The drawTransform that gets computed below is effectively the layer's dra wTransform, unless 674 // The drawTransform that gets computed below is effectively the layer's dra wTransform, unless
675 // the layer itself creates a renderSurface. In that case, the renderSurface re-parents the transforms. 675 // the layer itself creates a renderSurface. In that case, the renderSurface re-parents the transforms.
676 layerDrawProperties.target_space_transform = combinedTransform; 676 layerDrawProperties.target_space_transform = combinedTransform;
677 // M[draw] = M[parent] * LT * S[layer2content] 677 // M[draw] = M[parent] * LT * S[layer2content]
678 layerDrawProperties.target_space_transform.Scale(1.0 / layer->contentsScaleX (), 1.0 / layer->contentsScaleY()); 678 layerDrawProperties.target_space_transform.Scale(1.0 / layer->contentsScaleX (), 1.0 / layer->contentsScaleY());
679 679
680 // layerScreenSpaceTransform represents the transform between root layer's " screen space" and local content space. 680 // layerScreenSpaceTransform represents the transform between root layer's " screen space" and local content space.
681 layerDrawProperties.screen_space_transform = fullHierarchyMatrix; 681 layerDrawProperties.screen_space_transform = fullHierarchyMatrix;
682 if (!layer->preserves3D()) 682 if (!layer->preserves3D())
683 MathUtil::flattenTransformTo2d(layerDrawProperties.screen_space_transfor m); 683 layerDrawProperties.screen_space_transform.FlattenTo2d();
684 layerDrawProperties.screen_space_transform.PreconcatTransform(layerDrawPrope rties.target_space_transform); 684 layerDrawProperties.screen_space_transform.PreconcatTransform(layerDrawPrope rties.target_space_transform);
685 685
686 // Adjusting text AA method during animation may cause repaints, which in-tu rn causes jank. 686 // Adjusting text AA method during animation may cause repaints, which in-tu rn causes jank.
687 bool adjustTextAA = !animatingOpacityToScreen && !animatingTransformToScreen ; 687 bool adjustTextAA = !animatingOpacityToScreen && !animatingTransformToScreen ;
688 // To avoid color fringing, LCD text should only be used on opaque layers wi th just integral translation. 688 // To avoid color fringing, LCD text should only be used on opaque layers wi th just integral translation.
689 bool layerCanUseLCDText = subtreeCanUseLCDText && 689 bool layerCanUseLCDText = subtreeCanUseLCDText &&
690 (accumulatedDrawOpacity == 1.0) && 690 (accumulatedDrawOpacity == 1.0) &&
691 layerDrawProperties.target_space_transform.IsIdent ityOrIntegerTranslation(); 691 layerDrawProperties.target_space_transform.IsIdent ityOrIntegerTranslation();
692 692
693 gfx::RectF contentRect(gfx::PointF(), layer->contentBounds()); 693 gfx::RectF contentRect(gfx::PointF(), layer->contentBounds());
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
827 subtreeShouldBeClipped = true; 827 subtreeShouldBeClipped = true;
828 if (ancestorClipsSubtree && !layer->renderSurface()) { 828 if (ancestorClipsSubtree && !layer->renderSurface()) {
829 clipRectForSubtree = clipRectFromAncestor; 829 clipRectForSubtree = clipRectFromAncestor;
830 clipRectForSubtree.Intersect(rectInTargetSpace); 830 clipRectForSubtree.Intersect(rectInTargetSpace);
831 } else 831 } else
832 clipRectForSubtree = rectInTargetSpace; 832 clipRectForSubtree = rectInTargetSpace;
833 } 833 }
834 834
835 // Flatten to 2D if the layer doesn't preserve 3D. 835 // Flatten to 2D if the layer doesn't preserve 3D.
836 if (!layer->preserves3D()) 836 if (!layer->preserves3D())
837 MathUtil::flattenTransformTo2d(sublayerMatrix); 837 sublayerMatrix.FlattenTo2d();
838 838
839 // Apply the sublayer transform at the center of the layer. 839 // Apply the sublayer transform at the center of the layer.
840 if (!layer->sublayerTransform().IsIdentity()) { 840 if (!layer->sublayerTransform().IsIdentity()) {
841 sublayerMatrix.Translate(0.5 * bounds.width(), 0.5 * bounds.height()); 841 sublayerMatrix.Translate(0.5 * bounds.width(), 0.5 * bounds.height());
842 sublayerMatrix.PreconcatTransform(layer->sublayerTransform()); 842 sublayerMatrix.PreconcatTransform(layer->sublayerTransform());
843 sublayerMatrix.Translate(-0.5 * bounds.width(), -0.5 * bounds.height()); 843 sublayerMatrix.Translate(-0.5 * bounds.width(), -0.5 * bounds.height());
844 } 844 }
845 845
846 LayerList& descendants = (layer->renderSurface() ? layer->renderSurface()->l ayerList() : layerList); 846 LayerList& descendants = (layer->renderSurface() ? layer->renderSurface()->l ayerList() : layerList);
847 847
(...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after
1163 1163
1164 // At this point, we think the point does hit the touch event handler region o n the layer, but we need to walk up 1164 // At this point, we think the point does hit the touch event handler region o n the layer, but we need to walk up
1165 // the parents to ensure that the layer was not clipped in such a way that the 1165 // the parents to ensure that the layer was not clipped in such a way that the
1166 // hit point actually should not hit the layer. 1166 // hit point actually should not hit the layer.
1167 if (pointIsClippedBySurfaceOrClipRect(screenSpacePoint, layerImpl)) 1167 if (pointIsClippedBySurfaceOrClipRect(screenSpacePoint, layerImpl))
1168 return false; 1168 return false;
1169 1169
1170 return true; 1170 return true;
1171 } 1171 }
1172 } // namespace cc 1172 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698