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

Side by Side Diff: base/gfx/rect.h

Issue 7244: Linux build fixes for webframe_imple.cc (Closed)
Patch Set: Linux build fixes for webframe_imple.cc Created 12 years, 2 months 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
« no previous file with comments | « base/gfx/bitmap_platform_device_linux.cc ('k') | base/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) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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 contain()) to complain in this case. 10 // in the operations (such as contain()) to complain in this case.
11 11
12 #ifndef BASE_GFX_RECT_H__ 12 #ifndef BASE_GFX_RECT_H__
13 #define BASE_GFX_RECT_H__ 13 #define BASE_GFX_RECT_H__
14 14
15 #include "base/gfx/size.h" 15 #include "base/gfx/size.h"
16 #include "base/gfx/point.h" 16 #include "base/gfx/point.h"
17 17
18 #if defined(OS_WIN) 18 #if defined(OS_WIN)
19 typedef struct tagRECT RECT; 19 typedef struct tagRECT RECT;
20 #elif defined(OS_LINUX)
21 typedef struct _GdkRectangle GdkRectangle;
20 #endif 22 #endif
21 23
22 namespace gfx { 24 namespace gfx {
23 25
24 class Rect { 26 class Rect {
25 public: 27 public:
26 Rect(); 28 Rect();
27 Rect(int width, int height); 29 Rect(int width, int height);
28 Rect(int x, int y, int width, int height); 30 Rect(int x, int y, int width, int height);
29 #if defined(OS_WIN) 31 #if defined(OS_WIN)
30 explicit Rect(const RECT& r); 32 explicit Rect(const RECT& r);
31 #elif defined(OS_MACOSX) 33 #elif defined(OS_MACOSX)
32 explicit Rect(const CGRect& r); 34 explicit Rect(const CGRect& r);
35 #elif defined(OS_LINUX)
36 explicit Rect(const GdkRectangle& r);
33 #endif 37 #endif
34 Rect(const gfx::Point& origin, const gfx::Size& size); 38 Rect(const gfx::Point& origin, const gfx::Size& size);
35 39
36 ~Rect() {} 40 ~Rect() {}
37 41
38 #if defined(OS_WIN) 42 #if defined(OS_WIN)
39 Rect& operator=(const RECT& r); 43 Rect& operator=(const RECT& r);
40 #elif defined(OS_MACOSX) 44 #elif defined(OS_MACOSX)
41 Rect& operator=(const CGRect& r); 45 Rect& operator=(const CGRect& r);
46 #elif defined(OS_LINUX)
47 Rect& operator=(const GdkRectangle& r);
42 #endif 48 #endif
43 49
44 int x() const { return origin_.x(); } 50 int x() const { return origin_.x(); }
45 void set_x(int x) { origin_.set_x(x); } 51 void set_x(int x) { origin_.set_x(x); }
46 52
47 int y() const { return origin_.y(); } 53 int y() const { return origin_.y(); }
48 void set_y(int y) { origin_.set_y(y); } 54 void set_y(int y) { origin_.set_y(y); }
49 55
50 int width() const { return size_.width(); } 56 int width() const { return size_.width(); }
51 void set_width(int width); 57 void set_width(int width);
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
135 #ifdef UNIT_TEST 141 #ifdef UNIT_TEST
136 142
137 inline std::ostream& operator<<(std::ostream& out, const gfx::Rect& r) { 143 inline std::ostream& operator<<(std::ostream& out, const gfx::Rect& r) {
138 return out << r.origin() << " " << r.size(); 144 return out << r.origin() << " " << r.size();
139 } 145 }
140 146
141 #endif // #ifdef UNIT_TEST 147 #endif // #ifdef UNIT_TEST
142 148
143 #endif // BASE_GFX_RECT_H__ 149 #endif // BASE_GFX_RECT_H__
144 150
OLDNEW
« no previous file with comments | « base/gfx/bitmap_platform_device_linux.cc ('k') | base/gfx/rect.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698