From 2fcf42dd11c0d68822a84c4e2ccbe3acb1ccafa1 Mon Sep 17 00:00:00 2001 From: Jabiertxof Date: Mon, 25 Mar 2024 19:17:57 +0100 Subject: [PATCH] improve visual bbox speed calculation --- src/object/sp-shape.cpp | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/src/object/sp-shape.cpp b/src/object/sp-shape.cpp index 0aa746f28d..cce2f32f35 100644 --- a/src/object/sp-shape.cpp +++ b/src/object/sp-shape.cpp @@ -553,25 +553,25 @@ Geom::OptRect SPShape::either_bbox(Geom::Affine const &transform, SPItem::BBoxTy if (!this->_curve || this->_curve->get_pathvector().empty()) { return bbox; } - - bbox = bounds_exact_transformed(this->_curve->get_pathvector(), transform); - - if (!bbox) { - return bbox; - } - if (bboxtype == SPItem::VISUAL_BBOX) { // convert the stroke to a path and calculate that path's geometric bbox - if (!this->style->stroke.isNone() && !this->style->stroke_extensions.hairline) { - Geom::PathVector *pathv = item_to_outline(this, true); // calculate bbox_only - - if (pathv) { - bbox |= bounds_exact_transformed(*pathv, transform); + if (Geom::PathVector *pathv = item_to_outline(this, true)) { // calculate bbox_only + bbox = bounds_exact_transformed(*pathv, transform); delete pathv; } } + } + if (!bbox) { + bbox = bounds_exact_transformed(this->_curve->get_pathvector(), transform); + } + + if (!bbox) { + return bbox; + } + if (bboxtype == SPItem::VISUAL_BBOX) { + // convert the stroke to a path and calculate that path's geometric bbox // Union with bboxes of the markers, if any if ( this->hasMarkers() && !this->_curve->get_pathvector().empty() ) { /** \todo make code prettier! */ -- GitLab