summaryrefslogtreecommitdiffstats
path: root/gfx
diff options
context:
space:
mode:
authorestade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-04-30 23:35:44 +0000
committerestade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-04-30 23:35:44 +0000
commit36622b18a61d8896fa8417ee17863469e6aea427 (patch)
tree6547736dc86d92a561213ee4236754b68396084f /gfx
parentd38f83f98ff29ec940f0bc978a925fa7828fad67 (diff)
downloadchromium_src-36622b18a61d8896fa8417ee17863469e6aea427.zip
chromium_src-36622b18a61d8896fa8417ee17863469e6aea427.tar.gz
chromium_src-36622b18a61d8896fa8417ee17863469e6aea427.tar.bz2
GTK: unify the bookmark dragging icon generation code into bookmark utils.
this also has the effect of standardizing the appearance of boomkark drags. On compositing window managers, the drag widget will have no background. BUG=42147 TEST=manual Review URL: http://codereview.chromium.org/1780016 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@46153 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'gfx')
-rw-r--r--gfx/point.h12
-rw-r--r--gfx/rect.cc13
-rw-r--r--gfx/rect.h1
3 files changed, 20 insertions, 6 deletions
diff --git a/gfx/point.h b/gfx/point.h
index 6e2cfe7..b3bb37b 100644
--- a/gfx/point.h
+++ b/gfx/point.h
@@ -52,6 +52,18 @@ class Point {
y_ += delta_y;
}
+ Point Add(const Point& other) {
+ Point copy = *this;
+ copy.Offset(other.x_, other.y_);
+ return copy;
+ }
+
+ Point Subtract(const Point& other) {
+ Point copy = *this;
+ copy.Offset(-other.x_, -other.y_);
+ return copy;
+ }
+
bool operator==(const Point& rhs) const {
return x_ == rhs.x_ && y_ == rhs.y_;
}
diff --git a/gfx/rect.cc b/gfx/rect.cc
index 30338f4..dd8f392 100644
--- a/gfx/rect.cc
+++ b/gfx/rect.cc
@@ -35,15 +35,16 @@ namespace gfx {
Rect::Rect() {
}
-Rect::Rect(int width, int height) {
- set_width(width);
- set_height(height);
+Rect::Rect(int width, int height)
+ : size_(width, height) {
}
Rect::Rect(int x, int y, int width, int height)
- : origin_(x, y) {
- set_width(width);
- set_height(height);
+ : origin_(x, y), size_(width, height) {
+}
+
+Rect::Rect(const gfx::Size& size)
+ : size_(size) {
}
Rect::Rect(const gfx::Point& origin, const gfx::Size& size)
diff --git a/gfx/rect.h b/gfx/rect.h
index 4a217c2..1c83f48 100644
--- a/gfx/rect.h
+++ b/gfx/rect.h
@@ -37,6 +37,7 @@ class Rect {
#elif defined(USE_X11)
explicit Rect(const GdkRectangle& r);
#endif
+ Rect(const gfx::Size& size);
Rect(const gfx::Point& origin, const gfx::Size& size);
~Rect() {}