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

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

Issue 11028127: Implicit coversion operators from integer geometry types to floating point. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: rebase 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
« no previous file with comments | « ui/gfx/rect_base_impl.h ('k') | ui/gfx/rect_unittest.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_RECT_F_H_ 5 #ifndef UI_GFX_RECT_F_H_
6 #define UI_GFX_RECT_F_H_ 6 #define UI_GFX_RECT_F_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "ui/gfx/point_f.h" 10 #include "ui/gfx/point_f.h"
(...skipping 22 matching lines...) Expand all
33 33
34 RectF Scale(float x_scale, float y_scale) const WARN_UNUSED_RESULT { 34 RectF Scale(float x_scale, float y_scale) const WARN_UNUSED_RESULT {
35 SizeF newSize = size().Scale(x_scale, y_scale); 35 SizeF newSize = size().Scale(x_scale, y_scale);
36 newSize.ClampToNonNegative(); 36 newSize.ClampToNonNegative();
37 return RectF(origin().Scale(x_scale, y_scale), newSize); 37 return RectF(origin().Scale(x_scale, y_scale), newSize);
38 } 38 }
39 39
40 std::string ToString() const; 40 std::string ToString() const;
41 }; 41 };
42 42
43 inline bool operator==(const RectF& lhs, const RectF& rhs) {
44 return lhs.origin() == rhs.origin() && lhs.size() == rhs.size();
45 }
46
47 inline bool operator!=(const RectF& lhs, const RectF& rhs) {
48 return !(lhs == rhs);
49 }
50
43 #if !defined(COMPILER_MSVC) 51 #if !defined(COMPILER_MSVC)
44 extern template class RectBase<RectF, PointF, SizeF, InsetsF, float>; 52 extern template class RectBase<RectF, PointF, SizeF, InsetsF, float>;
45 #endif 53 #endif
46 54
47 } // namespace gfx 55 } // namespace gfx
48 56
49 #endif // UI_GFX_RECT_F_H_ 57 #endif // UI_GFX_RECT_F_H_
OLDNEW
« no previous file with comments | « ui/gfx/rect_base_impl.h ('k') | ui/gfx/rect_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698