diff options
author | jhawkins@chromium.org <jhawkins@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-08-24 21:24:53 +0000 |
---|---|---|
committer | jhawkins@chromium.org <jhawkins@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-08-24 21:24:53 +0000 |
commit | 1302ece5eab6d9fefbf274f33dd61797e8ab5f69 (patch) | |
tree | 13207e51ce1eaa18f2eef3709816edb7946a7057 /app | |
parent | f6422553a95c2548f4eda8eb56cef5c6fa1cb55b (diff) | |
download | chromium_src-1302ece5eab6d9fefbf274f33dd61797e8ab5f69.zip chromium_src-1302ece5eab6d9fefbf274f33dd61797e8ab5f69.tar.gz chromium_src-1302ece5eab6d9fefbf274f33dd61797e8ab5f69.tar.bz2 |
gtk: Clip the cairo context to the extents provided to the DrawStringInt function. This fixes an issue when rendering the tab title where the ellipses are rendered no matter how small the tab is sized. This change also fixes an issue where we were using the default font to determine whether to show the tooltip.
BUG=19741
TEST=Open many tabs. See that the ellipses should disappear when there's no room left in the tab to display them.
Review URL: http://codereview.chromium.org/173300
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@24149 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'app')
-rw-r--r-- | app/gfx/canvas_linux.cc | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/app/gfx/canvas_linux.cc b/app/gfx/canvas_linux.cc index d1d391b..5d644ad 100644 --- a/app/gfx/canvas_linux.cc +++ b/app/gfx/canvas_linux.cc @@ -196,6 +196,7 @@ void Canvas::DrawStringInt(const std::wstring& text, pango_layout_set_width(layout, w * PANGO_SCALE); pango_layout_set_height(layout, h * PANGO_SCALE); + cairo_save(cr); cairo_set_source_rgb(cr, SkColorGetR(color) / 255.0, SkColorGetG(color) / 255.0, @@ -217,7 +218,13 @@ void Canvas::DrawStringInt(const std::wstring& text, } 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); g_object_unref(layout); // NOTE: beginPlatformPaint returned its surface, we shouldn't destroy it. |