summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJohan B. C. Engelen <jbc.engelen@swissonline.ch>2008-08-01 18:10:26 +0000
committerjohanengelen <johanengelen@users.sourceforge.net>2008-08-01 18:10:26 +0000
commit28945119489f6af06469312dad4286b27c57c493 (patch)
tree997fb2305b3dda5d82452a4d6733793c8fc11bcf /src
parentchange knot.h to Geom::Point only instead of NR::Point. (diff)
downloadinkscape-28945119489f6af06469312dad4286b27c57c493.tar.gz
inkscape-28945119489f6af06469312dad4286b27c57c493.zip
replace matrix division code.
(bzr r6512)
Diffstat (limited to 'src')
-rw-r--r--src/desktop.cpp3
-rw-r--r--src/display/sp-canvas-util.cpp6
-rw-r--r--src/knotholder.cpp5
-rw-r--r--src/live_effects/parameter/pointparam-knotholder.cpp15
-rw-r--r--src/object-edit.cpp1
-rw-r--r--src/sp-conn-end.cpp9
-rw-r--r--src/sp-gradient.cpp3
-rw-r--r--src/sp-item.cpp3
-rw-r--r--src/sp-rect.cpp6
9 files changed, 22 insertions, 29 deletions
diff --git a/src/desktop.cpp b/src/desktop.cpp
index 0a7f353a8..b8d9ef0b0 100644
--- a/src/desktop.cpp
+++ b/src/desktop.cpp
@@ -79,7 +79,6 @@
#include "display/sp-canvas-util.h"
#include "display/canvas-temporary-item-list.h"
#include "display/snap-indicator.h"
-#include "libnr/nr-matrix-div.h"
#include "libnr/nr-rect-ops.h"
#include "ui/dialog/dialog-manager.h"
#include "xml/repr.h"
@@ -1680,7 +1679,7 @@ NR::Point SPDesktop::doc2dt(NR::Point const &p) const
NR::Point SPDesktop::dt2doc(NR::Point const &p) const
{
- return p / _doc2dt;
+ return p * _doc2dt.inverse();
}
diff --git a/src/display/sp-canvas-util.cpp b/src/display/sp-canvas-util.cpp
index 28d4b0c69..9be8d5844 100644
--- a/src/display/sp-canvas-util.cpp
+++ b/src/display/sp-canvas-util.cpp
@@ -13,7 +13,7 @@
*/
-#include "libnr/nr-matrix-div.h"
+#include "libnr/nr-matrix-ops.h"
#include "libnr/nr-pixops.h"
#include "sp-canvas-util.h"
#include <string.h> /* for memset */
@@ -90,14 +90,14 @@ NR::Matrix sp_canvas_item_i2i_affine (SPCanvasItem * from, SPCanvasItem * to)
g_assert (from != NULL);
g_assert (to != NULL);
- return sp_canvas_item_i2w_affine(from) / sp_canvas_item_i2w_affine(to);
+ return sp_canvas_item_i2w_affine(from) * sp_canvas_item_i2w_affine(to).inverse();
}
void sp_canvas_item_set_i2w_affine (SPCanvasItem * item, NR::Matrix const &i2w)
{
g_assert (item != NULL);
- sp_canvas_item_affine_absolute(item, i2w / sp_canvas_item_i2w_affine(item->parent));
+ sp_canvas_item_affine_absolute(item, i2w * sp_canvas_item_i2w_affine(item->parent).inverse());
}
void sp_canvas_item_move_to_z (SPCanvasItem * item, gint z)
diff --git a/src/knotholder.cpp b/src/knotholder.cpp
index 629aa7368..f4892b008 100644
--- a/src/knotholder.cpp
+++ b/src/knotholder.cpp
@@ -33,7 +33,6 @@
#include "xml/repr.h" // for debugging only
-#include <libnr/nr-matrix-div.h>
#include <glibmm/i18n.h>
class SPDesktop;
@@ -140,8 +139,8 @@ KnotHolder::knot_moved_handler(SPKnot *knot, Geom::Point const &p, guint state)
for(std::list<KnotHolderEntity *>::iterator i = this->entity.begin(); i != this->entity.end(); ++i) {
KnotHolderEntity *e = *i;
if (e->knot == knot) {
- NR::Point const q = p / from_2geom(sp_item_i2d_affine(item));
- e->knot_set(q, e->knot->drag_origin / from_2geom(sp_item_i2d_affine(item)), state);
+ NR::Point const q = p * sp_item_i2d_affine(item).inverse();
+ e->knot_set(q, e->knot->drag_origin * sp_item_i2d_affine(item).inverse(), state);
break;
}
}
diff --git a/src/live_effects/parameter/pointparam-knotholder.cpp b/src/live_effects/parameter/pointparam-knotholder.cpp
index 42601c170..434eff4f4 100644
--- a/src/live_effects/parameter/pointparam-knotholder.cpp
+++ b/src/live_effects/parameter/pointparam-knotholder.cpp
@@ -19,7 +19,6 @@
#include "knotholder.h"
#include "knot-holder-entity.h"
-#include <libnr/nr-matrix-div.h>
#include <glibmm/i18n.h>
#include <2geom/point.h>
#include <2geom/matrix.h>
@@ -92,7 +91,7 @@ PointParamKnotHolder::add_knot (
entity.push_back(e);
// Move to current point.
- NR::Point dp = p * from_2geom(sp_item_i2d_affine(item));
+ Geom::Point dp = p * sp_item_i2d_affine(item);
sp_knot_set_position(e->knot, dp, SP_KNOT_STATE_NORMAL);
e->handler_id = g_signal_connect(e->knot, "moved", G_CALLBACK(pointparam_knot_moved_handler), this);
@@ -113,22 +112,22 @@ static void pointparam_knot_clicked_handler(SPKnot */*knot*/, guint /*state*/, P
*/
static void pointparam_knot_moved_handler(SPKnot */*knot*/, NR::Point const *p, guint /*state*/, PointParamKnotHolder *kh)
{
- NR::Matrix const i2d(from_2geom(sp_item_i2d_affine(kh->getItem())));
- NR::Point pos = (*p) / i2d;
+ Geom::Matrix const i2d(sp_item_i2d_affine(kh->getItem()));
+ Geom::Point pos = (*p) * i2d.inverse();
Inkscape::SVGOStringStream os;
- os << pos.to_2geom();
+ os << pos;
kh->lpeobject->lpe->setParameter(kh->repr_key, os.str().c_str());
}
static void pointparam_knot_ungrabbed_handler(SPKnot *knot, unsigned int /*state*/, PointParamKnotHolder *kh)
{
- NR::Matrix const i2d(from_2geom(sp_item_i2d_affine(kh->getItem())));
- NR::Point pos = sp_knot_position(knot) / i2d;
+ Geom::Matrix const i2d(sp_item_i2d_affine(kh->getItem()));
+ Geom::Point pos = sp_knot_position(knot) * i2d.inverse();
Inkscape::SVGOStringStream os;
- os << pos.to_2geom();
+ os << pos;
kh->repr->setAttribute(kh->repr_key , os.str().c_str());
diff --git a/src/object-edit.cpp b/src/object-edit.cpp
index ea0291159..1d72b9b29 100644
--- a/src/object-edit.cpp
+++ b/src/object-edit.cpp
@@ -41,7 +41,6 @@
#include "object-edit.h"
#include <libnr/nr-scale-ops.h>
-#include <libnr/nr-matrix-div.h>
#include "xml/repr.h"
diff --git a/src/sp-conn-end.cpp b/src/sp-conn-end.cpp
index 80ecb060f..a4ecf1f65 100644
--- a/src/sp-conn-end.cpp
+++ b/src/sp-conn-end.cpp
@@ -3,7 +3,6 @@
#include <string>
#include "display/curve.h"
-#include "libnr/nr-matrix-div.h"
#include "libnr/nr-matrix-fns.h"
#include "xml/repr.h"
#include "sp-conn-end.h"
@@ -91,8 +90,8 @@ sp_conn_end_move_compensate(NR::Matrix const */*mp*/, SPItem */*moved_item*/,
NR::Point h2endPt_pcoordsys[2];
for (unsigned h = 0; h < 2; ++h) {
h2endPt_icoordsys[h] = calc_bbox_conn_pt(h2bbox_icoordsys[h],
- ( last_seg_endPt[h] / h2i2anc[h] ));
- h2endPt_pcoordsys[h] = h2endPt_icoordsys[h] * h2i2anc[h] / path2anc;
+ ( last_seg_endPt[h] * h2i2anc[h].inverse() ));
+ h2endPt_pcoordsys[h] = h2endPt_icoordsys[h] * h2i2anc[h] * path2anc.inverse();
}
change_endpts(path->curve, h2endPt_pcoordsys);
} else {
@@ -135,8 +134,8 @@ sp_conn_end_move_compensate(NR::Matrix const */*mp*/, SPItem */*moved_item*/,
// on the edge of the bbox.
NR::Point h2endPt_pcoordsys[2];
h2endPt_icoordsys[ind] = calc_bbox_conn_pt(h2bbox_icoordsys[ind],
- ( last_seg_pt / h2i2anc ));
- h2endPt_pcoordsys[ind] = h2endPt_icoordsys[ind] * h2i2anc / path2anc;
+ ( last_seg_pt * h2i2anc.inverse() ));
+ h2endPt_pcoordsys[ind] = h2endPt_icoordsys[ind] * h2i2anc * path2anc.inverse();
// Leave the other where it is.
h2endPt_pcoordsys[!ind] = other_endpt;
diff --git a/src/sp-gradient.cpp b/src/sp-gradient.cpp
index 82724303f..1fe0d2218 100644
--- a/src/sp-gradient.cpp
+++ b/src/sp-gradient.cpp
@@ -21,7 +21,6 @@
#include <cstring>
#include <string>
-#include <libnr/nr-matrix-div.h>
#include <libnr/nr-matrix-fns.h>
#include <libnr/nr-matrix-ops.h>
#include <libnr/nr-matrix-scale-ops.h>
@@ -1279,7 +1278,7 @@ void
sp_gradient_set_gs2d_matrix(SPGradient *gr, NR::Matrix const &ctm,
NR::Rect const &bbox, NR::Matrix const &gs2d)
{
- gr->gradientTransform = gs2d / ctm;
+ gr->gradientTransform = gs2d * ctm.inverse();
if (gr->units == SP_GRADIENT_UNITS_OBJECTBOUNDINGBOX ) {
gr->gradientTransform = ( gr->gradientTransform
/ NR::translate(bbox.min())
diff --git a/src/sp-item.cpp b/src/sp-item.cpp
index c888bc195..422ea1195 100644
--- a/src/sp-item.cpp
+++ b/src/sp-item.cpp
@@ -56,7 +56,6 @@
#include "filter-chemistry.h"
#include "sp-guide.h"
-#include "libnr/nr-matrix-div.h"
#include "libnr/nr-matrix-fns.h"
#include "libnr/nr-matrix-scale-ops.h"
#include "libnr/nr-matrix-translate-ops.h"
@@ -1514,7 +1513,7 @@ Geom::Matrix
i2i_affine(SPObject const *src, SPObject const *dest) {
g_return_val_if_fail(src != NULL && dest != NULL, Geom::identity());
SPObject const *ancestor = src->nearestCommonAncestor(dest);
- return to_2geom( from_2geom(i2anc_affine(src, ancestor)) / from_2geom(i2anc_affine(dest, ancestor)) );
+ return i2anc_affine(src, ancestor) * i2anc_affine(dest, ancestor).inverse();
}
NR::Matrix SPItem::getRelativeTransform(SPObject const *dest) const {
diff --git a/src/sp-rect.cpp b/src/sp-rect.cpp
index e5ffa8b39..ad8ba38a9 100644
--- a/src/sp-rect.cpp
+++ b/src/sp-rect.cpp
@@ -19,7 +19,7 @@
#include <display/curve.h>
-#include <libnr/nr-matrix-div.h>
+#include <libnr/nr-matrix-ops.h>
#include <libnr/nr-matrix-fns.h>
#include "inkscape.h"
@@ -385,10 +385,10 @@ sp_rect_set_transform(SPItem *item, NR::Matrix const &xform)
sp_item_adjust_stroke(item, sqrt(fabs(sw * sh)));
// Adjust pattern fill
- sp_item_adjust_pattern(item, xform / ret);
+ sp_item_adjust_pattern(item, xform * ret.inverse());
// Adjust gradient fill
- sp_item_adjust_gradient(item, xform / ret);
+ sp_item_adjust_gradient(item, xform * ret.inverse());
item->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG | SP_OBJECT_STYLE_MODIFIED_FLAG);