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

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

Issue 11364054: ui: Add IsExpressibleAsRect() method to RectF (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 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 | « no previous file | ui/gfx/rect_f.cc » ('j') | ui/gfx/safe_integer_conversions.cc » ('J')
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 Scale(scale, scale); 33 Scale(scale, scale);
34 } 34 }
35 35
36 void Scale(float x_scale, float y_scale) { 36 void Scale(float x_scale, float y_scale) {
37 SizeF newSize = size().Scale(x_scale, y_scale); 37 SizeF newSize = size().Scale(x_scale, y_scale);
38 newSize.ClampToNonNegative(); 38 newSize.ClampToNonNegative();
39 set_origin(origin().Scale(x_scale, y_scale)); 39 set_origin(origin().Scale(x_scale, y_scale));
40 set_size(newSize); 40 set_size(newSize);
41 } 41 }
42 42
43 bool IsExpressibleAsRect() const;
sky 2012/11/02 17:54:30 Add your description in the bug here.
danakj 2012/11/02 18:01:30 k!
44
43 std::string ToString() const; 45 std::string ToString() const;
44 }; 46 };
45 47
46 inline bool operator==(const RectF& lhs, const RectF& rhs) { 48 inline bool operator==(const RectF& lhs, const RectF& rhs) {
47 return lhs.origin() == rhs.origin() && lhs.size() == rhs.size(); 49 return lhs.origin() == rhs.origin() && lhs.size() == rhs.size();
48 } 50 }
49 51
50 inline bool operator!=(const RectF& lhs, const RectF& rhs) { 52 inline bool operator!=(const RectF& lhs, const RectF& rhs) {
51 return !(lhs == rhs); 53 return !(lhs == rhs);
52 } 54 }
(...skipping 15 matching lines...) Expand all
68 // contained within the rect, because they will appear on one of these edges. 70 // contained within the rect, because they will appear on one of these edges.
69 UI_EXPORT RectF BoundingRect(const PointF& p1, const PointF& p2); 71 UI_EXPORT RectF BoundingRect(const PointF& p1, const PointF& p2);
70 72
71 #if !defined(COMPILER_MSVC) 73 #if !defined(COMPILER_MSVC)
72 extern template class RectBase<RectF, PointF, SizeF, InsetsF, Vector2dF, float>; 74 extern template class RectBase<RectF, PointF, SizeF, InsetsF, Vector2dF, float>;
73 #endif 75 #endif
74 76
75 } // namespace gfx 77 } // namespace gfx
76 78
77 #endif // UI_GFX_RECT_F_H_ 79 #endif // UI_GFX_RECT_F_H_
OLDNEW
« no previous file with comments | « no previous file | ui/gfx/rect_f.cc » ('j') | ui/gfx/safe_integer_conversions.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698