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

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

Issue 7319: get webframe_impl.cc to compile on linux (Closed)
Patch Set: merge fixes from icefox 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 // It's wrong to hide GDK stuff behind OS_LINUX, but until we have a different
22 // linux target, this is less complex.
23 typedef struct _GdkRectangle GdkRectangle;
20 #endif 24 #endif
21 25
22 namespace gfx { 26 namespace gfx {
23 27
24 class Rect { 28 class Rect {
25 public: 29 public:
26 Rect(); 30 Rect();
27 Rect(int width, int height); 31 Rect(int width, int height);
28 Rect(int x, int y, int width, int height); 32 Rect(int x, int y, int width, int height);
29 #if defined(OS_WIN) 33 #if defined(OS_WIN)
30 explicit Rect(const RECT& r); 34 explicit Rect(const RECT& r);
31 #elif defined(OS_MACOSX) 35 #elif defined(OS_MACOSX)
32 explicit Rect(const CGRect& r); 36 explicit Rect(const CGRect& r);
37 #elif defined(OS_LINUX)
38 explicit Rect(const GdkRectangle& r);
33 #endif 39 #endif
34 Rect(const gfx::Point& origin, const gfx::Size& size); 40 Rect(const gfx::Point& origin, const gfx::Size& size);
35 41
36 ~Rect() {} 42 ~Rect() {}
37 43
38 #if defined(OS_WIN) 44 #if defined(OS_WIN)
39 Rect& operator=(const RECT& r); 45 Rect& operator=(const RECT& r);
40 #elif defined(OS_MACOSX) 46 #elif defined(OS_MACOSX)
41 Rect& operator=(const CGRect& r); 47 Rect& operator=(const CGRect& r);
48 #elif defined(OS_LINUX)
49 Rect& operator=(const GdkRectangle& r);
42 #endif 50 #endif
43 51
44 int x() const { return origin_.x(); } 52 int x() const { return origin_.x(); }
45 void set_x(int x) { origin_.set_x(x); } 53 void set_x(int x) { origin_.set_x(x); }
46 54
47 int y() const { return origin_.y(); } 55 int y() const { return origin_.y(); }
48 void set_y(int y) { origin_.set_y(y); } 56 void set_y(int y) { origin_.set_y(y); }
49 57
50 int width() const { return size_.width(); } 58 int width() const { return size_.width(); }
51 void set_width(int width); 59 void set_width(int width);
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
140 #ifdef UNIT_TEST 148 #ifdef UNIT_TEST
141 149
142 inline std::ostream& operator<<(std::ostream& out, const gfx::Rect& r) { 150 inline std::ostream& operator<<(std::ostream& out, const gfx::Rect& r) {
143 return out << r.origin() << " " << r.size(); 151 return out << r.origin() << " " << r.size();
144 } 152 }
145 153
146 #endif // #ifdef UNIT_TEST 154 #endif // #ifdef UNIT_TEST
147 155
148 #endif // BASE_GFX_RECT_H__ 156 #endif // BASE_GFX_RECT_H__
149 157
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