From 2be2cf32db0668dc64512a98f6c2394152bd10cc Mon Sep 17 00:00:00 2001 From: "Jon A. Cruz" Date: Sat, 16 Jul 2011 00:42:39 -0700 Subject: Cleanup of oudated/redundant SP_ITEM() macro use. (bzr r10461) --- src/sp-shape.cpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'src/sp-shape.cpp') diff --git a/src/sp-shape.cpp b/src/sp-shape.cpp index 24b6b8025..bbfa98598 100644 --- a/src/sp-shape.cpp +++ b/src/sp-shape.cpp @@ -225,7 +225,6 @@ Inkscape::XML::Node * SPShape::sp_shape_write(SPObject *object, Inkscape::XML::D */ void SPShape::sp_shape_update(SPObject *object, SPCtx *ctx, unsigned int flags) { - SPItem *item = (SPItem *) object; SPShape *shape = (SPShape *) object; if (((SPObjectClass *) (SPShapeClass::parent_class))->update) { @@ -257,7 +256,7 @@ void SPShape::sp_shape_update(SPObject *object, SPCtx *ctx, unsigned int flags) /* This is suboptimal, because changing parent style schedules recalculation */ /* But on the other hand - how can we know that parent does not tie style and transform */ Geom::OptRect paintbox = SP_ITEM(object)->getBounds(Geom::identity(), SPItem::GEOMETRIC_BBOX); - for (SPItemView *v = SP_ITEM (shape)->display; v != NULL; v = v->next) { + for (SPItemView *v = shape->display; v != NULL; v = v->next) { NRArenaShape * const s = NR_ARENA_SHAPE(v->arenaitem); if (flags & SP_OBJECT_MODIFIED_FLAG) { nr_arena_shape_set_path(s, shape->curve, (flags & SP_OBJECT_USER_MODIFIED_FLAG_B)); @@ -270,7 +269,7 @@ void SPShape::sp_shape_update(SPObject *object, SPCtx *ctx, unsigned int flags) if (shape->hasMarkers ()) { /* Dimension marker views */ - for (SPItemView *v = item->display; v != NULL; v = v->next) { + for (SPItemView *v = shape->display; v != NULL; v = v->next) { if (!v->arenaitem->key) { NR_ARENA_ITEM_SET_KEY (v->arenaitem, SPItem::display_key_new (SP_MARKER_LOC_QTY)); } @@ -284,7 +283,7 @@ void SPShape::sp_shape_update(SPObject *object, SPCtx *ctx, unsigned int flags) } /* Update marker views */ - for (SPItemView *v = item->display; v != NULL; v = v->next) { + for (SPItemView *v = shape->display; v != NULL; v = v->next) { sp_shape_update_marker_view (shape, v->arenaitem); } } @@ -495,7 +494,7 @@ void SPShape::sp_shape_modified(SPObject *object, unsigned int flags) } if (flags & SP_OBJECT_STYLE_MODIFIED_FLAG) { - for (SPItemView *v = SP_ITEM (shape)->display; v != NULL; v = v->next) { + for (SPItemView *v = shape->display; v != NULL; v = v->next) { nr_arena_shape_set_style (NR_ARENA_SHAPE (v->arenaitem), object->style); } } -- cgit v1.2.3 From eed6e9c2c229b10911a23976c47da79fc70a5b87 Mon Sep 17 00:00:00 2001 From: "Johan B. C. Engelen" Date: Sun, 17 Jul 2011 21:47:09 +0200 Subject: - rename SPItem::i2d_affine to i2dt_affine, to clarify that it is item-to-desktop, not item-to-document. This should make it easier to spot bugs. - tag some instances where the document-to-desktop transform has been hardcoded (bzr r10466) --- src/sp-shape.cpp | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'src/sp-shape.cpp') diff --git a/src/sp-shape.cpp b/src/sp-shape.cpp index bbfa98598..beec860be 100644 --- a/src/sp-shape.cpp +++ b/src/sp-shape.cpp @@ -763,16 +763,16 @@ sp_shape_print (SPItem *item, SPPrintContext *ctx) dbox.x1 = item->document->getWidth(); dbox.y1 = item->document->getHeight(); item->getBboxDesktop (&bbox); - Geom::Affine const i2d(item->i2d_affine()); + Geom::Affine const i2dt(item->i2dt_affine()); SPStyle* style = item->style; if (!style->fill.isNone()) { - sp_print_fill (ctx, pathv, &i2d, style, &pbox, &dbox, &bbox); + sp_print_fill (ctx, pathv, &i2dt, style, &pbox, &dbox, &bbox); } if (!style->stroke.isNone()) { - sp_print_stroke (ctx, pathv, &i2d, style, &pbox, &dbox, &bbox); + sp_print_stroke (ctx, pathv, &i2dt, style, &pbox, &dbox, &bbox); } /** \todo make code prettier */ @@ -1197,10 +1197,10 @@ void SPShape::sp_shape_snappoints(SPItem const *item, std::vectori2d_affine ()); + Geom::Affine const i2dt (item->i2dt_affine ()); if (snapprefs->getSnapObjectMidpoints()) { - Geom::OptRect bbox = item->getBounds(item->i2d_affine()); + Geom::OptRect bbox = item->getBounds(i2dt); if (bbox) { p.push_back(Inkscape::SnapCandidatePoint(bbox->midpoint(), Inkscape::SNAPSOURCE_OBJECT_MIDPOINT, Inkscape::SNAPTARGET_OBJECT_MIDPOINT)); } @@ -1209,7 +1209,7 @@ void SPShape::sp_shape_snappoints(SPItem const *item, std::vectorgetSnapToItemNode()) { // Add the first point of the path - p.push_back(Inkscape::SnapCandidatePoint(path_it->initialPoint() * i2d, Inkscape::SNAPSOURCE_NODE_CUSP, Inkscape::SNAPTARGET_NODE_CUSP)); + p.push_back(Inkscape::SnapCandidatePoint(path_it->initialPoint() * i2dt, Inkscape::SNAPSOURCE_NODE_CUSP, Inkscape::SNAPTARGET_NODE_CUSP)); } Geom::Path::const_iterator curve_it1 = path_it->begin(); // incoming curve @@ -1219,7 +1219,7 @@ void SPShape::sp_shape_snappoints(SPItem const *item, std::vectorgetSnapLineMidpoints()) { // only do this when we're snapping nodes (enforces strict snapping) if (Geom::LineSegment const* line_segment = dynamic_cast(&(*curve_it1))) { - p.push_back(Inkscape::SnapCandidatePoint(Geom::middle_point(*line_segment) * i2d, Inkscape::SNAPSOURCE_LINE_MIDPOINT, Inkscape::SNAPTARGET_LINE_MIDPOINT)); + p.push_back(Inkscape::SnapCandidatePoint(Geom::middle_point(*line_segment) * i2dt, Inkscape::SNAPSOURCE_LINE_MIDPOINT, Inkscape::SNAPTARGET_LINE_MIDPOINT)); } } @@ -1227,7 +1227,7 @@ void SPShape::sp_shape_snappoints(SPItem const *item, std::vectorgetSnapToItemNode() && !path_it->closed()) { // Add the last point of the path, but only for open paths // (for closed paths the first and last point will coincide) - p.push_back(Inkscape::SnapCandidatePoint((*curve_it1).finalPoint() * i2d, Inkscape::SNAPSOURCE_NODE_CUSP, Inkscape::SNAPTARGET_NODE_CUSP)); + p.push_back(Inkscape::SnapCandidatePoint((*curve_it1).finalPoint() * i2dt, Inkscape::SNAPSOURCE_NODE_CUSP, Inkscape::SNAPTARGET_NODE_CUSP)); } } else { /* Test whether to add the node between curve_it1 and curve_it2. @@ -1256,7 +1256,7 @@ void SPShape::sp_shape_snappoints(SPItem const *item, std::vectorfinalPoint() * i2d, sst, stt)); + p.push_back(Inkscape::SnapCandidatePoint(curve_it1->finalPoint() * i2dt, sst, stt)); } } @@ -1273,7 +1273,7 @@ void SPShape::sp_shape_snappoints(SPItem const *item, std::vector 0) { // There might be multiple intersections... for (Geom::Crossings::const_iterator i = cs.begin(); i != cs.end(); i++) { Geom::Point p_ix = (*path_it).pointAt((*i).ta); - p.push_back(Inkscape::SnapCandidatePoint(p_ix * i2d, Inkscape::SNAPSOURCE_PATH_INTERSECTION, Inkscape::SNAPTARGET_PATH_INTERSECTION)); + p.push_back(Inkscape::SnapCandidatePoint(p_ix * i2dt, Inkscape::SNAPSOURCE_PATH_INTERSECTION, Inkscape::SNAPTARGET_PATH_INTERSECTION)); } } } catch (Geom::RangeError &e) { -- cgit v1.2.3