From 77dc5f1acd4a6b66b2d6fc5c81f7e5c61ef95785 Mon Sep 17 00:00:00 2001 From: Krzysztof Kosi??ski Date: Thu, 5 Aug 2010 02:49:51 +0200 Subject: Wholesale cruft removal part 4; fix crash when rendering guides (bzr r9508.1.48) --- src/snapped-point.cpp | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) (limited to 'src/snapped-point.cpp') diff --git a/src/snapped-point.cpp b/src/snapped-point.cpp index 48efa10e6..29e094a7c 100644 --- a/src/snapped-point.cpp +++ b/src/snapped-point.cpp @@ -21,11 +21,11 @@ Inkscape::SnappedPoint::SnappedPoint(Geom::Point const &p, SnapSourceType const _at_intersection = false; _constrained_snap = constrained_snap; _fully_constrained = fully_constrained; - _second_distance = NR_HUGE; + _second_distance = Geom::infinity(); _second_tolerance = 1; _second_always_snap = false; _transformation = Geom::Point(1,1); - _pointer_distance = NR_HUGE; + _pointer_distance = Geom::infinity(); } Inkscape::SnappedPoint::SnappedPoint(Inkscape::SnapCandidatePoint const &p, SnapTargetType const &target, Geom::Coord const &d, Geom::Coord const &t, bool const &a, bool const &constrained_snap, bool const &fully_constrained) @@ -37,11 +37,11 @@ Inkscape::SnappedPoint::SnappedPoint(Inkscape::SnapCandidatePoint const &p, Snap _at_intersection = false; _constrained_snap = constrained_snap; _fully_constrained = fully_constrained; - _second_distance = NR_HUGE; + _second_distance = Geom::infinity(); _second_tolerance = 1; _second_always_snap = false; _transformation = Geom::Point(1,1); - _pointer_distance = NR_HUGE; + _pointer_distance = Geom::infinity(); _target_bbox = p.getTargetBBox(); } @@ -53,7 +53,7 @@ Inkscape::SnappedPoint::SnappedPoint(Geom::Point const &p, SnapSourceType const // tolerance should never be smaller than 1 px, as it is used for normalization in // isOtherSnapBetter. We don't want a division by zero. _transformation = Geom::Point(1,1); - _pointer_distance = NR_HUGE; + _pointer_distance = Geom::infinity(); _target_bbox = Geom::OptRect(); } @@ -66,14 +66,14 @@ Inkscape::SnappedPoint::SnappedPoint() _at_intersection = false; _constrained_snap = false; _fully_constrained = false; - _distance = NR_HUGE; + _distance = Geom::infinity(); _tolerance = 1; _always_snap = false; - _second_distance = NR_HUGE; + _second_distance = Geom::infinity(); _second_tolerance = 1; _second_always_snap = false; _transformation = Geom::Point(1,1); - _pointer_distance = NR_HUGE; + _pointer_distance = Geom::infinity(); _target_bbox = Geom::OptRect(); } @@ -85,14 +85,14 @@ Inkscape::SnappedPoint::SnappedPoint(Geom::Point const &p) _target = SNAPTARGET_UNDEFINED, _at_intersection = false; _fully_constrained = false; - _distance = NR_HUGE; + _distance = Geom::infinity(); _tolerance = 1; _always_snap = false; - _second_distance = NR_HUGE; + _second_distance = Geom::infinity(); _second_tolerance = 1; _second_always_snap = false; _transformation = Geom::Point(1,1); - _pointer_distance = NR_HUGE; + _pointer_distance = Geom::infinity(); _target_bbox = Geom::OptRect(); } @@ -152,7 +152,7 @@ bool Inkscape::SnappedPoint::isOtherSnapBetter(Inkscape::SnappedPoint const &oth // When accounting for the distance to the mouse pointer, then at least one of the snapped points should // have that distance set. If not, then this is a bug. Either "weighted" must be set to false, or the // mouse pointer distance must be set. - g_assert(dist_pointer_this != NR_HUGE || dist_pointer_other != NR_HUGE); + g_assert(dist_pointer_this != Geom::infinity() || dist_pointer_other != Geom::infinity()); // The snap distance will always be smaller than the tolerance set for the snapper. The pointer distance can // however be very large. To compare these in a fair way, we will have to normalize these metrics first // The closest pointer distance will be normalized to 1.0; the other one will be > 1.0 @@ -195,7 +195,7 @@ bool Inkscape::SnappedPoint::isOtherSnapBetter(Inkscape::SnappedPoint const &oth // or, if it's just as close then consider the second distance ... bool c5a = (dist_other == dist_this); - bool c5b = (other_one.getSecondSnapDistance() < getSecondSnapDistance()) && (getSecondSnapDistance() < NR_HUGE); + bool c5b = (other_one.getSecondSnapDistance() < getSecondSnapDistance()) && (getSecondSnapDistance() < Geom::infinity()); // ... or prefer free snaps over constrained snaps bool c5c = !other_one.getConstrainedSnap() && getConstrainedSnap(); -- cgit v1.2.3 From 458c1a2a8f34a342d2728b144592110a65b4c2d1 Mon Sep 17 00:00:00 2001 From: Diederik van Lierop Date: Mon, 22 Aug 2011 22:27:25 +0200 Subject: Fix snap bug #816044 Fixed bugs: - https://launchpad.net/bugs/816044 (bzr r10572) --- src/snapped-point.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/snapped-point.cpp') diff --git a/src/snapped-point.cpp b/src/snapped-point.cpp index 2db3d62e4..a777e4dc0 100644 --- a/src/snapped-point.cpp +++ b/src/snapped-point.cpp @@ -131,6 +131,10 @@ bool Inkscape::SnappedPoint::isOtherSnapBetter(Inkscape::SnappedPoint const &oth return false; } + if (!getSnapped() && other_one.getSnapped()) { + return true; + } + double dist_other = other_one.getSnapDistance(); double dist_this = getSnapDistance(); -- cgit v1.2.3 From 20097d47e6945bceb57d2335d23fe764f493ab59 Mon Sep 17 00:00:00 2001 From: "Jon A. Cruz" Date: Sun, 2 Oct 2011 20:44:17 -0700 Subject: Another minor pass of Doxygen cleanup. (bzr r10659) --- src/snapped-point.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/snapped-point.cpp') diff --git a/src/snapped-point.cpp b/src/snapped-point.cpp index a777e4dc0..83c932539 100644 --- a/src/snapped-point.cpp +++ b/src/snapped-point.cpp @@ -1,6 +1,6 @@ /** * \file src/snapped-point.cpp - * \brief SnappedPoint class. + * SnappedPoint class. * * Authors: * Mathieu Dimanche -- cgit v1.2.3 From 47b55c0d9fccf3994f86fd764cefca3a2f734dbe Mon Sep 17 00:00:00 2001 From: Kris De Gussem Date: Sat, 15 Oct 2011 22:03:44 +0200 Subject: cppcheck (bzr r10678) --- src/snapped-point.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/snapped-point.cpp') diff --git a/src/snapped-point.cpp b/src/snapped-point.cpp index 83c932539..cffdda5d7 100644 --- a/src/snapped-point.cpp +++ b/src/snapped-point.cpp @@ -114,7 +114,7 @@ bool getClosestSP(std::list const &list, Inkscape::Snapp { bool success = false; - for (std::list::const_iterator i = list.begin(); i != list.end(); i++) { + for (std::list::const_iterator i = list.begin(); i != list.end(); ++i) { if ((i == list.begin()) || (*i).getSnapDistance() < result.getSnapDistance()) { result = *i; success = true; -- cgit v1.2.3 From d7a3d42e527b4a7754b52640006d8eed01e71fc8 Mon Sep 17 00:00:00 2001 From: Kris De Gussem Date: Sat, 29 Oct 2011 18:41:49 +0200 Subject: cppcheck: variable initialisation (bzr r10705) --- src/snapped-point.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'src/snapped-point.cpp') diff --git a/src/snapped-point.cpp b/src/snapped-point.cpp index cffdda5d7..72875995d 100644 --- a/src/snapped-point.cpp +++ b/src/snapped-point.cpp @@ -84,6 +84,7 @@ Inkscape::SnappedPoint::SnappedPoint(Geom::Point const &p) _source_num = -1, _target = SNAPTARGET_UNDEFINED, _at_intersection = false; + _constrained_snap = false; _fully_constrained = false; _distance = Geom::infinity(); _tolerance = 1; -- cgit v1.2.3