From 2de63283757c15667a91c28fd312e904696c9d47 Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Fri, 4 Aug 2023 22:51:12 -0400 Subject: [PATCH] io-svg.c: back to diagram width and height once again. --- io-svg.c | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) 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) { -- 2.43.2