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

Side by Side Diff: ui/compositor/layer.cc

Issue 23724024: Refactor TransformPoint{,Reverse}. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase and resolve conflicts. Created 7 years, 3 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
« no previous file with comments | « ui/compositor/debug_utils.cc ('k') | ui/gfx/interpolated_transform_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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "ui/compositor/layer.h" 5 #include "ui/compositor/layer.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/debug/trace_event.h" 10 #include "base/debug/trace_event.h"
(...skipping 696 matching lines...) Expand 10 before | Expand all | Expand 10 after
707 707
708 child->cc_layer_->RemoveFromParent(); 708 child->cc_layer_->RemoveFromParent();
709 cc_layer_->InsertChild(child->cc_layer_, dest_i); 709 cc_layer_->InsertChild(child->cc_layer_, dest_i);
710 } 710 }
711 711
712 bool Layer::ConvertPointForAncestor(const Layer* ancestor, 712 bool Layer::ConvertPointForAncestor(const Layer* ancestor,
713 gfx::Point* point) const { 713 gfx::Point* point) const {
714 gfx::Transform transform; 714 gfx::Transform transform;
715 bool result = GetTargetTransformRelativeTo(ancestor, &transform); 715 bool result = GetTargetTransformRelativeTo(ancestor, &transform);
716 gfx::Point3F p(*point); 716 gfx::Point3F p(*point);
717 transform.TransformPoint(p); 717 transform.TransformPoint(&p);
718 *point = gfx::ToFlooredPoint(p.AsPointF()); 718 *point = gfx::ToFlooredPoint(p.AsPointF());
719 return result; 719 return result;
720 } 720 }
721 721
722 bool Layer::ConvertPointFromAncestor(const Layer* ancestor, 722 bool Layer::ConvertPointFromAncestor(const Layer* ancestor,
723 gfx::Point* point) const { 723 gfx::Point* point) const {
724 gfx::Transform transform; 724 gfx::Transform transform;
725 bool result = GetTargetTransformRelativeTo(ancestor, &transform); 725 bool result = GetTargetTransformRelativeTo(ancestor, &transform);
726 gfx::Point3F p(*point); 726 gfx::Point3F p(*point);
727 transform.TransformPointReverse(p); 727 transform.TransformPointReverse(&p);
728 *point = gfx::ToFlooredPoint(p.AsPointF()); 728 *point = gfx::ToFlooredPoint(p.AsPointF());
729 return result; 729 return result;
730 } 730 }
731 731
732 void Layer::SetBoundsImmediately(const gfx::Rect& bounds) { 732 void Layer::SetBoundsImmediately(const gfx::Rect& bounds) {
733 if (bounds == bounds_) 733 if (bounds == bounds_)
734 return; 734 return;
735 735
736 base::Closure closure; 736 base::Closure closure;
737 if (delegate_) 737 if (delegate_)
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after
971 cc_layer_->SetBounds(ConvertSizeToPixel(this, size)); 971 cc_layer_->SetBounds(ConvertSizeToPixel(this, size));
972 } 972 }
973 973
974 void Layer::RecomputePosition() { 974 void Layer::RecomputePosition() {
975 cc_layer_->SetPosition(gfx::ScalePoint( 975 cc_layer_->SetPosition(gfx::ScalePoint(
976 gfx::PointF(bounds_.x(), bounds_.y()), 976 gfx::PointF(bounds_.x(), bounds_.y()),
977 device_scale_factor_)); 977 device_scale_factor_));
978 } 978 }
979 979
980 } // namespace ui 980 } // namespace ui
OLDNEW
« no previous file with comments | « ui/compositor/debug_utils.cc ('k') | ui/gfx/interpolated_transform_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698