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

Side by Side Diff: ui/gfx/point.h

Issue 11369144: ui: Make gfx::Point::Scale() mutate the class, similar to gfx::Rect. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixes for aura Created 8 years, 1 month 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 (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 #ifndef UI_GFX_POINT_H_ 5 #ifndef UI_GFX_POINT_H_
6 #define UI_GFX_POINT_H_ 6 #define UI_GFX_POINT_H_
7 7
8 #include "ui/base/ui_export.h" 8 #include "ui/base/ui_export.h"
9 #include "ui/gfx/point_base.h" 9 #include "ui/gfx/point_base.h"
10 #include "ui/gfx/point_f.h" 10 #include "ui/gfx/point_f.h"
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 #if defined(OS_WIN) 42 #if defined(OS_WIN)
43 POINT ToPOINT() const; 43 POINT ToPOINT() const;
44 #elif defined(OS_MACOSX) 44 #elif defined(OS_MACOSX)
45 CGPoint ToCGPoint() const; 45 CGPoint ToCGPoint() const;
46 #endif 46 #endif
47 47
48 operator PointF() const { 48 operator PointF() const {
49 return PointF(x(), y()); 49 return PointF(x(), y());
50 } 50 }
51 51
52 PointF Scale(float scale) const WARN_UNUSED_RESULT {
53 return Scale(scale, scale);
54 }
55
56 PointF Scale(float x_scale, float y_scale) const WARN_UNUSED_RESULT {
57 return PointF(x() * x_scale, y() * y_scale);
58 }
59
60 // Returns a string representation of point. 52 // Returns a string representation of point.
61 std::string ToString() const; 53 std::string ToString() const;
62 }; 54 };
63 55
64 inline bool operator==(const Point& lhs, const Point& rhs) { 56 inline bool operator==(const Point& lhs, const Point& rhs) {
65 return lhs.x() == rhs.x() && lhs.y() == rhs.y(); 57 return lhs.x() == rhs.x() && lhs.y() == rhs.y();
66 } 58 }
67 59
68 inline bool operator!=(const Point& lhs, const Point& rhs) { 60 inline bool operator!=(const Point& lhs, const Point& rhs) {
69 return !(lhs == rhs); 61 return !(lhs == rhs);
(...skipping 15 matching lines...) Expand all
85 return Point(offset_from_origin.x(), offset_from_origin.y()); 77 return Point(offset_from_origin.x(), offset_from_origin.y());
86 } 78 }
87 79
88 #if !defined(COMPILER_MSVC) 80 #if !defined(COMPILER_MSVC)
89 extern template class PointBase<Point, int, Vector2d>; 81 extern template class PointBase<Point, int, Vector2d>;
90 #endif 82 #endif
91 83
92 } // namespace gfx 84 } // namespace gfx
93 85
94 #endif // UI_GFX_POINT_H_ 86 #endif // UI_GFX_POINT_H_
OLDNEW
« cc/layer_impl.cc ('K') | « ui/compositor/dip_util.cc ('k') | ui/gfx/point_f.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698