summaryrefslogtreecommitdiffstats
path: root/src/sp-image.cpp
diff options
context:
space:
mode:
authorDiederik van Lierop <mailat-signdiedenrezidotnl>2010-01-09 21:14:38 +0000
committerDiederik van Lierop <mailat-signdiedenrezidotnl>2010-01-09 21:14:38 +0000
commite8f4c644181a8a68e2c33e1783f77a400dc1a29f (patch)
tree38083930039a3507ff467c62cf2e588a229a061f /src/sp-image.cpp
parentPatch by Alex Leone to fix crash with recursive masks from 190130, I also add... (diff)
downloadinkscape-e8f4c644181a8a68e2c33e1783f77a400dc1a29f.tar.gz
inkscape-e8f4c644181a8a68e2c33e1783f77a400dc1a29f.zip
Refactoring the snapping API (making it easier to maintain and understand for the devs)
(bzr r8960)
Diffstat (limited to 'src/sp-image.cpp')
-rw-r--r--src/sp-image.cpp16
1 files changed, 7 insertions, 9 deletions
diff --git a/src/sp-image.cpp b/src/sp-image.cpp
index e3f708142..daf5e9e88 100644
--- a/src/sp-image.cpp
+++ b/src/sp-image.cpp
@@ -44,7 +44,7 @@
#include <glibmm/i18n.h>
#include "xml/quote.h"
#include <xml/repr.h>
-
+#include "snap-candidate.h"
#include "libnr/nr-matrix-fns.h"
#include "io/sys.h"
@@ -86,7 +86,7 @@ static Inkscape::XML::Node *sp_image_write (SPObject *object, Inkscape::XML::Doc
static void sp_image_bbox(SPItem const *item, NRRect *bbox, Geom::Matrix const &transform, unsigned const flags);
static void sp_image_print (SPItem * item, SPPrintContext *ctx);
static gchar * sp_image_description (SPItem * item);
-static void sp_image_snappoints(SPItem const *item, bool const target, SnapPointsWithType &p, Inkscape::SnapPreferences const *snapprefs);
+static void sp_image_snappoints(SPItem const *item, std::vector<Inkscape::SnapCandidatePoint> &p, Inkscape::SnapPreferences const *snapprefs);
static NRArenaItem *sp_image_show (SPItem *item, NRArena *arena, unsigned int key, unsigned int flags);
static Geom::Matrix sp_image_set_transform (SPItem *item, Geom::Matrix const &xform);
static void sp_image_set_curve(SPImage *image);
@@ -1332,7 +1332,7 @@ sp_image_update_canvas_image (SPImage *image)
}
}
-static void sp_image_snappoints(SPItem const *item, bool const target, SnapPointsWithType &p, Inkscape::SnapPreferences const */*snapprefs*/)
+static void sp_image_snappoints(SPItem const *item, std::vector<Inkscape::SnapCandidatePoint> &p, Inkscape::SnapPreferences const */*snapprefs*/)
{
/* An image doesn't have any nodes to snap, but still we want to be able snap one image
to another. Therefore we will create some snappoints at the corner, similar to a rect. If
@@ -1354,12 +1354,10 @@ static void sp_image_snappoints(SPItem const *item, bool const target, SnapPoint
double const x1 = x0 + image.width.computed;
double const y1 = y0 + image.height.computed;
Geom::Matrix const i2d (sp_item_i2d_affine (item));
- Geom::Point pt;
- int type = target ? int(Inkscape::SNAPTARGET_CORNER) : int(Inkscape::SNAPSOURCE_CORNER);
- p.push_back(std::make_pair(Geom::Point(x0, y0) * i2d, type));
- p.push_back(std::make_pair(Geom::Point(x0, y1) * i2d, type));
- p.push_back(std::make_pair(Geom::Point(x1, y1) * i2d, type));
- p.push_back(std::make_pair(Geom::Point(x1, y0) * i2d, type));
+ p.push_back(Inkscape::SnapCandidatePoint(Geom::Point(x0, y0) * i2d, Inkscape::SNAPSOURCE_CORNER, Inkscape::SNAPTARGET_CORNER));
+ p.push_back(Inkscape::SnapCandidatePoint(Geom::Point(x0, y1) * i2d, Inkscape::SNAPSOURCE_CORNER, Inkscape::SNAPTARGET_CORNER));
+ p.push_back(Inkscape::SnapCandidatePoint(Geom::Point(x1, y1) * i2d, Inkscape::SNAPSOURCE_CORNER, Inkscape::SNAPTARGET_CORNER));
+ p.push_back(Inkscape::SnapCandidatePoint(Geom::Point(x1, y0) * i2d, Inkscape::SNAPSOURCE_CORNER, Inkscape::SNAPTARGET_CORNER));
}
}