summaryrefslogtreecommitdiffstats
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
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)
-rw-r--r--src/box3d.cpp6
-rw-r--r--src/desktop-style.cpp4
-rw-r--r--src/display/canvas-bpath.cpp4
-rw-r--r--src/display/guideline.cpp138
-rw-r--r--src/display/nr-arena-shape.cpp2
-rw-r--r--src/display/sp-canvas.cpp2
-rw-r--r--src/draw-context.cpp2
-rw-r--r--src/helper/geom.cpp4
-rw-r--r--src/libnr/Makefile_insert2
-rw-r--r--src/libnr/nr-maybe.h201
-rw-r--r--src/libnr/nr-path-code.h28
-rw-r--r--src/live_effects/lpe-curvestitch.cpp2
-rw-r--r--src/live_effects/lpe-dynastroke.cpp6
-rw-r--r--src/live_effects/lpe-interpolate.cpp2
-rw-r--r--src/live_effects/lpe-patternalongpath.cpp4
-rw-r--r--src/live_effects/lpe-rough-hatches.cpp12
-rw-r--r--src/live_effects/lpe-sketch.cpp12
-rw-r--r--src/live_effects/lpe-vonkoch.cpp4
-rw-r--r--src/live_effects/parameter/parameter.cpp4
-rw-r--r--src/live_effects/parameter/random.cpp4
-rw-r--r--src/proj_pt.cpp2
-rw-r--r--src/proj_pt.h9
-rw-r--r--src/seltrans.cpp12
-rw-r--r--src/shape-editor.h1
-rw-r--r--src/snap.cpp30
-rw-r--r--src/snapped-curve.cpp12
-rw-r--r--src/snapped-line.cpp16
-rw-r--r--src/snapped-point.cpp26
-rw-r--r--src/snapped-point.h3
-rw-r--r--src/sp-item-transform.cpp6
-rw-r--r--src/sp-item.cpp6
-rw-r--r--src/transf_mat_3x4.h2
-rw-r--r--src/vanishing-point.h2
-rw-r--r--src/widgets/stroke-style.cpp2
-rw-r--r--src/widgets/toolbox.cpp2
35 files changed, 121 insertions, 453 deletions
diff --git a/src/box3d.cpp b/src/box3d.cpp
index aa2dc55e3..2c932b87c 100644
--- a/src/box3d.cpp
+++ b/src/box3d.cpp
@@ -391,7 +391,7 @@ Geom::Point
box3d_get_corner_screen (SPBox3D const *box, guint id, bool item_coords) {
Proj::Pt3 proj_corner (box3d_get_proj_corner (box, id));
if (!box3d_get_perspective(box)) {
- return Geom::Point (NR_HUGE, NR_HUGE);
+ return Geom::Point (Geom::infinity(), Geom::infinity());
}
Geom::Matrix const i2d (sp_item_i2d_affine (SP_ITEM(box)));
if (item_coords) {
@@ -415,7 +415,7 @@ Geom::Point
box3d_get_center_screen (SPBox3D *box) {
Proj::Pt3 proj_center (box3d_get_proj_center (box));
if (!box3d_get_perspective(box)) {
- return Geom::Point (NR_HUGE, NR_HUGE);
+ return Geom::Point (Geom::infinity(), Geom::infinity());
}
Geom::Matrix const i2d (sp_item_i2d_affine (SP_ITEM(box)));
return box3d_get_perspective(box)->perspective_impl->tmat.image(proj_center).affine() * i2d.inverse();
@@ -489,7 +489,7 @@ box3d_snap (SPBox3D *box, int id, Proj::Pt3 const &pt_proj, Proj::Pt3 const &sta
// find the closest snapping point
int snap_index = -1;
- double snap_dist = NR_HUGE;
+ double snap_dist = Geom::infinity();
for (int i = 0; i < num_snap_lines; ++i) {
if (snap_dists[i] < snap_dist) {
snap_index = i;
diff --git a/src/desktop-style.cpp b/src/desktop-style.cpp
index 1b277a381..f68797d80 100644
--- a/src/desktop-style.cpp
+++ b/src/desktop-style.cpp
@@ -406,7 +406,7 @@ gdouble
stroke_average_width (GSList const *objects)
{
if (g_slist_length ((GSList *) objects) == 0)
- return NR_HUGE;
+ return Geom::infinity();
gdouble avgwidth = 0.0;
bool notstroked = true;
@@ -431,7 +431,7 @@ stroke_average_width (GSList const *objects)
}
if (notstroked)
- return NR_HUGE;
+ return Geom::infinity();
return avgwidth / (g_slist_length ((GSList *) objects) - n_notstroked);
}
diff --git a/src/display/canvas-bpath.cpp b/src/display/canvas-bpath.cpp
index cf9127352..ac2980de5 100644
--- a/src/display/canvas-bpath.cpp
+++ b/src/display/canvas-bpath.cpp
@@ -195,12 +195,12 @@ sp_canvas_bpath_point (SPCanvasItem *item, Geom::Point p, SPCanvasItem **actual_
if ( !cbp->curve ||
((cbp->stroke_rgba & 0xff) == 0 && (cbp->fill_rgba & 0xff) == 0 ) ||
cbp->curve->get_segment_count() < 1)
- return NR_HUGE;
+ return Geom::infinity();
double width = 0.5;
Geom::Rect viewbox = item->canvas->getViewbox();
viewbox.expandBy (width);
- double dist = NR_HUGE;
+ double dist = Geom::infinity();
pathv_matrix_point_bbox_wind_distance(cbp->curve->get_pathvector(), cbp->affine, p, NULL, NULL, &dist, 0.5, &viewbox);
if (dist <= 1.0) {
diff --git a/src/display/guideline.cpp b/src/display/guideline.cpp
index f1b85b556..9c68cd8af 100644
--- a/src/display/guideline.cpp
+++ b/src/display/guideline.cpp
@@ -15,13 +15,12 @@
* Released under GNU GPL, read the file 'COPYING' for more information
*/
-
-#include <libnr/nr-pixops.h>
#include <2geom/transforms.h>
#include "display-forward.h"
#include "sp-canvas-util.h"
#include "sp-ctrlpoint.h"
#include "guideline.h"
+#include "display/cairo-utils.h"
static void sp_guideline_class_init(SPGuideLineClass *c);
static void sp_guideline_init(SPGuideLine *guideline);
@@ -104,47 +103,20 @@ static void sp_guideline_render(SPCanvasItem *item, SPCanvasBuf *buf)
{
SPGuideLine const *gl = SP_GUIDELINE (item);
- sp_canvas_prepare_buffer(buf);
-
- unsigned int const r = NR_RGBA32_R (gl->rgba);
- unsigned int const g = NR_RGBA32_G (gl->rgba);
- unsigned int const b = NR_RGBA32_B (gl->rgba);
- unsigned int const a = NR_RGBA32_A (gl->rgba);
+ cairo_save(buf->ct);
+ cairo_translate(buf->ct, -buf->rect.x0, -buf->rect.y0);
+ ink_cairo_set_source_rgba32(buf->ct, gl->rgba);
if (gl->is_vertical()) {
int position = (int) Inkscape::round(gl->point_on_line[Geom::X]);
- if (position < buf->rect.x0 || position >= buf->rect.x1) {
- return;
- }
-
- int p0 = buf->rect.y0;
- int p1 = buf->rect.y1;
- int step = buf->buf_rowstride;
- unsigned char *d = buf->buf + 4 * (position - buf->rect.x0);
-
- for (int p = p0; p < p1; p++) {
- d[0] = NR_COMPOSEN11_1111(r, a, d[0]);
- d[1] = NR_COMPOSEN11_1111(g, a, d[1]);
- d[2] = NR_COMPOSEN11_1111(b, a, d[2]);
- d += step;
- }
+ cairo_move_to(buf->ct, position + 0.5, buf->rect.y0 + 0.5);
+ cairo_line_to(buf->ct, position + 0.5, buf->rect.y1 - 0.5);
+ cairo_stroke(buf->ct);
} else if (gl->is_horizontal()) {
int position = (int) Inkscape::round(gl->point_on_line[Geom::Y]);
- if (position < buf->rect.y0 || position >= buf->rect.y1) {
- return;
- }
-
- int p0 = buf->rect.x0;
- int p1 = buf->rect.x1;
- int step = 4;
- unsigned char *d = buf->buf + (position - buf->rect.y0) * buf->buf_rowstride;
-
- for (int p = p0; p < p1; p++) {
- d[0] = NR_COMPOSEN11_1111(r, a, d[0]);
- d[1] = NR_COMPOSEN11_1111(g, a, d[1]);
- d[2] = NR_COMPOSEN11_1111(b, a, d[2]);
- d += step;
- }
+ cairo_move_to(buf->ct, buf->rect.x0 + 0.5, position + 0.5);
+ cairo_line_to(buf->ct, buf->rect.x1 - 0.5, position + 0.5);
+ cairo_stroke(buf->ct);
} else {
// render angled line, once intersection has been detected, draw from there.
Geom::Point parallel_to_line( gl->normal_to_line[Geom::Y],
@@ -156,7 +128,7 @@ static void sp_guideline_render(SPCanvasItem *item, SPCanvasBuf *buf)
// intersects with left vertical!
double y_intersect_right = (buf->rect.x1 - gl->point_on_line[Geom::X]) * parallel_to_line[Geom::Y] / parallel_to_line[Geom::X] + gl->point_on_line[Geom::Y];
sp_guideline_drawline (buf, buf->rect.x0, static_cast<gint>(round(y_intersect_left)), buf->rect.x1, static_cast<gint>(round(y_intersect_right)), gl->rgba);
- return;
+ goto end;
}
//try to intersect with right vertical of rect
@@ -164,7 +136,7 @@ static void sp_guideline_render(SPCanvasItem *item, SPCanvasBuf *buf)
if ( (y_intersect_right >= buf->rect.y0) && (y_intersect_right <= buf->rect.y1) ) {
// intersects with right vertical!
sp_guideline_drawline (buf, buf->rect.x1, static_cast<gint>(round(y_intersect_right)), buf->rect.x0, static_cast<gint>(round(y_intersect_left)), gl->rgba);
- return;
+ goto end;
}
//try to intersect with top horizontal of rect
@@ -173,7 +145,7 @@ static void sp_guideline_render(SPCanvasItem *item, SPCanvasBuf *buf)
// intersects with top horizontal!
double x_intersect_bottom = (buf->rect.y1 - gl->point_on_line[Geom::Y]) * parallel_to_line[Geom::X] / parallel_to_line[Geom::Y] + gl->point_on_line[Geom::X];
sp_guideline_drawline (buf, static_cast<gint>(round(x_intersect_top)), buf->rect.y0, static_cast<gint>(round(x_intersect_bottom)), buf->rect.y1, gl->rgba);
- return;
+ goto end;
}
//try to intersect with bottom horizontal of rect
@@ -181,9 +153,11 @@ static void sp_guideline_render(SPCanvasItem *item, SPCanvasBuf *buf)
if ( (x_intersect_top >= buf->rect.x0) && (x_intersect_top <= buf->rect.x1) ) {
// intersects with bottom horizontal!
sp_guideline_drawline (buf, static_cast<gint>(round(x_intersect_bottom)), buf->rect.y1, static_cast<gint>(round(x_intersect_top)), buf->rect.y0, gl->rgba);
- return;
+ goto end;
}
}
+ end:
+ cairo_restore(buf->ct);
}
static void sp_guideline_update(SPCanvasItem *item, Geom::Matrix const &affine, unsigned int flags)
@@ -215,7 +189,7 @@ static double sp_guideline_point(SPCanvasItem *item, Geom::Point p, SPCanvasItem
SPGuideLine *gl = SP_GUIDELINE (item);
if (!gl->sensitive) {
- return NR_HUGE;
+ return Geom::infinity();
}
*actual_item = item;
@@ -277,82 +251,12 @@ void sp_guideline_delete(SPGuideLine *gl)
gtk_object_destroy(GTK_OBJECT(gl));
}
-//##########################################################
-// Line rendering
-#define SAFE_SETPIXEL //undefine this when it is certain that setpixel is never called with invalid params
-
-/**
- \brief This function renders a pixel on a particular buffer.
-
- The topleft of the buffer equals
- ( rect.x0 , rect.y0 ) in screen coordinates
- ( 0 , 0 ) in setpixel coordinates
- The bottomright of the buffer equals
- ( rect.x1 , rect,y1 ) in screen coordinates
- ( rect.x1 - rect.x0 , rect.y1 - rect.y0 ) in setpixel coordinates
-*/
static void
-sp_guideline_setpixel (SPCanvasBuf *buf, gint x, gint y, guint32 rgba)
+sp_guideline_drawline (SPCanvasBuf *buf, gint x0, gint y0, gint x1, gint y1, guint32 /*rgba*/)
{
-#ifdef SAFE_SETPIXEL
- if ( (x >= buf->rect.x0) && (x < buf->rect.x1) && (y >= buf->rect.y0) && (y < buf->rect.y1) ) {
-#endif
- guint r, g, b, a;
- r = NR_RGBA32_R (rgba);
- g = NR_RGBA32_G (rgba);
- b = NR_RGBA32_B (rgba);
- a = NR_RGBA32_A (rgba);
- guchar * p = buf->buf + (y - buf->rect.y0) * buf->buf_rowstride + (x - buf->rect.x0) * 4;
- p[0] = NR_COMPOSEN11_1111 (r, a, p[0]);
- p[1] = NR_COMPOSEN11_1111 (g, a, p[1]);
- p[2] = NR_COMPOSEN11_1111 (b, a, p[2]);
-#ifdef SAFE_SETPIXEL
- }
-#endif
-}
-
-/**
- \brief This function renders a line on a particular canvas buffer,
- using Bresenham's line drawing function.
- http://www.cs.unc.edu/~mcmillan/comp136/Lecture6/Lines.html
- Coordinates are interpreted as SCREENcoordinates
-*/
-static void
-sp_guideline_drawline (SPCanvasBuf *buf, gint x0, gint y0, gint x1, gint y1, guint32 rgba)
-{
- int dy = y1 - y0;
- int dx = x1 - x0;
- int stepx, stepy;
-
- if (dy < 0) { dy = -dy; stepy = -1; } else { stepy = 1; }
- if (dx < 0) { dx = -dx; stepx = -1; } else { stepx = 1; }
- dy <<= 1; // dy is now 2*dy
- dx <<= 1; // dx is now 2*dx
-
- sp_guideline_setpixel(buf, x0, y0, rgba);
- if (dx > dy) {
- int fraction = dy - (dx >> 1); // same as 2*dy - dx
- while (x0 != x1) {
- if (fraction >= 0) {
- y0 += stepy;
- fraction -= dx; // same as fraction -= 2*dx
- }
- x0 += stepx;
- fraction += dy; // same as fraction -= 2*dy
- sp_guideline_setpixel(buf, x0, y0, rgba);
- }
- } else {
- int fraction = dx - (dy >> 1);
- while (y0 != y1) {
- if (fraction >= 0) {
- x0 += stepx;
- fraction -= dy;
- }
- y0 += stepy;
- fraction += dx;
- sp_guideline_setpixel(buf, x0, y0, rgba);
- }
- }
+ cairo_move_to(buf->ct, x0 + 0.5, y0 + 0.5);
+ cairo_line_to(buf->ct, x1 - 0.5, y1 - 0.5);
+ cairo_stroke(buf->ct);
}
/*
diff --git a/src/display/nr-arena-shape.cpp b/src/display/nr-arena-shape.cpp
index 0f86db041..5b5000c60 100644
--- a/src/display/nr-arena-shape.cpp
+++ b/src/display/nr-arena-shape.cpp
@@ -446,7 +446,7 @@ nr_arena_shape_pick(NRArenaItem *item, Geom::Point p, double delta, unsigned int
width = 0;
}
- double dist = NR_HUGE;
+ double dist = Geom::infinity();
int wind = 0;
bool needfill = (shape->nrstyle.fill.type != NRStyle::PAINT_NONE
&& shape->nrstyle.fill.opacity > 1e-3 && !outline);
diff --git a/src/display/sp-canvas.cpp b/src/display/sp-canvas.cpp
index 8be585a43..bfd007cfe 100644
--- a/src/display/sp-canvas.cpp
+++ b/src/display/sp-canvas.cpp
@@ -318,7 +318,7 @@ sp_canvas_item_invoke_point (SPCanvasItem *item, Geom::Point p, SPCanvasItem **a
if (SP_CANVAS_ITEM_GET_CLASS (item)->point)
return SP_CANVAS_ITEM_GET_CLASS (item)->point (item, p, actual_item);
- return NR_HUGE;
+ return Geom::infinity();
}
/**
diff --git a/src/draw-context.cpp b/src/draw-context.cpp
index da22c8a7a..4c1c775df 100644
--- a/src/draw-context.cpp
+++ b/src/draw-context.cpp
@@ -480,7 +480,7 @@ void spdc_endpoint_snap_rotation(SPEventContext const *const ec, Geom::Point &p,
/* mirrored by fabs, so this corresponds to 15 degrees */
Geom::Point best; /* best solution */
- double bn = NR_HUGE; /* best normal */
+ double bn = Geom::infinity(); /* best normal */
double bdot = 0;
Geom::Point v = Geom::Point(0, 1);
double const r00 = cos(M_PI / snaps), r01 = sin(M_PI / snaps);
diff --git a/src/helper/geom.cpp b/src/helper/geom.cpp
index c79cd829a..da5d09436 100644
--- a/src/helper/geom.cpp
+++ b/src/helper/geom.cpp
@@ -28,8 +28,6 @@
using Geom::X;
using Geom::Y;
-#define NR_HUGE 1e18
-
//#################################################################################
// BOUNDING BOX CALCULATIONS
@@ -423,7 +421,7 @@ pathv_matrix_point_bbox_wind_distance (Geom::PathVector const & pathv, Geom::Mat
{
if (pathv.empty()) {
if (wind) *wind = 0;
- if (dist) *dist = NR_HUGE;
+ if (dist) *dist = Geom::infinity();
return;
}
diff --git a/src/libnr/Makefile_insert b/src/libnr/Makefile_insert
index 6afef39ef..0a9b99e1e 100644
--- a/src/libnr/Makefile_insert
+++ b/src/libnr/Makefile_insert
@@ -13,10 +13,8 @@ ink_common_sources += \
libnr/nr-forward.h \
libnr/nr-i-coord.h \
libnr/nr-macros.h \
- libnr/nr-maybe.h \
libnr/nr-object.cpp \
libnr/nr-object.h \
- libnr/nr-path-code.h \
libnr/nr-pixblock-pattern.cpp \
libnr/nr-pixblock-pattern.h \
libnr/nr-pixblock.cpp \
diff --git a/src/libnr/nr-maybe.h b/src/libnr/nr-maybe.h
deleted file mode 100644
index 6071a60ad..000000000
--- a/src/libnr/nr-maybe.h
+++ /dev/null
@@ -1,201 +0,0 @@
-#ifndef __NR_MAYBE_H__
-#define __NR_MAYBE_H__
-
-/*
- * Nullable values for C++
- *
- * Copyright 2004, 2007 MenTaLguY <mental@rydia.net>
- *
- * This code is licensed under the GNU GPL; see COPYING for more information.
- */
-
-#if HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <stdexcept>
-#include <string>
-#include <algorithm>
-
-namespace NR {
-
-class IsNothing : public std::domain_error {
-public:
- IsNothing() : domain_error(std::string("Is nothing")) {}
-};
-
-struct Nothing {};
-
-template <typename T>
-class MaybeStorage {
-public:
- MaybeStorage() : _is_nothing(true) {}
- MaybeStorage(T const &value)
- : _value(value), _is_nothing(false) {}
-
- bool is_nothing() const { return _is_nothing; }
- T &value() { return _value; }
- T const &value() const { return _value; }
-
-private:
- T _value;
- bool _is_nothing;
-};
-
-template <typename T>
-class Maybe {
-public:
- Maybe() {}
- Maybe(Nothing) {}
- Maybe(T const &t) : _storage(t) {}
- Maybe(Maybe const &m) : _storage(m._storage) {}
-
- template <typename T2>
- Maybe(Maybe<T2> const &m) {
- if (m) {
- _storage = *m;
- }
- }
-
- template <typename T2>
- Maybe(Maybe<T2 const &> m) {
- if (m) {
- _storage = *m;
- }
- }
-
- operator bool() const { return !_storage.is_nothing(); }
-
- T const &operator*() const throw(IsNothing) {
- if (_storage.is_nothing()) {
- throw IsNothing();
- } else {
- return _storage.value();
- }
- }
- T &operator*() throw(IsNothing) {
- if (_storage.is_nothing()) {
- throw IsNothing();
- } else {
- return _storage.value();
- }
- }
-
- T const *operator->() const throw(IsNothing) {
- if (_storage.is_nothing()) {
- throw IsNothing();
- } else {
- return &_storage.value();
- }
- }
- T *operator->() throw(IsNothing) {
- if (_storage.is_nothing()) {
- throw IsNothing();
- } else {
- return &_storage.value();
- }
- }
-
- template <typename T2>
- bool operator==(Maybe<T2> const &other) const {
- bool is_nothing = _storage.is_nothing();
- if ( is_nothing || !other ) {
- return is_nothing && !other;
- } else {
- return _storage.value() == *other;
- }
- }
- template <typename T2>
- bool operator!=(Maybe<T2> const &other) const {
- bool is_nothing = _storage.is_nothing();
- if ( is_nothing || !other ) {
- return !is_nothing || other;
- } else {
- return _storage.value() != *other;
- }
- }
-
-private:
- MaybeStorage<T> _storage;
-};
-
-template <typename T>
-class Maybe<T &> {
-public:
- Maybe() : _ref(NULL) {}
- Maybe(Nothing) : _ref(NULL) {}
- Maybe(T &t) : _ref(&t) {}
-
- template <typename T2>
- Maybe(Maybe<T2> const &m) {
- if (m) {
- _ref = &*m;
- }
- }
-
- template <typename T2>
- Maybe(Maybe<T2 &> m) {
- if (m) {
- _ref = *m;
- }
- }
-
- template <typename T2>
- Maybe(Maybe<T2 const &> m) {
- if (m) {
- _ref = *m;
- }
- }
-
- operator bool() const { return _ref; }
-
- T &operator*() const throw(IsNothing) {
- if (!_ref) {
- throw IsNothing();
- } else {
- return *_ref;
- }
- }
- T *operator->() const throw(IsNothing) {
- if (!_ref) {
- throw IsNothing();
- } else {
- return _ref;
- }
- }
-
- template <typename T2>
- bool operator==(Maybe<T2> const &other) const {
- if ( !_ref || !other ) {
- return !_ref && !other;
- } else {
- return *_ref == *other;
- }
- }
- template <typename T2>
- bool operator!=(Maybe <T2> const &other) const {
- if ( !_ref || !other ) {
- return _ref || other;
- } else {
- return *_ref != *other;
- }
- }
-
-private:
- T *_ref;
-};
-
-} /* namespace NR */
-
-#endif
-
-/*
- Local Variables:
- mode:c++
- c-file-style:"stroustrup"
- c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
- indent-tabs-mode:nil
- fill-column:99
- End:
-*/
-// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 :
diff --git a/src/libnr/nr-path-code.h b/src/libnr/nr-path-code.h
deleted file mode 100644
index cc174d73b..000000000
--- a/src/libnr/nr-path-code.h
+++ /dev/null
@@ -1,28 +0,0 @@
-#ifndef SEEN_LIBNR_NR_PATH_CODE_H
-#define SEEN_LIBNR_NR_PATH_CODE_H
-
-/** \file
- * NRPathcode enum definition
- */
-
-typedef enum {
- NR_MOVETO, ///< Start of closed subpath
- NR_MOVETO_OPEN, ///< Start of open subpath
- NR_CURVETO, ///< Bezier curve segment
- NR_LINETO, ///< Line segment
- NR_END ///< End record
-} NRPathcode;
-
-
-#endif /* !SEEN_LIBNR_NR_PATH_CODE_H */
-
-/*
- Local Variables:
- mode:c++
- c-file-style:"stroustrup"
- c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
- indent-tabs-mode:nil
- fill-column:99
- End:
-*/
-// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4 :
diff --git a/src/live_effects/lpe-curvestitch.cpp b/src/live_effects/lpe-curvestitch.cpp
index e1e21107c..9e02a3975 100644
--- a/src/live_effects/lpe-curvestitch.cpp
+++ b/src/live_effects/lpe-curvestitch.cpp
@@ -58,7 +58,7 @@ LPECurveStitch::LPECurveStitch(LivePathEffectObject *lpeobject) :
registerParameter( dynamic_cast<Parameter *>(&scale_y_rel) );
nrofpaths.param_make_integer();
- nrofpaths.param_set_range(2, NR_HUGE);
+ nrofpaths.param_set_range(2, Geom::infinity());
prop_scale.param_set_digits(3);
prop_scale.param_set_increments(0.01, 0.10);
diff --git a/src/live_effects/lpe-dynastroke.cpp b/src/live_effects/lpe-dynastroke.cpp
index 0c97d50f0..a9f9202e9 100644
--- a/src/live_effects/lpe-dynastroke.cpp
+++ b/src/live_effects/lpe-dynastroke.cpp
@@ -97,11 +97,11 @@ LPEDynastroke::LPEDynastroke(LivePathEffectObject *lpeobject) :
registerParameter( dynamic_cast<Parameter *>(& round_ends) );
registerParameter( dynamic_cast<Parameter *>(& capping) );
- width.param_set_range(0, NR_HUGE);
+ width.param_set_range(0, Geom::infinity());
roundness.param_set_range(0.01, 1);
angle.param_set_range(-360, 360);
- growfor.param_set_range(0, NR_HUGE);
- fadefor.param_set_range(0, NR_HUGE);
+ growfor.param_set_range(0, Geom::infinity());
+ fadefor.param_set_range(0, Geom::infinity());
show_orig_path = true;
}
diff --git a/src/live_effects/lpe-interpolate.cpp b/src/live_effects/lpe-interpolate.cpp
index e77a392e9..4eb86ccf0 100644
--- a/src/live_effects/lpe-interpolate.cpp
+++ b/src/live_effects/lpe-interpolate.cpp
@@ -38,7 +38,7 @@ LPEInterpolate::LPEInterpolate(LivePathEffectObject *lpeobject) :
registerParameter( dynamic_cast<Parameter *>(&number_of_steps) );
number_of_steps.param_make_integer();
- number_of_steps.param_set_range(2, NR_HUGE);
+ number_of_steps.param_set_range(2, Geom::infinity());
}
LPEInterpolate::~LPEInterpolate()
diff --git a/src/live_effects/lpe-patternalongpath.cpp b/src/live_effects/lpe-patternalongpath.cpp
index 45b2b67b4..6e1738db8 100644
--- a/src/live_effects/lpe-patternalongpath.cpp
+++ b/src/live_effects/lpe-patternalongpath.cpp
@@ -139,9 +139,9 @@ LPEPatternAlongPath::doEffect_pwd2 (Geom::Piecewise<Geom::D2<Geom::SBasis> > con
}
//TODO: dynamical update of parameter ranges?
//if (prop_units.get_value()){
- // spacing.param_set_range(-.9, NR_HUGE);
+ // spacing.param_set_range(-.9, Geom::infinity());
// }else{
- // spacing.param_set_range(-pattBndsX.extent()*.9, NR_HUGE);
+ // spacing.param_set_range(-pattBndsX.extent()*.9, Geom::infinity());
// }
y0+=noffset;
diff --git a/src/live_effects/lpe-rough-hatches.cpp b/src/live_effects/lpe-rough-hatches.cpp
index f110aa743..eebac299a 100644
--- a/src/live_effects/lpe-rough-hatches.cpp
+++ b/src/live_effects/lpe-rough-hatches.cpp
@@ -271,13 +271,13 @@ LPERoughHatches::LPERoughHatches(LivePathEffectObject *lpeobject) :
registerParameter( dynamic_cast<Parameter *>(&front_thickness) );
registerParameter( dynamic_cast<Parameter *>(&back_thickness) );
- //hatch_dist.param_set_range(0.1, NR_HUGE);
- growth.param_set_range(0, NR_HUGE);
+ //hatch_dist.param_set_range(0.1, Geom::infinity());
+ growth.param_set_range(0, Geom::infinity());
dist_rdm.param_set_range(0, 99.);
- stroke_width_top.param_set_range(0, NR_HUGE);
- stroke_width_bot.param_set_range(0, NR_HUGE);
- front_thickness.param_set_range(0, NR_HUGE);
- back_thickness.param_set_range(0, NR_HUGE);
+ stroke_width_top.param_set_range(0, Geom::infinity());
+ stroke_width_bot.param_set_range(0, Geom::infinity());
+ front_thickness.param_set_range(0, Geom::infinity());
+ back_thickness.param_set_range(0, Geom::infinity());
// hide the widgets for direction and bender vectorparams
direction.widget_is_visible = false;
diff --git a/src/live_effects/lpe-sketch.cpp b/src/live_effects/lpe-sketch.cpp
index e3354bff9..4d0212576 100644
--- a/src/live_effects/lpe-sketch.cpp
+++ b/src/live_effects/lpe-sketch.cpp
@@ -89,24 +89,24 @@ LPESketch::LPESketch(LivePathEffectObject *lpeobject) :
#endif
nbiter_approxstrokes.param_make_integer();
- nbiter_approxstrokes.param_set_range(0, NR_HUGE);
- strokelength.param_set_range(1, NR_HUGE);
+ nbiter_approxstrokes.param_set_range(0, Geom::infinity());
+ strokelength.param_set_range(1, Geom::infinity());
strokelength.param_set_increments(1., 5.);
strokelength_rdm.param_set_range(0, 1.);
strokeoverlap.param_set_range(0, 1.);
strokeoverlap.param_set_increments(0.1, 0.30);
ends_tolerance.param_set_range(0., 1.);
- parallel_offset.param_set_range(0, NR_HUGE);
+ parallel_offset.param_set_range(0, Geom::infinity());
tremble_frequency.param_set_range(0.01, 100.);
tremble_frequency.param_set_increments(.5, 1.5);
strokeoverlap_rdm.param_set_range(0, 1.);
#ifdef LPE_SKETCH_USE_CONSTRUCTION_LINES
nbtangents.param_make_integer();
- nbtangents.param_set_range(0, NR_HUGE);
- tgtscale.param_set_range(0, NR_HUGE);
+ nbtangents.param_set_range(0, Geom::infinity());
+ tgtscale.param_set_range(0, Geom::infinity());
tgtscale.param_set_increments(.1, .5);
- tgtlength.param_set_range(0, NR_HUGE);
+ tgtlength.param_set_range(0, Geom::infinity());
tgtlength.param_set_increments(1., 5.);
tgtlength_rdm.param_set_range(0, 1.);
tgt_places_rdmness.param_set_range(0, 1.);
diff --git a/src/live_effects/lpe-vonkoch.cpp b/src/live_effects/lpe-vonkoch.cpp
index 85f8cde0c..23e76fe39 100644
--- a/src/live_effects/lpe-vonkoch.cpp
+++ b/src/live_effects/lpe-vonkoch.cpp
@@ -66,9 +66,9 @@ LPEVonKoch::LPEVonKoch(LivePathEffectObject *lpeobject) :
//registerParameter( dynamic_cast<Parameter *>(&draw_boxes) );
nbgenerations.param_make_integer();
- nbgenerations.param_set_range(0, NR_HUGE);
+ nbgenerations.param_set_range(0, Geom::infinity());
maxComplexity.param_make_integer();
- maxComplexity.param_set_range(0, NR_HUGE);
+ maxComplexity.param_set_range(0, Geom::infinity());
}
LPEVonKoch::~LPEVonKoch()
diff --git a/src/live_effects/parameter/parameter.cpp b/src/live_effects/parameter/parameter.cpp
index 57d583ba6..fc15ce1f5 100644
--- a/src/live_effects/parameter/parameter.cpp
+++ b/src/live_effects/parameter/parameter.cpp
@@ -53,8 +53,8 @@ ScalarParam::ScalarParam( const Glib::ustring& label, const Glib::ustring& tip,
Effect* effect, gdouble default_value)
: Parameter(label, tip, key, wr, effect),
value(default_value),
- min(-NR_HUGE),
- max(NR_HUGE),
+ min(-Geom::infinity()),
+ max(Geom::infinity()),
integer(false),
defvalue(default_value),
digits(2),
diff --git a/src/live_effects/parameter/random.cpp b/src/live_effects/parameter/random.cpp
index 889e5375b..cdfb1fb50 100644
--- a/src/live_effects/parameter/random.cpp
+++ b/src/live_effects/parameter/random.cpp
@@ -32,8 +32,8 @@ RandomParam::RandomParam( const Glib::ustring& label, const Glib::ustring& tip,
{
defvalue = default_value;
value = defvalue;
- min = -NR_HUGE;
- max = NR_HUGE;
+ min = -Geom::infinity();
+ max = Geom::infinity();
integer = false;
defseed = default_seed;
diff --git a/src/proj_pt.cpp b/src/proj_pt.cpp
index 9294046ab..55f896a1a 100644
--- a/src/proj_pt.cpp
+++ b/src/proj_pt.cpp
@@ -48,7 +48,7 @@ Pt2::normalize() {
Geom::Point
Pt2::affine() {
if (fabs(pt[2]) < epsilon) {
- return Geom::Point (NR_HUGE, NR_HUGE);
+ return Geom::Point (Geom::infinity(), Geom::infinity());
}
return Geom::Point (pt[0]/pt[2], pt[1]/pt[2]);
}
diff --git a/src/proj_pt.h b/src/proj_pt.h
index 844cbb2c4..cc56f1aa8 100644
--- a/src/proj_pt.h
+++ b/src/proj_pt.h
@@ -13,7 +13,6 @@
*/
#include <2geom/point.h>
-#include "libnr/nr-values.h"
#include <gtk/gtk.h>
namespace Proj {
@@ -29,12 +28,12 @@ public:
Pt2 (const gchar *coord_str);
inline double operator[] (unsigned int index) const {
- if (index > 2) { return NR_HUGE; }
+ if (index > 2) { return Geom::infinity(); }
return pt[index];
}
inline double &operator[] (unsigned int index) {
// FIXME: How should we handle wrong indices?
- //if (index > 2) { return NR_HUGE; }
+ //if (index > 2) { return Geom::infinity(); }
return pt[index];
}
inline bool operator== (Pt2 &rhs) {
@@ -137,12 +136,12 @@ public:
}
inline double operator[] (unsigned int index) const {
- if (index > 3) { return NR_HUGE; }
+ if (index > 3) { return Geom::infinity(); }
return pt[index];
}
inline double &operator[] (unsigned int index) {
// FIXME: How should we handle wrong indices?
- //if (index > 3) { return NR_HUGE; }
+ //if (index > 3) { return Geom::infinity(); }
return pt[index];
}
void normalize();
diff --git a/src/seltrans.cpp b/src/seltrans.cpp
index 05f47d4ab..64c41ea23 100644
--- a/src/seltrans.cpp
+++ b/src/seltrans.cpp
@@ -377,9 +377,9 @@ void Inkscape::SelTrans::grab(Geom::Point const &p, gdouble x, gdouble y, bool s
}
// Now let's reduce this to a single closest snappoint
- Geom::Coord dsp = _snap_points.size() == 1 ? Geom::L2((_snap_points.at(0)).getPoint() - p) : NR_HUGE;
- Geom::Coord dbbp = _bbox_points.size() == 1 ? Geom::L2((_bbox_points.at(0)).getPoint() - p) : NR_HUGE;
- Geom::Coord dbbpft = _bbox_points_for_translating.size() == 1 ? Geom::L2((_bbox_points_for_translating.at(0)).getPoint() - p) : NR_HUGE;
+ Geom::Coord dsp = _snap_points.size() == 1 ? Geom::L2((_snap_points.at(0)).getPoint() - p) : Geom::infinity();
+ Geom::Coord dbbp = _bbox_points.size() == 1 ? Geom::L2((_bbox_points.at(0)).getPoint() - p) : Geom::infinity();
+ Geom::Coord dbbpft = _bbox_points_for_translating.size() == 1 ? Geom::L2((_bbox_points_for_translating.at(0)).getPoint() - p) : Geom::infinity();
if (translating) {
_bbox_points.clear();
@@ -1216,7 +1216,7 @@ gboolean Inkscape::SelTrans::skewRequest(SPSelTransHandle const &handle, Geom::P
if (sn.getSnapped()) {
// We snapped something, so change the skew to reflect it
- Geom::Coord const sd = sn.getSnapped() ? sn.getTransformation()[0] : NR_HUGE;
+ Geom::Coord const sd = sn.getSnapped() ? sn.getTransformation()[0] : Geom::infinity();
_desktop->snapindicator->set_new_snaptarget(sn);
skew[dim_a] = sd;
} else {
@@ -1630,8 +1630,8 @@ void Inkscape::SelTrans::_keepClosestPointOnly(std::vector<Inkscape::SnapCandida
{
if (points.size() < 2) return;
- Inkscape::SnapCandidatePoint closest_point = Inkscape::SnapCandidatePoint(Geom::Point(NR_HUGE, NR_HUGE), SNAPSOURCE_UNDEFINED, SNAPTARGET_UNDEFINED);
- Geom::Coord closest_dist = NR_HUGE;
+ Inkscape::SnapCandidatePoint closest_point = Inkscape::SnapCandidatePoint(Geom::Point(Geom::infinity(), Geom::infinity()), SNAPSOURCE_UNDEFINED, SNAPTARGET_UNDEFINED);
+ Geom::Coord closest_dist = Geom::infinity();
for(std::vector<Inkscape::SnapCandidatePoint>::const_iterator i = points.begin(); i != points.end(); i++) {
Geom::Coord dist = Geom::L2((*i).getPoint() - reference);
diff --git a/src/shape-editor.h b/src/shape-editor.h
index f400244b3..1f0958a3e 100644
--- a/src/shape-editor.h
+++ b/src/shape-editor.h
@@ -24,7 +24,6 @@ class SPNodeContext;
class ShapeEditorsCollective;
class LivePathEffectObject;
-#include "libnr/nr-path-code.h"
#include <2geom/point.h>
#include <boost/optional.hpp>
#include <vector>
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;
}
diff --git a/src/snapped-curve.cpp b/src/snapped-curve.cpp
index 77bc8280c..894e49f9a 100644
--- a/src/snapped-curve.cpp
+++ b/src/snapped-curve.cpp
@@ -20,7 +20,7 @@ Inkscape::SnappedCurve::SnappedCurve(Geom::Point const &snapped_point, int num_p
_tolerance = std::max(snapped_tolerance, 1.0);
_always_snap = always_snap;
_curve = curve;
- _second_distance = NR_HUGE;
+ _second_distance = Geom::infinity();
_second_tolerance = 1;
_second_always_snap = false;
_point = snapped_point;
@@ -36,11 +36,11 @@ Inkscape::SnappedCurve::SnappedCurve()
{
_num_path = 0;
_num_segm = 0;
- _distance = NR_HUGE;
+ _distance = Geom::infinity();
_tolerance = 1;
_always_snap = false;
_curve = NULL;
- _second_distance = NR_HUGE;
+ _second_distance = Geom::infinity();
_second_tolerance = 1;
_second_always_snap = false;
_point = Geom::Point(0,0);
@@ -67,8 +67,8 @@ Inkscape::SnappedPoint Inkscape::SnappedCurve::intersect(SnappedCurve const &cur
if (cs.size() > 0) {
// There might be multiple intersections: find the closest
- Geom::Coord best_dist = NR_HUGE;
- Geom::Point best_p = Geom::Point(NR_HUGE, NR_HUGE);
+ Geom::Coord best_dist = Geom::infinity();
+ Geom::Point best_p = Geom::Point(Geom::infinity(), Geom::infinity());
for (Geom::Crossings::const_iterator i = cs.begin(); i != cs.end(); i++) {
Geom::Point p_ix = this->_curve->pointAt((*i).ta);
Geom::Coord dist = Geom::distance(p_ix, p);
@@ -106,7 +106,7 @@ Inkscape::SnappedPoint Inkscape::SnappedCurve::intersect(SnappedCurve const &cur
}
// No intersection
- return SnappedPoint(Geom::Point(NR_HUGE, NR_HUGE), SNAPSOURCE_UNDEFINED, 0, SNAPTARGET_UNDEFINED, NR_HUGE, 0, false, false, false, false, NR_HUGE, 0, false);
+ return SnappedPoint(Geom::Point(Geom::infinity(), Geom::infinity()), SNAPSOURCE_UNDEFINED, 0, SNAPTARGET_UNDEFINED, Geom::infinity(), 0, false, false, false, false, Geom::infinity(), 0, false);
}
// search for the closest snapped line
diff --git a/src/snapped-line.cpp b/src/snapped-line.cpp
index da17ff81a..4b6a25929 100644
--- a/src/snapped-line.cpp
+++ b/src/snapped-line.cpp
@@ -22,7 +22,7 @@ Inkscape::SnappedLineSegment::SnappedLineSegment(Geom::Point const &snapped_poin
_tolerance = std::max(snapped_tolerance, 1.0);
_always_snap = always_snap;
_at_intersection = false;
- _second_distance = NR_HUGE;
+ _second_distance = Geom::infinity();
_second_tolerance = 1;
_second_always_snap = false;
}
@@ -35,11 +35,11 @@ Inkscape::SnappedLineSegment::SnappedLineSegment()
_source = SNAPSOURCE_UNDEFINED;
_source_num = 0;
_target = SNAPTARGET_UNDEFINED;
- _distance = NR_HUGE;
+ _distance = Geom::infinity();
_tolerance = 1;
_always_snap = false;
_at_intersection = false;
- _second_distance = NR_HUGE;
+ _second_distance = Geom::infinity();
_second_tolerance = 1;
_second_always_snap = false;
}
@@ -85,7 +85,7 @@ Inkscape::SnappedPoint Inkscape::SnappedLineSegment::intersect(SnappedLineSegmen
}
// No intersection
- return SnappedPoint(Geom::Point(NR_HUGE, NR_HUGE), SNAPSOURCE_UNDEFINED, 0, SNAPTARGET_UNDEFINED, NR_HUGE, 0, false, false, false, false, NR_HUGE, 0, false);
+ return SnappedPoint(Geom::Point(Geom::infinity(), Geom::infinity()), SNAPSOURCE_UNDEFINED, 0, SNAPTARGET_UNDEFINED, Geom::infinity(), 0, false, false, false, false, Geom::infinity(), 0, false);
};
@@ -99,7 +99,7 @@ Inkscape::SnappedLine::SnappedLine(Geom::Point const &snapped_point, Geom::Coord
_distance = snapped_distance;
_tolerance = std::max(snapped_tolerance, 1.0);
_always_snap = always_snap;
- _second_distance = NR_HUGE;
+ _second_distance = Geom::infinity();
_second_tolerance = 1;
_second_always_snap = false;
_point = snapped_point;
@@ -113,10 +113,10 @@ Inkscape::SnappedLine::SnappedLine()
_source = SNAPSOURCE_UNDEFINED;
_source_num = 0;
_target = SNAPTARGET_UNDEFINED;
- _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;
_point = Geom::Point(0,0);
@@ -168,7 +168,7 @@ Inkscape::SnappedPoint Inkscape::SnappedLine::intersect(SnappedLine const &line)
}
// No intersection
- return SnappedPoint(Geom::Point(NR_HUGE, NR_HUGE), SNAPSOURCE_UNDEFINED, 0, SNAPTARGET_UNDEFINED, NR_HUGE, 0, false, false, false, false, NR_HUGE, 0, false);
+ return SnappedPoint(Geom::Point(Geom::infinity(), Geom::infinity()), SNAPSOURCE_UNDEFINED, 0, SNAPTARGET_UNDEFINED, Geom::infinity(), 0, false, false, false, false, Geom::infinity(), 0, false);
}
// search for the closest snapped line segment
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();
diff --git a/src/snapped-point.h b/src/snapped-point.h
index 05e954e1e..d0bcd324d 100644
--- a/src/snapped-point.h
+++ b/src/snapped-point.h
@@ -14,7 +14,6 @@
#include <vector>
#include <list>
-#include <libnr/nr-values.h> //Because of NR_HUGE
#include <2geom/geom.h>
#include <snap-candidate.h>
@@ -62,7 +61,7 @@ public:
bool getAtIntersection() const {return _at_intersection;}
bool getFullyConstrained() const {return _fully_constrained;}
bool getConstrainedSnap() const {return _constrained_snap;}
- bool getSnapped() const {return _distance < NR_HUGE;}
+ bool getSnapped() const {return _distance < Geom::infinity();}
Geom::Point getTransformation() const {return _transformation;}
void setTransformation(Geom::Point const t) {_transformation = t;}
void setTarget(SnapTargetType const target) {_target = target;}
diff --git a/src/sp-item-transform.cpp b/src/sp-item-transform.cpp
index 23c0bdf33..aefd6603a 100644
--- a/src/sp-item-transform.cpp
+++ b/src/sp-item-transform.cpp
@@ -123,7 +123,7 @@ get_scale_transform_with_stroke (Geom::Rect const &bbox_param, gdouble strokewid
Geom::Matrix direct_constant_r = Geom::Scale(flip_x * ratio_x, flip_y * ratio_y);
- if (transform_stroke && r0 != 0 && r0 != NR_HUGE) { // there's stroke, and we need to scale it
+ if (transform_stroke && r0 != 0 && r0 != Geom::infinity()) { // there's stroke, and we need to scale it
// These coefficients are obtained from the assumption that scaling applies to the
// non-stroked "shape proper" and that stroke scale is scaled by the expansion of that
// matrix. We're trying to solve this equation:
@@ -148,7 +148,7 @@ get_scale_transform_with_stroke (Geom::Rect const &bbox_param, gdouble strokewid
scale *= direct;
}
} else {
- if (r0 == 0 || r0 == NR_HUGE) { // no stroke to scale
+ if (r0 == 0 || r0 == Geom::infinity()) { // no stroke to scale
scale *= direct;
} else {// nonscaling strokewidth
scale *= direct_constant_r;
@@ -175,7 +175,7 @@ get_visual_bbox (Geom::OptRect const &initial_geom_bbox, Geom::Matrix const &abs
}
Geom::Rect new_visual_bbox = new_geom_bbox;
- if (initial_strokewidth > 0 && initial_strokewidth < NR_HUGE) {
+ if (initial_strokewidth > 0 && initial_strokewidth < Geom::infinity()) {
if (transform_stroke) {
// scale stroke by: sqrt (((w1-r0)/(w0-r0))*((h1-r0)/(h0-r0))) (for visual bboxes, see get_scale_transform_with_stroke)
// equals scaling by: sqrt ((w1/w0)*(h1/h0)) for geometrical bboxes
diff --git a/src/sp-item.cpp b/src/sp-item.cpp
index a778c3d79..a5510f203 100644
--- a/src/sp-item.cpp
+++ b/src/sp-item.cpp
@@ -773,8 +773,8 @@ sp_item_invoke_bbox_full(SPItem const *item, Geom::OptRect &bbox, Geom::Matrix c
// TODO: replace NRRect by Geom::Rect, for all SPItemClasses, and for SP_CLIPPATH
NRRect temp_bbox;
- temp_bbox.x0 = temp_bbox.y0 = NR_HUGE;
- temp_bbox.x1 = temp_bbox.y1 = -NR_HUGE;
+ temp_bbox.x0 = temp_bbox.y0 = Geom::infinity();
+ temp_bbox.x1 = temp_bbox.y1 = -Geom::infinity();
// call the subclass method
if (((SPItemClass *) G_OBJECT_GET_CLASS(item))->bbox) {
@@ -846,7 +846,7 @@ sp_item_invoke_bbox_full(SPItem const *item, Geom::OptRect &bbox, Geom::Matrix c
if (temp_bbox.x0 > temp_bbox.x1 || temp_bbox.y0 > temp_bbox.y1) {
// Either the bbox hasn't been touched by the SPItemClass' bbox method
- // (it still has its initial values, see above: x0 = y0 = NR_HUGE and x1 = y1 = -NR_HUGE)
+ // (it still has its initial values, see above: x0 = y0 = Geom::infinity() and x1 = y1 = -Geom::infinity())
// or it has explicitely been set to be like this (e.g. in sp_shape_bbox)
// When x0 > x1 or y0 > y1, the bbox is considered to be "nothing", although it has not been
diff --git a/src/transf_mat_3x4.h b/src/transf_mat_3x4.h
index 53c9ffa81..4b61c0951 100644
--- a/src/transf_mat_3x4.h
+++ b/src/transf_mat_3x4.h
@@ -29,7 +29,7 @@ public:
void toggle_finite (Proj::Axis axis);
double get_infinite_angle (Proj::Axis axis) {
if (has_finite_image(axis)) {
- return 1e18; //this used to be NR_HUGE before 2geom conversion
+ return Geom::infinity();
}
Pt2 vp(column(axis));
return Geom::atan2(Geom::Point(vp[0], vp[1])) * 180.0/M_PI;
diff --git a/src/vanishing-point.h b/src/vanishing-point.h
index 9fcb6bb46..0551c87ba 100644
--- a/src/vanishing-point.h
+++ b/src/vanishing-point.h
@@ -67,7 +67,7 @@ public:
return persp3d_get_VP (_persp, _axis).is_finite();
}
inline Geom::Point get_pos() const {
- g_return_val_if_fail (_persp, Geom::Point (NR_HUGE, NR_HUGE));
+ g_return_val_if_fail (_persp, Geom::Point (Geom::infinity(), Geom::infinity()));
return persp3d_get_VP (_persp,_axis).affine();
}
inline Persp3D * get_perspective() const {
diff --git a/src/widgets/stroke-style.cpp b/src/widgets/stroke-style.cpp
index f020b0c3a..3e628c2cf 100644
--- a/src/widgets/stroke-style.cpp
+++ b/src/widgets/stroke-style.cpp
@@ -608,7 +608,7 @@ static gboolean stroke_width_set_unit(SPUnitSelector *,
gdouble average = stroke_average_width (objects);
- if (average == NR_HUGE || average == 0)
+ if (average == Geom::infinity() || average == 0)
return FALSE;
a->set_value (100.0 * w / average);
diff --git a/src/widgets/toolbox.cpp b/src/widgets/toolbox.cpp
index c255e087b..e2f85a627 100644
--- a/src/widgets/toolbox.cpp
+++ b/src/widgets/toolbox.cpp
@@ -3360,7 +3360,7 @@ static void box3d_set_button_and_adjustment(Persp3D *persp,
gtk_action_set_sensitive(act, TRUE);
double angle = persp3d_get_infinite_angle(persp, axis);
- if (angle != NR_HUGE) { // FIXME: We should catch this error earlier (don't show the spinbutton at all)
+ if (angle != Geom::infinity()) { // FIXME: We should catch this error earlier (don't show the spinbutton at all)
gtk_adjustment_set_value(adj, box3d_normalize_angle(angle));
}
} else {