From c88be829a2fccea2277bdfcd362db30b26da43a3 Mon Sep 17 00:00:00 2001 From: johanengelen Date: Sun, 25 Jan 2009 00:16:22 +0000 Subject: [PATCH] fix percentage coordinates for ellipses. (svgtestsuite-1.1/coords-units-02-b.svg) --- src/sp-ellipse.cpp | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/sp-ellipse.cpp b/src/sp-ellipse.cpp index 0d28e9f6b..b5f3df1cb 100644 --- a/src/sp-ellipse.cpp +++ b/src/sp-ellipse.cpp @@ -143,13 +143,16 @@ sp_genericellipse_update(SPObject *object, SPCtx *ctx, guint flags) if (flags & (SP_OBJECT_MODIFIED_FLAG | SP_OBJECT_STYLE_MODIFIED_FLAG | SP_OBJECT_VIEWPORT_MODIFIED_FLAG)) { SPGenericEllipse *ellipse = (SPGenericEllipse *) object; SPStyle const *style = object->style; - double const d = 1.0 / NR::expansion(((SPItemCtx const *) ctx)->i2vp); + Geom::OptRect viewbox = ((SPItemCtx const *) ctx)->vp; + double const dx = viewbox->width(); + double const dy = viewbox->height(); + double const dr = sqrt(dx*dx + dy*dy)/sqrt(2); double const em = style->font_size.computed; double const ex = em * 0.5; // fixme: get from pango or libnrtype - ellipse->cx.update(em, ex, d); - ellipse->cy.update(em, ex, d); - ellipse->rx.update(em, ex, d); - ellipse->ry.update(em, ex, d); + ellipse->cx.update(em, ex, dx); + ellipse->cy.update(em, ex, dy); + ellipse->rx.update(em, ex, dr); + ellipse->ry.update(em, ex, dr); sp_shape_set_shape((SPShape *) object); } -- 2.30.2