N_COLS
};
+/* Draws a white background on the GtkLayout to match the white background of
+ each of the output items. */
+static gboolean
+layout_draw_callback (GtkWidget *widget, cairo_t *cr, gpointer data)
+{
+ cairo_save (cr);
+
+ int width = gtk_widget_get_allocated_width (widget);
+ int height = gtk_widget_get_allocated_height (widget);
+ cairo_rectangle (cr, 0, 0, width, height);
+ cairo_set_source_rgb (cr, 1.0, 1.0, 1.0);
+ cairo_fill (cr);
+
+ cairo_restore (cr);
+
+ return FALSE; /* Continue drawing the GtkDrawingAreas. */
+}
+
static gboolean
draw_callback (GtkWidget *widget, cairo_t *cr, gpointer data)
{
+ GdkRectangle clip;
+ if (!gdk_cairo_get_clip_rectangle (cr, &clip))
+ return TRUE;
+
struct xr_rendering *r = g_object_get_data (G_OBJECT (widget), "rendering");
- xr_rendering_draw_all (r, cr);
+ xr_rendering_draw (r, cr, clip.x, clip.y,
+ clip.x + clip.width, clip.y + clip.height);
return TRUE;
}
GdkRectangle *allocation,
struct psppire_output_view *view)
{
- int new_render_width = MAX (300, allocation->width);
-
- if (view->render_width != new_render_width)
- {
- view->render_width = new_render_width;
- rerender (view);
- }
+ view->render_width = MAX (300, allocation->width);
+ rerender (view);
}
static void
view->print_n_pages = 0;
view->paginated = FALSE;
+ g_signal_connect (output, "draw", G_CALLBACK (layout_draw_callback), NULL);
+
g_signal_connect (output, "style-updated", G_CALLBACK (on_style_updated), view);
g_signal_connect (output, "size-allocate", G_CALLBACK (on_size_allocate), view);