diff options
| author | bulia byak <buliabyak@gmail.com> | 2006-06-22 18:09:05 +0000 |
|---|---|---|
| committer | buliabyak <buliabyak@users.sourceforge.net> | 2006-06-22 18:09:05 +0000 |
| commit | 30a7d2d8e82b94dc0beac05ea58a71798479e780 (patch) | |
| tree | 50ac5dfbacd4d6197a42ef1006a7d8e53ee37b7e /src/sp-item-transform.cpp | |
| parent | apply patch 1498946 by zbsz (fixes #1492545 "PNG resolution value export") (diff) | |
| download | inkscape-30a7d2d8e82b94dc0beac05ea58a71798479e780.tar.gz inkscape-30a7d2d8e82b94dc0beac05ea58a71798479e780.zip | |
fix 1510614
(bzr r1263)
Diffstat (limited to 'src/sp-item-transform.cpp')
| -rw-r--r-- | src/sp-item-transform.cpp | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/src/sp-item-transform.cpp b/src/sp-item-transform.cpp index c2b1a2648..d62211245 100644 --- a/src/sp-item-transform.cpp +++ b/src/sp-item-transform.cpp @@ -102,15 +102,17 @@ get_scale_transform_with_stroke (NR::Rect &bbox_param, gdouble strokewidth, bool gdouble h1 = y1 - y0; gdouble r0 = strokewidth; - if (bbox.isEmpty() || bbox.extent(NR::X) < 1e-06 || bbox.extent(NR::Y) < 1e-06 || - fabs(w0 - r0) < 1e-6 || fabs(h0 - r0) < 1e-6 || - (!transform_stroke && (fabs(w1 - r0) < 1e-6 || fabs(h1 - r0) < 1e-6)) - ) { + if (bbox.isEmpty() || bbox.extent(NR::X) < 1e-06 || bbox.extent(NR::Y) < 1e-06) { NR::Matrix move = NR::Matrix(NR::translate(x0 - bbox.min()[NR::X], y0 - bbox.min()[NR::Y])); - return (move); // sorry, cannot scale from or to empty boxes, so only translate + return (move); // cannot scale from empty boxes at all, so only translate } NR::Matrix direct = NR::Matrix (NR::scale(w1 / w0, h1 / h0)); + + if (fabs(w0 - r0) < 1e-6 || fabs(h0 - r0) < 1e-6 || (!transform_stroke && (fabs(w1 - r0) < 1e-6 || fabs(h1 - r0) < 1e-6))) { + return (p2o * direct * o2n); // can't solve the equation: one of the dimensions is equal to stroke width, so return the straightforward scaler + } + gdouble ratio_x = (w1 - r0) / (w0 - r0); gdouble ratio_y = (h1 - r0) / (h0 - r0); NR::Matrix direct_constant_r = NR::Matrix (NR::scale(ratio_x, ratio_y)); |
