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

Side by Side Diff: ui/views/view.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
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 #define _USE_MATH_DEFINES // For VC++ to get M_PI. This has to be first. 5 #define _USE_MATH_DEFINES // For VC++ to get M_PI. This has to be first.
6 6
7 #include "ui/views/view.h" 7 #include "ui/views/view.h"
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <cmath> 10 #include <cmath>
(...skipping 1981 matching lines...) Expand 10 before | Expand all | Expand 10 after
1992 } 1992 }
1993 1993
1994 // Coordinate conversion ------------------------------------------------------- 1994 // Coordinate conversion -------------------------------------------------------
1995 1995
1996 bool View::ConvertPointForAncestor(const View* ancestor, 1996 bool View::ConvertPointForAncestor(const View* ancestor,
1997 gfx::Point* point) const { 1997 gfx::Point* point) const {
1998 gfx::Transform trans; 1998 gfx::Transform trans;
1999 // TODO(sad): Have some way of caching the transformation results. 1999 // TODO(sad): Have some way of caching the transformation results.
2000 bool result = GetTransformRelativeTo(ancestor, &trans); 2000 bool result = GetTransformRelativeTo(ancestor, &trans);
2001 gfx::Point3F p(*point); 2001 gfx::Point3F p(*point);
2002 trans.TransformPoint(p); 2002 trans.TransformPoint(&p);
2003 *point = gfx::ToFlooredPoint(p.AsPointF()); 2003 *point = gfx::ToFlooredPoint(p.AsPointF());
2004 return result; 2004 return result;
2005 } 2005 }
2006 2006
2007 bool View::ConvertPointFromAncestor(const View* ancestor, 2007 bool View::ConvertPointFromAncestor(const View* ancestor,
2008 gfx::Point* point) const { 2008 gfx::Point* point) const {
2009 gfx::Transform trans; 2009 gfx::Transform trans;
2010 bool result = GetTransformRelativeTo(ancestor, &trans); 2010 bool result = GetTransformRelativeTo(ancestor, &trans);
2011 gfx::Point3F p(*point); 2011 gfx::Point3F p(*point);
2012 trans.TransformPointReverse(p); 2012 trans.TransformPointReverse(&p);
2013 *point = gfx::ToFlooredPoint(p.AsPointF()); 2013 *point = gfx::ToFlooredPoint(p.AsPointF());
2014 return result; 2014 return result;
2015 } 2015 }
2016 2016
2017 // Accelerated painting -------------------------------------------------------- 2017 // Accelerated painting --------------------------------------------------------
2018 2018
2019 void View::CreateLayer() { 2019 void View::CreateLayer() {
2020 // A new layer is being created for the view. So all the layers of the 2020 // A new layer is being created for the view. So all the layers of the
2021 // sub-tree can inherit the visibility of the corresponding view. 2021 // sub-tree can inherit the visibility of the corresponding view.
2022 for (int i = 0, count = child_count(); i < count; ++i) 2022 for (int i = 0, count = child_count(); i < count; ++i)
(...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after
2320 ConvertPointToWidget(this, &widget_location); 2320 ConvertPointToWidget(this, &widget_location);
2321 widget->RunShellDrag(this, data, widget_location, drag_operations, source); 2321 widget->RunShellDrag(this, data, widget_location, drag_operations, source);
2322 // WARNING: we may have been deleted. 2322 // WARNING: we may have been deleted.
2323 return true; 2323 return true;
2324 #else 2324 #else
2325 return false; 2325 return false;
2326 #endif // !defined(OS_MACOSX) 2326 #endif // !defined(OS_MACOSX)
2327 } 2327 }
2328 2328
2329 } // namespace views 2329 } // namespace views
OLDNEW
« no previous file with comments | « ui/gfx/transform_util_unittest.cc ('k') | webkit/renderer/compositor_bindings/web_layer_impl_fixed_bounds_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698