summaryrefslogtreecommitdiffstats
path: root/app/gfx/canvas_linux.cc
diff options
context:
space:
mode:
authorjhawkins@chromium.org <jhawkins@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-08-26 23:40:03 +0000
committerjhawkins@chromium.org <jhawkins@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-08-26 23:40:03 +0000
commit7cd36323e3107b86303502f81ae79721a2ba6135 (patch)
treea6568a7bf6019ef24a4159ec9681f99e7981e0c1 /app/gfx/canvas_linux.cc
parent08bf350c32da989d105ed3777535eec472be5967 (diff)
downloadchromium_src-7cd36323e3107b86303502f81ae79721a2ba6135.zip
chromium_src-7cd36323e3107b86303502f81ae79721a2ba6135.tar.gz
chromium_src-7cd36323e3107b86303502f81ae79721a2ba6135.tar.bz2
gtk: Fix the bounds of the clip region for tab title text.
BUG=19741 TEST=Open many tabs. The ellipses should not be rendered if the tab is not large enough. Review URL: http://codereview.chromium.org/174582 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@24560 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'app/gfx/canvas_linux.cc')
-rw-r--r--app/gfx/canvas_linux.cc15
1 files changed, 10 insertions, 5 deletions
diff --git a/app/gfx/canvas_linux.cc b/app/gfx/canvas_linux.cc
index 602edf5..6db12ea 100644
--- a/app/gfx/canvas_linux.cc
+++ b/app/gfx/canvas_linux.cc
@@ -217,12 +217,17 @@ void Canvas::DrawStringInt(const std::wstring& text,
y = y + ((h - (height / PANGO_SCALE)) / 2);
}
+ // cairo_rectangle creates a rectangle with a border of 1px inclusive. The
+ // clipping region includes this border. cairo places the top-left corner of
+ // the rectangle at (x - 1, y - 1). We need the top-left corner of the
+ // rectangle to be at (x + 1, y + 2) so that we fully cover the extent of the
+ // text.
+ const int kClipXOffset = 1;
+ const int kClipYOffset = 2;
+ cairo_rectangle(cr, x + kClipXOffset, y + kClipYOffset, w, h);
+ cairo_clip(cr);
+
cairo_move_to(cr, x, y);
- cairo_rectangle(cr, x, y, x + w, y + h);
- // We use cairo_clip_preserve so that we can reset the clip region with
- // cairo_restore; otherwise, any further drawing operations on this context
- // will be clipped to this region.
- cairo_clip_preserve(cr);
pango_cairo_show_layout(cr, layout);
cairo_restore(cr);