diff options
| author | Diederik van Lierop <mail@diedenrezi.nl> | 2011-07-17 12:05:05 +0000 |
|---|---|---|
| committer | Diederik van Lierop <mail@diedenrezi.nl> | 2011-07-17 12:05:05 +0000 |
| commit | 2b6e0b43dbcb38e1098a5308d36ba5e75c08d5a1 (patch) | |
| tree | 17dfb832e478653088fa0cc7acd3a49c1d074d6b /src/sp-item-transform.cpp | |
| parent | Fix drawing of controls at (0,0) (e.g. scaling handles, snap-indicator, etc.)... (diff) | |
| download | inkscape-2b6e0b43dbcb38e1098a5308d36ba5e75c08d5a1.tar.gz inkscape-2b6e0b43dbcb38e1098a5308d36ba5e75c08d5a1.zip | |
Fix crash that occurred when scaling a clipped object, as reported in lp:811819
Fixed bugs:
- https://launchpad.net/bugs/811819
(bzr r10464)
Diffstat (limited to 'src/sp-item-transform.cpp')
| -rw-r--r-- | src/sp-item-transform.cpp | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/sp-item-transform.cpp b/src/sp-item-transform.cpp index eb4b81a61..0fbce27f9 100644 --- a/src/sp-item-transform.cpp +++ b/src/sp-item-transform.cpp @@ -248,10 +248,6 @@ get_scale_transform_with_unequal_stroke (Geom::Rect const &bbox_visual, Geom::Re gdouble r0w = w0 - bbox_geom.width(); // r0w is the average strokewidth of the left and right edges, i.e. 0.5*(r0l + r0r) gdouble r0h = h0 - bbox_geom.height(); // r0h is the average strokewidth of the top and bottom edges, i.e. 0.5*(r0t + r0b) - // Check whether the stroke is not negative; should not be possible, but just in case: - g_assert(r0w >= 0); - g_assert(r0h >= 0); - if (bbox_visual.hasZeroArea()) { // Obviously we cannot scale from empty visual bounding boxes at all, so we will only translate in such a case Geom::Affine move = Geom::Translate(x0 - bbox_visual.min()[Geom::X], y0 - bbox_visual.min()[Geom::Y]); return (move); @@ -266,6 +262,14 @@ get_scale_transform_with_unequal_stroke (Geom::Rect const &bbox_visual, Geom::Re return (p2o * direct * o2n); } + // Check whether the stroke is negative; i.e. the geometric bounding box is larger than the visual bounding box, which + // occurs for example for clipped objects (see launchpad bug #811819) + if (r0w < 0 || r0w < 0) { + // How should we handle the stroke width scaling of clipped object? I don't know if we can/should handle this, + // so for now we simply return the direct scaling + return (p2o * direct * o2n); + } + // Here starts the calculation you've been waiting for; first do some preparation int flip_x = (w1 > 0) ? 1 : -1; int flip_y = (h1 > 0) ? 1 : -1; |
