diff options
| author | Johan B. C. Engelen <jbc.engelen@swissonline.ch> | 2008-06-16 21:25:19 +0000 |
|---|---|---|
| committer | johanengelen <johanengelen@users.sourceforge.net> | 2008-06-16 21:25:19 +0000 |
| commit | 07e18ec0923d844fbef0d8a6e9bd5abd777860d0 (patch) | |
| tree | 3b768c5ad78b32325ef691e39bcd8638ae77689d /src | |
| parent | add comment (original update code used exact bbox) (diff) | |
| download | inkscape-07e18ec0923d844fbef0d8a6e9bd5abd777860d0.tar.gz inkscape-07e18ec0923d844fbef0d8a6e9bd5abd777860d0.zip | |
use 2geom method to calc boundingbox of shape
(bzr r5968)
Diffstat (limited to 'src')
| -rw-r--r-- | src/helper/geom.cpp | 7 | ||||
| -rw-r--r-- | src/helper/geom.h | 1 | ||||
| -rw-r--r-- | src/sp-shape.cpp | 14 |
3 files changed, 15 insertions, 7 deletions
diff --git a/src/helper/geom.cpp b/src/helper/geom.cpp index 3917218bb..8a32386fc 100644 --- a/src/helper/geom.cpp +++ b/src/helper/geom.cpp @@ -11,6 +11,8 @@ * Released under GNU GPL
*/
+#include "helper/geom.h"
+
#include <2geom/pathvector.h>
#include <2geom/transforms.h>
@@ -20,6 +22,11 @@ bounds_fast_transformed(Geom::PathVector const & pv, Geom::Matrix const & t) return Geom::bounds_fast(pv * t);
}
+Geom::Rect
+bounds_exact_transformed(Geom::PathVector const & pv, Geom::Matrix const & t)
+{
+ return Geom::bounds_exact(pv * t);
+}
/*
Local Variables:
diff --git a/src/helper/geom.h b/src/helper/geom.h index fbc3f2c00..d7548756a 100644 --- a/src/helper/geom.h +++ b/src/helper/geom.h @@ -15,6 +15,7 @@ #include <2geom/forward.h>
Geom::Rect bounds_fast_transformed(Geom::PathVector const & pv, Geom::Matrix const & t);
+Geom::Rect bounds_exact_transformed(Geom::PathVector const & pv, Geom::Matrix const & t);
#endif // INKSCAPE_HELPER_GEOM_H
diff --git a/src/sp-shape.cpp b/src/sp-shape.cpp index 4ae2a98f8..efed9209b 100644 --- a/src/sp-shape.cpp +++ b/src/sp-shape.cpp @@ -21,6 +21,8 @@ #include <libnr/nr-matrix-ops.h> #include <libnr/nr-matrix-translate-ops.h> #include <libnr/nr-scale-matrix-ops.h> +#include <2geom/rect.h> +#include "helper/geom.h" #include <sigc++/functors/ptr_fun.h> #include <sigc++/adaptors/bind.h> @@ -637,14 +639,12 @@ static void sp_shape_bbox(SPItem const *item, NRRect *bbox, NR::Matrix const &tr if (shape->curve) { NRRect cbbox; - const_NRBPath bp; - - bp.path = SP_CURVE_BPATH (shape->curve); - - cbbox.x0 = cbbox.y0 = NR_HUGE; - cbbox.x1 = cbbox.y1 = -NR_HUGE; - nr_path_matrix_bbox_union(&bp, transform, &cbbox); + Geom::Rect geombbox = bounds_exact_transformed(shape->curve->get_pathvector(), to_2geom(transform)); + cbbox.x0 = geombbox[0][0]; + cbbox.y0 = geombbox[1][0]; + cbbox.x1 = geombbox[0][1]; + cbbox.y1 = geombbox[1][1]; if ((SPItem::BBoxType) flags != SPItem::GEOMETRIC_BBOX) { |
