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

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

Issue 11428076: Inline hot ctor/dtors for struct-like gfx:: geometry types (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix style issues Created 8 years 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.cc ('k') | ui/gfx/rect_f.cc » ('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_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 #include "ui/gfx/vector2d_f.h"
14 14
15 namespace gfx { 15 namespace gfx {
16 16
17 class InsetsF; 17 class InsetsF;
18 18
19 // A floating version of gfx::Rect. 19 // A floating version of gfx::Rect.
20 class UI_EXPORT RectF 20 class UI_EXPORT RectF
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 : RectBase<RectF, PointF, SizeF, InsetsF, Vector2dF, float>
25 RectF(float x, float y, float width, float height); 25 (SizeF()) {}
26 explicit RectF(const gfx::SizeF& size);
27 RectF(const gfx::PointF& origin, const gfx::SizeF& size);
28 26
29 ~RectF(); 27 RectF(float width, float height)
28 : RectBase<RectF, PointF, SizeF, InsetsF, Vector2dF, float>
29 (SizeF(width, height)) {}
30
31 RectF(float x, float y, float width, float height)
32 : RectBase<RectF, PointF, SizeF, InsetsF, Vector2dF, float>
33 (PointF(x, y), SizeF(width, height)) {}
34
35 explicit RectF(const SizeF& size)
36 : RectBase<RectF, PointF, SizeF, InsetsF, Vector2dF, float>
37 (size) {}
38
39 RectF(const PointF& origin, const SizeF& size)
40 : RectBase<RectF, PointF, SizeF, InsetsF, Vector2dF, float>
41 (origin, size) {}
42
43 ~RectF() {}
30 44
31 // Scales the rectangle by |scale|. 45 // Scales the rectangle by |scale|.
32 void Scale(float scale) { 46 void Scale(float scale) {
33 Scale(scale, scale); 47 Scale(scale, scale);
34 } 48 }
35 49
36 void Scale(float x_scale, float y_scale) { 50 void Scale(float x_scale, float y_scale) {
37 set_origin(ScalePoint(origin(), x_scale, y_scale)); 51 set_origin(ScalePoint(origin(), x_scale, y_scale));
38 52
39 SizeF new_size = gfx::ScaleSize(size(), x_scale, y_scale); 53 SizeF new_size = gfx::ScaleSize(size(), x_scale, y_scale);
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 // contained within the rect, because they will appear on one of these edges. 96 // contained within the rect, because they will appear on one of these edges.
83 UI_EXPORT RectF BoundingRect(const PointF& p1, const PointF& p2); 97 UI_EXPORT RectF BoundingRect(const PointF& p1, const PointF& p2);
84 98
85 #if !defined(COMPILER_MSVC) 99 #if !defined(COMPILER_MSVC)
86 extern template class RectBase<RectF, PointF, SizeF, InsetsF, Vector2dF, float>; 100 extern template class RectBase<RectF, PointF, SizeF, InsetsF, Vector2dF, float>;
87 #endif 101 #endif
88 102
89 } // namespace gfx 103 } // namespace gfx
90 104
91 #endif // UI_GFX_RECT_F_H_ 105 #endif // UI_GFX_RECT_F_H_
OLDNEW
« no previous file with comments | « ui/gfx/rect.cc ('k') | ui/gfx/rect_f.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698