diff options
| author | Jabier Arraiza Cenoz <jabier.arraiza@marker.es> | 2016-10-19 20:03:34 +0000 |
|---|---|---|
| committer | jabiertxof <info@marker.es> | 2016-10-19 20:03:34 +0000 |
| commit | fa7621c1f6ff4a7203b05f43db348e48da31d211 (patch) | |
| tree | 2a6afca2b861f72494580e72b8a79462e58516f4 /src | |
| parent | Styling rotate (diff) | |
| parent | Fix bug:1634641 crash on delete (diff) | |
| download | inkscape-fa7621c1f6ff4a7203b05f43db348e48da31d211.tar.gz inkscape-fa7621c1f6ff4a7203b05f43db348e48da31d211.zip | |
Update to trunk
(bzr r15142.1.18)
Diffstat (limited to 'src')
| -rw-r--r-- | src/attributes.cpp | 1 | ||||
| -rw-r--r-- | src/attributes.h | 3 | ||||
| -rw-r--r-- | src/display/drawing-shape.cpp | 14 | ||||
| -rw-r--r-- | src/display/drawing-text.cpp | 13 | ||||
| -rw-r--r-- | src/sp-lpe-item.cpp | 2 | ||||
| -rw-r--r-- | src/sp-object.cpp | 2 | ||||
| -rw-r--r-- | src/style-enums.h | 10 | ||||
| -rw-r--r-- | src/style.cpp | 13 | ||||
| -rw-r--r-- | src/style.h | 3 |
9 files changed, 52 insertions, 9 deletions
diff --git a/src/attributes.cpp b/src/attributes.cpp index cc75d94c6..8154bfbbe 100644 --- a/src/attributes.cpp +++ b/src/attributes.cpp @@ -443,6 +443,7 @@ static SPStyleProp const props[] = { {SP_PROP_PAINT_ORDER, "paint-order" }, {SP_PROP_SOLID_COLOR, "solid-color"}, {SP_PROP_SOLID_OPACITY, "solid-opacity"}, + {SP_PROP_VECTOR_EFFECT, "vector-effect"}, /* CSS Blending/Compositing */ {SP_PROP_MIX_BLEND_MODE, "mix-blend-mode"}, diff --git a/src/attributes.h b/src/attributes.h index ba82c18f1..e21851bcf 100644 --- a/src/attributes.h +++ b/src/attributes.h @@ -451,7 +451,8 @@ enum SPAttributeEnum { SP_PROP_PAINT_ORDER, /* SVG2 */ SP_PROP_SOLID_COLOR, SP_PROP_SOLID_OPACITY, - + SP_PROP_VECTOR_EFFECT, + /* CSS Blending/Compositing */ SP_PROP_MIX_BLEND_MODE, SP_PROP_ISOLATION, diff --git a/src/display/drawing-shape.cpp b/src/display/drawing-shape.cpp index 63efb3c0d..ba95a63ce 100644 --- a/src/display/drawing-shape.cpp +++ b/src/display/drawing-shape.cpp @@ -180,6 +180,10 @@ DrawingShape::_renderStroke(DrawingContext &dc) if( has_stroke ) { // TODO: remove segments outside of bbox when no dashes present dc.path(_curve->get_pathvector()); + if (_style && _style->vector_effect.computed == SP_VECTOR_EFFECT_NON_SCALING_STROKE) { + dc.restore(); + dc.save(); + } _nrstyle.applyStroke(dc); dc.strokePreserve(); dc.newPath(); // clear path @@ -213,7 +217,7 @@ DrawingShape::_renderItem(DrawingContext &dc, Geom::IntRect const &area, unsigne } { Inkscape::DrawingContext::Save save(dc); dc.setSource(rgba); - dc.setLineWidth(0.5); + dc.setLineWidth(5); dc.setTolerance(0.5); dc.stroke(); } @@ -230,6 +234,8 @@ DrawingShape::_renderItem(DrawingContext &dc, Geom::IntRect const &area, unsigne // we assume the context has no path Inkscape::DrawingContext::Save save(dc); dc.transform(_ctm); + dc.path(_curve->get_pathvector()); + // update fill and stroke paints. // this cannot be done during nr_arena_shape_update, because we need a Cairo context @@ -237,14 +243,16 @@ DrawingShape::_renderItem(DrawingContext &dc, Geom::IntRect const &area, unsigne bool has_fill = _nrstyle.prepareFill(dc, _item_bbox, _fill_pattern); bool has_stroke = _nrstyle.prepareStroke(dc, _item_bbox, _stroke_pattern); has_stroke &= (_nrstyle.stroke_width != 0); - if (has_fill || has_stroke) { // TODO: remove segments outside of bbox when no dashes present - dc.path(_curve->get_pathvector()); if (has_fill) { _nrstyle.applyFill(dc); dc.fillPreserve(); } + if (_style && _style->vector_effect.computed == SP_VECTOR_EFFECT_NON_SCALING_STROKE) { + dc.restore(); + dc.save(); + } if (has_stroke) { _nrstyle.applyStroke(dc); dc.strokePreserve(); diff --git a/src/display/drawing-text.cpp b/src/display/drawing-text.cpp index a0918e9f5..1280a2db9 100644 --- a/src/display/drawing-text.cpp +++ b/src/display/drawing-text.cpp @@ -592,17 +592,24 @@ unsigned DrawingText::_renderItem(DrawingContext &dc, Geom::IntRect const &/*are { Inkscape::DrawingContext::Save save(dc); dc.transform(_ctm); - if (has_fill && fill_first) { _nrstyle.applyFill(dc); dc.fillPreserve(); } - + } + { + Inkscape::DrawingContext::Save save(dc); + if (!_style || ! _style->vector_effect.computed == SP_VECTOR_EFFECT_NON_SCALING_STROKE) { + dc.transform(_ctm); + } if (has_stroke) { _nrstyle.applyStroke(dc); dc.strokePreserve(); } - + } + { + Inkscape::DrawingContext::Save save(dc); + dc.transform(_ctm); if (has_fill && !fill_first) { _nrstyle.applyFill(dc); dc.fillPreserve(); diff --git a/src/sp-lpe-item.cpp b/src/sp-lpe-item.cpp index f0b46a547..8f0713652 100644 --- a/src/sp-lpe-item.cpp +++ b/src/sp-lpe-item.cpp @@ -588,7 +588,7 @@ bool SPLPEItem::hasBrokenPathEffect() const bool SPLPEItem::hasPathEffect() const { - if (path_effect_list->empty()) { + if (!path_effect_list || path_effect_list->empty()) { return false; } diff --git a/src/sp-object.cpp b/src/sp-object.cpp index cbd7aa969..21d8bcd93 100644 --- a/src/sp-object.cpp +++ b/src/sp-object.cpp @@ -485,7 +485,7 @@ void SPObject::_sendDeleteSignalRecursive() { void SPObject::deleteObject(bool propagate, bool propagate_descendants) { sp_object_ref(this, NULL); - if ( SP_IS_LPE_ITEM(this) ) { + if ( SP_IS_LPE_ITEM(this) && SP_LPE_ITEM(this)->hasPathEffect()) { SP_LPE_ITEM(this)->removeAllPathEffects(false); } if (propagate) { diff --git a/src/style-enums.h b/src/style-enums.h index 06207852c..a0fcaedef 100644 --- a/src/style-enums.h +++ b/src/style-enums.h @@ -309,6 +309,10 @@ enum SPTextRendering { SP_CSS_TEXT_RENDERING_GEOMETRICPRECISION }; +enum SPVectorEffect { + SP_VECTOR_EFFECT_NONE, + SP_VECTOR_EFFECT_NON_SCALING_STROKE +}; struct SPStyleEnum { char const *key; @@ -668,6 +672,12 @@ static SPStyleEnum const enum_color_interpolation[] = { {NULL, -1} }; +static SPStyleEnum const enum_vector_effect[] = { + {"none", SP_VECTOR_EFFECT_NONE}, + {"non-scaling-stroke", SP_VECTOR_EFFECT_NON_SCALING_STROKE}, + {NULL, -1} +}; + #endif // SEEN_SP_STYLE_ENUMS_H diff --git a/src/style.cpp b/src/style.cpp index 930e271ad..c513b735d 100644 --- a/src/style.cpp +++ b/src/style.cpp @@ -161,6 +161,9 @@ SPStyle::SPStyle(SPDocument *document_in, SPObject *object_in) : solid_color( "solid-color" ), // SPIColor solid_opacity( "solid-opacity", SP_SCALE24_MAX ), + // Vector effects + vector_effect( "vector-effect", enum_vector_effect, SP_VECTOR_EFFECT_NONE, false ), + // Fill properties fill( "fill" ), // SPIPaint fill_opacity( "fill-opacity", SP_SCALE24_MAX ), @@ -331,6 +334,8 @@ SPStyle::SPStyle(SPDocument *document_in, SPObject *object_in) : _properties.push_back( &solid_color ); _properties.push_back( &solid_opacity ); + _properties.push_back( &vector_effect ); + _properties.push_back( &fill ); _properties.push_back( &fill_opacity ); _properties.push_back( &fill_rule ); @@ -427,6 +432,8 @@ SPStyle::SPStyle(SPDocument *document_in, SPObject *object_in) : // _propmap.insert( std::make_pair( solid_color.name, reinterpret_cast<SPIBasePtr>(&SPStyle::solid_color ) ) ); // _propmap.insert( std::make_pair( solid_opacity.name, reinterpret_cast<SPIBasePtr>(&SPStyle::solid_opacity ) ) ); + // _propmap.insert( std::make_pair( vector_effect.name, reinterpret_cast<SPIBasePtr>(&SPStyle::vector_effect ) ) ); + // _propmap.insert( std::make_pair( fill.name, reinterpret_cast<SPIBasePtr>(&SPStyle::fill ) ) ); // _propmap.insert( std::make_pair( fill_opacity.name, reinterpret_cast<SPIBasePtr>(&SPStyle::fill_opacity ) ) ); // _propmap.insert( std::make_pair( fill_rule.name, reinterpret_cast<SPIBasePtr>(&SPStyle::fill_rule ) ) ); @@ -911,6 +918,9 @@ SPStyle::readIfUnset( gint id, gchar const *val ) { case SP_PROP_SOLID_OPACITY: solid_opacity.readIfUnset( val ); break; + case SP_PROP_VECTOR_EFFECT: + vector_effect.readIfUnset( val ); + break; case SP_PROP_FILL: fill.readIfUnset( val ); break; @@ -1624,6 +1634,9 @@ sp_style_unset_property_attrs(SPObject *o) if (style->solid_opacity.set) { repr->setAttribute("solid-opacity", NULL); } + if (style->vector_effect.set) { + repr->setAttribute("vector-effect", NULL); + } if (style->fill.set) { repr->setAttribute("fill", NULL); } diff --git a/src/style.h b/src/style.h index 0e8e34145..c8192f782 100644 --- a/src/style.h +++ b/src/style.h @@ -215,6 +215,9 @@ public: /** solid-opacity */ SPIScale24 solid_opacity; + /** vector effect */ + SPIEnum vector_effect; + /** fill */ SPIPaint fill; /** fill-opacity */ |
