summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: a7db6de)
raw | patch | inline | side by side (parent: a7db6de)
author | johanengelen <johanengelen@users.sourceforge.net> | |
Fri, 1 Aug 2008 20:07:58 +0000 (20:07 +0000) | ||
committer | johanengelen <johanengelen@users.sourceforge.net> | |
Fri, 1 Aug 2008 20:07:58 +0000 (20:07 +0000) |
src/live_effects/lpe-mirror_symmetry.cpp | patch | blob | history | |
src/live_effects/lpegroupbbox.cpp | patch | blob | history | |
src/sp-item.cpp | patch | blob | history | |
src/sp-item.h | patch | blob | history |
index a70ab507f55467f905751aeee743f2d5ec3af822..834877f369a803a172d865931bed5f067c14fb6a 100644 (file)
SPItem *item = SP_ITEM(lpeitem);
Geom::Matrix t = sp_item_i2d_affine(item);
- NR::Maybe<Geom::Rect> bbox = item->getBounds(t);
+ Geom::Rect bbox = item->getBounds(t);
- Point A(bbox->left(), bbox->bottom());
- Point B(bbox->left(), bbox->top());
+ Point A(bbox.left(), bbox.bottom());
+ Point B(bbox.left(), bbox.top());
A *= t;
B *= t;
Piecewise<D2<SBasis> > rline = Piecewise<D2<SBasis> >(D2<SBasis>(Linear(A[X], B[X]), Linear(A[Y], B[Y])));
index 2ea839892c0673c5209da7d13db22cf8112a490b..c0f1222f268f97a4c58af5fc9e2e6f039310229f 100644 (file)
else {
transform = Geom::identity();
}
-
- NR::Maybe<NR::Rect> itemBBox = item->getBounds(from_2geom(transform), SPItem::GEOMETRIC_BBOX);
- // NR to Geom glue
- Geom::Rect geomBBox = Geom::Rect(itemBBox->min(), itemBBox->max());
- boundingbox_X = geomBBox[Geom::X];
- boundingbox_Y = geomBBox[Geom::Y];
+ Geom::Rect itemBBox = item->getBounds(transform, SPItem::GEOMETRIC_BBOX);
+ boundingbox_X = itemBBox[Geom::X];
+ boundingbox_Y = itemBBox[Geom::Y];
}
} // namespace LivePathEffect
diff --git a/src/sp-item.cpp b/src/sp-item.cpp
index 691d471ca8e32e2a5ce65ee775e1db4893da1cbf..5d717725310bd16c97408d013e58b1e500901500 100644 (file)
--- a/src/sp-item.cpp
+++ b/src/sp-item.cpp
return r;
}
-NR::Maybe<Geom::Rect>
+/*
+ * If the item is empty, or has an empty boundingbox for another reason, this method will
+ * return an empty rectangle. I.e. "getBounds(...).isEmpty() == true".
+ */
+Geom::Rect
SPItem::getBounds(Geom::Matrix const &transform, SPItem::BBoxType type, unsigned int /*dkey*/)
const
{
NR::Maybe<NR::Rect> r = NR::Nothing();
sp_item_invoke_bbox_full(this, &r, from_2geom(transform), type, TRUE);
- return NR::Maybe<Geom::Rect>(to_2geom(*r));
+ if (r)
+ return to_2geom(*r);
+ else
+ return Geom::Rect(); // return empty rectangle
}
void
diff --git a/src/sp-item.h b/src/sp-item.h
index 814581a5d839a3b1c485df875f157b0dac9cb5c4..39907999fd5a56392df298e7f5694b53ca5a1978 100644 (file)
--- a/src/sp-item.h
+++ b/src/sp-item.h
void lowerToBottom();
NR::Maybe<NR::Rect> getBounds(NR::Matrix const &transform, BBoxType type=APPROXIMATE_BBOX, unsigned int dkey=0) const;
- NR::Maybe<Geom::Rect> getBounds(Geom::Matrix const &transform, BBoxType type=APPROXIMATE_BBOX, unsigned int dkey=0) const;
+ Geom::Rect getBounds(Geom::Matrix const &transform, BBoxType type=APPROXIMATE_BBOX, unsigned int dkey=0) const;
sigc::connection _clip_ref_connection;
sigc::connection _mask_ref_connection;