summaryrefslogtreecommitdiffstats
path: root/src/display/drawing-item.cpp
diff options
context:
space:
mode:
authorLiam P. White <inkscapebrony@gmail.com>2014-10-17 20:03:14 +0000
committerLiam P. White <inkscapebrony@gmail.com>2014-10-17 20:03:14 +0000
commit4fc13b246c0c03c26c10c421c63c33331aa57d85 (patch)
tree82f8ceea42ace9c0512b6073935e4bd9c3d14f7a /src/display/drawing-item.cpp
parentSmall warning cleanup (diff)
parentPort inkscape to librevenge framework for WPG, CDR and VSD imports (diff)
downloadinkscape-4fc13b246c0c03c26c10c421c63c33331aa57d85.tar.gz
inkscape-4fc13b246c0c03c26c10c421c63c33331aa57d85.zip
Update to trunk r13621
(bzr r13341.1.278)
Diffstat (limited to 'src/display/drawing-item.cpp')
-rw-r--r--src/display/drawing-item.cpp47
1 files changed, 46 insertions, 1 deletions
diff --git a/src/display/drawing-item.cpp b/src/display/drawing-item.cpp
index 56507bacb..9bb81cea5 100644
--- a/src/display/drawing-item.cpp
+++ b/src/display/drawing-item.cpp
@@ -15,6 +15,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"
@@ -112,6 +113,8 @@ DrawingItem::DrawingItem(Drawing &drawing)
, _transform(NULL)
, _clip(NULL)
, _mask(NULL)
+ , _fill_pattern(NULL)
+ , _stroke_pattern(NULL)
, _filter(NULL)
, _user_data(NULL)
, _cache(NULL)
@@ -166,6 +169,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: ;
}
@@ -174,6 +183,8 @@ DrawingItem::~DrawingItem()
}
clearChildren();
delete _transform;
+ delete _stroke_pattern;
+ delete _fill_pattern;
delete _clip;
delete _mask;
delete _filter;
@@ -368,6 +379,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
@@ -532,6 +571,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();
}
@@ -970,7 +1015,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);