diff options
| author | Martin Owens <doctormo@gmail.com> | 2014-02-28 15:50:05 +0000 |
|---|---|---|
| committer | Martin Owens <doctormo@gmail.com> | 2014-02-28 15:50:05 +0000 |
| commit | 1bc1b442d8ec6f394f456c4675d5ca7f6aa1d0d6 (patch) | |
| tree | 0b4c86988abeb6c01b23324f159bd0a8a936f485 /src/sp-filter.cpp | |
| parent | Improved uri testing (diff) | |
| parent | Spray tool: (diff) | |
| download | inkscape-1bc1b442d8ec6f394f456c4675d5ca7f6aa1d0d6.tar.gz inkscape-1bc1b442d8ec6f394f456c4675d5ca7f6aa1d0d6.zip | |
Merge to trunk
(bzr r13047.1.7)
Diffstat (limited to 'src/sp-filter.cpp')
| -rw-r--r-- | src/sp-filter.cpp | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/src/sp-filter.cpp b/src/sp-filter.cpp index c3e7d217e..0e3d2d5ce 100644 --- a/src/sp-filter.cpp +++ b/src/sp-filter.cpp @@ -28,6 +28,7 @@ using std::pair; #include "sp-filter.h" #include "sp-filter-reference.h" #include "sp-filter-primitive.h" +#include "sp-item.h" #include "uri.h" #include "xml/repr.h" #include <cstring> @@ -206,6 +207,33 @@ void SPFilter::update(SPCtx *ctx, guint flags) { if (flags & (SP_OBJECT_MODIFIED_FLAG | SP_OBJECT_STYLE_MODIFIED_FLAG | SP_OBJECT_VIEWPORT_MODIFIED_FLAG)) { + SPItemCtx *ictx = (SPItemCtx *) ctx; + + // Do here since we know viewport (Bounding box case handled during rendering) + // Note: This only works for root viewport since this routine is not called after + // setting a new viewport. A true fix requires a strategy like SPItemView or SPMarkerView. + if(this->filterUnits == SP_FILTER_UNITS_USERSPACEONUSE) { + std::cout << " userSpaceOnUse" << std::endl; + if (this->x.unit == SVGLength::PERCENT) { + this->x._set = true; + this->x.computed = this->x.value * ictx->viewport.width(); + } + + if (this->y.unit == SVGLength::PERCENT) { + this->y._set = true; + this->y.computed = this->y.value * ictx->viewport.height(); + } + + if (this->width.unit == SVGLength::PERCENT) { + this->width._set = true; + this->width.computed = this->width.value * ictx->viewport.width(); + } + + if (this->height.unit == SVGLength::PERCENT) { + this->height._set = true; + this->height.computed = this->height.value * ictx->viewport.height(); + } + } /* do something to trigger redisplay, updates? */ } |
