diff options
| author | Krzysztof Kosi??ski <tweenk.pl@gmail.com> | 2011-08-27 16:05:32 +0000 |
|---|---|---|
| committer | Krzysztof Kosinski <tweenk.pl@gmail.com> | 2011-08-27 16:05:32 +0000 |
| commit | d6af1140ee108cc7d7fb6e0ba89ff7e30bb7ad3a (patch) | |
| tree | 69ea9c65f725d83ae1bc267ea5a0358a1bc1d793 /src | |
| parent | Remove all NRRect use. (diff) | |
| download | inkscape-d6af1140ee108cc7d7fb6e0ba89ff7e30bb7ad3a.tar.gz inkscape-d6af1140ee108cc7d7fb6e0ba89ff7e30bb7ad3a.zip | |
Completely remove NRRect, NRRectL, in-svg-plane.h
(bzr r10582.1.6)
Diffstat (limited to 'src')
61 files changed, 38 insertions, 682 deletions
diff --git a/src/display/canvas-axonomgrid.cpp b/src/display/canvas-axonomgrid.cpp index c0dabcc07..9ea06ec2d 100644 --- a/src/display/canvas-axonomgrid.cpp +++ b/src/display/canvas-axonomgrid.cpp @@ -744,13 +744,13 @@ CanvasAxonomGridSnapper::_getSnapLines(Geom::Point const &p) const if (use_left_half) { s.push_back(std::make_pair(norm_z, Geom::Point(grid->origin[Geom::X], y_proj_along_z_max))); s.push_back(std::make_pair(norm_x, Geom::Point(grid->origin[Geom::X], y_proj_along_x_min))); - s.push_back(std::make_pair(component_vectors[Geom::X], Geom::Point(x_max, 0))); + s.push_back(std::make_pair(Geom::Point(1, 0), Geom::Point(x_max, 0))); } if (use_right_half) { s.push_back(std::make_pair(norm_z, Geom::Point(grid->origin[Geom::X], y_proj_along_z_min))); s.push_back(std::make_pair(norm_x, Geom::Point(grid->origin[Geom::X], y_proj_along_x_max))); - s.push_back(std::make_pair(component_vectors[Geom::X], Geom::Point(x_min, 0))); + s.push_back(std::make_pair(Geom::Point(1, 0), Geom::Point(x_min, 0))); } return s; diff --git a/src/display/canvas-grid.cpp b/src/display/canvas-grid.cpp index 38fe69628..bdf0d6fb0 100644 --- a/src/display/canvas-grid.cpp +++ b/src/display/canvas-grid.cpp @@ -993,14 +993,16 @@ CanvasXYGridSnapper::_getSnapLines(Geom::Point const &p) const Geom::Coord rounded; Geom::Point point_on_line; + Geom::Point cvec(0.,0.); + cvec[i] = 1.; rounded = Inkscape::Util::round_to_upper_multiple_plus(p[i], spacing, grid->origin[i]); point_on_line = i ? Geom::Point(0, rounded) : Geom::Point(rounded, 0); - s.push_back(std::make_pair(component_vectors[i], point_on_line)); + s.push_back(std::make_pair(cvec, point_on_line)); rounded = Inkscape::Util::round_to_lower_multiple_plus(p[i], spacing, grid->origin[i]); point_on_line = i ? Geom::Point(0, rounded) : Geom::Point(rounded, 0); - s.push_back(std::make_pair(component_vectors[i], point_on_line)); + s.push_back(std::make_pair(cvec, point_on_line)); } return s; diff --git a/src/display/drawing-group.cpp b/src/display/drawing-group.cpp index a678c3feb..998c4b6e4 100644 --- a/src/display/drawing-group.cpp +++ b/src/display/drawing-group.cpp @@ -14,7 +14,6 @@ #include "display/drawing-context.h" #include "display/drawing-item.h" #include "display/drawing-group.h" -#include "libnr/nr-values.h" #include "style.h" namespace Inkscape { @@ -58,7 +57,7 @@ DrawingGroup::setChildTransform(Geom::Affine const &new_trans) current = *_child_transform; } - if (!Geom::are_near(current, new_trans, NR_EPSILON)) { + if (!Geom::are_near(current, new_trans, 1e-18)) { // mark the area where the object was for redraw. _markForRendering(); if (new_trans.isIdentity()) { diff --git a/src/display/drawing-item.cpp b/src/display/drawing-item.cpp index a5496e999..3fe56b6de 100644 --- a/src/display/drawing-item.cpp +++ b/src/display/drawing-item.cpp @@ -176,7 +176,7 @@ DrawingItem::setTransform(Geom::Affine const &new_trans) current = *_transform; } - if (!Geom::are_near(current, new_trans, NR_EPSILON)) { + if (!Geom::are_near(current, new_trans, 1e-18)) { // mark the area where the object was for redraw. _markForRendering(); if (new_trans.isIdentity()) { @@ -456,7 +456,7 @@ DrawingItem::render(DrawingContext &ct, Geom::IntRect const &area, unsigned flag // If we are invisible, return immediately if (!_visible) return RENDER_OK; - if (_ctm.isSingular(NR_EPSILON)) return RENDER_OK; + if (_ctm.isSingular(1e-18)) return RENDER_OK; // TODO convert outline rendering to a separate virtual function if (outline) { diff --git a/src/display/drawing-shape.cpp b/src/display/drawing-shape.cpp index ac0ff2ccb..6e28c0184 100644 --- a/src/display/drawing-shape.cpp +++ b/src/display/drawing-shape.cpp @@ -25,7 +25,6 @@ #include "display/drawing-shape.h" #include "helper/geom-curves.h" #include "helper/geom.h" -#include "libnr/nr-convert2geom.h" #include "preferences.h" #include "style.h" #include "svg/svg.h" diff --git a/src/display/nr-filter-convolve-matrix.h b/src/display/nr-filter-convolve-matrix.h index c37fe721f..4041ff96f 100644 --- a/src/display/nr-filter-convolve-matrix.h +++ b/src/display/nr-filter-convolve-matrix.h @@ -13,7 +13,6 @@ */ #include "display/nr-filter-primitive.h" -#include "libnr/nr-rect-l.h" #include <vector> namespace Inkscape { diff --git a/src/display/nr-filter-diffuselighting.cpp b/src/display/nr-filter-diffuselighting.cpp index c94df2d70..9df771879 100644 --- a/src/display/nr-filter-diffuselighting.cpp +++ b/src/display/nr-filter-diffuselighting.cpp @@ -21,7 +21,6 @@ #include "display/nr-filter-units.h" #include "display/nr-filter-utils.h" #include "display/nr-light.h" -#include "libnr/nr-rect-l.h" namespace Inkscape { namespace Filters { diff --git a/src/display/nr-filter-displacement-map.h b/src/display/nr-filter-displacement-map.h index e4228323a..a01930045 100644 --- a/src/display/nr-filter-displacement-map.h +++ b/src/display/nr-filter-displacement-map.h @@ -16,7 +16,6 @@ #include "display/nr-filter-primitive.h" #include "display/nr-filter-slot.h" #include "display/nr-filter-units.h" -#include "libnr/nr-rect-l.h" namespace Inkscape { namespace Filters { diff --git a/src/display/nr-filter-image.cpp b/src/display/nr-filter-image.cpp index 5911f5908..8b2161425 100644 --- a/src/display/nr-filter-image.cpp +++ b/src/display/nr-filter-image.cpp @@ -19,7 +19,6 @@ #include "display/nr-filter.h" #include "display/nr-filter-image.h" #include "display/nr-filter-units.h" -#include "libnr/nr-rect-l.h" namespace Inkscape { namespace Filters { diff --git a/src/display/nr-filter-offset.cpp b/src/display/nr-filter-offset.cpp index da46095ef..833f6ecc9 100644 --- a/src/display/nr-filter-offset.cpp +++ b/src/display/nr-filter-offset.cpp @@ -13,7 +13,6 @@ #include "display/nr-filter-offset.h" #include "display/nr-filter-slot.h" #include "display/nr-filter-units.h" -#include "libnr/nr-rect-l.h" namespace Inkscape { namespace Filters { diff --git a/src/display/nr-filter-offset.h b/src/display/nr-filter-offset.h index 5551131f0..1ecc1621e 100644 --- a/src/display/nr-filter-offset.h +++ b/src/display/nr-filter-offset.h @@ -15,7 +15,6 @@ #include "display/nr-filter-primitive.h" #include "display/nr-filter-slot.h" #include "display/nr-filter-units.h" -#include "libnr/nr-rect-l.h" namespace Inkscape { namespace Filters { diff --git a/src/display/nr-filter-specularlighting.cpp b/src/display/nr-filter-specularlighting.cpp index ddb0c06eb..0530e38cb 100644 --- a/src/display/nr-filter-specularlighting.cpp +++ b/src/display/nr-filter-specularlighting.cpp @@ -21,7 +21,6 @@ #include "display/nr-filter-units.h" #include "display/nr-filter-utils.h" #include "display/nr-light.h" -#include "libnr/nr-rect-l.h" namespace Inkscape { namespace Filters { diff --git a/src/display/nr-filter-tile.cpp b/src/display/nr-filter-tile.cpp index 6680e7a46..93ca50210 100644 --- a/src/display/nr-filter-tile.cpp +++ b/src/display/nr-filter-tile.cpp @@ -9,6 +9,7 @@ * Released under GNU GPL, read the file 'COPYING' for more information */ +#include <glib.h> #include "display/nr-filter-tile.h" #include "display/nr-filter-slot.h" #include "display/nr-filter-units.h" diff --git a/src/display/nr-filter-turbulence.cpp b/src/display/nr-filter-turbulence.cpp index f065ded11..7e47c3bd9 100644 --- a/src/display/nr-filter-turbulence.cpp +++ b/src/display/nr-filter-turbulence.cpp @@ -23,7 +23,6 @@ #include "display/nr-filter-turbulence.h" #include "display/nr-filter-units.h" #include "display/nr-filter-utils.h" -#include "libnr/nr-rect-l.h" #include <math.h> namespace Inkscape { diff --git a/src/display/nr-filter-turbulence.h b/src/display/nr-filter-turbulence.h index 0b451d355..360853364 100644 --- a/src/display/nr-filter-turbulence.h +++ b/src/display/nr-filter-turbulence.h @@ -25,7 +25,6 @@ #include "display/nr-filter-primitive.h" #include "display/nr-filter-slot.h" #include "display/nr-filter-units.h" -#include "libnr/nr-rect-l.h" namespace Inkscape { namespace Filters { diff --git a/src/display/nr-filter-units.cpp b/src/display/nr-filter-units.cpp index baf4af45d..369deeb00 100644 --- a/src/display/nr-filter-units.cpp +++ b/src/display/nr-filter-units.cpp @@ -12,7 +12,6 @@ #include <glib.h> #include "display/nr-filter-units.h" -#include "libnr/nr-rect-l.h" #include "sp-filter-units.h" #include <2geom/transforms.h> diff --git a/src/display/nr-filter-units.h b/src/display/nr-filter-units.h index 1cb4fdbce..f918cf12e 100644 --- a/src/display/nr-filter-units.h +++ b/src/display/nr-filter-units.h @@ -13,7 +13,6 @@ */ #include "sp-filter-units.h" -#include "libnr/nr-rect-l.h" #include <2geom/affine.h> #include <2geom/rect.h> diff --git a/src/display/nr-filter.h b/src/display/nr-filter.h index 32e1df60b..d53005c5d 100644 --- a/src/display/nr-filter.h +++ b/src/display/nr-filter.h @@ -16,7 +16,6 @@ #include <cairo.h> #include "display/nr-filter-primitive.h" #include "display/nr-filter-types.h" -#include "libnr/nr-rect.h" #include "svg/svg-length.h" #include "sp-filter-units.h" #include "gc-managed.h" diff --git a/src/display/nr-style.cpp b/src/display/nr-style.cpp index 9db52ea7e..6e8ccb030 100644 --- a/src/display/nr-style.cpp +++ b/src/display/nr-style.cpp @@ -14,7 +14,6 @@ #include "sp-paint-server.h" #include "display/canvas-bpath.h" // contains SPStrokeJoinType, SPStrokeCapType etc. (WTF!) #include "display/drawing-context.h" -#include "libnr/nr-rect.h" void NRStyle::Paint::clear() { diff --git a/src/display/sodipodi-ctrl.h b/src/display/sodipodi-ctrl.h index 88cae28fd..2617e7db2 100644 --- a/src/display/sodipodi-ctrl.h +++ b/src/display/sodipodi-ctrl.h @@ -9,7 +9,6 @@ #include <gtk/gtk.h> #include <gdk-pixbuf/gdk-pixbuf.h> -#include <libnr/nr-rect-l.h> #include "sp-canvas-item.h" diff --git a/src/display/sp-canvas.h b/src/display/sp-canvas.h index 9e716b69c..bffa5e4e9 100644 --- a/src/display/sp-canvas.h +++ b/src/display/sp-canvas.h @@ -30,12 +30,8 @@ #include <glib/gtypes.h> #include <gdk/gdk.h> #include <gtk/gtk.h> - #include <glibmm/ustring.h> - #include <2geom/affine.h> -#include <libnr/nr-rect-l.h> - #include <2geom/rect.h> G_BEGIN_DECLS diff --git a/src/extension/internal/cairo-renderer.cpp b/src/extension/internal/cairo-renderer.cpp index 3a2cea3c1..3b6c26113 100644 --- a/src/extension/internal/cairo-renderer.cpp +++ b/src/extension/internal/cairo-renderer.cpp @@ -28,7 +28,6 @@ #include <signal.h> #include <errno.h> -#include "libnr/nr-rect.h" #include "libnrtype/Layout-TNG.h" #include <2geom/transforms.h> #include <2geom/pathvector.h> diff --git a/src/extension/internal/pdfinput/svg-builder.cpp b/src/extension/internal/pdfinput/svg-builder.cpp index dc995b7aa..fe383b920 100644 --- a/src/extension/internal/pdfinput/svg-builder.cpp +++ b/src/extension/internal/pdfinput/svg-builder.cpp @@ -37,7 +37,6 @@ #include "io/stringstream.h" #include "io/base64stream.h" #include "display/nr-filter-utils.h" -#include "libnr/nr-macros.h" #include "libnrtype/font-instance.h" #include "Function.h" diff --git a/src/helper/geom.cpp b/src/helper/geom.cpp index fdfbdb9d3..61551ad2e 100644 --- a/src/helper/geom.cpp +++ b/src/helper/geom.cpp @@ -22,7 +22,6 @@ #include <2geom/rect.h> #include <2geom/coord.h> #include <2geom/sbasis-to-bezier.h> -#include <libnr/nr-convert2geom.h> #include <glibmm.h> using Geom::X; diff --git a/src/inkview.cpp b/src/inkview.cpp index 09169f5be..0b1292e8e 100644 --- a/src/inkview.cpp +++ b/src/inkview.cpp @@ -39,7 +39,6 @@ #include <locale.h> #include <glib/gmem.h> -#include <libnr/nr-macros.h> // #include <stropts.h> diff --git a/src/libnr/Makefile_insert b/src/libnr/Makefile_insert index cdb0b482c..6156a45e3 100644 --- a/src/libnr/Makefile_insert +++ b/src/libnr/Makefile_insert @@ -1,23 +1,9 @@ ## Makefile.am fragment sourced by src/Makefile.am. ink_common_sources += \ - libnr/in-svg-plane.h \ - libnr/nr-convert2geom.h \ libnr/nr-forward.h \ libnr/nr-macros.h \ libnr/nr-object.cpp \ libnr/nr-object.h \ libnr/nr-point-fns.cpp \ - libnr/nr-point-fns.h \ - libnr/nr-rect-l.cpp \ - libnr/nr-rect-l.h \ - libnr/nr-rect.cpp \ - libnr/nr-rect.h \ - libnr/nr-values.cpp \ - libnr/nr-values.h - -# ###################### -# ### CxxTest stuff #### -# ###################### -CXXTEST_TESTSUITES += \ - $(srcdir)/libnr/in-svg-plane-test.h + libnr/nr-point-fns.h diff --git a/src/libnr/in-svg-plane-test.h b/src/libnr/in-svg-plane-test.h deleted file mode 100644 index 696f82421..000000000 --- a/src/libnr/in-svg-plane-test.h +++ /dev/null @@ -1,82 +0,0 @@ -#include <cxxtest/TestSuite.h> - -#include <glib/gmacros.h> -#include <cmath> - -#include "libnr/in-svg-plane.h" -#include <2geom/math-utils.h> -#include <2geom/point.h> - -class InSvgPlaneTest : public CxxTest::TestSuite -{ -public: - - InSvgPlaneTest() : - setupValid(true), - p3n4( 3.0, -4.0 ), - p0(0.0, 0.0), - small( pow(2.0, -1070) ), - inf( 1e400 ), - nan( inf - inf ), - small_left( -small, 0.0 ), - small_n3_4( -3.0 * small, 4.0 * small ), - part_nan( 3., nan ) - { - setupValid &= IS_NAN(nan); - setupValid &= !IS_NAN(small); - } - virtual ~InSvgPlaneTest() {} - -// createSuite and destroySuite get us per-suite setup and teardown -// without us having to worry about static initialization order, etc. - static InSvgPlaneTest *createSuite() { return new InSvgPlaneTest(); } - static void destroySuite( InSvgPlaneTest *suite ) { delete suite; } - -// Called before each test in this suite - void setUp() - { - TS_ASSERT( setupValid ); - } - - bool setupValid; - Geom::Point const p3n4; - Geom::Point const p0; - double const small; - double const inf; - double const nan; - Geom::Point const small_left; - Geom::Point const small_n3_4; - Geom::Point const part_nan; - - - void testInSvgPlane(void) - { - TS_ASSERT( in_svg_plane(p3n4) ); - TS_ASSERT( in_svg_plane(p0) ); - TS_ASSERT( in_svg_plane(small_left) ); - TS_ASSERT( in_svg_plane(small_n3_4) ); - TS_ASSERT_DIFFERS( nan, nan ); - TS_ASSERT( !in_svg_plane(Geom::Point(nan, 3.)) ); - TS_ASSERT( !in_svg_plane(Geom::Point(inf, nan)) ); - TS_ASSERT( !in_svg_plane(Geom::Point(0., -inf)) ); - double const xs[] = {inf, -inf, nan, 1., -2., small, -small}; - for (unsigned i = 0; i < G_N_ELEMENTS(xs); ++i) { - for (unsigned j = 0; j < G_N_ELEMENTS(xs); ++j) { - TS_ASSERT_EQUALS( in_svg_plane(Geom::Point(xs[i], xs[j])), - (fabs(xs[i]) < inf && - fabs(xs[j]) < inf ) ); - } - } - } -}; - -/* - 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:fileencoding=utf-8:textwidth=99 : diff --git a/src/libnr/in-svg-plane.h b/src/libnr/in-svg-plane.h deleted file mode 100644 index 68c9e92a0..000000000 --- a/src/libnr/in-svg-plane.h +++ /dev/null @@ -1,32 +0,0 @@ -#ifndef SEEN_LIBNR_IN_SVG_PLANE_H -#define SEEN_LIBNR_IN_SVG_PLANE_H - -#include <2geom/point.h> - -/** - * Returns true iff the coordinates of \a p are finite, non-NaN, and "small enough". Currently we - * use the magic number 1e18 for determining "small enough", as this number has in the past been - * used in sodipodi code as a sort of "infinity" value. - * - * For SVG Tiny output, we might choose a smaller value corresponding to the range of valid numbers - * in SVG Tiny (which uses fixed-point arithmetic). - */ -inline bool -in_svg_plane(Geom::Point const &p) -{ - return Geom::LInfty(p) < 1e18; -} - - -#endif /* !SEEN_LIBNR_IN_SVG_PLANE_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:fileencoding=utf-8:textwidth=99 : diff --git a/src/libnr/nr-convert2geom.h b/src/libnr/nr-convert2geom.h deleted file mode 100644 index 7e2423ea6..000000000 --- a/src/libnr/nr-convert2geom.h +++ /dev/null @@ -1,34 +0,0 @@ -#ifndef INKSCAPE_LIBNR_CONVERT2GEOM_H -#define INKSCAPE_LIBNR_CONVERT2GEOM_H - -/* - * Converts between NR and 2Geom types. - * -* Copyright (C) Johan Engelen 2008 <j.b.c.engelen@utwente.nl> - * - * Released under GNU GPL, read the file 'COPYING' for more information - */ - -#include <libnr/nr-rect.h> -#include <2geom/rect.h> - -inline Geom::OptRect to_2geom(NRRect const *nr) { - Geom::OptRect ret; - if (!nr) return ret; - if (nr->x1 < nr->x0 || nr->y1 < nr->y0) return ret; - ret = Geom::Rect(Geom::Point(nr->x0, nr->y0), Geom::Point(nr->x1, nr->y1)); - return ret; -} - -#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:fileencoding=utf-8:textwidth=99 : diff --git a/src/libnr/nr-rect-l.cpp b/src/libnr/nr-rect-l.cpp deleted file mode 100644 index 1cb268266..000000000 --- a/src/libnr/nr-rect-l.cpp +++ /dev/null @@ -1,59 +0,0 @@ -#include "libnr/nr-rect-l.h" - -NRRectL::NRRectL() -{ - x0 = G_MAXINT32; - y0 = G_MAXINT32; - x1 = G_MININT32; - y1 = G_MININT32; -} - -NRRectL::NRRectL(gint32 xmin, gint32 ymin, gint32 xmax, gint32 ymax) -{ - x0 = xmin; - y0 = ymin; - x1 = xmax; - y1 = ymax; -} - -NRRectL::NRRectL(Geom::OptIntRect const &r) -{ - if (r) { - x0 = r->left(); - y0 = r->top(); - x1 = r->right(); - y1 = r->bottom(); - } else { - x0 = G_MAXINT32; - y0 = G_MAXINT32; - x1 = G_MININT32; - y1 = G_MININT32; - } -} - -NRRectL::NRRectL(Geom::IntRect const &r) -{ - x0 = r.left(); - y0 = r.top(); - x1 = r.right(); - y1 = r.bottom(); -} - -Geom::OptIntRect NRRectL::upgrade_2geom() const -{ - Geom::OptIntRect ret; - if (x0 > x1 || y0 > y1) return ret; - ret = Geom::IntRect(x0, y0, x1, y1); - return ret; -} - -/* - 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:fileencoding=utf-8:textwidth=99 : diff --git a/src/libnr/nr-rect-l.h b/src/libnr/nr-rect-l.h deleted file mode 100644 index c4c5f5a6d..000000000 --- a/src/libnr/nr-rect-l.h +++ /dev/null @@ -1,28 +0,0 @@ -#ifndef SEEN_NR_RECT_L_H -#define SEEN_NR_RECT_L_H - -#include <glib.h> -#include <2geom/int-rect.h> - -struct NRRectL { - gint32 x0, y0, x1, y1; - NRRectL(); - NRRectL(gint32 xmin, gint32 ymin, gint32 xmax, gint32 ymax); - explicit NRRectL(Geom::IntRect const &r); - explicit NRRectL(Geom::OptIntRect const &r); - operator Geom::OptIntRect() const { Geom::OptIntRect r = upgrade_2geom(); return r; } - Geom::OptIntRect upgrade_2geom() const; -}; - -#endif /* !SEEN_NR_RECT_L_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:fileencoding=utf-8:textwidth=99 : diff --git a/src/libnr/nr-rect.cpp b/src/libnr/nr-rect.cpp deleted file mode 100644 index 67857ad49..000000000 --- a/src/libnr/nr-rect.cpp +++ /dev/null @@ -1,203 +0,0 @@ -#define __NR_RECT_C__ - -/* - * Pixel buffer rendering library - * - * Authors: - * Lauris Kaplinski <lauris@kaplinski.com> - * - * This code is in public domain - */ - -#include <algorithm> -#include "nr-rect.h" -#include "nr-rect-l.h" - -NRRect::NRRect(Geom::OptRect const &rect) { - if (rect) { - x0 = rect->min()[Geom::X]; - y0 = rect->min()[Geom::Y]; - x1 = rect->max()[Geom::X]; - y1 = rect->max()[Geom::Y]; - } else { - *this = NR_RECT_EMPTY; - } -} - -Geom::OptRect NRRect::upgrade_2geom() const { - if (x0 > x1 || y0 > y1) { - return Geom::OptRect(); - } else { - return Geom::Rect(Geom::Point(x0, y0), Geom::Point(x1, y1)); - } -} - -/** - * \param r0 Rectangle. - * \param r1 Another rectangle. - * \param d Filled in with the intersection of r0 and r1. - * \return d. - */ - -NRRectL *nr_rect_l_intersect(NRRectL *d, const NRRectL *r0, const NRRectL *r1) -{ - gint32 t; - t = std::max(r0->x0, r1->x0); - d->x1 = std::min(r0->x1, r1->x1); - d->x0 = t; - t = std::max(r0->y0, r1->y0); - d->y1 = std::min(r0->y1, r1->y1); - d->y0 = t; - - return d; -} - -NRRect * -nr_rect_d_intersect (NRRect *d, const NRRect *r0, const NRRect *r1) -{ - gint32 t; - t = MAX (r0->x0, r1->x0); - d->x1 = MIN (r0->x1, r1->x1); - d->x0 = t; - t = MAX (r0->y0, r1->y0); - d->y1 = MIN (r0->y1, r1->y1); - d->y0 = t; - - return d; -} - -// returns minimal rect which covers all of r0 not covered by r1 -NRRectL * -nr_rect_l_subtract(NRRectL *d, NRRectL const *r0, NRRectL const *r1) -{ - bool inside1 = nr_rect_l_test_inside(r1, r0->x0, r0->y0); - bool inside2 = nr_rect_l_test_inside(r1, r0->x1, r0->y0); - bool inside3 = nr_rect_l_test_inside(r1, r0->x1, r0->y1); - bool inside4 = nr_rect_l_test_inside(r1, r0->x0, r0->y1); - - if (inside1 && inside2 && inside3) { - *d = NR_RECT_L_EMPTY; - - } else if (inside1 && inside2) { - d->x0 = r0->x0; - d->y0 = r1->y1; - - d->x1 = r0->x1; - d->y1 = r0->y1; - } else if (inside2 && inside3) { - d->x0 = r0->x0; - d->y0 = r0->y0; - - d->x1 = r1->x0; - d->y1 = r0->y1; - } else if (inside3 && inside4) { - d->x0 = r0->x0; - d->y0 = r0->y0; - - d->x1 = r0->x1; - d->y1 = r1->y0; - } else if (inside4 && inside1) { - d->x0 = r1->x1; - d->y0 = r0->y0; - - d->x1 = r0->x1; - d->y1 = r0->y1; - } else { - d->x0 = r0->x0; - d->y0 = r0->y0; - - d->x1 = r0->x1; - d->y1 = r0->y1; - } - return d; -} - -gint32 nr_rect_l_area(NRRectL *r) -{ - if (!r || NR_RECT_DFLS_TEST_EMPTY (r)) { - return 0; - } - return ((r->x1 - r->x0) * (r->y1 - r->y0)); -} - -NRRect * -nr_rect_d_union (NRRect *d, const NRRect *r0, const NRRect *r1) -{ - if (NR_RECT_DFLS_TEST_EMPTY (r0)) { - if (NR_RECT_DFLS_TEST_EMPTY (r1)) { - *d = NR_RECT_EMPTY; - } else { - *d = *r1; - } - } else { - if (NR_RECT_DFLS_TEST_EMPTY (r1)) { - *d = *r0; - } else { - double t; - t = MIN (r0->x0, r1->x0); - d->x1 = MAX (r0->x1, r1->x1); - d->x0 = t; - t = MIN (r0->y0, r1->y0); - d->y1 = MAX (r0->y1, r1->y1); - d->y0 = t; - } - } - return d; -} - -NRRectL * -nr_rect_l_union (NRRectL *d, const NRRectL *r0, const NRRectL *r1) -{ - if (NR_RECT_DFLS_TEST_EMPTY (r0)) { - if (NR_RECT_DFLS_TEST_EMPTY (r1)) { - *d = NR_RECT_L_EMPTY; - } else { - *d = *r1; - } - } else { - if (NR_RECT_DFLS_TEST_EMPTY (r1)) { - *d = *r0; - } else { - double t; - t = MIN (r0->x0, r1->x0); - d->x1 = MAX (r0->x1, r1->x1); - d->x0 = t; - t = MIN (r0->y0, r1->y0); - d->y1 = MAX (r0->y1, r1->y1); - d->y0 = t; - } - } - return d; -} - -NRRect * -nr_rect_union_pt(NRRect *dst, Geom::Point const &p) -{ - return nr_rect_d_union_xy(dst, p[Geom::X], p[Geom::Y]); -} - -NRRect * -nr_rect_d_union_xy (NRRect *d, double x, double y) -{ - if ((d->x0 <= d->x1) && (d->y0 <= d->y1)) { - d->x0 = MIN (d->x0, x); - d->y0 = MIN (d->y0, y); - d->x1 = MAX (d->x1, x); - d->y1 = MAX (d->y1, y); - } else { - d->x0 = d->x1 = x; - d->y0 = d->y1 = y; - } - return d; -} - -/* - 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/libnr/nr-rect.h b/src/libnr/nr-rect.h deleted file mode 100644 index 4931b3e10..000000000 --- a/src/libnr/nr-rect.h +++ /dev/null @@ -1,91 +0,0 @@ -#ifndef LIBNR_NR_RECT_H_SEEN -#define LIBNR_NR_RECT_H_SEEN - -/** \file - * Definitions of NRRect and NR::Rect types, and some associated functions \& macros. - *//* - * Authors: - * Lauris Kaplinski <lauris@kaplinski.com> - * Nathan Hurst <njh@mail.csse.monash.edu.au> - * MenTaLguY <mental@rydia.net> - * - * This code is in public domain - */ - -#include <stdexcept> -#include <limits> -#include <boost/optional.hpp> -#include <glib.h> -#include <2geom/rect.h> - -#include "libnr/nr-forward.h" -#include "libnr/nr-values.h" -#include "libnr/nr-macros.h" - -/* legacy rect stuff */ -/* NULL rect is infinite */ - -struct NRRect { - NRRect() - : x0(0), y0(0), x1(0), y1(0) - {} - NRRect(double xmin, double ymin, double xmax, double ymax) - : x0(xmin), y0(ymin), x1(xmax), y1(ymax) - {} - explicit NRRect(Geom::OptRect const &rect); - operator Geom::OptRect() const { return upgrade_2geom(); } - Geom::OptRect upgrade_2geom() const; - - double x0, y0, x1, y1; -}; - -// TODO convert to static overloaded functions (pointer and ref) once performance can be tested: -#define nr_rect_l_test_empty_ptr(r) ((r) && NR_RECT_DFLS_TEST_EMPTY(r)) -#define nr_rect_l_test_empty(r) NR_RECT_DFLS_TEST_EMPTY_REF(r) - -#define nr_rect_d_test_intersect(r0,r1) \ - (!nr_rect_d_test_empty(r0) && !nr_rect_d_test_empty(r1) && \ - !((r0) && (r1) && !NR_RECT_DFLS_TEST_INTERSECT(r0, r1))) - -// TODO convert to static overloaded functions (pointer and ref) once performance can be tested: -#define nr_rect_l_test_intersect_ptr(r0,r1) \ - (!nr_rect_l_test_empty_ptr(r0) && !nr_rect_l_test_empty_ptr(r1) && \ - !((r0) && (r1) && !NR_RECT_DFLS_TEST_INTERSECT(r0, r1))) -#define nr_rect_l_test_intersect(r0,r1) \ - (!nr_rect_l_test_empty(r0) && !nr_rect_l_test_empty(r1) && \ - !(!NR_RECT_DFLS_TEST_INTERSECT_REF(r0, r1))) - -#define nr_rect_d_point_d_test_inside(r,p) ((p) && (!(r) || (!NR_RECT_DF_TEST_EMPTY(r) && NR_RECT_DF_POINT_DF_TEST_INSIDE(r,p)))) -#define nr_rect_l_point_l_test_inside(r,p) ((p) && (!(r) || (!NR_RECT_DFLS_TEST_EMPTY(r) && NR_RECT_LS_POINT_LS_TEST_INSIDE(r,p)))) -#define nr_rect_l_test_inside(r,x,y) ((!(r) || (!NR_RECT_DFLS_TEST_EMPTY(r) && NR_RECT_LS_TEST_INSIDE(r,x,y)))) - -// returns minimal rect which covers all of r0 not covered by r1 -NRRectL *nr_rect_l_subtract(NRRectL *d, NRRectL const *r0, NRRectL const *r1); - -// returns the area of r -gint32 nr_rect_l_area(NRRectL *r); - -/* NULL values are OK for r0 and r1, but not for d */ -NRRect *nr_rect_d_intersect(NRRect *d, NRRect const *r0, NRRect const *r1); -NRRectL *nr_rect_l_intersect(NRRectL *d, NRRectL const *r0, NRRectL const *r1); - -NRRect *nr_rect_d_union(NRRect *d, NRRect const *r0, NRRect const *r1); -NRRectL *nr_rect_l_union(NRRectL *d, NRRectL const *r0, NRRectL const *r1); - -NRRect *nr_rect_union_pt(NRRect *dst, Geom::Point const &p); -NRRect *nr_rect_d_union_xy(NRRect *d, double x, double y); -NRRectL *nr_rect_l_union_xy(NRRectL *d, gint32 x, gint32 y); - - -#endif /* !LIBNR_NR_RECT_H_SEEN */ - -/* - 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:fileencoding=utf-8:textwidth=99 : diff --git a/src/libnr/nr-values.cpp b/src/libnr/nr-values.cpp deleted file mode 100644 index 06f33b13f..000000000 --- a/src/libnr/nr-values.cpp +++ /dev/null @@ -1,18 +0,0 @@ -#define __NR_VALUES_C__ - -#include "libnr/nr-values.h" -#include "libnr/nr-rect.h" -#include "libnr/nr-rect-l.h" - -/* -The following predefined objects are for reference -and comparison. -*/ -NRRect NR_RECT_EMPTY(NR_HUGE, NR_HUGE, -NR_HUGE, -NR_HUGE); -NRRectL NR_RECT_L_EMPTY(NR_HUGE_L, NR_HUGE_L, -NR_HUGE_L, -NR_HUGE_L); - -/** component_vectors[i] is like $e_i$ in common mathematical usage; - or equivalently $I_i$ (where $I$ is the identity matrix). */ -Geom::Point const component_vectors[] = {Geom::Point(1., 0.), - Geom::Point(0., 1.)}; - diff --git a/src/libnr/nr-values.h b/src/libnr/nr-values.h deleted file mode 100644 index 07faec9fa..000000000 --- a/src/libnr/nr-values.h +++ /dev/null @@ -1,43 +0,0 @@ -#ifndef __NR_VALUES_H__ -#define __NR_VALUES_H__ - -/* - * Pixel buffer rendering library - * - * Authors: - * Lauris Kaplinski <lauris@kaplinski.com> - * - * This code is in public domain - */ - -#include <libnr/nr-forward.h> -#include <2geom/point.h> - -#define NR_EPSILON 1e-18 - -#define NR_HUGE 1e18 -#define NR_HUGE_L (0x7fffffff) - -/* -The following predefined objects are for reference -and comparison. They are defined in nr-values.cpp -*/ -extern NRRect NR_RECT_EMPTY; -extern NRRectL NR_RECT_L_EMPTY; - -/** component_vectors[i] has 1.0 at position i, and 0.0 elsewhere - (i.e. in the other position). */ -extern Geom::Point const component_vectors[2]; - -#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:fileencoding=utf-8:textwidth=99 : diff --git a/src/libnrtype/FontInstance.cpp b/src/libnrtype/FontInstance.cpp index 641adc3ac..f8b2c3b9d 100644 --- a/src/libnrtype/FontInstance.cpp +++ b/src/libnrtype/FontInstance.cpp @@ -22,7 +22,6 @@ #include <pango/pangoft2.h> #include <2geom/pathvector.h> #include <2geom/svg-path.h> -#include "libnr/nr-rect.h" #include "libnrtype/font-glyph.h" #include "libnrtype/font-instance.h" #include "livarot/Path.h" diff --git a/src/libnrtype/Layout-TNG.h b/src/libnrtype/Layout-TNG.h index a8852ed8a..4406d9f93 100644 --- a/src/libnrtype/Layout-TNG.h +++ b/src/libnrtype/Layout-TNG.h @@ -14,7 +14,6 @@ #ifdef HAVE_CONFIG_H # include "config.h" #endif -#include <libnr/nr-rect.h> #include <2geom/d2.h> #include <2geom/affine.h> #include <glibmm/ustring.h> diff --git a/src/libnrtype/font-instance.h b/src/libnrtype/font-instance.h index 392ac20bf..3ca3feee4 100644 --- a/src/libnrtype/font-instance.h +++ b/src/libnrtype/font-instance.h @@ -7,11 +7,9 @@ #include <require-config.h> #include "FontFactory.h" -#include <libnr/nr-forward.h> #include <libnrtype/nrtype-forward.h> #include <libnrtype/font-style.h> #include <livarot/livarot-forward.h> -#include "libnr/nr-rect.h" #include <2geom/d2.h> // the font_instance are the template of several raster_font; they provide metrics and outlines diff --git a/src/libnrtype/nr-type-primitives.cpp b/src/libnrtype/nr-type-primitives.cpp index 34b1e43b8..2fbc18ffd 100644 --- a/src/libnrtype/nr-type-primitives.cpp +++ b/src/libnrtype/nr-type-primitives.cpp @@ -15,7 +15,6 @@ #include <stdlib.h> #include <string.h> #include <glib/gmem.h> -#include <libnr/nr-macros.h> #include "nr-type-primitives.h" /** diff --git a/src/livarot/Path.h b/src/livarot/Path.h index 6b5d4fd95..22d989778 100644 --- a/src/livarot/Path.h +++ b/src/livarot/Path.h @@ -12,7 +12,6 @@ #include <vector> #include "LivarotDefs.h" #include "livarot/livarot-forward.h" -#include <libnr/nr-rect-l.h> #include <2geom/point.h> struct SPStyle; diff --git a/src/livarot/PathConversion.cpp b/src/livarot/PathConversion.cpp index 74a057d06..ed5f03f80 100644 --- a/src/livarot/PathConversion.cpp +++ b/src/livarot/PathConversion.cpp @@ -6,10 +6,11 @@ * */ +#include <glib.h> +#include <2geom/transforms.h> #include "Path.h" #include "Shape.h" #include "livarot/path-description.h" -#include <2geom/transforms.h> /* * path description -> polyline diff --git a/src/livarot/PathCutting.cpp b/src/livarot/PathCutting.cpp index 708d20f3f..e47ed8916 100644 --- a/src/livarot/PathCutting.cpp +++ b/src/livarot/PathCutting.cpp @@ -20,7 +20,6 @@ #include "Path.h" #include "style.h" #include "livarot/path-description.h" -#include "libnr/nr-convert2geom.h" #include <2geom/pathvector.h> #include <2geom/point.h> #include <2geom/affine.h> diff --git a/src/live_effects/lpe-curvestitch.cpp b/src/live_effects/lpe-curvestitch.cpp index a002901b2..9bac3b860 100644 --- a/src/live_effects/lpe-curvestitch.cpp +++ b/src/live_effects/lpe-curvestitch.cpp @@ -30,7 +30,6 @@ #include <2geom/affine.h> #include "ui/widget/scalar.h" -#include "libnr/nr-values.h" namespace Inkscape { namespace LivePathEffect { diff --git a/src/live_effects/lpe-rough-hatches.cpp b/src/live_effects/lpe-rough-hatches.cpp index 87e3dbe5c..8324271ed 100644 --- a/src/live_effects/lpe-rough-hatches.cpp +++ b/src/live_effects/lpe-rough-hatches.cpp @@ -31,7 +31,6 @@ #include <2geom/affine.h> #include "ui/widget/scalar.h" -#include "libnr/nr-values.h" namespace Inkscape { namespace LivePathEffect { diff --git a/src/live_effects/parameter/parameter.cpp b/src/live_effects/parameter/parameter.cpp index fc15ce1f5..5454a5408 100644 --- a/src/live_effects/parameter/parameter.cpp +++ b/src/live_effects/parameter/parameter.cpp @@ -9,7 +9,6 @@ #include "live_effects/parameter/parameter.h" #include "live_effects/effect.h" #include "svg/svg.h" -#include "libnr/nr-values.h" #include "xml/repr.h" #include <gtkmm.h> #include "ui/widget/registered-widget.h" diff --git a/src/live_effects/parameter/random.cpp b/src/live_effects/parameter/random.cpp index cdfb1fb50..d5a6e9291 100644 --- a/src/live_effects/parameter/random.cpp +++ b/src/live_effects/parameter/random.cpp @@ -9,7 +9,6 @@ #include "live_effects/parameter/random.h" #include "live_effects/effect.h" #include "svg/svg.h" -#include "libnr/nr-values.h" #include "ui/widget/registered-widget.h" #include <gtkmm.h> #include "ui/widget/random.h" diff --git a/src/marker.cpp b/src/marker.cpp index db9779460..e75cdff43 100644 --- a/src/marker.cpp +++ b/src/marker.cpp @@ -17,7 +17,6 @@ #include <string> #include "config.h" -#include "libnr/nr-convert2geom.h" #include <2geom/affine.h> #include <2geom/transforms.h> #include "svg/svg.h" diff --git a/src/pencil-context.cpp b/src/pencil-context.cpp index 57205a436..d823c1daa 100644 --- a/src/pencil-context.cpp +++ b/src/pencil-context.cpp @@ -34,7 +34,6 @@ #include <2geom/bezier-utils.h> #include "display/canvas-bpath.h" #include <glibmm/i18n.h> -#include "libnr/in-svg-plane.h" #include "context-fns.h" #include "sp-namedview.h" #include "xml/repr.h" @@ -69,6 +68,8 @@ static SPDrawContextClass *pencil_parent_class; static Geom::Point pencil_drag_origin_w(0, 0); static bool pencil_within_tolerance = false; +static bool in_svg_plane(Geom::Point const &p) { return Geom::LInfty(p) < 1e18; } + /** * Register SPPencilContext class with Gdk and return its type number. */ diff --git a/src/selection-chemistry.cpp b/src/selection-chemistry.cpp index 75745f4af..4c3c0f197 100644 --- a/src/selection-chemistry.cpp +++ b/src/selection-chemistry.cpp @@ -85,7 +85,6 @@ SPCycleType SP_CYCLING = SP_CYCLE_FOCUS; #include "sp-filter-reference.h" #include "gradient-drag.h" #include "uri-references.h" -#include "libnr/nr-convert2geom.h" #include "display/curve.h" #include "display/canvas-bpath.h" #include "inkscape-private.h" diff --git a/src/seltrans.cpp b/src/seltrans.cpp index 0e5e533fc..19c09902b 100644 --- a/src/seltrans.cpp +++ b/src/seltrans.cpp @@ -1213,7 +1213,8 @@ gboolean Inkscape::SelTrans::skewRequest(SPSelTransHandle const &handle, Geom::P SnapManager &m = _desktop->namedview->snap_manager; m.setup(_desktop, false, _items_const); - Inkscape::Snapper::SnapConstraint const constraint(component_vectors[dim_b]); + Geom::Point cvec; cvec[dim_b] = 1.; + Inkscape::Snapper::SnapConstraint const constraint(cvec); // When skewing, we cannot snap the corners of the bounding box, see the comment in "constrainedSnapSkew" for details Geom::Point const s(skew[dim_a], scale[dim_a]); Inkscape::SnappedPoint sn = m.constrainedSnapSkew(_snap_points, _point, constraint, s, _origin, Geom::Dim2(dim_b)); @@ -1475,14 +1476,15 @@ void Inkscape::SelTrans::moveTo(Geom::Point const &xy, guint state) // the constraint-line once. The constraint lines are parallel, but might not be colinear. // Therefore we will have to set the point through which the constraint-line runs // individually for each point to be snapped; this will be handled however by _snapTransformed() + Geom::Point cvec; cvec[dim] = 1.; s.push_back(m.constrainedSnapTranslate(_bbox_points_for_translating, _point, - Inkscape::Snapper::SnapConstraint(component_vectors[dim]), + Inkscape::Snapper::SnapConstraint(cvec), dxy)); s.push_back(m.constrainedSnapTranslate(_snap_points, _point, - Inkscape::Snapper::SnapConstraint(component_vectors[dim]), + Inkscape::Snapper::SnapConstraint(cvec), dxy)); } else { // !control diff --git a/src/snap.cpp b/src/snap.cpp index 7647341fe..1756e7dd2 100644 --- a/src/snap.cpp +++ b/src/snap.cpp @@ -734,7 +734,8 @@ Inkscape::SnappedPoint SnapManager::_snapTransformed( Geom::Coord r = Geom::L2(b); // the radius of the circular constraint dedicated_constraint = Inkscape::Snapper::SnapConstraint(origin, b, r); } else if (transformation_type == STRETCH) { // when non-uniform stretching { - dedicated_constraint = Inkscape::Snapper::SnapConstraint((*i).getPoint(), component_vectors[dim]); + Geom::Point cvec; cvec[dim] = 1.; + dedicated_constraint = Inkscape::Snapper::SnapConstraint((*i).getPoint(), cvec); } else if (transformation_type == TRANSLATE) { // When doing a constrained translation, all points will move in the same direction, i.e. // either horizontally or vertically. The lines along which they move are therefore all @@ -751,7 +752,8 @@ Inkscape::SnappedPoint SnapManager::_snapTransformed( // When scaling, a point aligned either horizontally or vertically with the origin can only // move in that specific direction; therefore it should only snap in that direction, otherwise // we will get snapped points with an invalid transformation - dedicated_constraint = Inkscape::Snapper::SnapConstraint(origin, component_vectors[c1]); + Geom::Point cvec; cvec[c1] = 1.; + dedicated_constraint = Inkscape::Snapper::SnapConstraint(origin, cvec); snapped_point = constrainedSnap(*j, dedicated_constraint, bbox); } else { // If we have a collection of SnapCandidatePoints, with mixed constrained snapping and free snapping diff --git a/src/sp-guide.cpp b/src/sp-guide.cpp index a06d098d0..5d30800d6 100644 --- a/src/sp-guide.cpp +++ b/src/sp-guide.cpp @@ -116,7 +116,7 @@ static void sp_guide_class_init(SPGuideClass *gc) static void sp_guide_init(SPGuide *guide) { - guide->normal_to_line = component_vectors[Geom::Y]; + guide->normal_to_line = Geom::Point(0.,1.); guide->point_on_line = Geom::Point(0.,0.); guide->color = 0x0000ff7f; guide->hicolor = 0xff00007f; @@ -205,9 +205,9 @@ static void sp_guide_set(SPObject *object, unsigned int key, const gchar *value) { if (value && !strcmp(value, "horizontal")) { /* Visual representation of a horizontal line, constrain vertically (y coordinate). */ - guide->normal_to_line = component_vectors[Geom::Y]; + guide->normal_to_line = Geom::Point(0., 1.); } else if (value && !strcmp(value, "vertical")) { - guide->normal_to_line = component_vectors[Geom::X]; + guide->normal_to_line = Geom::Point(1., 0.); } else if (value) { gchar ** strarray = g_strsplit(value, ",", 2); double newx, newy; @@ -220,11 +220,11 @@ static void sp_guide_set(SPObject *object, unsigned int key, const gchar *value) guide->normal_to_line = direction; } else { // default to vertical line for bad arguments - guide->normal_to_line = component_vectors[Geom::X]; + guide->normal_to_line = Geom::Point(1., 0.); } } else { // default to vertical line for bad arguments - guide->normal_to_line = component_vectors[Geom::X]; + guide->normal_to_line = Geom::Point(1., 0.); } sp_guide_set_normal(*guide, guide->normal_to_line, false); } @@ -493,11 +493,11 @@ char *sp_guide_description(SPGuide const *guide, const bool verbose) gchar *shortcuts = g_strdup_printf("; %s", _("<b>Shift+drag</b> to rotate, <b>Ctrl+drag</b> to move origin, <b>Del</b> to delete")); - if ( are_near(guide->normal_to_line, component_vectors[X]) || - are_near(guide->normal_to_line, -component_vectors[X]) ) { + if ( are_near(guide->normal_to_line, Geom::Point(1., 0.)) || + are_near(guide->normal_to_line, -Geom::Point(1., 0.)) ) { descr = g_strdup_printf(_("vertical, at %s"), position_string_x->str); - } else if ( are_near(guide->normal_to_line, component_vectors[Y]) || - are_near(guide->normal_to_line, -component_vectors[Y]) ) { + } else if ( are_near(guide->normal_to_line, Geom::Point(0., 1.)) || + are_near(guide->normal_to_line, -Geom::Point(0., 1.)) ) { descr = g_strdup_printf(_("horizontal, at %s"), position_string_y->str); } else { double const radians = guide->angle(); diff --git a/src/sp-item.cpp b/src/sp-item.cpp index a2a603c68..c0c23ba8b 100644 --- a/src/sp-item.cpp +++ b/src/sp-item.cpp @@ -25,7 +25,6 @@ # include "config.h" #endif - #include "sp-item.h" #include "svg/svg.h" #include "print.h" @@ -60,7 +59,6 @@ #include "sp-title.h" #include "sp-desc.h" -#include "libnr/nr-convert2geom.h" #include "util/find-last-if.h" #include "util/reverse-list.h" #include <2geom/rect.h> @@ -1302,7 +1300,7 @@ gint SPItem::emitEvent(SPEvent &event) */ void SPItem::set_item_transform(Geom::Affine const &transform_matrix) { - if (!matrix_equalp(transform_matrix, transform, NR_EPSILON)) { + if (!Geom::are_near(transform_matrix, transform, 1e-18)) { transform = transform_matrix; /* The SP_OBJECT_USER_MODIFIED_FLAG_B is used to mark the fact that it's only a transformation. It's apparently not used anywhere else. */ diff --git a/src/sp-item.h b/src/sp-item.h index 21b3d9006..b827f6555 100644 --- a/src/sp-item.h +++ b/src/sp-item.h @@ -19,14 +19,13 @@ * Released under GNU GPL, read the file 'COPYING' for more information */ #include <vector> +#include <2geom/forward.h> +#include <2geom/affine.h> +#include <2geom/rect.h> #include "display/display-forward.h" #include "sp-object.h" -#include <2geom/affine.h> -#include <libnr/nr-rect.h> -#include <2geom/forward.h> -#include <libnr/nr-convert2geom.h> -#include <snap-preferences.h> +#include "snap-preferences.h" #include "snap-candidate.h" class SPGuideConstraint; diff --git a/src/sp-pattern.h b/src/sp-pattern.h index ee7ffd477..acfa3e76e 100644 --- a/src/sp-pattern.h +++ b/src/sp-pattern.h @@ -27,7 +27,6 @@ GType sp_pattern_get_type (void); class SPPatternClass; -#include <libnr/nr-rect.h> #include "svg/svg-length.h" #include "sp-paint-server.h" #include "uri-references.h" diff --git a/src/sp-symbol.h b/src/sp-symbol.h index 536486bc3..59f343285 100644 --- a/src/sp-symbol.h +++ b/src/sp-symbol.h @@ -25,7 +25,6 @@ class SPSymbol; class SPSymbolClass; #include <2geom/affine.h> -#include <libnr/nr-rect.h> #include "svg/svg-length.h" #include "enums.h" #include "sp-item-group.h" diff --git a/src/star-context.cpp b/src/star-context.cpp index 878ecfbe7..c954fd7d7 100644 --- a/src/star-context.cpp +++ b/src/star-context.cpp @@ -34,7 +34,6 @@ #include "desktop.h" #include "desktop-style.h" #include "message-context.h" -#include "libnr/nr-macros.h" #include "pixmaps/cursor-star.xpm" #include "sp-metrics.h" #include <glibmm/i18n.h> diff --git a/src/ui/clipboard.cpp b/src/ui/clipboard.cpp index adec1de5d..bb89879fb 100644 --- a/src/ui/clipboard.cpp +++ b/src/ui/clipboard.cpp @@ -46,8 +46,6 @@ #include "extension/input.h" #include "extension/output.h" #include "selection-chemistry.h" -#include "libnr/nr-rect.h" -#include "libnr/nr-convert2geom.h" #include <2geom/rect.h> #include <2geom/transforms.h> #include "box3d.h" diff --git a/src/ui/dialog/align-and-distribute.h b/src/ui/dialog/align-and-distribute.h index 22227cb60..88d934f87 100644 --- a/src/ui/dialog/align-and-distribute.h +++ b/src/ui/dialog/align-and-distribute.h @@ -25,8 +25,6 @@ #include <gtkmm/table.h> #include <gtkmm/buttonbox.h> #include <gtkmm/label.h> -#include "libnr/nr-rect.h" - #include "ui/widget/panel.h" #include "ui/widget/notebook-page.h" diff --git a/src/ui/widget/style-subject.h b/src/ui/widget/style-subject.h index 73f818516..29684ec02 100644 --- a/src/ui/widget/style-subject.h +++ b/src/ui/widget/style-subject.h @@ -11,7 +11,6 @@ #include "util/glib-list-iterators.h" #include <boost/optional.hpp> -#include "libnr/nr-rect.h" #include <2geom/rect.h> #include "sp-item.h" #include <stddef.h> diff --git a/src/ui/widget/zoom-status.cpp b/src/ui/widget/zoom-status.cpp index 9322aa803..c6d6f19a3 100644 --- a/src/ui/widget/zoom-status.cpp +++ b/src/ui/widget/zoom-status.cpp @@ -20,7 +20,6 @@ #include "desktop.h" #include "desktop-handles.h" #include "widgets/spw-utilities.h" -#include "libnr/nr-convert2geom.h" namespace Inkscape { namespace UI { |
