From 13c192e2fa564c0a743e13e30b1cf6de9b1a39a6 Mon Sep 17 00:00:00 2001 From: "Liam P. White" Date: Wed, 12 Mar 2014 08:56:04 -0400 Subject: Reverted swatches Removed a toy effect (not ready yet) Fixed a bug with Livarot General cleanup (bzr r13090.1.23) --- src/display/drawing-item.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/display/drawing-item.cpp') diff --git a/src/display/drawing-item.cpp b/src/display/drawing-item.cpp index 13e7b61eb..6c7f99d42 100644 --- a/src/display/drawing-item.cpp +++ b/src/display/drawing-item.cpp @@ -808,9 +808,10 @@ DrawingItem::pick(Geom::Point const &p, double delta, unsigned flags) { // Sometimes there's no BBOX in state, reason unknown (bug 992817) // I made this not an assert to remove the warning + // This warning clutters the console output, so commented out if (!(_state & STATE_BBOX) || !(_state & STATE_PICK)) { - g_warning("Invalid state when picking: STATE_BBOX = %d, STATE_PICK = %d", - _state & STATE_BBOX, _state & STATE_PICK); + /*g_warning("Invalid state when picking: STATE_BBOX = %d, STATE_PICK = %d", + _state & STATE_BBOX, _state & STATE_PICK);*/ return NULL; } // ignore invisible and insensitive items unless sticky -- cgit v1.2.3 From a4d440c162b02f2fe2099a0ac1c7796609a686e7 Mon Sep 17 00:00:00 2001 From: Tavmjong Bah Date: Wed, 30 Apr 2014 20:40:20 +0200 Subject: Enable 'mix-blend-mode' property (rendering only). (bzr r13326) --- src/display/drawing-item.cpp | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) (limited to 'src/display/drawing-item.cpp') diff --git a/src/display/drawing-item.cpp b/src/display/drawing-item.cpp index ccf905e81..938330b02 100644 --- a/src/display/drawing-item.cpp +++ b/src/display/drawing-item.cpp @@ -23,7 +23,6 @@ namespace Inkscape { -#ifdef WITH_CSSBLEND void set_cairo_blend_operator( DrawingContext &dc, unsigned blend_mode ) { // All of the blend modes are implemented in Cairo as of 1.10. @@ -81,7 +80,6 @@ void set_cairo_blend_operator( DrawingContext &dc, unsigned blend_mode ) { break; } } -#endif /** * @class DrawingItem @@ -594,9 +592,8 @@ DrawingItem::render(DrawingContext &dc, Geom::IntRect const &area, unsigned flag if (_cached) { if (_cache) { _cache->prepare(); -#ifdef WITH_CSSBLEND set_cairo_blend_operator( dc, _blend_mode ); -#endif + _cache->paintFromCache(dc, carea); if (!carea) return RENDER_OK; } else { @@ -625,10 +622,8 @@ DrawingItem::render(DrawingContext &dc, Geom::IntRect const &area, unsigned flag nir |= (_filter != NULL && render_filters); // 3. it has a filter nir |= needs_opacity; // 4. it is non-opaque nir |= (_cache != NULL); // 5. it is cached -#ifdef WITH_CSSBLEND nir |= (_blend_mode != SP_CSS_BLEND_NORMAL); // 6. Blend mode not normal nir |= (_isolation == SP_CSS_ISOLATION_ISOLATE); // 7. Explicit isolatiom -#endif /* How the rendering is done. * @@ -740,9 +735,7 @@ DrawingItem::render(DrawingContext &dc, Geom::IntRect const &area, unsigned flag } dc.rectangle(*carea); dc.setSource(&intermediate); -#ifdef WITH_CSSBLEND set_cairo_blend_operator( dc, _blend_mode ); -#endif dc.fill(); dc.setSource(0,0,0,0); // the call above is to clear a ref on the intermediate surface held by dc -- cgit v1.2.3 From 8f373840d0a408d43d2a6712c638463637890e97 Mon Sep 17 00:00:00 2001 From: Diederik van Lierop Date: Sat, 3 May 2014 23:37:36 +0200 Subject: Fix bounding box cache issues in general, and prevent the selector tool from updating anything in case of identity affines (which prevents the bounding box from being invalidated) Fixed bugs: - https://launchpad.net/bugs/1256597 (bzr r13333) --- src/display/drawing-item.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/display/drawing-item.cpp') diff --git a/src/display/drawing-item.cpp b/src/display/drawing-item.cpp index 938330b02..0bfb00b62 100644 --- a/src/display/drawing-item.cpp +++ b/src/display/drawing-item.cpp @@ -407,7 +407,7 @@ DrawingItem::setItemBounds(Geom::OptRect const &bounds) * @param reset State fields that should be reset before processing them. This is * a means to force a recomputation of internal data even if the item * considers it up to date. Mainly for internal use, such as - * propagating bunding box recomputation to children when the item's + * propagating bounding box recomputation to children when the item's * transform changes. */ void -- cgit v1.2.3 From 8b31d0e28a6cf0f916f5267c54fed76c712c48a3 Mon Sep 17 00:00:00 2001 From: Tavmjong Bah Date: Fri, 1 Aug 2014 10:13:43 +0200 Subject: Rename 'blend-mode' property to 'mix-blend-mode' per CSS spec. (bzr r13341.1.113) --- src/display/drawing-item.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'src/display/drawing-item.cpp') diff --git a/src/display/drawing-item.cpp b/src/display/drawing-item.cpp index 0bfb00b62..80eb69546 100644 --- a/src/display/drawing-item.cpp +++ b/src/display/drawing-item.cpp @@ -127,7 +127,7 @@ DrawingItem::DrawingItem(Drawing &drawing) , _pick_children(0) , _antialias(1) , _isolation(SP_CSS_ISOLATION_AUTO) - , _blend_mode(SP_CSS_BLEND_NORMAL) + , _mix_blend_mode(SP_CSS_BLEND_NORMAL) {} DrawingItem::~DrawingItem() @@ -291,10 +291,10 @@ DrawingItem::setIsolation(unsigned isolation) } void -DrawingItem::setBlendMode(unsigned blend_mode) +DrawingItem::setBlendMode(unsigned mix_blend_mode) { - _blend_mode = blend_mode; - //if( blend_mode != 0 ) std::cout << "setBlendMode: " << blend_mode << std::endl; + _mix_blend_mode = mix_blend_mode; + //if( mix_blend_mode != 0 ) std::cout << "setBlendMode: " << mix_blend_mode << std::endl; _markForRendering(); } @@ -592,7 +592,7 @@ DrawingItem::render(DrawingContext &dc, Geom::IntRect const &area, unsigned flag if (_cached) { if (_cache) { _cache->prepare(); - set_cairo_blend_operator( dc, _blend_mode ); + set_cairo_blend_operator( dc, _mix_blend_mode ); _cache->paintFromCache(dc, carea); if (!carea) return RENDER_OK; @@ -622,7 +622,7 @@ DrawingItem::render(DrawingContext &dc, Geom::IntRect const &area, unsigned flag nir |= (_filter != NULL && render_filters); // 3. it has a filter nir |= needs_opacity; // 4. it is non-opaque nir |= (_cache != NULL); // 5. it is cached - nir |= (_blend_mode != SP_CSS_BLEND_NORMAL); // 6. Blend mode not normal + nir |= (_mix_blend_mode != SP_CSS_BLEND_NORMAL); // 6. Blend mode not normal nir |= (_isolation == SP_CSS_ISOLATION_ISOLATE); // 7. Explicit isolatiom /* How the rendering is done. @@ -735,7 +735,7 @@ DrawingItem::render(DrawingContext &dc, Geom::IntRect const &area, unsigned flag } dc.rectangle(*carea); dc.setSource(&intermediate); - set_cairo_blend_operator( dc, _blend_mode ); + set_cairo_blend_operator( dc, _mix_blend_mode ); dc.fill(); dc.setSource(0,0,0,0); // the call above is to clear a ref on the intermediate surface held by dc -- cgit v1.2.3 From 97a4ef4fd8b0c841a90f3bb29dee13fd96edecb7 Mon Sep 17 00:00:00 2001 From: Tavmjong Bah Date: Fri, 1 Aug 2014 11:04:51 +0200 Subject: Rename 'blend-mode' property to 'mix-blend-mode' per CSS spec. (bzr r13485) --- src/display/drawing-item.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'src/display/drawing-item.cpp') diff --git a/src/display/drawing-item.cpp b/src/display/drawing-item.cpp index 0bfb00b62..80eb69546 100644 --- a/src/display/drawing-item.cpp +++ b/src/display/drawing-item.cpp @@ -127,7 +127,7 @@ DrawingItem::DrawingItem(Drawing &drawing) , _pick_children(0) , _antialias(1) , _isolation(SP_CSS_ISOLATION_AUTO) - , _blend_mode(SP_CSS_BLEND_NORMAL) + , _mix_blend_mode(SP_CSS_BLEND_NORMAL) {} DrawingItem::~DrawingItem() @@ -291,10 +291,10 @@ DrawingItem::setIsolation(unsigned isolation) } void -DrawingItem::setBlendMode(unsigned blend_mode) +DrawingItem::setBlendMode(unsigned mix_blend_mode) { - _blend_mode = blend_mode; - //if( blend_mode != 0 ) std::cout << "setBlendMode: " << blend_mode << std::endl; + _mix_blend_mode = mix_blend_mode; + //if( mix_blend_mode != 0 ) std::cout << "setBlendMode: " << mix_blend_mode << std::endl; _markForRendering(); } @@ -592,7 +592,7 @@ DrawingItem::render(DrawingContext &dc, Geom::IntRect const &area, unsigned flag if (_cached) { if (_cache) { _cache->prepare(); - set_cairo_blend_operator( dc, _blend_mode ); + set_cairo_blend_operator( dc, _mix_blend_mode ); _cache->paintFromCache(dc, carea); if (!carea) return RENDER_OK; @@ -622,7 +622,7 @@ DrawingItem::render(DrawingContext &dc, Geom::IntRect const &area, unsigned flag nir |= (_filter != NULL && render_filters); // 3. it has a filter nir |= needs_opacity; // 4. it is non-opaque nir |= (_cache != NULL); // 5. it is cached - nir |= (_blend_mode != SP_CSS_BLEND_NORMAL); // 6. Blend mode not normal + nir |= (_mix_blend_mode != SP_CSS_BLEND_NORMAL); // 6. Blend mode not normal nir |= (_isolation == SP_CSS_ISOLATION_ISOLATE); // 7. Explicit isolatiom /* How the rendering is done. @@ -735,7 +735,7 @@ DrawingItem::render(DrawingContext &dc, Geom::IntRect const &area, unsigned flag } dc.rectangle(*carea); dc.setSource(&intermediate); - set_cairo_blend_operator( dc, _blend_mode ); + set_cairo_blend_operator( dc, _mix_blend_mode ); dc.fill(); dc.setSource(0,0,0,0); // the call above is to clear a ref on the intermediate surface held by dc -- cgit v1.2.3 From a5e84125b62bf41871b57d93e457db81ee139485 Mon Sep 17 00:00:00 2001 From: "Liam P. White" Date: Mon, 18 Aug 2014 17:18:05 -0400 Subject: Fix build (not pretty). (bzr r13341.1.146) --- src/display/drawing-item.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src/display/drawing-item.cpp') diff --git a/src/display/drawing-item.cpp b/src/display/drawing-item.cpp index 80eb69546..bd6fb41d8 100644 --- a/src/display/drawing-item.cpp +++ b/src/display/drawing-item.cpp @@ -10,8 +10,7 @@ */ #include -#include "display/cairo-utils.h" -#include "display/cairo-templates.h" + #include "display/drawing.h" #include "display/drawing-context.h" #include "display/drawing-item.h" @@ -21,6 +20,9 @@ #include "preferences.h" #include "style.h" +#include "display/cairo-utils.h" +#include "display/cairo-templates.h" + namespace Inkscape { void set_cairo_blend_operator( DrawingContext &dc, unsigned blend_mode ) { -- cgit v1.2.3 From 2f2f164bbe75b4a4bb6d553242cecd587ed03456 Mon Sep 17 00:00:00 2001 From: "Johan B. C. Engelen" Date: Sun, 12 Oct 2014 19:25:47 +0200 Subject: DrawingItem: add NULL check (bug found by clang static analyzer) (bzr r13603) --- src/display/drawing-item.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/display/drawing-item.cpp') diff --git a/src/display/drawing-item.cpp b/src/display/drawing-item.cpp index 80eb69546..2ea3641dc 100644 --- a/src/display/drawing-item.cpp +++ b/src/display/drawing-item.cpp @@ -967,7 +967,7 @@ DrawingItem::_setStyleCommon(SPStyle *&_style, SPStyle *style) if (_style) sp_style_unref(_style); _style = style; - if (style->filter.set && style->getFilter()) { + if (style && style->filter.set && style->getFilter()) { if (!_filter) { int primitives = sp_filter_primitive_count(SP_FILTER(style->getFilter())); _filter = new Inkscape::Filters::Filter(primitives); -- cgit v1.2.3 From 703ddb77480e2e7ddeda21aa3b7d9a91ff8f23d2 Mon Sep 17 00:00:00 2001 From: Tomasz Boczkowski Date: Tue, 14 Oct 2014 11:26:38 +0200 Subject: Merged src/display folder from svg-paints-support branch (bzr r13611.1.1) --- src/display/drawing-item.cpp | 45 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) (limited to 'src/display/drawing-item.cpp') diff --git a/src/display/drawing-item.cpp b/src/display/drawing-item.cpp index 2ea3641dc..5226edda3 100644 --- a/src/display/drawing-item.cpp +++ b/src/display/drawing-item.cpp @@ -16,6 +16,7 @@ #include "display/drawing-context.h" #include "display/drawing-item.h" #include "display/drawing-group.h" +#include "display/drawing-pattern.h" #include "display/drawing-surface.h" #include "nr-filter.h" #include "preferences.h" @@ -110,6 +111,8 @@ DrawingItem::DrawingItem(Drawing &drawing) , _transform(NULL) , _clip(NULL) , _mask(NULL) + , _fill_pattern(NULL) + , _stroke_pattern(NULL) , _filter(NULL) , _user_data(NULL) , _cache(NULL) @@ -164,6 +167,12 @@ DrawingItem::~DrawingItem() case CHILD_ROOT: _drawing._root = NULL; break; + case CHILD_FILL_PATTERN: + _parent->_fill_pattern = NULL; + break; + case CHILD_STROKE_PATTERN: + _parent->_stroke_pattern = NULL; + break; default: ; } @@ -172,6 +181,8 @@ DrawingItem::~DrawingItem() } clearChildren(); delete _transform; + delete _stroke_pattern; + delete _fill_pattern; delete _clip; delete _mask; delete _filter; @@ -366,6 +377,34 @@ DrawingItem::setMask(DrawingItem *item) _markForUpdate(STATE_ALL, true); } +void +DrawingItem::setFillPattern(DrawingPattern *pattern) +{ + _markForRendering(); + delete _fill_pattern; + _fill_pattern = pattern; + if (pattern) { + pattern->_parent = this; + assert(pattern->_child_type == CHILD_ORPHAN); + pattern->_child_type = CHILD_FILL_PATTERN; + } + _markForUpdate(STATE_ALL, true); +} + +void +DrawingItem::setStrokePattern(DrawingPattern *pattern) +{ + _markForRendering(); + delete _stroke_pattern; + _stroke_pattern = pattern; + if (pattern) { + pattern->_parent = this; + assert(pattern->_child_type == CHILD_ORPHAN); + pattern->_child_type = CHILD_STROKE_PATTERN; + } + _markForUpdate(STATE_ALL, true); +} + /// Move this item to the given place in the Z order of siblings. /// Does nothing if the item has no parent. void @@ -530,6 +569,12 @@ DrawingItem::update(Geom::IntRect const &area, UpdateContext const &ctx, unsigne if (to_update & STATE_RENDER) { // now that we know drawbox, dirty the corresponding rect on canvas // unless filtered, groups do not need to render by themselves, only their members + if (_fill_pattern) { + _fill_pattern->update(area, child_ctx, flags, reset); + } + if (_stroke_pattern) { + _stroke_pattern->update(area, child_ctx, flags, reset); + } if (!is_drawing_group(this) || (_filter && render_filters)) { _markForRendering(); } -- cgit v1.2.3 From 830f59607d9a29552833abe25d2e8967e3ccc96d Mon Sep 17 00:00:00 2001 From: "Liam P. White" Date: Wed, 29 Oct 2014 21:20:43 -0400 Subject: Re-enable warning commented out from pony2ink branch (bzr r13644) --- src/display/drawing-item.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'src/display/drawing-item.cpp') diff --git a/src/display/drawing-item.cpp b/src/display/drawing-item.cpp index 9bb81cea5..8ed74b550 100644 --- a/src/display/drawing-item.cpp +++ b/src/display/drawing-item.cpp @@ -870,10 +870,9 @@ DrawingItem::pick(Geom::Point const &p, double delta, unsigned flags) { // Sometimes there's no BBOX in state, reason unknown (bug 992817) // I made this not an assert to remove the warning - // This warning clutters the console output, so commented out if (!(_state & STATE_BBOX) || !(_state & STATE_PICK)) { - /*g_warning("Invalid state when picking: STATE_BBOX = %d, STATE_PICK = %d", - _state & STATE_BBOX, _state & STATE_PICK);*/ + g_warning("Invalid state when picking: STATE_BBOX = %d, STATE_PICK = %d", + _state & STATE_BBOX, _state & STATE_PICK); return NULL; } // ignore invisible and insensitive items unless sticky -- cgit v1.2.3