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-rect.cpp | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) (limited to 'src/sp-rect.cpp') diff --git a/src/sp-rect.cpp b/src/sp-rect.cpp index db5a62f8f..7cc9c7f29 100644 --- a/src/sp-rect.cpp +++ b/src/sp-rect.cpp @@ -417,7 +417,7 @@ sp_rect_set_visible_rx(SPRect *rect, gdouble rx) rect->rx.computed = rx / vector_stretch( Geom::Point(rect->x.computed + 1, rect->y.computed), Geom::Point(rect->x.computed, rect->y.computed), - SP_ITEM(rect)->transform); + rect->transform); rect->rx._set = true; } SP_OBJECT(rect)->updateRepr(); @@ -433,7 +433,7 @@ sp_rect_set_visible_ry(SPRect *rect, gdouble ry) rect->ry.computed = ry / vector_stretch( Geom::Point(rect->x.computed, rect->y.computed + 1), Geom::Point(rect->x.computed, rect->y.computed), - SP_ITEM(rect)->transform); + rect->transform); rect->ry._set = true; } SP_OBJECT(rect)->updateRepr(); @@ -447,7 +447,7 @@ sp_rect_get_visible_rx(SPRect *rect) return rect->rx.computed * vector_stretch( Geom::Point(rect->x.computed + 1, rect->y.computed), Geom::Point(rect->x.computed, rect->y.computed), - SP_ITEM(rect)->transform); + rect->transform); } gdouble @@ -458,7 +458,7 @@ sp_rect_get_visible_ry(SPRect *rect) return rect->ry.computed * vector_stretch( Geom::Point(rect->x.computed, rect->y.computed + 1), Geom::Point(rect->x.computed, rect->y.computed), - SP_ITEM(rect)->transform); + rect->transform); } Geom::Rect @@ -481,9 +481,9 @@ sp_rect_compensate_rxry(SPRect *rect, Geom::Affine xform) Geom::Point cy = c + Geom::Point(0, 1); // apply previous transform if any - c *= SP_ITEM(rect)->transform; - cx *= SP_ITEM(rect)->transform; - cy *= SP_ITEM(rect)->transform; + c *= rect->transform; + cx *= rect->transform; + cy *= rect->transform; // find out stretches that we need to compensate gdouble eX = vector_stretch(cx, c, xform); @@ -513,7 +513,7 @@ sp_rect_set_visible_width(SPRect *rect, gdouble width) rect->width.computed = width / vector_stretch( Geom::Point(rect->x.computed + 1, rect->y.computed), Geom::Point(rect->x.computed, rect->y.computed), - SP_ITEM(rect)->transform); + rect->transform); rect->width._set = true; SP_OBJECT(rect)->updateRepr(); } @@ -524,7 +524,7 @@ sp_rect_set_visible_height(SPRect *rect, gdouble height) rect->height.computed = height / vector_stretch( Geom::Point(rect->x.computed, rect->y.computed + 1), Geom::Point(rect->x.computed, rect->y.computed), - SP_ITEM(rect)->transform); + rect->transform); rect->height._set = true; SP_OBJECT(rect)->updateRepr(); } @@ -537,7 +537,7 @@ sp_rect_get_visible_width(SPRect *rect) return rect->width.computed * vector_stretch( Geom::Point(rect->x.computed + 1, rect->y.computed), Geom::Point(rect->x.computed, rect->y.computed), - SP_ITEM(rect)->transform); + rect->transform); } gdouble @@ -548,7 +548,7 @@ sp_rect_get_visible_height(SPRect *rect) return rect->height.computed * vector_stretch( Geom::Point(rect->x.computed, rect->y.computed + 1), Geom::Point(rect->x.computed, rect->y.computed), - SP_ITEM(rect)->transform); + rect->transform); } /** @@ -606,13 +606,13 @@ sp_rect_convert_to_guides(SPItem *item) { Inkscape::Preferences *prefs = Inkscape::Preferences::get(); if (!prefs->getBool("/tools/shapes/rect/convertguides", true)) { - SP_ITEM(rect)->convert_to_guides(); + rect->convert_to_guides(); return; } std::list > pts; - Geom::Affine const i2d (SP_ITEM(rect)->i2d_affine()); + Geom::Affine const i2d(rect->i2d_affine()); Geom::Point A1(Geom::Point(rect->x.computed, rect->y.computed) * i2d); Geom::Point A2(Geom::Point(rect->x.computed, rect->y.computed + rect->height.computed) * i2d); -- 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-rect.cpp | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'src/sp-rect.cpp') diff --git a/src/sp-rect.cpp b/src/sp-rect.cpp index 7cc9c7f29..ec83a47e9 100644 --- a/src/sp-rect.cpp +++ b/src/sp-rect.cpp @@ -573,12 +573,12 @@ static void sp_rect_snappoints(SPItem const *item, std::vectori2d_affine ()); + Geom::Affine const i2dt (item->i2dt_affine ()); - Geom::Point p0 = Geom::Point(rect->x.computed, rect->y.computed) * i2d; - Geom::Point p1 = Geom::Point(rect->x.computed, rect->y.computed + rect->height.computed) * i2d; - Geom::Point p2 = Geom::Point(rect->x.computed + rect->width.computed, rect->y.computed + rect->height.computed) * i2d; - Geom::Point p3 = Geom::Point(rect->x.computed + rect->width.computed, rect->y.computed) * i2d; + Geom::Point p0 = Geom::Point(rect->x.computed, rect->y.computed) * i2dt; + Geom::Point p1 = Geom::Point(rect->x.computed, rect->y.computed + rect->height.computed) * i2dt; + Geom::Point p2 = Geom::Point(rect->x.computed + rect->width.computed, rect->y.computed + rect->height.computed) * i2dt; + Geom::Point p3 = Geom::Point(rect->x.computed + rect->width.computed, rect->y.computed) * i2dt; if (snapprefs->getSnapToItemNode()) { p.push_back(Inkscape::SnapCandidatePoint(p0, Inkscape::SNAPSOURCE_CORNER, Inkscape::SNAPTARGET_CORNER)); @@ -612,12 +612,12 @@ sp_rect_convert_to_guides(SPItem *item) { std::list > pts; - Geom::Affine const i2d(rect->i2d_affine()); + Geom::Affine const i2dt(rect->i2dt_affine()); - Geom::Point A1(Geom::Point(rect->x.computed, rect->y.computed) * i2d); - Geom::Point A2(Geom::Point(rect->x.computed, rect->y.computed + rect->height.computed) * i2d); - Geom::Point A3(Geom::Point(rect->x.computed + rect->width.computed, rect->y.computed + rect->height.computed) * i2d); - Geom::Point A4(Geom::Point(rect->x.computed + rect->width.computed, rect->y.computed) * i2d); + Geom::Point A1(Geom::Point(rect->x.computed, rect->y.computed) * i2dt); + Geom::Point A2(Geom::Point(rect->x.computed, rect->y.computed + rect->height.computed) * i2dt); + Geom::Point A3(Geom::Point(rect->x.computed + rect->width.computed, rect->y.computed + rect->height.computed) * i2dt); + Geom::Point A4(Geom::Point(rect->x.computed + rect->width.computed, rect->y.computed) * i2dt); pts.push_back(std::make_pair(A1, A2)); pts.push_back(std::make_pair(A2, A3)); -- cgit v1.2.3 From 97b1c4d688a979eb8e327c13c6bcc6fad20902f2 Mon Sep 17 00:00:00 2001 From: "Johan B. C. Engelen" Date: Tue, 19 Jul 2011 20:24:59 +0200 Subject: remove some unnecessary inkscape_active_desktop() calls (bzr r10477) --- src/sp-rect.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/sp-rect.cpp') diff --git a/src/sp-rect.cpp b/src/sp-rect.cpp index ec83a47e9..467b37d17 100644 --- a/src/sp-rect.cpp +++ b/src/sp-rect.cpp @@ -624,7 +624,7 @@ sp_rect_convert_to_guides(SPItem *item) { pts.push_back(std::make_pair(A3, A4)); pts.push_back(std::make_pair(A4, A1)); - sp_guide_pt_pairs_to_guides(inkscape_active_desktop(), pts); + sp_guide_pt_pairs_to_guides(item->document, pts); } /* -- cgit v1.2.3