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

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

Issue 11269022: Add Vector2d classes that represent offsets, instead of using Point. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: RenderText fixup 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"
11 #include "ui/gfx/rect_base.h" 11 #include "ui/gfx/rect_base.h"
12 #include "ui/gfx/size_f.h" 12 #include "ui/gfx/size_f.h"
13 #include "ui/gfx/vector2d_f.h"
13 14
14 namespace gfx { 15 namespace gfx {
15 16
16 class InsetsF; 17 class InsetsF;
17 18
18 // A floating version of gfx::Rect. 19 // A floating version of gfx::Rect.
19 class UI_EXPORT RectF : public RectBase<RectF, PointF, SizeF, InsetsF, float> { 20 class UI_EXPORT RectF
21 : public RectBase<RectF, PointF, SizeF, InsetsF, Vector2dF, float> {
20 public: 22 public:
21 RectF(); 23 RectF();
22 RectF(float width, float height); 24 RectF(float width, float height);
23 RectF(float x, float y, float width, float height); 25 RectF(float x, float y, float width, float height);
24 explicit RectF(const gfx::SizeF& size); 26 explicit RectF(const gfx::SizeF& size);
25 RectF(const gfx::PointF& origin, const gfx::SizeF& size); 27 RectF(const gfx::PointF& origin, const gfx::SizeF& size);
26 28
27 ~RectF(); 29 ~RectF();
28 30
29 /// Scales the rectangle by |scale|. 31 /// Scales the rectangle by |scale|.
(...skipping 22 matching lines...) Expand all
52 UI_EXPORT RectF IntersectRects(const RectF& a, const RectF& b); 54 UI_EXPORT RectF IntersectRects(const RectF& a, const RectF& b);
53 UI_EXPORT RectF UnionRects(const RectF& a, const RectF& b); 55 UI_EXPORT RectF UnionRects(const RectF& a, const RectF& b);
54 UI_EXPORT RectF SubtractRects(const RectF& a, const RectF& b); 56 UI_EXPORT RectF SubtractRects(const RectF& a, const RectF& b);
55 UI_EXPORT RectF ScaleRect(const RectF& r, float x_scale, float y_scale); 57 UI_EXPORT RectF ScaleRect(const RectF& r, float x_scale, float y_scale);
56 58
57 inline RectF ScaleRect(const RectF& r, float scale) { 59 inline RectF ScaleRect(const RectF& r, float scale) {
58 return ScaleRect(r, scale, scale); 60 return ScaleRect(r, scale, scale);
59 } 61 }
60 62
61 #if !defined(COMPILER_MSVC) 63 #if !defined(COMPILER_MSVC)
62 extern template class RectBase<RectF, PointF, SizeF, InsetsF, float>; 64 extern template class RectBase<RectF, PointF, SizeF, InsetsF, Vector2dF, float>;
63 #endif 65 #endif
64 66
65 } // namespace gfx 67 } // namespace gfx
66 68
67 #endif // UI_GFX_RECT_F_H_ 69 #endif // UI_GFX_RECT_F_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698