diff options
| author | Krzysztof Kosi??ski <tweenk.pl@gmail.com> | 2011-08-28 22:53:56 +0000 |
|---|---|---|
| committer | Krzysztof Kosinski <tweenk.pl@gmail.com> | 2011-08-28 22:53:56 +0000 |
| commit | f4b79d4a8edc870f099fb9194c8493ec04012ad1 (patch) | |
| tree | 2951d5171168abc288c00d09d04f5e5737e779d5 /src/marker.cpp | |
| parent | Tie the snapping of rectangle corners and quadrant points of ellipses to the ... (diff) | |
| parent | Completely remove libnr (diff) | |
| download | inkscape-f4b79d4a8edc870f099fb9194c8493ec04012ad1.tar.gz inkscape-f4b79d4a8edc870f099fb9194c8493ec04012ad1.zip | |
Completely remove libnr
(bzr r10589)
Diffstat (limited to 'src/marker.cpp')
| -rw-r--r-- | src/marker.cpp | 54 |
1 files changed, 24 insertions, 30 deletions
diff --git a/src/marker.cpp b/src/marker.cpp index c8fa9218d..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" @@ -45,7 +44,7 @@ static Inkscape::XML::Node *sp_marker_write (SPObject *object, Inkscape::XML::Do static Inkscape::DrawingItem *sp_marker_private_show (SPItem *item, Inkscape::Drawing &drawing, unsigned int key, unsigned int flags); static void sp_marker_private_hide (SPItem *item, unsigned int key); -static void sp_marker_bbox(SPItem const *item, NRRect *bbox, Geom::Affine const &transform, unsigned const flags); +static Geom::OptRect sp_marker_bbox(SPItem const *item, Geom::Affine const &transform, SPItem::BBoxType type); static void sp_marker_print (SPItem *item, SPPrintContext *ctx); static void sp_marker_view_remove (SPMarker *marker, SPMarkerView *view, unsigned int destroyitems); @@ -349,10 +348,7 @@ static void sp_marker_update(SPObject *object, SPCtx *ctx, guint flags) rctx.i2doc = Geom::identity(); rctx.i2vp = Geom::identity(); /* Set up viewport */ - rctx.vp.x0 = 0.0; - rctx.vp.y0 = 0.0; - rctx.vp.x1 = marker->markerWidth.computed; - rctx.vp.y1 = marker->markerHeight.computed; + rctx.viewport = Geom::Rect::from_xywh(0, 0, marker->markerWidth.computed, marker->markerHeight.computed); /* Start with identity transform */ marker->c2p.setIdentity(); @@ -361,20 +357,20 @@ static void sp_marker_update(SPObject *object, SPCtx *ctx, guint flags) if (marker->viewBox) { vb = *marker->viewBox; } else { - vb = *(rctx.vp.upgrade_2geom()); + vb = rctx.viewport; } /* Now set up viewbox transformation */ /* Determine actual viewbox in viewport coordinates */ if (marker->aspect_align == SP_ASPECT_NONE) { x = 0.0; y = 0.0; - width = rctx.vp.x1 - rctx.vp.x0; - height = rctx.vp.y1 - rctx.vp.y0; + width = rctx.viewport.width(); + height = rctx.viewport.height(); } else { double scalex, scaley, scale; /* Things are getting interesting */ - scalex = (rctx.vp.x1 - rctx.vp.x0) / (vb.width()); - scaley = (rctx.vp.y1 - rctx.vp.y0) / (vb.height()); + scalex = rctx.viewport.width() / (vb.width()); + scaley = rctx.viewport.height() / (vb.height()); scale = (marker->aspect_clip == SP_ASPECT_MEET) ? MIN (scalex, scaley) : MAX (scalex, scaley); width = (vb.width()) * scale; height = (vb.height()) * scale; @@ -385,36 +381,36 @@ static void sp_marker_update(SPObject *object, SPCtx *ctx, guint flags) y = 0.0; break; case SP_ASPECT_XMID_YMIN: - x = 0.5 * ((rctx.vp.x1 - rctx.vp.x0) - width); + x = 0.5 * (rctx.viewport.width() - width); y = 0.0; break; case SP_ASPECT_XMAX_YMIN: - x = 1.0 * ((rctx.vp.x1 - rctx.vp.x0) - width); + x = 1.0 * (rctx.viewport.width() - width); y = 0.0; break; case SP_ASPECT_XMIN_YMID: x = 0.0; - y = 0.5 * ((rctx.vp.y1 - rctx.vp.y0) - height); + y = 0.5 * (rctx.viewport.height() - height); break; case SP_ASPECT_XMID_YMID: - x = 0.5 * ((rctx.vp.x1 - rctx.vp.x0) - width); - y = 0.5 * ((rctx.vp.y1 - rctx.vp.y0) - height); + x = 0.5 * (rctx.viewport.width() - width); + y = 0.5 * (rctx.viewport.height() - height); break; case SP_ASPECT_XMAX_YMID: - x = 1.0 * ((rctx.vp.x1 - rctx.vp.x0) - width); - y = 0.5 * ((rctx.vp.y1 - rctx.vp.y0) - height); + x = 1.0 * (rctx.viewport.width() - width); + y = 0.5 * (rctx.viewport.height() - height); break; case SP_ASPECT_XMIN_YMAX: x = 0.0; - y = 1.0 * ((rctx.vp.y1 - rctx.vp.y0) - height); + y = 1.0 * (rctx.viewport.height() - height); break; case SP_ASPECT_XMID_YMAX: - x = 0.5 * ((rctx.vp.x1 - rctx.vp.x0) - width); - y = 1.0 * ((rctx.vp.y1 - rctx.vp.y0) - height); + x = 0.5 * (rctx.viewport.width() - width); + y = 1.0 * (rctx.viewport.height() - height); break; case SP_ASPECT_XMAX_YMAX: - x = 1.0 * ((rctx.vp.x1 - rctx.vp.x0) - width); - y = 1.0 * ((rctx.vp.y1 - rctx.vp.y0) - height); + x = 1.0 * (rctx.viewport.width() - width); + y = 1.0 * (rctx.viewport.height() - height); break; default: x = 0.0; @@ -432,10 +428,7 @@ static void sp_marker_update(SPObject *object, SPCtx *ctx, guint flags) /* If viewBox is set reinitialize child viewport */ /* Otherwise it already correct */ if (marker->viewBox) { - rctx.vp.x0 = marker->viewBox->min()[Geom::X]; - rctx.vp.y0 = marker->viewBox->min()[Geom::Y]; - rctx.vp.x1 = marker->viewBox->max()[Geom::X]; - rctx.vp.y1 = marker->viewBox->max()[Geom::Y]; + rctx.viewport = *marker->viewBox; rctx.i2vp = Geom::identity(); } @@ -541,10 +534,11 @@ sp_marker_private_hide (SPItem */*item*/, unsigned int /*key*/) /** * This routine is disabled to break propagation. */ -static void -sp_marker_bbox(SPItem const *, NRRect *, Geom::Affine const &, unsigned const) +static Geom::OptRect +sp_marker_bbox(SPItem const *, Geom::Affine const &, SPItem::BBoxType) { - /* Break propagation */ + /* Break propagation */ + return Geom::OptRect(); } /** |
