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

Side by Side Diff: ui/gfx/rect_f.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: 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
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 10 matching lines...) Expand all
21 : public RectBase<RectF, PointF, SizeF, InsetsF, Vector2dF, float> { 21 : public RectBase<RectF, PointF, SizeF, InsetsF, Vector2dF, float> {
22 public: 22 public:
23 RectF(); 23 RectF();
24 RectF(float width, float height); 24 RectF(float width, float height);
25 RectF(float x, float y, float width, float height); 25 RectF(float x, float y, float width, float height);
26 explicit RectF(const gfx::SizeF& size); 26 explicit RectF(const gfx::SizeF& size);
27 RectF(const gfx::PointF& origin, const gfx::SizeF& size); 27 RectF(const gfx::PointF& origin, const gfx::SizeF& size);
28 28
29 ~RectF(); 29 ~RectF();
30 30
31 /// Scales the rectangle by |scale|. 31 /// Scales the rectangle by |scale|.
tfarina 2012/11/09 13:05:37 nit: just two //
danakj 2012/11/09 16:11:38 Done.
32 void Scale(float scale) { 32 void Scale(float scale) {
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 set_origin(ScalePoint(origin(), x_scale, y_scale)); 37 set_origin(ScalePoint(origin(), x_scale, y_scale));
38 38 set_size(ScaleSize(size(), x_scale, y_scale));
39 SizeF newSize = size().Scale(x_scale, y_scale);
tfarina 2012/11/09 13:05:37 nit: newSize, tisk, tisk :( s/newSize/new_size.
danakj 2012/11/09 16:11:38 I'm removing this code.
40 set_size(newSize);
41 } 39 }
42 40
43 // This method reports if the RectF can be safely converted to an integer 41 // This method reports if the RectF can be safely converted to an integer
44 // Rect. When it is false, some dimension of the RectF is outside the bounds 42 // Rect. When it is false, some dimension of the RectF is outside the bounds
45 // of what an integer can represent, and converting it to a Rect will require 43 // of what an integer can represent, and converting it to a Rect will require
46 // clamping. 44 // clamping.
47 bool IsExpressibleAsRect() const; 45 bool IsExpressibleAsRect() const;
48 46
49 std::string ToString() const; 47 std::string ToString() const;
50 }; 48 };
(...skipping 23 matching lines...) Expand all
74 // contained within the rect, because they will appear on one of these edges. 72 // contained within the rect, because they will appear on one of these edges.
75 UI_EXPORT RectF BoundingRect(const PointF& p1, const PointF& p2); 73 UI_EXPORT RectF BoundingRect(const PointF& p1, const PointF& p2);
76 74
77 #if !defined(COMPILER_MSVC) 75 #if !defined(COMPILER_MSVC)
78 extern template class RectBase<RectF, PointF, SizeF, InsetsF, Vector2dF, float>; 76 extern template class RectBase<RectF, PointF, SizeF, InsetsF, Vector2dF, float>;
79 #endif 77 #endif
80 78
81 } // namespace gfx 79 } // namespace gfx
82 80
83 #endif // UI_GFX_RECT_F_H_ 81 #endif // UI_GFX_RECT_F_H_
OLDNEW
« no previous file with comments | « ui/gfx/image/image_skia_operations.cc ('k') | ui/gfx/size.h » ('j') | ui/gfx/size_f.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698