diff options
| author | Martin Owens <doctormo@gmail.com> | 2013-09-19 12:35:32 +0000 |
|---|---|---|
| committer | Martin Owens <doctormo@gmail.com> | 2013-09-19 12:35:32 +0000 |
| commit | 23b4c7fcb81ee195acb9bfd470723728f89bfc4a (patch) | |
| tree | 820a09b20afff98dddf38be7c13e8f5b40cc655f /src | |
| parent | Fixing colors in libdepixelize integration output. (diff) | |
| download | inkscape-23b4c7fcb81ee195acb9bfd470723728f89bfc4a.tar.gz inkscape-23b4c7fcb81ee195acb9bfd470723728f89bfc4a.zip | |
Revert some agressive changes and allow a seperate filter bbox for FER, should be refactored at some point.
(bzr r12536)
Diffstat (limited to 'src')
| -rw-r--r-- | src/display/drawing-item.cpp | 8 | ||||
| -rw-r--r-- | src/display/drawing-item.h | 2 | ||||
| -rw-r--r-- | src/display/nr-filter.cpp | 9 | ||||
| -rw-r--r-- | src/libnrtype/Layout-TNG-Output.cpp | 1 | ||||
| -rw-r--r-- | src/sp-item.cpp | 10 |
5 files changed, 26 insertions, 4 deletions
diff --git a/src/display/drawing-item.cpp b/src/display/drawing-item.cpp index 097a5fe76..a9836a9e3 100644 --- a/src/display/drawing-item.cpp +++ b/src/display/drawing-item.cpp @@ -281,6 +281,12 @@ DrawingItem::setZOrder(unsigned z) _markForRendering(); } +void +DrawingItem::setItemBounds(Geom::OptRect const &bounds) +{ + if (bounds) _filter_bbox = bounds; +} + /** * Update derived data before operations. * The purpose of this call is to recompute internal data which depends @@ -346,7 +352,7 @@ DrawingItem::update(Geom::IntRect const &area, UpdateContext const &ctx, unsigne if (to_update & STATE_BBOX) { // compute drawbox - if (_filter && render_filters) { + if (_filter && render_filters && _bbox) { Geom::IntRect newbox(*_bbox); _filter->area_enlarge(newbox, this); _drawbox = Geom::OptIntRect(newbox); diff --git a/src/display/drawing-item.h b/src/display/drawing-item.h index 650653ce2..8020659db 100644 --- a/src/display/drawing-item.h +++ b/src/display/drawing-item.h @@ -89,6 +89,7 @@ public: Geom::OptIntRect geometricBounds() const { return _bbox; } Geom::OptIntRect visualBounds() const { return _drawbox; } + Geom::OptRect filterBounds() const { return _filter_bbox; } Geom::Affine ctm() const { return _ctm; } Geom::Affine transform() const { return _transform ? *_transform : Geom::identity(); } Drawing &drawing() const { return _drawing; } @@ -174,6 +175,7 @@ protected: Geom::Affine _ctm; ///< Total transform from item coords to display coords Geom::OptIntRect _bbox; ///< Bounding box in display (pixel) coords including stroke Geom::OptIntRect _drawbox; ///< Full visual bounding box - enlarged by filters, shrunk by clips and masks + Geom::OptRect _filter_bbox; ///< Used by filters when settings bounds DrawingItem *_clip; DrawingItem *_mask; diff --git a/src/display/nr-filter.cpp b/src/display/nr-filter.cpp index 54bd36168..a0103cbb0 100644 --- a/src/display/nr-filter.cpp +++ b/src/display/nr-filter.cpp @@ -115,12 +115,15 @@ int Filter::render(Inkscape::DrawingItem const *item, DrawingContext &graphic, D Geom::Affine trans = item->ctm(); // Get filter are, the filter_effect_area is already done in visualBounds - Geom::OptRect filter_area = item->geometricBounds(); - if (!filter_area) return 1; + Geom::OptRect filter_area = item->filterBounds(); + // Use the geometricBounds as a backup solution + if (!filter_area || (filter_area->hasZeroArea() && + filter_area->min()[Geom::X] == 0 && filter_area->min()[Geom::Y] == 0)) + filter_area = item->geometricBounds(); FilterUnits units(_filter_units, _primitive_units); units.set_ctm(trans); - units.set_item_bbox(item->geometricBounds()); + units.set_item_bbox(filter_area); units.set_filter_area(*filter_area); std::pair<double,double> resolution diff --git a/src/libnrtype/Layout-TNG-Output.cpp b/src/libnrtype/Layout-TNG-Output.cpp index 9967ba149..f7f910c2f 100644 --- a/src/libnrtype/Layout-TNG-Output.cpp +++ b/src/libnrtype/Layout-TNG-Output.cpp @@ -181,6 +181,7 @@ void Layout::show(DrawingGroup *in_arena, Geom::OptRect const &paintbox) const glyph_index++; } nr_text->setStyle(text_source->style); + nr_text->setItemBounds(paintbox); in_arena->prependChild(nr_text); } } diff --git a/src/sp-item.cpp b/src/sp-item.cpp index 52ccdbdd4..e6991a1fa 100644 --- a/src/sp-item.cpp +++ b/src/sp-item.cpp @@ -601,6 +601,15 @@ void SPItem::update(SPCtx *ctx, guint flags) { } } } + /* Update bounding box data used by filters */ + if (item->style->filter.set && item->display) { + Geom::OptRect item_bbox = item->visualBounds(); + SPItemView *itemview = item->display; + do { + if (itemview->arenaitem) + itemview->arenaitem->setItemBounds(item_bbox); + } while ( (itemview = itemview->next) ); + } // Update libavoid with item geometry (for connector routing). if (item->avoidRef) @@ -1050,6 +1059,7 @@ Inkscape::DrawingItem *SPItem::invoke_show(Inkscape::Drawing &drawing, unsigned item_bbox = visualBounds(); } ai->setData(this); + ai->setItemBounds(item_bbox); } return ai; |
