summaryrefslogtreecommitdiffstats
path: root/src/snap.cpp
diff options
context:
space:
mode:
authorKrzysztof Kosi??ski <tweenk.pl@gmail.com>2010-08-05 00:49:51 +0000
committerKrzysztof KosiƄski <tweenk.pl@gmail.com>2010-08-05 00:49:51 +0000
commit77dc5f1acd4a6b66b2d6fc5c81f7e5c61ef95785 (patch)
tree15c3b32afa8a124f69644c8bd279dd361680974e /src/snap.cpp
parentWholesale cruft removal part 3 (diff)
downloadinkscape-77dc5f1acd4a6b66b2d6fc5c81f7e5c61ef95785.tar.gz
inkscape-77dc5f1acd4a6b66b2d6fc5c81f7e5c61ef95785.zip
Wholesale cruft removal part 4; fix crash when rendering guides
(bzr r9508.1.48)
Diffstat (limited to 'src/snap.cpp')
-rw-r--r--src/snap.cpp30
1 files changed, 15 insertions, 15 deletions
diff --git a/src/snap.cpp b/src/snap.cpp
index c47f93ff1..718700103 100644
--- a/src/snap.cpp
+++ b/src/snap.cpp
@@ -201,7 +201,7 @@ Inkscape::SnappedPoint SnapManager::freeSnap(Inkscape::SnapCandidatePoint const
Geom::OptRect const &bbox_to_snap) const
{
if (!someSnapperMightSnap()) {
- return Inkscape::SnappedPoint(p, Inkscape::SNAPTARGET_UNDEFINED, NR_HUGE, 0, false, false, false);
+ return Inkscape::SnappedPoint(p, Inkscape::SNAPTARGET_UNDEFINED, Geom::infinity(), 0, false, false, false);
}
SnappedConstraints sc;
@@ -257,7 +257,7 @@ Geom::Point SnapManager::multipleOfGridPitch(Geom::Point const &t, Geom::Point c
if (_desktop && _desktop->gridsEnabled()) {
bool success = false;
Geom::Point nearest_multiple;
- Geom::Coord nearest_distance = NR_HUGE;
+ Geom::Coord nearest_distance = Geom::infinity();
Inkscape::SnappedPoint bestSnappedPoint(t);
// It will snap to the grid for which we find the closest snap. This might be a different
@@ -551,10 +551,10 @@ Inkscape::SnappedPoint SnapManager::_snapTransformed(
/* The current best transformation */
Geom::Point best_transformation = transformation;
- /* The current best metric for the best transformation; lower is better, NR_HUGE
+ /* The current best metric for the best transformation; lower is better, Geom::infinity()
** means that we haven't snapped anything.
*/
- Geom::Point best_scale_metric(NR_HUGE, NR_HUGE);
+ Geom::Point best_scale_metric(Geom::infinity(), Geom::infinity());
Inkscape::SnappedPoint best_snapped_point;
g_assert(best_snapped_point.getAlwaysSnap() == false); // Check initialization of snapped point
g_assert(best_snapped_point.getAtIntersection() == false);
@@ -643,7 +643,7 @@ Inkscape::SnappedPoint SnapManager::_snapTransformed(
break;
case SCALE:
{
- result = Geom::Point(NR_HUGE, NR_HUGE);
+ result = Geom::Point(Geom::infinity(), Geom::infinity());
// If this point *i is horizontally or vertically aligned with
// the origin of the scaling, then it will scale purely in X or Y
// We can therefore only calculate the scaling in this direction
@@ -654,7 +654,7 @@ Inkscape::SnappedPoint SnapManager::_snapTransformed(
if (fabs(fabs(a[index]/b[index]) - fabs(transformation[index])) > 1e-12) { // if SNAPPING DID occur in this direction
result[index] = a[index] / b[index]; // then calculate it!
}
- // we might leave result[1-index] = NR_HUGE
+ // we might leave result[1-index] = Geom::infinity()
// if scaling didn't occur in the other direction
}
}
@@ -666,13 +666,13 @@ Inkscape::SnappedPoint SnapManager::_snapTransformed(
}
}
// Compare the resulting scaling with the desired scaling
- Geom::Point scale_metric = Geom::abs(result - transformation); // One or both of its components might be NR_HUGE
+ Geom::Point scale_metric = Geom::abs(result - transformation); // One or both of its components might be Geom::infinity()
snapped_point.setSnapDistance(std::min(scale_metric[0], scale_metric[1]));
snapped_point.setSecondSnapDistance(std::max(scale_metric[0], scale_metric[1]));
break;
}
case STRETCH:
- result = Geom::Point(NR_HUGE, NR_HUGE);
+ result = Geom::Point(Geom::infinity(), Geom::infinity());
if (fabs(b[dim]) > 1e-6) { // if STRETCHING will occur for this point
result[dim] = a[dim] / b[dim];
result[1-dim] = uniform ? result[dim] : 1;
@@ -684,14 +684,14 @@ Inkscape::SnappedPoint SnapManager::_snapTransformed(
}
// Store the metric for this transformation as a virtual distance
snapped_point.setSnapDistance(std::abs(result[dim] - transformation[dim]));
- snapped_point.setSecondSnapDistance(NR_HUGE);
+ snapped_point.setSecondSnapDistance(Geom::infinity());
break;
case SKEW:
result[0] = (snapped_point.getPoint()[dim] - ((*i).getPoint())[dim]) / (((*i).getPoint())[1 - dim] - origin[1 - dim]); // skew factor
result[1] = transformation[1]; // scale factor
// Store the metric for this transformation as a virtual distance
snapped_point.setSnapDistance(std::abs(result[0] - transformation[0]));
- snapped_point.setSecondSnapDistance(NR_HUGE);
+ snapped_point.setSecondSnapDistance(Geom::infinity());
break;
default:
g_assert_not_reached();
@@ -708,10 +708,10 @@ Inkscape::SnappedPoint SnapManager::_snapTransformed(
Geom::Coord best_metric;
if (transformation_type == SCALE) {
- // When scaling, don't ever exit with one of scaling components set to NR_HUGE
+ // When scaling, don't ever exit with one of scaling components set to Geom::infinity()
for (int index = 0; index < 2; index++) {
- if (best_transformation[index] == NR_HUGE) {
- if (uniform && best_transformation[1-index] < NR_HUGE) {
+ if (best_transformation[index] == Geom::infinity()) {
+ if (uniform && best_transformation[1-index] < Geom::infinity()) {
best_transformation[index] = best_transformation[1-index];
} else {
best_transformation[index] = transformation[index];
@@ -722,9 +722,9 @@ Inkscape::SnappedPoint SnapManager::_snapTransformed(
best_metric = best_snapped_point.getSnapDistance();
best_snapped_point.setTransformation(best_transformation);
- // Using " < 1e6" instead of " < NR_HUGE" for catching some rounding errors
+ // Using " < 1e6" instead of " < Geom::infinity()" for catching some rounding errors
// These rounding errors might be caused by NRRects, see bug #1584301
- best_snapped_point.setSnapDistance(best_metric < 1e6 ? best_metric : NR_HUGE);
+ best_snapped_point.setSnapDistance(best_metric < 1e6 ? best_metric : Geom::infinity());
return best_snapped_point;
}