diff options
author | Matthias Clasen <mclasen@redhat.com> | 2012-02-09 19:05:20 -0500 |
---|---|---|
committer | Matthias Clasen <mclasen@redhat.com> | 2012-02-14 16:37:04 -0500 |
commit | 1f698e4f624d351e8f6c18f0c6b33b3f3bf006e2 (patch) | |
tree | 06f3fab70ff908181c5f81518a6fddc8c0639cea /gtk/gtkcolorscale.c | |
parent | 49a23acd891e49d1b9e645cedb0bab6d7bf90711 (diff) | |
download | gtk+-1f698e4f624d351e8f6c18f0c6b33b3f3bf006e2.tar.gz |
GtkColorScale: fix an RTL issue
When using a horizontal scale in RTL, we need to flip the
background image to go along with the flipped scale.
Diffstat (limited to 'gtk/gtkcolorscale.c')
-rw-r--r-- | gtk/gtkcolorscale.c | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/gtk/gtkcolorscale.c b/gtk/gtkcolorscale.c index 455590938b..7070281b87 100644 --- a/gtk/gtkcolorscale.c +++ b/gtk/gtkcolorscale.c @@ -192,6 +192,7 @@ scale_draw (GtkWidget *widget, { GtkColorScale *scale = GTK_COLOR_SCALE (widget); gint width, height; + cairo_pattern_t *pattern; width = gtk_widget_get_allocated_width (widget); height = gtk_widget_get_allocated_height (widget); @@ -218,9 +219,21 @@ scale_draw (GtkWidget *widget, cairo_rectangle (cr, 1, 1, width - 2, height - 2); cairo_clip (cr); - cairo_set_source_surface (cr, scale->priv->surface, 0, 0); + pattern = cairo_pattern_create_for_surface (scale->priv->surface); + if (gtk_orientable_get_orientation (GTK_ORIENTABLE (widget)) == GTK_ORIENTATION_HORIZONTAL && + gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL) + { + cairo_matrix_t matrix; + + cairo_matrix_init_scale (&matrix, -1, 1); + cairo_matrix_translate (&matrix, -width, 0); + cairo_pattern_set_matrix (pattern, &matrix); + } + cairo_set_source (cr, pattern); cairo_paint (cr); + cairo_pattern_destroy (pattern); + cairo_restore (cr); GTK_WIDGET_CLASS (gtk_color_scale_parent_class)->draw (widget, cr); |