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

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

Issue 11081007: Remove implicit flooring Scale() method from Point and Size. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 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
« no previous file with comments | « ui/gfx/point_conversions.cc ('k') | ui/gfx/shadow_value.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 #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 14
15 // A floating version of gfx::Point. 15 // A floating version of gfx::Point.
16 class UI_EXPORT PointF : public PointBase<PointF, float> { 16 class UI_EXPORT PointF : public PointBase<PointF, float> {
17 public: 17 public:
18 PointF(); 18 PointF();
19 PointF(float x, float y); 19 PointF(float x, float y);
20 ~PointF(); 20 ~PointF();
21 21
22 PointF Scale(float scale) const WARN_UNUSED_RESULT {
23 return Scale(scale, scale);
24 }
25
26 PointF Scale(float x_scale, float y_scale) const WARN_UNUSED_RESULT {
27 return PointF(x() * x_scale, y() * y_scale);
28 }
29
22 // Returns a string representation of point. 30 // Returns a string representation of point.
23 std::string ToString() const; 31 std::string ToString() const;
24 }; 32 };
25 33
26 inline PointF operator+(PointF lhs, PointF rhs) { 34 inline PointF operator+(PointF lhs, PointF rhs) {
27 return lhs.Add(rhs); 35 return lhs.Add(rhs);
28 } 36 }
29 37
30 inline PointF operator-(PointF lhs, PointF rhs) { 38 inline PointF operator-(PointF lhs, PointF rhs) {
31 return lhs.Subtract(rhs); 39 return lhs.Subtract(rhs);
32 } 40 }
33 41
34 #if !defined(COMPILER_MSVC) 42 #if !defined(COMPILER_MSVC)
35 extern template class PointBase<PointF, float>; 43 extern template class PointBase<PointF, float>;
36 #endif 44 #endif
37 45
38 } // namespace gfx 46 } // namespace gfx
39 47
40 #endif // UI_GFX_POINT_F_H_ 48 #endif // UI_GFX_POINT_F_H_
OLDNEW
« no previous file with comments | « ui/gfx/point_conversions.cc ('k') | ui/gfx/shadow_value.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698