diff options
| author | Krzysztof Kosi??ski <tweenk.pl@gmail.com> | 2011-07-09 00:52:06 +0000 |
|---|---|---|
| committer | Krzysztof KosiĆski <tweenk.pl@gmail.com> | 2011-07-09 00:52:06 +0000 |
| commit | a3e406b2ceafb8fb6b44db0a7816a083d7b3c8ee (patch) | |
| tree | 7e9a749edf47feed38908b5dad896f79f791c4e2 /src/libnr | |
| parent | Merge from trunk (diff) | |
| download | inkscape-a3e406b2ceafb8fb6b44db0a7816a083d7b3c8ee.tar.gz inkscape-a3e406b2ceafb8fb6b44db0a7816a083d7b3c8ee.zip | |
Add SPCanvasArena caching layer. Currently breaks for clipped groups
that contain filtered objects (Cairo clipping bug?)
(bzr r10347.1.6)
Diffstat (limited to 'src/libnr')
| -rw-r--r-- | src/libnr/nr-rect-l.cpp | 49 | ||||
| -rw-r--r-- | src/libnr/nr-rect-l.h | 7 | ||||
| -rw-r--r-- | src/libnr/nr-values.cpp | 3 |
3 files changed, 57 insertions, 2 deletions
diff --git a/src/libnr/nr-rect-l.cpp b/src/libnr/nr-rect-l.cpp index 08910a1d6..1cb268266 100644 --- a/src/libnr/nr-rect-l.cpp +++ b/src/libnr/nr-rect-l.cpp @@ -1,3 +1,52 @@ +#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++ diff --git a/src/libnr/nr-rect-l.h b/src/libnr/nr-rect-l.h index 6e82bb790..c4c5f5a6d 100644 --- a/src/libnr/nr-rect-l.h +++ b/src/libnr/nr-rect-l.h @@ -2,9 +2,16 @@ #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 */ diff --git a/src/libnr/nr-values.cpp b/src/libnr/nr-values.cpp index 5238353d4..06f33b13f 100644 --- a/src/libnr/nr-values.cpp +++ b/src/libnr/nr-values.cpp @@ -9,8 +9,7 @@ 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}; +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). */ |
