line-visualizer-row: use scaled surface when available

If we have not yet received our proper draw for the new size
allocation (likely right after the size allocate), then we can
just use the old surface but at a scaled value. This is handy
so that we don't block the main loop trying to do drawing of
lots of data points. Instead we just scale the image and wait
for the high-quality version to complete.
This commit is contained in:
Christian Hergert
2016-09-26 23:24:17 -07:00
parent 321fc18eee
commit 1dcb41f623

View File

@ -246,7 +246,10 @@ sp_line_visualizer_row_draw (GtkWidget *widget,
*/
if (width != alloc.width || height != alloc.height)
{
/* TODO: Handle intermediate scaling */
cairo_rectangle (cr, 0, 0, width, height);
cairo_scale (cr, (gdouble)alloc.width / (gdouble)width, (gdouble)alloc.height / (gdouble)height);
cairo_set_source_surface (cr, priv->surface, 0, 0);
cairo_fill (cr);
return ret;
}