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

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

Issue 10993094: Make adding and subtracting gfx:: point types simpler. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: remove some patch noise Created 8 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 | 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_F_H_ 5 #ifndef UI_GFX_POINT_F_H_
6 #define UI_GFX_POINT_F_H_ 6 #define UI_GFX_POINT_F_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "ui/base/ui_export.h" 10 #include "ui/base/ui_export.h"
11 #include "ui/gfx/point_base.h" 11 #include "ui/gfx/point_base.h"
12 12
13 namespace gfx { 13 namespace gfx {
14 class Point;
15 14
16 // A floating version of gfx::Point. 15 // A floating version of gfx::Point.
17 class UI_EXPORT PointF : public PointBase<PointF, float> { 16 class UI_EXPORT PointF : public PointBase<PointF, float> {
18 public: 17 public:
19 PointF(); 18 PointF();
20 PointF(float x, float y); 19 PointF(float x, float y);
21 explicit PointF(Point& point); 20 PointF(const PointF& other);
sky 2012/09/28 23:05:49 Why remove the explicit?
22 ~PointF() {} 21 ~PointF();
23
24 Point ToPoint() const;
25 22
26 // Returns a string representation of point. 23 // Returns a string representation of point.
27 std::string ToString() const; 24 std::string ToString() const;
28 }; 25 };
29 26
27 inline PointF operator+(PointF lhs, PointF rhs) {
28 return lhs.Add(rhs);
29 }
30
31 inline PointF operator-(PointF lhs, PointF rhs) {
32 return lhs.Subtract(rhs);
33 }
34
30 #if !defined(COMPILER_MSVC) 35 #if !defined(COMPILER_MSVC)
31 extern template class PointBase<PointF, float>; 36 extern template class PointBase<PointF, float>;
32 #endif 37 #endif
33 38
34 } // namespace gfx 39 } // namespace gfx
35 40
36 #endif // UI_GFX_POINT_F_H_ 41 #endif // UI_GFX_POINT_F_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698