Commit 38e87c2d authored by Federico Mena Quintero's avatar Federico Mena Quintero Committed by Michael Natterer

Issue #2561: Fix computation of SVG image sizes

The librsvg API was being called in an incorrect order.  One cannot
call rsvg_handle_get_dimensions() until after rsvg_handle_close() is
done.

(cherry picked from commit b2027c40)
parent 8d609ecf
...@@ -521,19 +521,24 @@ load_rsvg_size (const gchar *filename, ...@@ -521,19 +521,24 @@ load_rsvg_size (const gchar *filename,
break; break;
case G_IO_STATUS_EOF: case G_IO_STATUS_EOF:
success = rsvg_handle_close (handle, error); success = rsvg_handle_close (handle, error);
break;
case G_IO_STATUS_NORMAL:
success = rsvg_handle_write (handle,
(const guchar *) buf, len, error);
rsvg_handle_get_dimensions (handle, &dim);
if (dim.width > 0 && dim.height > 0) if (success)
{ {
vals->width = dim.width; rsvg_handle_get_dimensions (handle, &dim);
vals->height = dim.height;
if (dim.width > 0 && dim.height > 0)
{
vals->width = dim.width;
vals->height = dim.height;
done = TRUE; done = TRUE;
}
} }
break;
case G_IO_STATUS_NORMAL:
success = rsvg_handle_write (handle,
(const guchar *) buf, len, error);
break; break;
case G_IO_STATUS_AGAIN: case G_IO_STATUS_AGAIN:
break; break;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment