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

Side by Side Diff: ui/views/view.cc

Issue 1372253002: gfx: Make conversions from gfx::Point to PointF explicit. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: pointfconvert-gfx: . Created 5 years, 2 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 1964 matching lines...) Expand 10 before | Expand all | Expand 10 after
1975 return p == ancestor; 1975 return p == ancestor;
1976 } 1976 }
1977 1977
1978 // Coordinate conversion ------------------------------------------------------- 1978 // Coordinate conversion -------------------------------------------------------
1979 1979
1980 bool View::ConvertPointForAncestor(const View* ancestor, 1980 bool View::ConvertPointForAncestor(const View* ancestor,
1981 gfx::Point* point) const { 1981 gfx::Point* point) const {
1982 gfx::Transform trans; 1982 gfx::Transform trans;
1983 // TODO(sad): Have some way of caching the transformation results. 1983 // TODO(sad): Have some way of caching the transformation results.
1984 bool result = GetTransformRelativeTo(ancestor, &trans); 1984 bool result = GetTransformRelativeTo(ancestor, &trans);
1985 gfx::Point3F p(*point); 1985 auto p = gfx::Point3F(gfx::PointF(*point));
1986 trans.TransformPoint(&p); 1986 trans.TransformPoint(&p);
1987 *point = gfx::ToFlooredPoint(p.AsPointF()); 1987 *point = gfx::ToFlooredPoint(p.AsPointF());
1988 return result; 1988 return result;
1989 } 1989 }
1990 1990
1991 bool View::ConvertPointFromAncestor(const View* ancestor, 1991 bool View::ConvertPointFromAncestor(const View* ancestor,
1992 gfx::Point* point) const { 1992 gfx::Point* point) const {
1993 gfx::Transform trans; 1993 gfx::Transform trans;
1994 bool result = GetTransformRelativeTo(ancestor, &trans); 1994 bool result = GetTransformRelativeTo(ancestor, &trans);
1995 gfx::Point3F p(*point); 1995 auto p = gfx::Point3F(gfx::PointF(*point));
1996 trans.TransformPointReverse(&p); 1996 trans.TransformPointReverse(&p);
1997 *point = gfx::ToFlooredPoint(p.AsPointF()); 1997 *point = gfx::ToFlooredPoint(p.AsPointF());
1998 return result; 1998 return result;
1999 } 1999 }
2000 2000
2001 bool View::ConvertRectForAncestor(const View* ancestor, 2001 bool View::ConvertRectForAncestor(const View* ancestor,
2002 gfx::RectF* rect) const { 2002 gfx::RectF* rect) const {
2003 gfx::Transform trans; 2003 gfx::Transform trans;
2004 // TODO(sad): Have some way of caching the transformation results. 2004 // TODO(sad): Have some way of caching the transformation results.
2005 bool result = GetTransformRelativeTo(ancestor, &trans); 2005 bool result = GetTransformRelativeTo(ancestor, &trans);
(...skipping 343 matching lines...) Expand 10 before | Expand all | Expand 10 after
2349 // Message the RootView to do the drag and drop. That way if we're removed 2349 // Message the RootView to do the drag and drop. That way if we're removed
2350 // the RootView can detect it and avoid calling us back. 2350 // the RootView can detect it and avoid calling us back.
2351 gfx::Point widget_location(event.location()); 2351 gfx::Point widget_location(event.location());
2352 ConvertPointToWidget(this, &widget_location); 2352 ConvertPointToWidget(this, &widget_location);
2353 widget->RunShellDrag(this, data, widget_location, drag_operations, source); 2353 widget->RunShellDrag(this, data, widget_location, drag_operations, source);
2354 // WARNING: we may have been deleted. 2354 // WARNING: we may have been deleted.
2355 return true; 2355 return true;
2356 } 2356 }
2357 2357
2358 } // namespace views 2358 } // namespace views
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698