summaryrefslogtreecommitdiffstats
path: root/src/splivarot.cpp
diff options
context:
space:
mode:
authorAlvin Penner <penner@vaxxine.com>2012-02-23 23:20:44 +0000
committerapenner <penner@vaxxine.com>2012-02-23 23:20:44 +0000
commitb7e5111e685e4bf9b75c5823708fdf79fc0c307b (patch)
tree88d51acf92f0c85d0b87ae9569b2b833707defb6 /src/splivarot.cpp
parentcppcheck: null pointer dereference fix (diff)
downloadinkscape-b7e5111e685e4bf9b75c5823708fdf79fc0c307b.tar.gz
inkscape-b7e5111e685e4bf9b75c5823708fdf79fc0c307b.zip
avoid some Shape calculations that are not relevant to visual bbox (Bug 906952)
Fixed bugs: - https://launchpad.net/bugs/906952 (bzr r11010)
Diffstat (limited to 'src/splivarot.cpp')
-rw-r--r--src/splivarot.cpp48
1 files changed, 22 insertions, 26 deletions
diff --git a/src/splivarot.cpp b/src/splivarot.cpp
index 8b06e8ae4..4c1421684 100644
--- a/src/splivarot.cpp
+++ b/src/splivarot.cpp
@@ -678,7 +678,7 @@ void item_outline_add_marker( SPObject const *marker_object, Geom::Affine marker
* Returns a pathvector that is the outline of the stroked item, with markers.
* item must be SPShape or SPText.
*/
-Geom::PathVector* item_outline(SPItem const *item, bool coalesce)
+Geom::PathVector* item_outline(SPItem const *item, bool bbox_only)
{
Geom::PathVector *ret_pathv = NULL;
@@ -768,40 +768,36 @@ Geom::PathVector* item_outline(SPItem const *item, bool coalesce)
0.5 * o_miter);
orig->Outline(res, 0.5 * o_width, o_join, o_butt, 0.5 * o_miter);
- Shape *theRes = new Shape;
-
- theRes->ConvertToShape(theShape, fill_positive);
-
- Path *originaux[1];
- originaux[0] = res;
- theRes->ConvertToForme(orig, 1, originaux);
+ if (!bbox_only) {
+ Shape *theRes = new Shape;
+ theRes->ConvertToShape(theShape, fill_positive);
- if (coalesce) {
+ Path *originaux[1];
+ originaux[0] = res;
+ theRes->ConvertToForme(orig, 1, originaux);
res->Coalesce(5.0);
+ delete theRes;
}
-
delete theShape;
- delete theRes;
} else {
orig->Outline(res, 0.5 * o_width, o_join, o_butt, 0.5 * o_miter);
- if (coalesce) {
+ if (!bbox_only) {
orig->Coalesce(0.5 * o_width);
- }
-
- Shape *theShape = new Shape;
- Shape *theRes = new Shape;
+ Shape *theShape = new Shape;
+ Shape *theRes = new Shape;
- res->ConvertWithBackData(1.0);
- res->Fill(theShape, 0);
- theRes->ConvertToShape(theShape, fill_positive);
+ res->ConvertWithBackData(1.0);
+ res->Fill(theShape, 0);
+ theRes->ConvertToShape(theShape, fill_positive);
- Path *originaux[1];
- originaux[0] = res;
- theRes->ConvertToForme(orig, 1, originaux);
+ Path *originaux[1];
+ originaux[0] = res;
+ theRes->ConvertToForme(orig, 1, originaux);
- delete theShape;
- delete theRes;
+ delete theShape;
+ delete theRes;
+ }
}
if (orig->descr_cmd.size() <= 1) {
@@ -814,9 +810,9 @@ Geom::PathVector* item_outline(SPItem const *item, bool coalesce)
if (res->descr_cmd.size() > 1) { // if there's 0 or 1 node left, drop this path altogether
- ret_pathv = orig->MakePathVector();
+ ret_pathv = bbox_only ? res->MakePathVector() : orig->MakePathVector();
- if (SP_IS_SHAPE(item) && SP_SHAPE(item)->hasMarkers ()) {
+ if (SP_IS_SHAPE(item) && SP_SHAPE(item)->hasMarkers() && !bbox_only) {
SPShape *shape = SP_SHAPE(item);
Geom::PathVector const & pathv = curve->get_pathvector();