diff options
| author | Marc Jeanmougin <marc@jeanmougin.fr> | 2015-04-26 09:46:39 +0000 |
|---|---|---|
| committer | Marc Jeanmougin <mc@M0nst3r.bouyguesbox.fr> | 2015-04-26 09:46:39 +0000 |
| commit | ac6617a55b9f7c05db084eeaa5684fb42d5e1406 (patch) | |
| tree | 1fc8e668890618463d48298074559c7fe6bc5040 /src/sp-item-transform.cpp | |
| parent | merge (diff) | |
| parent | extensions. ink2canvas.py - do not parse html comments. (Bug 1446204) (diff) | |
| download | inkscape-ac6617a55b9f7c05db084eeaa5684fb42d5e1406.tar.gz inkscape-ac6617a55b9f7c05db084eeaa5684fb42d5e1406.zip | |
merging
(bzr r13922.1.13)
Diffstat (limited to 'src/sp-item-transform.cpp')
| -rw-r--r-- | src/sp-item-transform.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/sp-item-transform.cpp b/src/sp-item-transform.cpp index 86beee907..767f0ed91 100644 --- a/src/sp-item-transform.cpp +++ b/src/sp-item-transform.cpp @@ -181,7 +181,9 @@ Geom::Affine get_scale_transform_for_uniform_stroke(Geom::Rect const &bbox_visua if (B*B - 4*A*C < 0) { g_message("stroke scaling error : %d, %f, %f, %f, %f, %f", preserve, r0, w0, h0, w1, h1); } else { - r1 = fabs((-B - sqrt(B*B - 4*A*C))/(2*A)); + r1 = -C/B; + if (!Geom::are_near(A*C/B/B, 0.0, Geom::EPSILON)) + r1 = fabs((-B - sqrt(B*B - 4*A*C))/(2*A)); // If w1 < 0 then the scale will be wrong if we just assume that scale_x = (w1 - r1)/(w0 - r0); // Therefore we here need the absolute values of w0, w1, h0, h1, and r0, as taken care of earlier scale_x = (w1 - r1)/(w0 - r0); @@ -339,7 +341,9 @@ Geom::Affine get_scale_transform_for_variable_stroke(Geom::Rect const &bbox_visu if (B*B - 4*A*C < 0) { g_message("variable stroke scaling error : %d, %d, %f, %f, %f, %f, %f, %f", transform_stroke, preserve, r0w, r0h, w0, h0, w1, h1); } else { - gdouble det = (-B + sqrt(B*B - 4*A*C))/(2*A); + gdouble det = -C/B; + if (!Geom::are_near(A*C/B/B, 0.0, Geom::EPSILON)) + det = (-B + sqrt(B*B - 4*A*C))/(2*A); r1w = r0w*det; r1h = r0h*det; // If w1 < 0 then the scale will be wrong if we just assume that scale_x = (w1 - r1)/(w0 - r0); |
