summaryrefslogtreecommitdiffstats
path: root/src/widgets
diff options
context:
space:
mode:
authorLiam P. White <inkscapebrony@gmail.com>2015-02-25 02:19:56 +0000
committerLiam P. White <inkscapebrony@gmail.com>2015-02-25 02:19:56 +0000
commitc41f1ca2878908fecd97c171ecac3ffa8641ec53 (patch)
treea1a30732d3a2c67bc8a019e486706ea05832d5a5 /src/widgets
parentRestore libinkscape.a . (diff)
downloadinkscape-c41f1ca2878908fecd97c171ecac3ffa8641ec53.tar.gz
inkscape-c41f1ca2878908fecd97c171ecac3ffa8641ec53.zip
Backport commit 2086344 from GIMP master: try to fix rulers (bug #1351597)
This might not do what it's supposed to, but I doubt keeping it in will do any harm if it doesn't fix the bug (bzr r13941)
Diffstat (limited to 'src/widgets')
-rw-r--r--src/widgets/ruler.cpp42
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);
}
}