From: johanengelen Date: Mon, 1 Sep 2008 23:04:44 +0000 (+0000) Subject: removed unnecessary pointer, changed to by reference. (the pointer was not allowed... X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=18600997446ed9436a47ab7f233e282a1c2b1ae6;p=inkscape.git removed unnecessary pointer, changed to by reference. (the pointer was not allowed to be NULL, so reference is better) --- diff --git a/src/object-snapper.cpp b/src/object-snapper.cpp index 29b429b2e..90acb7f29 100644 --- a/src/object-snapper.cpp +++ b/src/object-snapper.cpp @@ -143,11 +143,11 @@ void Inkscape::ObjectSnapper::_findCandidates(SPObject* parent, // Oh oh, this will get ugly. We cannot use sp_item_i2d_affine directly because we need to // insert an additional transformation in document coordinates (code copied from sp_item_i2d_affine) sp_item_invoke_bbox(item, - &bbox_of_item, + bbox_of_item, from_2geom(to_2geom(sp_item_i2doc_affine(item)) * matrix_to_desktop(additional_affine, item)), true); } else { - sp_item_invoke_bbox(item, &bbox_of_item, sp_item_i2d_affine(item), true); + sp_item_invoke_bbox(item, bbox_of_item, sp_item_i2d_affine(item), true); } if (bbox_of_item) { // See if the item is within range diff --git a/src/sp-item-group.cpp b/src/sp-item-group.cpp index 4cea8aad5..38bf03bdc 100644 --- a/src/sp-item-group.cpp +++ b/src/sp-item-group.cpp @@ -708,7 +708,7 @@ void CGroup::calculateBBox(NRRect *bbox, NR::Matrix const &transform, unsigned c if (SP_IS_ITEM(o) && !SP_ITEM(o)->isHidden()) { SPItem *child = SP_ITEM(o); NR::Matrix const ct(child->transform * transform); - sp_item_invoke_bbox_full(child, &dummy_bbox, ct, flags, FALSE); + sp_item_invoke_bbox_full(child, dummy_bbox, ct, flags, FALSE); } l = g_slist_remove (l, o); } diff --git a/src/sp-item.cpp b/src/sp-item.cpp index 0d285c3f0..706469d3c 100644 --- a/src/sp-item.cpp +++ b/src/sp-item.cpp @@ -724,12 +724,12 @@ boost::optional SPItem::getBounds(NR::Matrix const &transform, unsigned int /*dkey*/) const { boost::optional r; - sp_item_invoke_bbox_full(this, &r, transform, type, TRUE); + sp_item_invoke_bbox_full(this, r, transform, type, TRUE); return r; } void -sp_item_invoke_bbox(SPItem const *item, boost::optional *bbox, NR::Matrix const &transform, unsigned const clear, SPItem::BBoxType type) +sp_item_invoke_bbox(SPItem const *item, boost::optional &bbox, NR::Matrix const &transform, unsigned const clear, SPItem::BBoxType type) { sp_item_invoke_bbox_full(item, bbox, transform, type, clear); } @@ -746,14 +746,13 @@ sp_item_invoke_bbox(SPItem const *item, NRRect *bbox, NR::Matrix const &transfor * transform and the flags to the actual bbox methods. Note that many of subclasses (e.g. groups, * clones), in turn, call this function in their bbox methods. */ void -sp_item_invoke_bbox_full(SPItem const *item, boost::optional *bbox, NR::Matrix const &transform, unsigned const flags, unsigned const clear) +sp_item_invoke_bbox_full(SPItem const *item, boost::optional &bbox, NR::Matrix const &transform, unsigned const flags, unsigned const clear) { g_assert(item != NULL); g_assert(SP_IS_ITEM(item)); - g_assert(bbox != NULL); if (clear) { - *bbox = boost::optional(); + bbox = boost::optional(); } // TODO: replace NRRect by NR::Rect, for all SPItemClasses, and for SP_CLIPPATH @@ -846,7 +845,7 @@ sp_item_invoke_bbox_full(SPItem const *item, boost::optional *bbox, NR // would therefore be translated into empty boost::optional() (see bug https://bugs.launchpad.net/inkscape/+bug/168684) boost::optional temp_bbox_new = NR::Rect(NR::Point(temp_bbox.x0, temp_bbox.y0), NR::Point(temp_bbox.x1, temp_bbox.y1)); - *bbox = NR::union_bounds(*bbox, temp_bbox_new); + bbox = NR::union_bounds(bbox, temp_bbox_new); } // DEPRECATED to phase out the use of NRRect in favor of boost::optional @@ -926,7 +925,7 @@ sp_item_bbox_desktop(SPItem *item, NRRect *bbox, SPItem::BBoxType type) boost::optional sp_item_bbox_desktop(SPItem *item, SPItem::BBoxType type) { boost::optional rect = boost::optional(); - sp_item_invoke_bbox(item, &rect, sp_item_i2d_affine(item), TRUE, type); + sp_item_invoke_bbox(item, rect, sp_item_i2d_affine(item), TRUE, type); return rect; } diff --git a/src/sp-item.h b/src/sp-item.h index 358f3d75c..dd2a995f7 100644 --- a/src/sp-item.h +++ b/src/sp-item.h @@ -213,9 +213,9 @@ struct SPItemClass { /* Methods */ -void sp_item_invoke_bbox(SPItem const *item, boost::optional *bbox, NR::Matrix const &transform, unsigned const clear, SPItem::BBoxType type = SPItem::APPROXIMATE_BBOX); +void sp_item_invoke_bbox(SPItem const *item, boost::optional &bbox, NR::Matrix const &transform, unsigned const clear, SPItem::BBoxType type = SPItem::APPROXIMATE_BBOX); void sp_item_invoke_bbox(SPItem const *item, NRRect *bbox, NR::Matrix const &transform, unsigned const clear, SPItem::BBoxType type = SPItem::APPROXIMATE_BBOX) __attribute__ ((deprecated)); -void sp_item_invoke_bbox_full(SPItem const *item, boost::optional *bbox, NR::Matrix const &transform, unsigned const flags, unsigned const clear); +void sp_item_invoke_bbox_full(SPItem const *item, boost::optional &bbox, NR::Matrix const &transform, unsigned const flags, unsigned const clear); void sp_item_invoke_bbox_full(SPItem const *item, NRRect *bbox, NR::Matrix const &transform, unsigned const flags, unsigned const clear) __attribute__ ((deprecated)); unsigned sp_item_pos_in_parent(SPItem *item); diff --git a/src/ui/dialog/filedialogimpl-win32.cpp b/src/ui/dialog/filedialogimpl-win32.cpp index 4f9c33ff5..1f714c3db 100644 --- a/src/ui/dialog/filedialogimpl-win32.cpp +++ b/src/ui/dialog/filedialogimpl-win32.cpp @@ -868,7 +868,7 @@ bool FileOpenDialogImplWin32::set_svg_preview() // write object bbox to area boost::optional maybeArea(from_2geom(area)); sp_document_ensure_up_to_date (svgDoc); - sp_item_invoke_bbox((SPItem *) svgDoc->root, &maybeArea, + sp_item_invoke_bbox((SPItem *) svgDoc->root, maybeArea, sp_item_i2r_affine((SPItem *)(svgDoc->root)), TRUE); NRArena *const arena = NRArena::create();