}
- /* 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) {