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

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

Issue 11377068: ui: Make gfx::Size::Scale() mutate the class. Add gfx::ScaleSize() similar to Rect/Point. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebaseTOGO 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
« no previous file with comments | « ui/gfx/rect_f.h ('k') | ui/gfx/size_f.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 29 matching lines...) Expand all
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 operator SizeF() 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 {
51 return Scale(scale, scale);
52 }
53
54 SizeF Scale(float x_scale, float y_scale) const WARN_UNUSED_RESULT {
55 return SizeF(width() * x_scale, height() * y_scale);
56 }
57
58 std::string ToString() const; 50 std::string ToString() const;
59 }; 51 };
60 52
61 inline bool operator==(const Size& lhs, const Size& rhs) { 53 inline bool operator==(const Size& lhs, const Size& rhs) {
62 return lhs.width() == rhs.width() && lhs.height() == rhs.height(); 54 return lhs.width() == rhs.width() && lhs.height() == rhs.height();
63 } 55 }
64 56
65 inline bool operator!=(const Size& lhs, const Size& rhs) { 57 inline bool operator!=(const Size& lhs, const Size& rhs) {
66 return !(lhs == rhs); 58 return !(lhs == rhs);
67 } 59 }
68 60
69 #if !defined(COMPILER_MSVC) 61 #if !defined(COMPILER_MSVC)
70 extern template class SizeBase<Size, int>; 62 extern template class SizeBase<Size, int>;
71 #endif 63 #endif
72 64
73 } // namespace gfx 65 } // namespace gfx
74 66
75 #endif // UI_GFX_SIZE_H_ 67 #endif // UI_GFX_SIZE_H_
OLDNEW
« no previous file with comments | « ui/gfx/rect_f.h ('k') | ui/gfx/size_f.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698