From b6d303d11e572d8888d29c44e11d06d256821a03 Mon Sep 17 00:00:00 2001 From: Tavmjong Bah Date: Sun, 21 Dec 2014 15:29:02 +0100 Subject: Implement rendering for 'context-fill' and 'context-stroke' (text not handled yet). (bzr r13807) --- src/sp-use.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'src/sp-use.cpp') diff --git a/src/sp-use.cpp b/src/sp-use.cpp index 2bd6757ff..cadd6a16c 100644 --- a/src/sp-use.cpp +++ b/src/sp-use.cpp @@ -94,7 +94,7 @@ void SPUse::build(SPDocument *document, Inkscape::XML::Node *repr) { // We don't need to create child here: // reading xlink:href will attach ref, and that will cause the changed signal to be emitted, - // which will call sp_use_href_changed, and that will take care of the child + // which will call SPUse::href_changed, and that will take care of the child } void SPUse::release() { @@ -145,7 +145,7 @@ void SPUse::set(unsigned int key, const gchar* value) { this->href = NULL; if (value) { - // First, set the href field, because sp_use_href_changed will need it. + // First, set the href field, because SPUse::href_changed will need it. this->href = g_strdup(value); // Now do the attaching, which emits the changed signal. @@ -280,9 +280,10 @@ gchar* SPUse::description() const { } Inkscape::DrawingItem* SPUse::show(Inkscape::Drawing &drawing, unsigned int key, unsigned int flags) { + Inkscape::DrawingGroup *ai = new Inkscape::DrawingGroup(drawing); ai->setPickChildren(false); - ai->setStyle(this->style); + ai->setStyle(this->style, this->style); if (this->child) { Inkscape::DrawingItem *ac = this->child->invoke_show(drawing, key, flags); @@ -579,7 +580,7 @@ void SPUse::update(SPCtx *ctx, unsigned flags) { if (flags & SP_OBJECT_STYLE_MODIFIED_FLAG) { for (SPItemView *v = this->display; v != NULL; v = v->next) { Inkscape::DrawingGroup *g = dynamic_cast(v->arenaitem); - g->setStyle(this->style); + g->setStyle(this->style, this->style); } } @@ -601,7 +602,7 @@ void SPUse::modified(unsigned int flags) { if (flags & SP_OBJECT_STYLE_MODIFIED_FLAG) { for (SPItemView *v = this->display; v != NULL; v = v->next) { Inkscape::DrawingGroup *g = dynamic_cast(v->arenaitem); - g->setStyle(this->style); + g->setStyle(this->style, this->style); } } -- cgit v1.2.3 From f01a18216e26fd87a53188018e03527c7fdf8a57 Mon Sep 17 00:00:00 2001 From: Tavmjong Bah Date: Tue, 23 Dec 2014 10:25:08 +0100 Subject: Use gray for 'context-fill' and 'context-stroke' in marker selector. Fix rendering bug when elements with 'context-fill' and 'context-stroke' are inside groups. (bzr r13822) --- src/sp-use.cpp | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'src/sp-use.cpp') diff --git a/src/sp-use.cpp b/src/sp-use.cpp index cadd6a16c..ba3f4a9d7 100644 --- a/src/sp-use.cpp +++ b/src/sp-use.cpp @@ -281,10 +281,12 @@ gchar* SPUse::description() const { Inkscape::DrawingItem* SPUse::show(Inkscape::Drawing &drawing, unsigned int key, unsigned int flags) { + // std::cout << "SPUse::show: " << (getId()?getId():"null") << std::endl; Inkscape::DrawingGroup *ai = new Inkscape::DrawingGroup(drawing); ai->setPickChildren(false); - ai->setStyle(this->style, this->style); - + this->context_style = this->style; + ai->setStyle(this->style, this->context_style); + if (this->child) { Inkscape::DrawingItem *ac = this->child->invoke_show(drawing, key, flags); @@ -530,6 +532,7 @@ void SPUse::delete_self() { } void SPUse::update(SPCtx *ctx, unsigned flags) { + // std::cout << "SPUse::update: " << (getId()?getId():"null") << std::endl; SPItemCtx *ictx = (SPItemCtx *) ctx; SPItemCtx cctx = *ictx; @@ -580,7 +583,8 @@ void SPUse::update(SPCtx *ctx, unsigned flags) { if (flags & SP_OBJECT_STYLE_MODIFIED_FLAG) { for (SPItemView *v = this->display; v != NULL; v = v->next) { Inkscape::DrawingGroup *g = dynamic_cast(v->arenaitem); - g->setStyle(this->style, this->style); + this->context_style = this->style; + g->setStyle(this->style, this->context_style); } } @@ -593,6 +597,7 @@ void SPUse::update(SPCtx *ctx, unsigned flags) { } void SPUse::modified(unsigned int flags) { + // std::cout << "SPUse::modified: " << (getId()?getId():"null") << std::endl; if (flags & SP_OBJECT_MODIFIED_FLAG) { flags |= SP_OBJECT_PARENT_MODIFIED_FLAG; } @@ -602,7 +607,8 @@ void SPUse::modified(unsigned int flags) { if (flags & SP_OBJECT_STYLE_MODIFIED_FLAG) { for (SPItemView *v = this->display; v != NULL; v = v->next) { Inkscape::DrawingGroup *g = dynamic_cast(v->arenaitem); - g->setStyle(this->style, this->style); + this->context_style = this->style; + g->setStyle(this->style, this->context_style); } } -- cgit v1.2.3 From 3598d85ed64693808296324289a2d6e5284d486e Mon Sep 17 00:00:00 2001 From: Tavmjong Bah Date: Thu, 25 Dec 2014 17:05:40 +0100 Subject: Remove sp_style_merge_from_parent() and sp_style_merge_from_dying_parent(). (bzr r13822.1.5) --- src/sp-use.cpp | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'src/sp-use.cpp') diff --git a/src/sp-use.cpp b/src/sp-use.cpp index ba3f4a9d7..9b38a91c5 100644 --- a/src/sp-use.cpp +++ b/src/sp-use.cpp @@ -664,11 +664,8 @@ SPItem *SPUse::unlink() { SPObject *unlinked = document->getObjectByRepr(copy); // Merge style from the use. - SPStyle *unli_sty = unlinked->style; - SPStyle const *use_sty = this->style; - sp_style_merge_from_dying_parent(unli_sty, use_sty); - sp_style_merge_from_parent(unli_sty, unlinked->parent->style); - + unlinked->style->merge( this->style ); + unlinked->style->cascade( unlinked->parent->style ); unlinked->updateRepr(); // Hold onto our SPObject and repr for now. -- cgit v1.2.3