diff options
| author | Jabier Arraiza <jabier.arraiza@marker.es> | 2019-11-01 13:50:57 +0000 |
|---|---|---|
| committer | Jabier Arraiza <jabier.arraiza@marker.es> | 2019-11-01 13:50:57 +0000 |
| commit | 0b6b395ee6f16e42bf36e691c91af83fa95d97e1 (patch) | |
| tree | d403165773ed5adf708e11c794bdf80cc5ad3a22 /src/object | |
| parent | Dutch translation update (diff) | |
| download | inkscape-0b6b395ee6f16e42bf36e691c91af83fa95d97e1.tar.gz inkscape-0b6b395ee6f16e42bf36e691c91af83fa95d97e1.zip | |
Improve clip LPE
Fixes:
https://gitlab.com/inkscape/inbox/issues/868
https://gitlab.com/inkscape/inbox/issues/867
https://gitlab.com/inkscape/inbox/issues/866
Diffstat (limited to 'src/object')
| -rw-r--r-- | src/object/sp-item.cpp | 8 | ||||
| -rw-r--r-- | src/object/sp-item.h | 6 |
2 files changed, 9 insertions, 5 deletions
diff --git a/src/object/sp-item.cpp b/src/object/sp-item.cpp index d12d8e465..884bf6be4 100644 --- a/src/object/sp-item.cpp +++ b/src/object/sp-item.cpp @@ -791,7 +791,7 @@ Geom::OptRect SPItem::geometricBounds(Geom::Affine const &transform) const return bbox; } -Geom::OptRect SPItem::visualBounds(Geom::Affine const &transform) const +Geom::OptRect SPItem::visualBounds(Geom::Affine const &transform, bool wfilter, bool wclip, bool wmask) const { using Geom::X; using Geom::Y; @@ -800,7 +800,7 @@ Geom::OptRect SPItem::visualBounds(Geom::Affine const &transform) const SPFilter *filter = (style && style->filter.href) ? dynamic_cast<SPFilter *>(style->getFilter()) : nullptr; - if ( filter ) { + if (filter && wfilter) { // call the subclass method // CPPIFY //bbox = this->bbox(Geom::identity(), SPItem::VISUAL_BBOX); @@ -851,13 +851,13 @@ Geom::OptRect SPItem::visualBounds(Geom::Affine const &transform) const //bbox = this->bbox(transform, SPItem::VISUAL_BBOX); bbox = const_cast<SPItem*>(this)->bbox(transform, SPItem::VISUAL_BBOX); } - if (clip_ref->getObject()) { + if (clip_ref->getObject() && wclip) { SPItem *ownerItem = dynamic_cast<SPItem *>(clip_ref->getOwner()); g_assert(ownerItem != nullptr); ownerItem->bbox_valid = FALSE; // LP Bug 1349018 bbox.intersectWith(clip_ref->getObject()->geometricBounds(transform)); } - if (mask_ref->getObject()) { + if (mask_ref->getObject() && wmask) { bbox_valid = false; // LP Bug 1349018 bbox.intersectWith(mask_ref->getObject()->visualBounds(transform)); } diff --git a/src/object/sp-item.h b/src/object/sp-item.h index 37faf999b..180142ec1 100644 --- a/src/object/sp-item.h +++ b/src/object/sp-item.h @@ -246,8 +246,12 @@ public: * Get item's visual bounding box in this item's coordinate system. * * The visual bounding box includes the stroke and the filter region. + * @param wfilter use filter expand in bbox calculation + * @param wclip use clip data in bbox calculation + * @param wmask use mask data in bbox calculation */ - Geom::OptRect visualBounds(Geom::Affine const &transform = Geom::identity()) const; + Geom::OptRect visualBounds(Geom::Affine const &transform = Geom::identity(), bool wfilter = true, bool wclip = true, + bool wmask = true) const; Geom::OptRect bounds(BBoxType type, Geom::Affine const &transform = Geom::identity()) const; |
