diff options
| author | Jabier Arraiza <jabier.arraiza@marker.es> | 2019-10-23 09:22:18 +0000 |
|---|---|---|
| committer | Jabier Arraiza <jabier.arraiza@marker.es> | 2019-10-23 09:22:18 +0000 |
| commit | ca75d29815a7d6548227fd2b5fb4f084d3ade2da (patch) | |
| tree | 6eb55edf6efe3de27eca7c3e430f7e5b83dc4856 /src/display | |
| parent | Small update for Hungarian translation (diff) | |
| download | inkscape-ca75d29815a7d6548227fd2b5fb4f084d3ade2da.tar.gz inkscape-ca75d29815a7d6548227fd2b5fb4f084d3ade2da.zip | |
Fix isolation issues
Diffstat (limited to 'src/display')
| -rw-r--r-- | src/display/drawing-group.cpp | 23 | ||||
| -rw-r--r-- | src/display/drawing-item.cpp | 21 |
2 files changed, 18 insertions, 26 deletions
diff --git a/src/display/drawing-group.cpp b/src/display/drawing-group.cpp index 337a6bcd9..e2fb26581 100644 --- a/src/display/drawing-group.cpp +++ b/src/display/drawing-group.cpp @@ -93,20 +93,11 @@ DrawingGroup::_updateItem(Geom::IntRect const &area, UpdateContext const &ctx, u unsigned DrawingGroup::_renderItem(DrawingContext &dc, Geom::IntRect const &area, unsigned flags, DrawingItem *stop_at) { - bool isolated = false; - if (!parent() || _isolation == SP_CSS_ISOLATION_ISOLATE || _mix_blend_mode) { - isolated = true; - } - int device_scale = dc.surface()->device_scale(); - DrawingSurface intermediate(area, device_scale); - DrawingContext ict(intermediate); - ict.setOperator(CAIRO_OPERATOR_OVER); - if (stop_at == nullptr) { // normal rendering for (auto &i : _children) { i.setAntialiasing(_antialias); - i.render(isolated ? ict : dc, area, flags, stop_at); + i.render(dc, area, flags, stop_at); } } else { // background rendering @@ -116,20 +107,14 @@ DrawingGroup::_renderItem(DrawingContext &dc, Geom::IntRect const &area, unsigne if (i.isAncestorOf(stop_at)) { // render its ancestors without masks, opacity or filters i.setAntialiasing(_antialias); - i.render(isolated ? ict : dc, area, flags | RENDER_FILTER_BACKGROUND, stop_at); - break; + i.render(dc, area, flags | RENDER_FILTER_BACKGROUND, stop_at); + return RENDER_OK; } else { i.setAntialiasing(_antialias); - i.render(isolated ? ict : dc, area, flags, stop_at); + i.render(dc, area, flags, stop_at); } } } - if (isolated) { - dc.rectangle(area); - dc.setSource(&intermediate); - dc.setOperator(ink_css_blend_to_cairo_operator(_mix_blend_mode)); - dc.fill(); - } return RENDER_OK; } diff --git a/src/display/drawing-item.cpp b/src/display/drawing-item.cpp index 94d41674c..eba5fb6e2 100644 --- a/src/display/drawing-item.cpp +++ b/src/display/drawing-item.cpp @@ -98,7 +98,6 @@ DrawingItem::~DrawingItem() if (_parent) { _markForRendering(); } - switch (_child_type) { case CHILD_NORMAL: { ChildrenList::iterator ithis = _parent->_children.iterator_to(*this); @@ -677,7 +676,7 @@ DrawingItem::render(DrawingContext &dc, Geom::IntRect const &area, unsigned flag // expand render on filtered items Geom::OptIntRect cl = _cacheRect(); if (_filter != nullptr && render_filters && cl) { - setCached(true, true); + setCached(_cached, true); carea = cl; } @@ -707,7 +706,7 @@ DrawingItem::render(DrawingContext &dc, Geom::IntRect const &area, unsigned flag // Render from cache if possible // Bypass in case of pattern, see below. - if (_cached && !(flags & RENDER_BYPASS_CACHE) && !(flags & RENDER_FILTER_BACKGROUND)) { + if (_cached && !(flags & RENDER_BYPASS_CACHE)) { if (_cache) { _cache->prepare(); dc.setOperator(ink_css_blend_to_cairo_operator(_mix_blend_mode)); @@ -733,14 +732,20 @@ DrawingItem::render(DrawingContext &dc, Geom::IntRect const &area, unsigned flag bool &nir = needs_intermediate_rendering; bool needs_opacity = (_opacity < 0.995); - // this item needs an intermediate rendering if: + // this item needs an intermediate rendering if: nir |= (_clip != nullptr); // 1. it has a clipping path nir |= (_mask != nullptr); // 2. it has a mask nir |= (_filter != nullptr && render_filters); // 3. it has a filter nir |= needs_opacity; // 4. it is non-opaque - nir |= (_mix_blend_mode != SP_CSS_BLEND_NORMAL); // 5. it has blend mode + nir |= (_mix_blend_mode != SP_CSS_BLEND_NORMAL); // 5. it has blend mode + nir |= (_isolation == SP_CSS_ISOLATION_ISOLATE); // 6. it is isolated + nir |= !parent(); // 7. is root need isolation from background if (prev_nir && !needs_intermediate_rendering) { setCached(false, true); + if (_has_cache_iterator) { + _drawing._candidate_items.erase(_cache_iterator); + _has_cache_iterator = false; + } } prev_nir = needs_intermediate_rendering; nir |= (_cache != nullptr); // 5. it is to be cached @@ -756,7 +761,6 @@ DrawingItem::render(DrawingContext &dc, Geom::IntRect const &area, unsigned flag * the entire intermediate surface is painted with alpha corresponding * to the opacity value. * - * Isolation: Is handled in drawing-group */ // Short-circuit the simple case. // We also use this path for filter background rendering, because masking, clipping, @@ -1042,7 +1046,7 @@ DrawingItem::_markForRendering() { // TODO: this function does too much work when a large subtree // is invalidated - fix - + bool outline = _drawing.outline(); Geom::OptIntRect dirty = outline ? _bbox : _drawbox; if (!dirty) return; @@ -1131,6 +1135,9 @@ DrawingItem::_cacheScore() { Geom::OptIntRect cache_rect = _cacheRect(); if (!cache_rect) return -1.0; + if (is_drawing_group(this) && !prev_nir) { + return -1.0; + } // a crude first approximation: // the basic score is the number of pixels in the drawbox |
