From: Michael Orlitzky Date: Sat, 5 Aug 2023 02:51:12 +0000 (-0400) Subject: io-svg.c: back to diagram width and height once again. X-Git-Tag: 0.0.1~32 X-Git-Url: https://gitweb.michael.orlitzky.com/?a=commitdiff_plain;h=2de63283757c15667a91c28fd312e904696c9d47;p=libsvgtiny-pixbuf.git io-svg.c: back to diagram width and height once again. --- diff --git a/io-svg.c b/io-svg.c index 341d9e5..cf8864a 100644 --- a/io-svg.c +++ b/io-svg.c @@ -300,21 +300,19 @@ static GdkPixbuf* gdk_pixbuf_from_svg_buffer(char* buffer, } - /* We're using the viewport width and height and not the diagram - * width/height for the image. The diagram can be of a different - * size and aspect ratio than the viewport, and our main use case is - * for icons that are generally square and reasonably sized. If the - * diagram is "small," then we want to scale it up until it fits - * nicely in the viewport before rendering it. That's as opposed to - * rendering the image small, and letting GDK scale it up. Of course - * this reasoning makes the assumption that the viewport is usually - * larger than the diagram. - */ + /* I've gone back and forth on this about five times: we use the + * diagram width and height, and not the viewport width and height. + * This can ultimately render an image that's larger than the + * viewport size, but I think GDK will resize the final pixbuf + * anyway. More importantly, rendering small icons at a larger + * (viewport) size seems to make the whole thing go ape-shit. + * So for now I'm back in the diagram camp. + */ pb = gdk_pixbuf_get_from_surface(cairo_get_target(cr), 0, 0, - VIEWPORT_WIDTH, - VIEWPORT_HEIGHT); + diagram->width, + diagram->height); if (!pb) {