diff options
| author | Marc Jeanmougin <marc@jeanmougin.fr> | 2015-04-26 09:44:42 +0000 |
|---|---|---|
| committer | Marc Jeanmougin <mc@M0nst3r.bouyguesbox.fr> | 2015-04-26 09:44:42 +0000 |
| commit | 1c6d7546699e45643c2ab8e1d41d7b6f4fc52365 (patch) | |
| tree | a56b6da9bb0f660d5986919ac8d75dc04113cd69 /src/widgets/ruler.cpp | |
| parent | more cast cleanup (diff) | |
| parent | Rename libgc/ => inkgc/ to reflect difference from Boehm GC (diff) | |
| download | inkscape-1c6d7546699e45643c2ab8e1d41d7b6f4fc52365.tar.gz inkscape-1c6d7546699e45643c2ab8e1d41d7b6f4fc52365.zip | |
merge
(bzr r13922.1.12)
Diffstat (limited to 'src/widgets/ruler.cpp')
| -rw-r--r-- | src/widgets/ruler.cpp | 42 |
1 files changed, 25 insertions, 17 deletions
diff --git a/src/widgets/ruler.cpp b/src/widgets/ruler.cpp index 8e818843d..ab486eeeb 100644 --- a/src/widgets/ruler.cpp +++ b/src/widgets/ruler.cpp @@ -144,7 +144,8 @@ static gboolean sp_ruler_expose (GtkWidget *widget, GdkEventExpose *event); #endif static void sp_ruler_draw_ticks (SPRuler *ruler); -static void sp_ruler_draw_pos (SPRuler *ruler); +static void sp_ruler_draw_pos (SPRuler *ruler, + cairo_t *cr); static void sp_ruler_make_pixmap (SPRuler *ruler); static PangoLayout * sp_ruler_get_layout (GtkWidget *widget, @@ -710,7 +711,7 @@ sp_ruler_draw (GtkWidget *widget, cairo_set_source_surface(cr, priv->backing_store, 0, 0); cairo_paint(cr); - sp_ruler_draw_pos (ruler); + sp_ruler_draw_pos (ruler, cr); return FALSE; } @@ -735,7 +736,8 @@ sp_ruler_make_pixmap (SPRuler *ruler) } static void -sp_ruler_draw_pos (SPRuler *ruler) +sp_ruler_draw_pos (SPRuler *ruler, + cairo_t *cr) { GtkWidget *widget = GTK_WIDGET (ruler); @@ -797,25 +799,31 @@ sp_ruler_draw_pos (SPRuler *ruler) if ((bs_width > 0) && (bs_height > 0)) { - cairo_t *cr = gdk_cairo_create (gtk_widget_get_window (widget)); gdouble lower; gdouble upper; gdouble position; gdouble increment; - cairo_rectangle (cr, - allocation.x, allocation.y, - allocation.width, allocation.height); - cairo_clip (cr); - - cairo_translate (cr, allocation.x, allocation.y); - - /* If a backing store exists, restore the ruler */ - if (priv->backing_store) + if (! cr) + { + cr = gdk_cairo_create (gtk_widget_get_window (widget)); + cairo_translate (cr, allocation.x, allocation.y); + cairo_rectangle (cr, allocation.x, allocation.y, allocation.width, allocation.height); + cairo_clip (cr); + + cairo_translate (cr, allocation.x, allocation.y); + + /* If a backing store exists, restore the ruler */ + if (priv->backing_store) + { + cairo_set_source_surface (cr, priv->backing_store, 0, 0); + cairo_rectangle (cr, priv->xsrc, priv->ysrc, bs_width, bs_height); + cairo_fill (cr); + } + } + else { - cairo_set_source_surface (cr, priv->backing_store, 0, 0); - cairo_rectangle (cr, priv->xsrc, priv->ysrc, bs_width, bs_height); - cairo_fill (cr); + cairo_reference (cr); } position = sp_ruler_get_position (ruler); @@ -1126,7 +1134,7 @@ sp_ruler_set_position (SPRuler *ruler, priv->position = position; g_object_notify (G_OBJECT (ruler), "position"); - sp_ruler_draw_pos (ruler); + sp_ruler_draw_pos (ruler, NULL); } } |
