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

Side by Side Diff: ui/gfx/size.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_unittest.cc ('k') | ui/gfx/size_base.h » ('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_SIZE_H_ 5 #ifndef UI_GFX_SIZE_H_
6 #define UI_GFX_SIZE_H_ 6 #define UI_GFX_SIZE_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "build/build_config.h" 10 #include "build/build_config.h"
(...skipping 25 matching lines...) Expand all
36 #if defined(OS_MACOSX) 36 #if defined(OS_MACOSX)
37 Size& operator=(const CGSize& s); 37 Size& operator=(const CGSize& s);
38 #endif 38 #endif
39 39
40 #if defined(OS_WIN) 40 #if defined(OS_WIN)
41 SIZE ToSIZE() const; 41 SIZE ToSIZE() const;
42 #elif defined(OS_MACOSX) 42 #elif defined(OS_MACOSX)
43 CGSize ToCGSize() const; 43 CGSize ToCGSize() const;
44 #endif 44 #endif
45 45
46 SizeF ToSizeF() const { 46 operator SizeF() const {
47 return SizeF(width(), height()); 47 return SizeF(width(), height());
48 } 48 }
49 49
50 SizeF Scale(float scale) const WARN_UNUSED_RESULT { 50 SizeF Scale(float scale) const WARN_UNUSED_RESULT {
51 return Scale(scale, scale); 51 return Scale(scale, scale);
52 } 52 }
53 53
54 SizeF Scale(float x_scale, float y_scale) const WARN_UNUSED_RESULT { 54 SizeF Scale(float x_scale, float y_scale) const WARN_UNUSED_RESULT {
55 return SizeF(width() * x_scale, height() * y_scale); 55 return SizeF(width() * x_scale, height() * y_scale);
56 } 56 }
57 57
58 std::string ToString() const; 58 std::string ToString() const;
59 }; 59 };
60 60
61 inline bool operator==(const Size& lhs, const Size& rhs) {
62 return lhs.width() == rhs.width() && lhs.height() == rhs.height();
63 }
64
65 inline bool operator!=(const Size& lhs, const Size& rhs) {
66 return !(lhs == rhs);
67 }
68
61 #if !defined(COMPILER_MSVC) 69 #if !defined(COMPILER_MSVC)
62 extern template class SizeBase<Size, int>; 70 extern template class SizeBase<Size, int>;
63 #endif 71 #endif
64 72
65 } // namespace gfx 73 } // namespace gfx
66 74
67 #endif // UI_GFX_SIZE_H_ 75 #endif // UI_GFX_SIZE_H_
OLDNEW
« no previous file with comments | « ui/gfx/rect_unittest.cc ('k') | ui/gfx/size_base.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698