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

Side by Side Diff: ui/gfx/rect.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/point_f.cc ('k') | ui/gfx/rect.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 // Defines a simple integer rectangle class. The containment semantics 5 // Defines a simple integer rectangle class. The containment semantics
6 // are array-like; that is, the coordinate (x, y) is considered to be 6 // are array-like; that is, the coordinate (x, y) is considered to be
7 // contained by the rectangle, but the coordinate (x + width, y) is not. 7 // contained by the rectangle, but the coordinate (x + width, y) is not.
8 // The class will happily let you create malformed rectangles (that is, 8 // The class will happily let you create malformed rectangles (that is,
9 // rectangles with negative width and/or height), but there will be assertions 9 // rectangles with negative width and/or height), but there will be assertions
10 // in the operations (such as Contains()) to complain in this case. 10 // in the operations (such as Contains()) to complain in this case.
(...skipping 19 matching lines...) Expand all
30 #include <ApplicationServices/ApplicationServices.h> 30 #include <ApplicationServices/ApplicationServices.h>
31 #endif 31 #endif
32 32
33 namespace gfx { 33 namespace gfx {
34 34
35 class Insets; 35 class Insets;
36 36
37 class UI_EXPORT Rect 37 class UI_EXPORT Rect
38 : public RectBase<Rect, Point, Size, Insets, Vector2d, int> { 38 : public RectBase<Rect, Point, Size, Insets, Vector2d, int> {
39 public: 39 public:
40 Rect(); 40 Rect() : RectBase<Rect, Point, Size, Insets, Vector2d, int>(Point()) {}
41 Rect(int width, int height); 41
42 Rect(int x, int y, int width, int height); 42 Rect(int width, int height)
43 : RectBase<Rect, Point, Size, Insets, Vector2d, int>
44 (Size(width, height)) {}
45
46 Rect(int x, int y, int width, int height)
47 : RectBase<Rect, Point, Size, Insets, Vector2d, int>
48 (Point(x, y), Size(width, height)) {}
49
43 #if defined(OS_WIN) 50 #if defined(OS_WIN)
44 explicit Rect(const RECT& r); 51 explicit Rect(const RECT& r);
45 #elif defined(OS_MACOSX) 52 #elif defined(OS_MACOSX)
46 explicit Rect(const CGRect& r); 53 explicit Rect(const CGRect& r);
47 #elif defined(TOOLKIT_GTK) 54 #elif defined(TOOLKIT_GTK)
48 explicit Rect(const GdkRectangle& r); 55 explicit Rect(const GdkRectangle& r);
49 #endif 56 #endif
50 explicit Rect(const gfx::Size& size);
51 Rect(const gfx::Point& origin, const gfx::Size& size);
52 57
53 ~Rect(); 58 explicit Rect(const gfx::Size& size)
59 : RectBase<Rect, Point, Size, Insets, Vector2d, int>(size) {}
60
61 Rect(const gfx::Point& origin, const gfx::Size& size)
62 : RectBase<Rect, Point, Size, Insets, Vector2d, int>(origin, size) {}
63
64 ~Rect() {}
54 65
55 #if defined(OS_WIN) 66 #if defined(OS_WIN)
56 // Construct an equivalent Win32 RECT object. 67 // Construct an equivalent Win32 RECT object.
57 RECT ToRECT() const; 68 RECT ToRECT() const;
58 #elif defined(TOOLKIT_GTK) 69 #elif defined(TOOLKIT_GTK)
59 GdkRectangle ToGdkRectangle() const; 70 GdkRectangle ToGdkRectangle() const;
60 #elif defined(OS_MACOSX) 71 #elif defined(OS_MACOSX)
61 // Construct an equivalent CoreGraphics object. 72 // Construct an equivalent CoreGraphics object.
62 CGRect ToCGRect() const; 73 CGRect ToCGRect() const;
63 #endif 74 #endif
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 // contained within the rect, because they will appear on one of these edges. 107 // contained within the rect, because they will appear on one of these edges.
97 UI_EXPORT Rect BoundingRect(const Point& p1, const Point& p2); 108 UI_EXPORT Rect BoundingRect(const Point& p1, const Point& p2);
98 109
99 #if !defined(COMPILER_MSVC) 110 #if !defined(COMPILER_MSVC)
100 extern template class RectBase<Rect, Point, Size, Insets, Vector2d, int>; 111 extern template class RectBase<Rect, Point, Size, Insets, Vector2d, int>;
101 #endif 112 #endif
102 113
103 } // namespace gfx 114 } // namespace gfx
104 115
105 #endif // UI_GFX_RECT_H_ 116 #endif // UI_GFX_RECT_H_
OLDNEW
« no previous file with comments | « ui/gfx/point_f.cc ('k') | ui/gfx/rect.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698