From c56f8aa1ad194ab0714bbab259535ba6e3316085 Mon Sep 17 00:00:00 2001 From: Alvin Penner Date: Fri, 16 Jan 2015 15:35:59 -0500 Subject: improve precision of i2doc for case where viewBox aspect ratio does not change (bzr r13859) --- src/viewbox.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/viewbox.cpp') diff --git a/src/viewbox.cpp b/src/viewbox.cpp index 662b05686..95a167109 100644 --- a/src/viewbox.cpp +++ b/src/viewbox.cpp @@ -175,7 +175,9 @@ void SPViewBox::apply_viewbox(const Geom::Rect& in) { /* Things are getting interesting */ double scalex = in.width() / ((float) this->viewBox.width()); double scaley = in.height() / ((float) this->viewBox.height()); - double scale = (this->aspect_clip == SP_ASPECT_MEET) ? MIN (scalex, scaley) : MAX (scalex, scaley); + double scale = (scalex + scaley)/2.0; // default if aspect ratio is not changing + if (!Geom::are_near(scalex / scaley, 1.0, Geom::EPSILON)) + scale = (this->aspect_clip == SP_ASPECT_MEET) ? MIN (scalex, scaley) : MAX (scalex, scaley); width = this->viewBox.width() * scale; height = this->viewBox.height() * scale; -- cgit v1.2.3