summaryrefslogtreecommitdiffstats
path: root/gfx
diff options
context:
space:
mode:
Diffstat (limited to 'gfx')
-rw-r--r--gfx/gfx.gyp1
-rw-r--r--gfx/rect.cc5
-rw-r--r--gfx/rect.h5
3 files changed, 11 insertions, 0 deletions
diff --git a/gfx/gfx.gyp b/gfx/gfx.gyp
index 668ac00..898b981 100644
--- a/gfx/gfx.gyp
+++ b/gfx/gfx.gyp
@@ -126,6 +126,7 @@
# font_gtk.cc uses fontconfig.
# TODO(evanm): I think this is wrong; it should just use GTK.
'../build/linux/system.gyp:fontconfig',
+ '../build/linux/system.gyp:gtk',
],
'sources': [
'font_skia.cc',
diff --git a/gfx/rect.cc b/gfx/rect.cc
index dd8f392..ea328beb 100644
--- a/gfx/rect.cc
+++ b/gfx/rect.cc
@@ -15,6 +15,7 @@
#include <iostream>
#include "base/logging.h"
+#include "gfx/insets.h"
namespace {
@@ -105,6 +106,10 @@ void Rect::SetRect(int x, int y, int width, int height) {
set_height(height);
}
+void Rect::Inset(const gfx::Insets& insets) {
+ Inset(insets.left(), insets.top(), insets.right(), insets.bottom());
+}
+
void Rect::Inset(int left, int top, int right, int bottom) {
Offset(left, top);
set_width(std::max(width() - left - right, 0));
diff --git a/gfx/rect.h b/gfx/rect.h
index 1c83f48..f1e43a7 100644
--- a/gfx/rect.h
+++ b/gfx/rect.h
@@ -25,6 +25,8 @@ typedef struct _GdkRectangle GdkRectangle;
namespace gfx {
+class Insets;
+
class Rect {
public:
Rect();
@@ -78,6 +80,9 @@ class Rect {
Inset(horizontal, vertical, horizontal, vertical);
}
+ // Shrink the rectangle by the given insets.
+ void Inset(const gfx::Insets& insets);
+
// Shrink the rectangle by the specified amount on each side.
void Inset(int left, int top, int right, int bottom);