diff options
Diffstat (limited to 'src/sp-shape.cpp')
| -rw-r--r-- | src/sp-shape.cpp | 29 |
1 files changed, 14 insertions, 15 deletions
diff --git a/src/sp-shape.cpp b/src/sp-shape.cpp index 24b6b8025..beec860be 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); } } @@ -764,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 */ @@ -1198,10 +1197,10 @@ void SPShape::sp_shape_snappoints(SPItem const *item, std::vector<Inkscape::Snap if (pathv.empty()) return; - Geom::Affine const i2d (item->i2d_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)); } @@ -1210,7 +1209,7 @@ void SPShape::sp_shape_snappoints(SPItem const *item, std::vector<Inkscape::Snap for(Geom::PathVector::const_iterator path_it = pathv.begin(); path_it != pathv.end(); ++path_it) { if (snapprefs->getSnapToItemNode()) { // 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 @@ -1220,7 +1219,7 @@ void SPShape::sp_shape_snappoints(SPItem const *item, std::vector<Inkscape::Snap // For each path: consider midpoints of line segments for snapping if (snapprefs->getSnapLineMidpoints()) { // only do this when we're snapping nodes (enforces strict snapping) if (Geom::LineSegment const* line_segment = dynamic_cast<Geom::LineSegment const*>(&(*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)); } } @@ -1228,7 +1227,7 @@ void SPShape::sp_shape_snappoints(SPItem const *item, std::vector<Inkscape::Snap if (snapprefs->getSnapToItemNode() && !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. @@ -1257,7 +1256,7 @@ void SPShape::sp_shape_snappoints(SPItem const *item, std::vector<Inkscape::Snap stt = Inkscape::SNAPTARGET_UNDEFINED; break; } - p.push_back(Inkscape::SnapCandidatePoint(curve_it1->finalPoint() * i2d, sst, stt)); + p.push_back(Inkscape::SnapCandidatePoint(curve_it1->finalPoint() * i2dt, sst, stt)); } } @@ -1274,7 +1273,7 @@ void SPShape::sp_shape_snappoints(SPItem const *item, std::vector<Inkscape::Snap if (cs.size() > 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) { |
