diff options
| author | Alvin Penner <penner@vaxxine.com> | 2015-01-16 20:35:59 +0000 |
|---|---|---|
| committer | apenner <penner@vaxxine.com> | 2015-01-16 20:35:59 +0000 |
| commit | c56f8aa1ad194ab0714bbab259535ba6e3316085 (patch) | |
| tree | 41cdf5ec799298dbae7382ac4c762de0456a1535 /src/viewbox.cpp | |
| parent | Test implementation of 'shape-padding'. (diff) | |
| download | inkscape-c56f8aa1ad194ab0714bbab259535ba6e3316085.tar.gz inkscape-c56f8aa1ad194ab0714bbab259535ba6e3316085.zip | |
improve precision of i2doc for case where viewBox aspect ratio does not change
(bzr r13859)
Diffstat (limited to 'src/viewbox.cpp')
| -rw-r--r-- | src/viewbox.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
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; |
