This greatly improves scrolling performance for large tables.
/* Draws onto CR */
void
-xr_rendering_draw_all (struct xr_rendering *r, cairo_t *cr)
+xr_rendering_draw (struct xr_rendering *r, cairo_t *cr,
+ int x0, int y0, int x1, int y1)
{
if (is_table_item (r->item))
{
xr_set_cairo (xr, cr);
- render_pager_draw (r->p);
-
+ render_pager_draw_region (r->p, x0 * XR_POINT, y0 * XR_POINT,
+ (x1 - x0) * XR_POINT, (y1 - y0) * XR_POINT);
}
else
xr_draw_chart (to_chart_item (r->item), cr,
void xr_rendering_apply_options (struct xr_rendering *, struct string_map *o);
void xr_rendering_measure (struct xr_rendering *, int *w, int *h);
-void xr_rendering_draw_all (struct xr_rendering *r, cairo_t *cr);
+void xr_rendering_draw (struct xr_rendering *r, cairo_t *cr,
+ int x0, int y0, int x1, int y1);
/* Functions for rendering a series of output items to a series of Cairo
contexts, with pagination, possibly including headers.
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;
}