summaryrefslogtreecommitdiffstats
path: root/src/sp-shape.cpp
diff options
context:
space:
mode:
authorTavmjong Bah <tavmjong@free.fr>2014-12-21 14:29:02 +0000
committertavmjong-free <tavmjong@free.fr>2014-12-21 14:29:02 +0000
commitb6d303d11e572d8888d29c44e11d06d256821a03 (patch)
tree715b43f92a002f4c2a3bdadc7fb10675b60d85eb /src/sp-shape.cpp
parentdisable rev 13709, following Bug 1365451, comments 13-16 (diff)
downloadinkscape-b6d303d11e572d8888d29c44e11d06d256821a03.tar.gz
inkscape-b6d303d11e572d8888d29c44e11d06d256821a03.zip
Implement rendering for 'context-fill' and 'context-stroke' (text not handled yet).
(bzr r13807)
Diffstat (limited to 'src/sp-shape.cpp')
-rw-r--r--src/sp-shape.cpp27
1 files changed, 22 insertions, 5 deletions
diff --git a/src/sp-shape.cpp b/src/sp-shape.cpp
index 6d240fbf5..02b9969b3 100644
--- a/src/sp-shape.cpp
+++ b/src/sp-shape.cpp
@@ -145,7 +145,12 @@ void SPShape::update(SPCtx* ctx, guint flags) {
for (SPItemView *v = ((SPItem *) (this))->display; v != NULL; v = v->next) {
Inkscape::DrawingShape *sh = dynamic_cast<Inkscape::DrawingShape *>(v->arenaitem);
- sh->setStyle(this->style);
+ if (hasMarkers()) {
+ sh->setStyle(this->style, this->style);
+ sh->setChildrenStyle(style); // Resolve 'context-fill' and 'context-stroke' in children.
+ } else {
+ sh->setStyle(this->style, this->parent->style);
+ }
}
}
}
@@ -163,6 +168,7 @@ void SPShape::update(SPCtx* ctx, guint flags) {
}
if (this->hasMarkers ()) {
+
/* Dimension marker views */
for (SPItemView *v = this->display; v != NULL; v = v->next) {
if (!v->arenaitem->key()) {
@@ -387,7 +393,12 @@ void SPShape::modified(unsigned int flags) {
if (flags & SP_OBJECT_STYLE_MODIFIED_FLAG) {
for (SPItemView *v = this->display; v != NULL; v = v->next) {
Inkscape::DrawingShape *sh = dynamic_cast<Inkscape::DrawingShape *>(v->arenaitem);
- sh->setStyle(this->style);
+ if (hasMarkers()) {
+ sh->setStyle(this->style, this->style);
+ sh->setChildrenStyle(style); // Resolve 'context-fill' and 'context-stroke' in children.
+ } else {
+ sh->setStyle(this->style, this->parent->style);
+ }
}
}
}
@@ -719,7 +730,9 @@ void SPShape::print(SPPrintContext* ctx) {
Inkscape::DrawingItem* SPShape::show(Inkscape::Drawing &drawing, unsigned int /*key*/, unsigned int /*flags*/) {
Inkscape::DrawingShape *s = new Inkscape::DrawingShape(drawing);
- s->setStyle(this->style);
+
+ bool has_markers = this->hasMarkers();
+
s->setPath(this->_curve);
/* This stanza checks that an object's marker style agrees with
@@ -731,7 +744,7 @@ Inkscape::DrawingItem* SPShape::show(Inkscape::Drawing &drawing, unsigned int /*
sp_shape_set_marker (this, i, this->style->marker_ptrs[i]->value);
}
- if (this->hasMarkers ()) {
+ if (has_markers) {
/* provide key and dimension the marker views */
if (!s->key()) {
s->setKey(SPItem::display_key_new (SP_MARKER_LOC_QTY));
@@ -747,8 +760,12 @@ Inkscape::DrawingItem* SPShape::show(Inkscape::Drawing &drawing, unsigned int /*
/* Update marker views */
sp_shape_update_marker_view (this, s);
- }
+ s->setStyle(this->style,this->style);
+ s->setChildrenStyle(style); // Resolve 'context-fill' and 'context-stroke' in children.
+ } else {
+ s->setStyle(this->style, this->parent->style);
+ }
return s;
}