From 3eae8aa890673270d0907d55395ccaf5368cea37 Mon Sep 17 00:00:00 2001 From: Shlomi Fish Date: Thu, 5 Oct 2017 17:33:06 +0300 Subject: Extract a base class, SPDimensions. From two places getting rid of duplicate code. --- src/sp-image.cpp | 17 +---------------- 1 file changed, 1 insertion(+), 16 deletions(-) (limited to 'src/sp-image.cpp') diff --git a/src/sp-image.cpp b/src/sp-image.cpp index 1961971cb..6736efdec 100644 --- a/src/sp-image.cpp +++ b/src/sp-image.cpp @@ -374,23 +374,8 @@ void SPImage::update(SPCtx *ctx, unsigned int flags) { } } - // Calculate x, y, width, height from parent/initial viewport, see sp-root.cpp - if (this->x.unit == SVGLength::PERCENT) { - this->x.computed = this->x.value * ictx->viewport.width(); - } - - if (this->y.unit == SVGLength::PERCENT) { - this->y.computed = this->y.value * ictx->viewport.height(); - } - - if (this->width.unit == SVGLength::PERCENT) { - this->width.computed = this->width.value * ictx->viewport.width(); - } - - if (this->height.unit == SVGLength::PERCENT) { - this->height.computed = this->height.value * ictx->viewport.height(); - } + this->calcDimsFromParentViewport(ictx); // Image creates a new viewport ictx->viewport= Geom::Rect::from_xywh( this->x.computed, this->y.computed, -- cgit v1.2.3