From b9875e6c09fcb62fa4f9c667ee6a48c8b62f8508 Mon Sep 17 00:00:00 2001 From: Tomasz Boczkowski Date: Tue, 14 Oct 2014 12:06:31 +0200 Subject: Merged src/sp-item.cpp from svg-paints-support branch (bzr r13611.1.7) --- src/sp-item.cpp | 75 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 75 insertions(+) (limited to 'src/sp-item.cpp') diff --git a/src/sp-item.cpp b/src/sp-item.cpp index 71cdfa394..edf758e7d 100644 --- a/src/sp-item.cpp +++ b/src/sp-item.cpp @@ -118,6 +118,9 @@ SPItem::SPItem() : SPObject() { mask_ref = new SPMaskReference(this); mask_ref->changedSignal().connect(sigc::bind(sigc::ptr_fun(mask_ref_changed), this)); + style->signal_fill_ps_changed.connect(sigc::bind(sigc::ptr_fun(fill_ps_ref_changed), this)); + style->signal_stroke_ps_changed.connect(sigc::bind(sigc::ptr_fun(stroke_ps_ref_changed), this)); + avoidRef = new SPAvoidRef(this); } @@ -442,7 +445,15 @@ void SPItem::release() { SPObject::release(); + SPPattern *fill_pattern = SP_PATTERN(style->getFillPaintServer()); + SPPattern *stroke_pattern = SP_PATTERN(style->getStrokePaintServer()); while (item->display) { + if (fill_pattern) { + fill_pattern->hide(item->display->arenaitem->key()); + } + if (stroke_pattern) { + stroke_pattern->hide(item->display->arenaitem->key()); + } item->display = sp_item_view_list_remove(item->display, item->display); } @@ -588,6 +599,34 @@ void SPItem::mask_ref_changed(SPObject *old_mask, SPObject *mask, SPItem *item) } } +void SPItem::fill_ps_ref_changed(SPObject *old_ps, SPObject *ps, SPItem *item) { + SPPattern *old_fill_pattern = SP_PATTERN(old_ps); + if (old_fill_pattern) { + for (SPItemView *v =item->display; v != NULL; v = v->next) { + old_fill_pattern->hide(v->arenaitem->key()); + } + } + + SPPattern *new_fill_pattern = SP_PATTERN(ps); + if (new_fill_pattern) { + Geom::OptRect bbox = item->geometricBounds(); + for (SPItemView *v = item->display; v != NULL; v = v->next) { + if (!v->arenaitem->key()) { + v->arenaitem->setKey(SPItem::display_key_new(3)); + } + Inkscape::DrawingPattern *pi = new_fill_pattern->show( + v->arenaitem->drawing(), v->arenaitem->key()); + v->arenaitem->setFillPattern(pi); + new_fill_pattern->setBBox(v->arenaitem->key(), bbox); + new_fill_pattern->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG); + } + } +} + +void SPItem::stroke_ps_ref_changed(SPObject *old_clip, SPObject *clip, SPItem *item) { + +} + void SPItem::update(SPCtx* /*ctx*/, guint flags) { SPItem *item = this; SPItem* object = item; @@ -647,6 +686,9 @@ void SPItem::update(SPCtx* /*ctx*/, guint flags) { item->avoidRef->handleSettingChange(); } +void SPItem::modified(unsigned int flags) { +} + Inkscape::XML::Node* SPItem::write(Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags) { SPItem *item = this; SPItem* object = item; @@ -1090,6 +1132,31 @@ Inkscape::DrawingItem *SPItem::invoke_show(Inkscape::Drawing &drawing, unsigned SP_MASK(mask)->sp_mask_set_bbox(mask_key, item_bbox); mask->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG); } + + SPPattern *fill_pattern = SP_PATTERN(style->getFillPaintServer()); + if (fill_pattern) { + if (!display->arenaitem->key()) { + display->arenaitem->setKey(display_key_new(3)); + } + int fill_key = display->arenaitem->key(); + + Inkscape::DrawingPattern *ac = fill_pattern->show(drawing, fill_key); + ai->setFillPattern(ac); + fill_pattern->setBBox(fill_key, item_bbox); + fill_pattern->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG); + } + SPPattern *stroke_pattern = SP_PATTERN(style->getStrokePaintServer()); + if (stroke_pattern) { + if (!display->arenaitem->key()) { + display->arenaitem->setKey(display_key_new(3)); + } + int stroke_key = display->arenaitem->key(); + + Inkscape::DrawingPattern *ac = stroke_pattern->show(drawing, stroke_key); + ai->setStrokePattern(ac); + stroke_pattern->setBBox(stroke_key, item_bbox); + stroke_pattern->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG); + } ai->setData(this); ai->setItemBounds(geometricBounds()); } @@ -1119,6 +1186,14 @@ void SPItem::invoke_hide(unsigned key) mask_ref->getObject()->sp_mask_hide(v->arenaitem->key()); v->arenaitem->setMask(NULL); } + SPPattern *fill_pattern = SP_PATTERN(style->getFillPaintServer()); + if (fill_pattern) { + fill_pattern->hide(v->arenaitem->key()); + } + SPPattern *stroke_pattern = SP_PATTERN(style->getStrokePaintServer()); + if (stroke_pattern) { + stroke_pattern->hide(v->arenaitem->key()); + } if (!ref) { display = v->next; } else { -- cgit v1.2.3 From f3b182a2facfd52c7bbfee67f207ad765f536beb Mon Sep 17 00:00:00 2001 From: Tomasz Boczkowski Date: Tue, 14 Oct 2014 13:01:49 +0200 Subject: Merged hatch rendering code (bzr r13611.1.8) --- src/sp-item.cpp | 70 +++++++++++++++++++++++++++++++-------------------------- 1 file changed, 38 insertions(+), 32 deletions(-) (limited to 'src/sp-item.cpp') diff --git a/src/sp-item.cpp b/src/sp-item.cpp index edf758e7d..da6e6ea58 100644 --- a/src/sp-item.cpp +++ b/src/sp-item.cpp @@ -445,14 +445,14 @@ void SPItem::release() { SPObject::release(); - SPPattern *fill_pattern = SP_PATTERN(style->getFillPaintServer()); - SPPattern *stroke_pattern = SP_PATTERN(style->getStrokePaintServer()); + SPPaintServer *fill_ps = style->getFillPaintServer(); + SPPaintServer *stroke_ps = style->getStrokePaintServer(); while (item->display) { - if (fill_pattern) { - fill_pattern->hide(item->display->arenaitem->key()); + if (fill_ps) { + fill_ps->hide(item->display->arenaitem->key()); } - if (stroke_pattern) { - stroke_pattern->hide(item->display->arenaitem->key()); + if (stroke_ps) { + stroke_ps->hide(item->display->arenaitem->key()); } item->display = sp_item_view_list_remove(item->display, item->display); } @@ -600,25 +600,27 @@ void SPItem::mask_ref_changed(SPObject *old_mask, SPObject *mask, SPItem *item) } void SPItem::fill_ps_ref_changed(SPObject *old_ps, SPObject *ps, SPItem *item) { - SPPattern *old_fill_pattern = SP_PATTERN(old_ps); - if (old_fill_pattern) { + SPPaintServer *old_fill_ps = SP_PAINT_SERVER(old_ps); + if (old_fill_ps) { for (SPItemView *v =item->display; v != NULL; v = v->next) { - old_fill_pattern->hide(v->arenaitem->key()); + old_fill_ps->hide(v->arenaitem->key()); } } - SPPattern *new_fill_pattern = SP_PATTERN(ps); - if (new_fill_pattern) { + SPPaintServer *new_fill_ps = SP_PAINT_SERVER(ps); + if (new_fill_ps) { Geom::OptRect bbox = item->geometricBounds(); for (SPItemView *v = item->display; v != NULL; v = v->next) { if (!v->arenaitem->key()) { v->arenaitem->setKey(SPItem::display_key_new(3)); } - Inkscape::DrawingPattern *pi = new_fill_pattern->show( + Inkscape::DrawingPattern *pi = new_fill_ps->show( v->arenaitem->drawing(), v->arenaitem->key()); v->arenaitem->setFillPattern(pi); - new_fill_pattern->setBBox(v->arenaitem->key(), bbox); - new_fill_pattern->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG); + new_fill_ps->setBBox(v->arenaitem->key(), bbox); + if (pi) { + new_fill_ps->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG); + } } } } @@ -1133,29 +1135,33 @@ Inkscape::DrawingItem *SPItem::invoke_show(Inkscape::Drawing &drawing, unsigned mask->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG); } - SPPattern *fill_pattern = SP_PATTERN(style->getFillPaintServer()); - if (fill_pattern) { + SPPaintServer *fill_ps = style->getFillPaintServer(); + if (fill_ps) { if (!display->arenaitem->key()) { display->arenaitem->setKey(display_key_new(3)); } int fill_key = display->arenaitem->key(); - Inkscape::DrawingPattern *ac = fill_pattern->show(drawing, fill_key); - ai->setFillPattern(ac); - fill_pattern->setBBox(fill_key, item_bbox); - fill_pattern->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG); + Inkscape::DrawingPattern *ap = fill_ps->show(drawing, fill_key); + ai->setFillPattern(ap); + fill_ps->setBBox(fill_key, item_bbox); + if (ap) { + fill_ps->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG); + } } - SPPattern *stroke_pattern = SP_PATTERN(style->getStrokePaintServer()); - if (stroke_pattern) { + SPPaintServer *stroke_ps = style->getStrokePaintServer(); + if (stroke_ps) { if (!display->arenaitem->key()) { display->arenaitem->setKey(display_key_new(3)); } int stroke_key = display->arenaitem->key(); - Inkscape::DrawingPattern *ac = stroke_pattern->show(drawing, stroke_key); - ai->setStrokePattern(ac); - stroke_pattern->setBBox(stroke_key, item_bbox); - stroke_pattern->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG); + Inkscape::DrawingPattern *ap = stroke_ps->show(drawing, stroke_key); + ai->setStrokePattern(ap); + stroke_ps->setBBox(stroke_key, item_bbox); + if (ap) { + stroke_ps->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG); + } } ai->setData(this); ai->setItemBounds(geometricBounds()); @@ -1186,13 +1192,13 @@ void SPItem::invoke_hide(unsigned key) mask_ref->getObject()->sp_mask_hide(v->arenaitem->key()); v->arenaitem->setMask(NULL); } - SPPattern *fill_pattern = SP_PATTERN(style->getFillPaintServer()); - if (fill_pattern) { - fill_pattern->hide(v->arenaitem->key()); + SPPaintServer *fill_ps = style->getFillPaintServer(); + if (fill_ps) { + fill_ps->hide(v->arenaitem->key()); } - SPPattern *stroke_pattern = SP_PATTERN(style->getStrokePaintServer()); - if (stroke_pattern) { - stroke_pattern->hide(v->arenaitem->key()); + SPPaintServer *stroke_ps = style->getStrokePaintServer(); + if (stroke_ps) { + stroke_ps->hide(v->arenaitem->key()); } if (!ref) { display = v->next; -- cgit v1.2.3 From bf11ecdfe29082801833fa565f0a1710f6fcd281 Mon Sep 17 00:00:00 2001 From: Tomasz Boczkowski Date: Tue, 14 Oct 2014 13:30:31 +0200 Subject: Merged hatch pdf and png export code (bzr r13611.1.9) --- src/sp-item.cpp | 32 +++++++++++++++++++++++++------- 1 file changed, 25 insertions(+), 7 deletions(-) (limited to 'src/sp-item.cpp') diff --git a/src/sp-item.cpp b/src/sp-item.cpp index da6e6ea58..f6de165a6 100644 --- a/src/sp-item.cpp +++ b/src/sp-item.cpp @@ -615,9 +615,8 @@ void SPItem::fill_ps_ref_changed(SPObject *old_ps, SPObject *ps, SPItem *item) { v->arenaitem->setKey(SPItem::display_key_new(3)); } Inkscape::DrawingPattern *pi = new_fill_ps->show( - v->arenaitem->drawing(), v->arenaitem->key()); + v->arenaitem->drawing(), v->arenaitem->key(), bbox); v->arenaitem->setFillPattern(pi); - new_fill_ps->setBBox(v->arenaitem->key(), bbox); if (pi) { new_fill_ps->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG); } @@ -625,8 +624,29 @@ void SPItem::fill_ps_ref_changed(SPObject *old_ps, SPObject *ps, SPItem *item) { } } -void SPItem::stroke_ps_ref_changed(SPObject *old_clip, SPObject *clip, SPItem *item) { +void SPItem::stroke_ps_ref_changed(SPObject *old_ps, SPObject *ps, SPItem *item) { + SPPaintServer *old_stroke_ps = SP_PAINT_SERVER(old_ps); + if (old_stroke_ps) { + for (SPItemView *v =item->display; v != NULL; v = v->next) { + old_stroke_ps->hide(v->arenaitem->key()); + } + } + SPPaintServer *new_stroke_ps = SP_PAINT_SERVER(ps); + if (new_stroke_ps) { + Geom::OptRect bbox = item->geometricBounds(); + for (SPItemView *v = item->display; v != NULL; v = v->next) { + if (!v->arenaitem->key()) { + v->arenaitem->setKey(SPItem::display_key_new(3)); + } + Inkscape::DrawingPattern *pi = new_stroke_ps->show( + v->arenaitem->drawing(), v->arenaitem->key(), bbox); + v->arenaitem->setStrokePattern(pi); + if (pi) { + new_stroke_ps->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG); + } + } + } } void SPItem::update(SPCtx* /*ctx*/, guint flags) { @@ -1142,9 +1162,8 @@ Inkscape::DrawingItem *SPItem::invoke_show(Inkscape::Drawing &drawing, unsigned } int fill_key = display->arenaitem->key(); - Inkscape::DrawingPattern *ap = fill_ps->show(drawing, fill_key); + Inkscape::DrawingPattern *ap = fill_ps->show(drawing, fill_key, item_bbox); ai->setFillPattern(ap); - fill_ps->setBBox(fill_key, item_bbox); if (ap) { fill_ps->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG); } @@ -1156,9 +1175,8 @@ Inkscape::DrawingItem *SPItem::invoke_show(Inkscape::Drawing &drawing, unsigned } int stroke_key = display->arenaitem->key(); - Inkscape::DrawingPattern *ap = stroke_ps->show(drawing, stroke_key); + Inkscape::DrawingPattern *ap = stroke_ps->show(drawing, stroke_key, item_bbox); ai->setStrokePattern(ap); - stroke_ps->setBBox(stroke_key, item_bbox); if (ap) { stroke_ps->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG); } -- cgit v1.2.3 From dcbfb36e7c6279b1cc651131758700961152a8b0 Mon Sep 17 00:00:00 2001 From: "Jon A. Cruz" Date: Wed, 15 Oct 2014 02:43:52 -0700 Subject: Post-merge cleanup. (bzr r13615) --- src/sp-item.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/sp-item.cpp') diff --git a/src/sp-item.cpp b/src/sp-item.cpp index f6de165a6..52ee6b7d8 100644 --- a/src/sp-item.cpp +++ b/src/sp-item.cpp @@ -708,7 +708,8 @@ void SPItem::update(SPCtx* /*ctx*/, guint flags) { item->avoidRef->handleSettingChange(); } -void SPItem::modified(unsigned int flags) { +void SPItem::modified(unsigned int /*flags*/) +{ } Inkscape::XML::Node* SPItem::write(Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags) { -- cgit v1.2.3