diff options
author | erg@chromium.org <erg@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-05-24 22:34:31 +0000 |
---|---|---|
committer | erg@chromium.org <erg@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-05-24 22:34:31 +0000 |
commit | c4f9dd6d1d39d075917b8a1f8c40d4f9e721bde6 (patch) | |
tree | c4a8d3e986c39d576499d500b2b09afc747c54ad /chrome/browser/gtk/custom_button.cc | |
parent | e58a8acb42751e1eb535e0dab8362ccf6d3b9145 (diff) | |
download | chromium_src-c4f9dd6d1d39d075917b8a1f8c40d4f9e721bde6.zip chromium_src-c4f9dd6d1d39d075917b8a1f8c40d4f9e721bde6.tar.gz chromium_src-c4f9dd6d1d39d075917b8a1f8c40d4f9e721bde6.tar.bz2 |
GTK: Mirror the close button when on the left.
There is a small notch in the top right corner of the button when it is on the
left so mirror it so the notch is on the left when the button is on the left.
BUG=44647
TEST=none
Review URL: http://codereview.chromium.org/2086023
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@48093 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/gtk/custom_button.cc')
-rw-r--r-- | chrome/browser/gtk/custom_button.cc | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/chrome/browser/gtk/custom_button.cc b/chrome/browser/gtk/custom_button.cc index 22bdb6c..fd7b21c 100644 --- a/chrome/browser/gtk/custom_button.cc +++ b/chrome/browser/gtk/custom_button.cc @@ -27,7 +27,8 @@ CustomDrawButtonBase::CustomDrawButtonBase(GtkThemeProvider* theme_provider, highlight_id_(highlight_id), depressed_id_(depressed_id), button_background_id_(background_id), - theme_provider_(theme_provider) { + theme_provider_(theme_provider), + flipped_(false) { for (int i = 0; i < (GTK_STATE_INSENSITIVE + 1); ++i) surfaces_[i].reset(new CairoCachedSurface); background_image_.reset(new CairoCachedSurface); @@ -89,6 +90,12 @@ gboolean CustomDrawButtonBase::OnExpose(GtkWidget* widget, cairo_t* cairo_context = gdk_cairo_create(GDK_DRAWABLE(widget->window)); cairo_translate(cairo_context, widget->allocation.x, widget->allocation.y); + if (flipped_) { + // Horizontally flip the image for non-LTR/RTL reasons. + cairo_translate(cairo_context, widget->allocation.width, 0.0f); + cairo_scale(cairo_context, -1.0f, 1.0f); + } + // The widget might be larger than the pixbuf. Paint the pixbuf flush with the // start of the widget (left for LTR, right for RTL) and its bottom. gfx::Rect bounds = gfx::Rect(0, 0, pixbuf->Width(), 0); |