diff options
| author | su_v <suv-sf@users.sourceforge.net> | 2014-12-31 14:36:09 +0000 |
|---|---|---|
| committer | ~suv <suv-sf@users.sourceforge.net> | 2014-12-31 14:36:09 +0000 |
| commit | 02cb649c0ceebd254dde302eeba71406fb25a24c (patch) | |
| tree | 4ccb52d7f06a7160adb2aaf1428d3a5a2acef9a5 /src/display | |
| parent | packaging/macosx: update local python ports (MacPorts drops support for Pytho... (diff) | |
| parent | Fix for bug #758718 (Color Picker/Dropper: Color selection area not lined up ... (diff) | |
| download | inkscape-02cb649c0ceebd254dde302eeba71406fb25a24c.tar.gz inkscape-02cb649c0ceebd254dde302eeba71406fb25a24c.zip | |
update to trunk (r13829)
(bzr r13798.1.2)
Diffstat (limited to 'src/display')
| -rw-r--r-- | src/display/canvas-axonomgrid.cpp | 2 | ||||
| -rw-r--r-- | src/display/canvas-grid.cpp | 6 | ||||
| -rw-r--r-- | src/display/drawing-group.cpp | 9 | ||||
| -rw-r--r-- | src/display/drawing-group.h | 4 | ||||
| -rw-r--r-- | src/display/drawing-image.cpp | 11 | ||||
| -rw-r--r-- | src/display/drawing-image.h | 2 | ||||
| -rw-r--r-- | src/display/drawing-item.cpp | 145 | ||||
| -rw-r--r-- | src/display/drawing-item.h | 13 | ||||
| -rw-r--r-- | src/display/drawing-pattern.h | 1 | ||||
| -rw-r--r-- | src/display/drawing-shape.cpp | 17 | ||||
| -rw-r--r-- | src/display/drawing-shape.h | 4 | ||||
| -rw-r--r-- | src/display/drawing-text.cpp | 20 | ||||
| -rw-r--r-- | src/display/drawing-text.h | 5 | ||||
| -rw-r--r-- | src/display/nr-filter-primitive.cpp | 10 | ||||
| -rw-r--r-- | src/display/nr-style.cpp | 82 | ||||
| -rw-r--r-- | src/display/nr-style.h | 3 | ||||
| -rw-r--r-- | src/display/snap-indicator.cpp | 12 |
17 files changed, 229 insertions, 117 deletions
diff --git a/src/display/canvas-axonomgrid.cpp b/src/display/canvas-axonomgrid.cpp index b81400266..05ba71a49 100644 --- a/src/display/canvas-axonomgrid.cpp +++ b/src/display/canvas-axonomgrid.cpp @@ -36,7 +36,7 @@ #include "ui/widget/registered-widget.h" #include "desktop.h" -#include "desktop-handles.h" + #include "display/cairo-utils.h" #include "display/canvas-grid.h" #include "display/sp-canvas-util.h" diff --git a/src/display/canvas-grid.cpp b/src/display/canvas-grid.cpp index 0bcb6c375..1a284b46e 100644 --- a/src/display/canvas-grid.cpp +++ b/src/display/canvas-grid.cpp @@ -36,7 +36,7 @@ #include "desktop.h" #include "sp-canvas-util.h" #include "util/mathfns.h" -#include "desktop-handles.h" + #include "display/cairo-utils.h" #include "display/canvas-axonomgrid.h" #include "display/canvas-grid.h" @@ -285,12 +285,12 @@ CanvasGrid::createCanvasItem(SPDesktop * desktop) // check if there is already a canvasitem on this desktop linking to this grid for (GSList *l = canvasitems; l != NULL; l = l->next) { - if ( sp_desktop_gridgroup(desktop) == SP_CANVAS_GROUP(SP_CANVAS_ITEM(l->data)->parent) ) { + if ( desktop->getGridGroup() == SP_CANVAS_GROUP(SP_CANVAS_ITEM(l->data)->parent) ) { return NULL; } } - GridCanvasItem * item = INKSCAPE_GRID_CANVASITEM( sp_canvas_item_new(sp_desktop_gridgroup(desktop), INKSCAPE_TYPE_GRID_CANVASITEM, NULL) ); + GridCanvasItem * item = INKSCAPE_GRID_CANVASITEM( sp_canvas_item_new(desktop->getGridGroup(), INKSCAPE_TYPE_GRID_CANVASITEM, NULL) ); item->grid = this; sp_canvas_item_show(SP_CANVAS_ITEM(item)); diff --git a/src/display/drawing-group.cpp b/src/display/drawing-group.cpp index bce89d70e..1a9cbfdcc 100644 --- a/src/display/drawing-group.cpp +++ b/src/display/drawing-group.cpp @@ -21,14 +21,11 @@ namespace Inkscape { DrawingGroup::DrawingGroup(Drawing &drawing) : DrawingItem(drawing) - , _style(NULL) , _child_transform(NULL) {} DrawingGroup::~DrawingGroup() { - if (_style) - sp_style_unref(_style); delete _child_transform; // delete NULL; is safe } @@ -42,12 +39,6 @@ DrawingGroup::setPickChildren(bool p) _pick_children = p; } -void -DrawingGroup::setStyle(SPStyle *style) -{ - _setStyleCommon(_style, style); -} - /** * Set additional transform for the group. * This is applied after the normal transform and mainly useful for diff --git a/src/display/drawing-group.h b/src/display/drawing-group.h index ab1f9895d..0c985b43f 100644 --- a/src/display/drawing-group.h +++ b/src/display/drawing-group.h @@ -14,8 +14,6 @@ #include "display/drawing-item.h" -class SPStyle; - namespace Inkscape { class DrawingGroup @@ -28,7 +26,6 @@ public: bool pickChildren() { return _pick_children; } void setPickChildren(bool p); - void setStyle(SPStyle *style); void setChildTransform(Geom::Affine const &new_trans); protected: @@ -40,7 +37,6 @@ protected: virtual DrawingItem *_pickItem(Geom::Point const &p, double delta, unsigned flags); virtual bool _canClip(); - SPStyle *_style; Geom::Affine *_child_transform; }; diff --git a/src/display/drawing-image.cpp b/src/display/drawing-image.cpp index e56f3e58b..8fe337959 100644 --- a/src/display/drawing-image.cpp +++ b/src/display/drawing-image.cpp @@ -24,15 +24,10 @@ namespace Inkscape { DrawingImage::DrawingImage(Drawing &drawing) : DrawingItem(drawing) , _pixbuf(NULL) - , _style(NULL) {} DrawingImage::~DrawingImage() { - if (_style) { - sp_style_unref(_style); - } - // _pixbuf is owned by SPImage - do not delete it } @@ -45,12 +40,6 @@ DrawingImage::setPixbuf(Inkscape::Pixbuf *pb) } void -DrawingImage::setStyle(SPStyle *style) -{ - _setStyleCommon(_style, style); -} - -void DrawingImage::setScale(double sx, double sy) { _scale = Geom::Scale(sx, sy); diff --git a/src/display/drawing-image.h b/src/display/drawing-image.h index 64e4517b0..7511768c9 100644 --- a/src/display/drawing-image.h +++ b/src/display/drawing-image.h @@ -29,7 +29,6 @@ public: ~DrawingImage(); void setPixbuf(Inkscape::Pixbuf *pb); - void setStyle(SPStyle *style); void setScale(double sx, double sy); void setOrigin(Geom::Point const &o); void setClipbox(Geom::Rect const &box); @@ -43,7 +42,6 @@ protected: virtual DrawingItem *_pickItem(Geom::Point const &p, double delta, unsigned flags); Inkscape::Pixbuf *_pixbuf; - SPStyle *_style; // TODO: the following three should probably be merged into a new Geom::Viewbox object Geom::Rect _clipbox; ///< for preserveAspectRatio diff --git a/src/display/drawing-item.cpp b/src/display/drawing-item.cpp index 8ed74b550..89ca66dc4 100644 --- a/src/display/drawing-item.cpp +++ b/src/display/drawing-item.cpp @@ -109,6 +109,8 @@ DrawingItem::DrawingItem(Drawing &drawing) : _drawing(drawing) , _parent(NULL) , _key(0) + , _style(NULL) + , _context_style(NULL) , _opacity(1.0) , _transform(NULL) , _clip(NULL) @@ -188,6 +190,8 @@ DrawingItem::~DrawingItem() delete _clip; delete _mask; delete _filter; + if(_style) + sp_style_unref(_style); } DrawingItem * @@ -351,6 +355,72 @@ DrawingItem::setCached(bool cached, bool persistent) } } +/** + * Process information related to the new style. + * + * Note: _style is not used by DrawingGlyphs which uses its parent style. + */ +void +DrawingItem::setStyle(SPStyle *style, SPStyle *context_style) +{ + // std::cout << "DrawingItem::setStyle: " << name() << " " << style + // << " " << context_style << std::endl; + + if( style != _style ) { + if (style) sp_style_ref(style); + if (_style) sp_style_unref(_style); + _style = style; + } + + 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); + } + sp_filter_build_renderer(SP_FILTER(style->getFilter()), _filter); + } else { + // no filter set for this group + delete _filter; + _filter = NULL; + } + + if (style && style->enable_background.set) { + if (style->enable_background.value == SP_CSS_BACKGROUND_NEW && !_background_new) { + _background_new = true; + _markForUpdate(STATE_BACKGROUND, true); + } else if (style->enable_background.value == SP_CSS_BACKGROUND_ACCUMULATE && _background_new) { + _background_new = false; + _markForUpdate(STATE_BACKGROUND, true); + } + } + + if (context_style != NULL) { + _context_style = context_style; + } else if (_parent != NULL) { + _context_style = _parent->_context_style; + } + + _markForUpdate(STATE_ALL, false); +} + + +/** + * Recursively update children style. + * The purpose of this call is to update fill and stroke for markers that have elements with + * fill/stroke property values of 'context-fill' or 'context-stroke'. Marker styling is not + * updated like other 'clones' as marker instances are not included the SP object tree. + * Note: this is a virtual function. + */ +void +DrawingItem::setChildrenStyle(SPStyle* context_style) +{ + _context_style = context_style; + for (ChildrenList::iterator i = _children.begin(); i != _children.end(); ++i) { + i->setChildrenStyle( context_style ); + } +} + + void DrawingItem::setClip(DrawingItem *item) { @@ -908,6 +978,39 @@ DrawingItem::pick(Geom::Point const &p, double delta, unsigned flags) return NULL; } +// For debugging +Glib::ustring +DrawingItem::name() +{ + SPObject *object = static_cast<SPObject *>(_user_data); + if (object) { + if(object->getId()) + return object->getId(); + else + return "No object id"; + } else { + return "No associated object"; + } +} + +// For debugging: Print drawing tree structure. +void +DrawingItem::recursivePrintTree( unsigned level ) +{ + if (level == 0) { + std::cout << "Display Item Tree" << std::endl; + } + std::cout << "DI: "; + for (unsigned i = 0; i < level; ++i) { + std::cout << " "; + } + std::cout << name() << std::endl; + for (ChildrenList::iterator i = _children.begin(); i != _children.end(); ++i) { + i->recursivePrintTree( level+1 ); + } +} + + /** * Marks the current visual bounding box of the item for redrawing. * This is called whenever the object changes its visible appearance. @@ -998,48 +1101,6 @@ DrawingItem::_markForUpdate(unsigned flags, bool propagate) } /** - * Process information related to the new style. - * - * This function is something of a hack to avoid creating an extra class in the hierarchy - * which would differ from DrawingItem only by having a _style member. - * This is mainly to the benefit of DrawingGlyphs, which use the style of their parent. - * This should probably be refactored some day, possibly by creating the relevant class - * or creating a more complex data model in DrawingText and removing DrawingGlyphs, - * which would cause every item to have a style. - */ -void -DrawingItem::_setStyleCommon(SPStyle *&_style, SPStyle *style) -{ - if (style) sp_style_ref(style); - if (_style) sp_style_unref(_style); - _style = style; - - 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); - } - sp_filter_build_renderer(SP_FILTER(style->getFilter()), _filter); - } else { - // no filter set for this group - delete _filter; - _filter = NULL; - } - - if (style && style->enable_background.set) { - if (style->enable_background.value == SP_CSS_BACKGROUND_NEW && !_background_new) { - _background_new = true; - _markForUpdate(STATE_BACKGROUND, true); - } else if (style->enable_background.value == SP_CSS_BACKGROUND_ACCUMULATE && _background_new) { - _background_new = false; - _markForUpdate(STATE_BACKGROUND, true); - } - } - - _markForUpdate(STATE_ALL, false); -} - -/** * Compute the caching score. * * Higher scores mean the item is more aggresively prioritized for automatic diff --git a/src/display/drawing-item.h b/src/display/drawing-item.h index 9b399e6e3..3c593ceaa 100644 --- a/src/display/drawing-item.h +++ b/src/display/drawing-item.h @@ -20,6 +20,10 @@ #include <exception> #include <list> +namespace Glib { +class ustring; +} + class SPStyle; namespace Inkscape { @@ -108,6 +112,8 @@ public: bool cached() const { return _cached; } void setCached(bool c, bool persistent = false); + virtual void setStyle(SPStyle *style, SPStyle *context_style = NULL); + virtual void setChildrenStyle(SPStyle *context_style); void setOpacity(float opacity); void setAntialiasing(bool a); void setIsolation(unsigned isolation); // CSS Compositing and Blending @@ -131,6 +137,9 @@ public: void clip(DrawingContext &dc, Geom::IntRect const &area); DrawingItem *pick(Geom::Point const &p, double delta, unsigned flags = 0); + virtual Glib::ustring name(); // For debugging + void recursivePrintTree(unsigned level = 0); // For debugging + protected: enum ChildType { CHILD_ORPHAN = 0, // no parent - implies _parent == NULL @@ -149,7 +158,6 @@ protected: void _markForUpdate(unsigned state, bool propagate); void _markForRendering(); void _invalidateFilterBackground(Geom::IntRect const &area); - void _setStyleCommon(SPStyle *&_style, SPStyle *style); double _cacheScore(); Geom::OptIntRect _cacheRect(); virtual unsigned _updateItem(Geom::IntRect const &/*area*/, UpdateContext const &/*ctx*/, @@ -176,6 +184,9 @@ protected: unsigned _key; ///< Some SPItems can have more than one DrawingItem; /// this value is a hack used to distinguish between them + SPStyle *_style; // Not used by DrawingGlyphs + SPStyle *_context_style; // Used for 'context-fill', 'context-stroke' + float _opacity; Geom::Affine *_transform; ///< Incremental transform from parent to this item's coords diff --git a/src/display/drawing-pattern.h b/src/display/drawing-pattern.h index 7483ba067..dc1f93ed1 100644 --- a/src/display/drawing-pattern.h +++ b/src/display/drawing-pattern.h @@ -15,7 +15,6 @@ #include "display/drawing-group.h" typedef struct _cairo_pattern cairo_pattern_t; -class SPStyle; namespace Inkscape { diff --git a/src/display/drawing-shape.cpp b/src/display/drawing-shape.cpp index 66160638f..63efb3c0d 100644 --- a/src/display/drawing-shape.cpp +++ b/src/display/drawing-shape.cpp @@ -34,15 +34,12 @@ namespace Inkscape { DrawingShape::DrawingShape(Drawing &drawing) : DrawingItem(drawing) , _curve(NULL) - , _style(NULL) , _last_pick(NULL) , _repick_after(0) {} DrawingShape::~DrawingShape() { - if (_style) - sp_style_unref(_style); if (_curve) _curve->unref(); } @@ -65,10 +62,17 @@ DrawingShape::setPath(SPCurve *curve) } void -DrawingShape::setStyle(SPStyle *style) +DrawingShape::setStyle(SPStyle *style, SPStyle *context_style) { - _setStyleCommon(_style, style); - _nrstyle.set(style); + DrawingItem::setStyle(style, context_style); // Must be first + _nrstyle.set(_style, _context_style); +} + +void +DrawingShape::setChildrenStyle(SPStyle* context_style) +{ + DrawingItem::setChildrenStyle( context_style ); + _nrstyle.set(_style, _context_style); } unsigned @@ -145,7 +149,6 @@ DrawingShape::_updateItem(Geom::IntRect const &area, UpdateContext const &ctx, u _bbox.unionWith(i->geometricBounds()); } } - return STATE_ALL; } diff --git a/src/display/drawing-shape.h b/src/display/drawing-shape.h index 9d93a642f..1cdbc636e 100644 --- a/src/display/drawing-shape.h +++ b/src/display/drawing-shape.h @@ -28,7 +28,8 @@ public: ~DrawingShape(); void setPath(SPCurve *curve); - void setStyle(SPStyle *style); + virtual void setStyle(SPStyle *style, SPStyle *context_style = NULL); + virtual void setChildrenStyle(SPStyle *context_style); protected: virtual unsigned _updateItem(Geom::IntRect const &area, UpdateContext const &ctx, @@ -45,7 +46,6 @@ protected: DrawingItem *stop_at); SPCurve *_curve; - SPStyle *_style; NRStyle _nrstyle; DrawingItem *_last_pick; diff --git a/src/display/drawing-text.cpp b/src/display/drawing-text.cpp index afe661b2e..e20a7ff2a 100644 --- a/src/display/drawing-text.cpp +++ b/src/display/drawing-text.cpp @@ -55,6 +55,13 @@ DrawingGlyphs::setGlyph(font_instance *font, int glyph, Geom::Affine const &tran _markForUpdate(STATE_ALL, false); } +void +DrawingGlyphs::setStyle(SPStyle * /*style*/, SPStyle * /*context_style*/) +{ + std::cerr << "DrawingGlyphs: Use parent style" << std::endl; +} + + unsigned DrawingGlyphs::_updateItem(Geom::IntRect const &/*area*/, UpdateContext const &ctx, unsigned /*flags*/, unsigned /*reset*/) { DrawingText *ggroup = dynamic_cast<DrawingText *>(_parent); @@ -216,10 +223,17 @@ DrawingText::addComponent(font_instance *font, int glyph, Geom::Affine const &tr } void -DrawingText::setStyle(SPStyle *style) +DrawingText::setStyle(SPStyle *style, SPStyle *context_style) +{ + DrawingGroup::setStyle(style, context_style); // Must be first + _nrstyle.set(_style, _context_style); +} + +void +DrawingText::setChildrenStyle(SPStyle* context_style) { - _nrstyle.set(style); - DrawingGroup::setStyle(style); + DrawingGroup::setChildrenStyle( context_style ); + _nrstyle.set(_style, _context_style); } unsigned diff --git a/src/display/drawing-text.h b/src/display/drawing-text.h index 4453a3db4..3d248df9b 100644 --- a/src/display/drawing-text.h +++ b/src/display/drawing-text.h @@ -28,6 +28,7 @@ public: ~DrawingGlyphs(); void setGlyph(font_instance *font, int glyph, Geom::Affine const &trans); + virtual void setStyle(SPStyle *style, SPStyle *context_style = NULL); // Not to be used protected: unsigned _updateItem(Geom::IntRect const &area, UpdateContext const &ctx, @@ -56,8 +57,8 @@ public: void clear(); bool addComponent(font_instance *font, int glyph, Geom::Affine const &trans, float width, float ascent, float descent, float phase_length); - void setStyle(SPStyle *style); - + virtual void setStyle(SPStyle *style, SPStyle *context_style = NULL); + virtual void setChildrenStyle(SPStyle *context_style); protected: virtual unsigned _updateItem(Geom::IntRect const &area, UpdateContext const &ctx, diff --git a/src/display/nr-filter-primitive.cpp b/src/display/nr-filter-primitive.cpp index b065ac445..c8b569036 100644 --- a/src/display/nr-filter-primitive.cpp +++ b/src/display/nr-filter-primitive.cpp @@ -17,7 +17,7 @@ #include "inkscape.h" #include "desktop.h" -#include "desktop-handles.h" + #include "document.h" #include "sp-root.h" #include "style.h" @@ -171,9 +171,11 @@ Geom::Rect FilterPrimitive::filter_primitive_area(FilterUnits const &units) void FilterPrimitive::setStyle(SPStyle *style) { - if (style) sp_style_ref(style); - if (_style) sp_style_unref(_style); - _style = style; + if( style != _style ) { + if (style) sp_style_ref(style); + if (_style) sp_style_unref(_style); + _style = style; + } } diff --git a/src/display/nr-style.cpp b/src/display/nr-style.cpp index 96d16bf06..1740785e2 100644 --- a/src/display/nr-style.cpp +++ b/src/display/nr-style.cpp @@ -93,24 +93,47 @@ NRStyle::~NRStyle() text_decoration_stroke.clear(); } -void NRStyle::set(SPStyle *style) +void NRStyle::set(SPStyle *style, SPStyle *context_style) { - if ( style->fill.isPaintserver() ) { + // Handle 'context-fill' and 'context-stroke': Work in progress + const SPIPaint *style_fill = &(style->fill); + if( style_fill->paintOrigin == SP_CSS_PAINT_ORIGIN_CONTEXT_FILL ) { + if( context_style != NULL ) { + style_fill = &(context_style->fill); + } else { + // A marker in the defs section will result in ending up here. + //std::cerr << "NRStyle::set: 'context-fill': 'context_style' is NULL" << std::endl; + } + } else if ( style_fill->paintOrigin == SP_CSS_PAINT_ORIGIN_CONTEXT_STROKE ) { + if( context_style != NULL ) { + style_fill = &(context_style->stroke); + } else { + //std::cerr << "NRStyle::set: 'context-stroke': 'context_style' is NULL" << std::endl; + } + } + + if ( style_fill->isPaintserver() ) { SPPaintServer* server = style->getFillPaintServer(); if ( server && server->isValid() ) { fill.set(server); - } else if ( style->fill.colorSet ) { - fill.set(style->fill.value.color); + } else if ( style_fill->colorSet ) { + fill.set(style_fill->value.color); } else { fill.clear(); } - } else if ( style->fill.isColor() ) { - fill.set(style->fill.value.color); - } else if ( style->fill.isNone() ) { + } else if ( style_fill->isColor() ) { + fill.set(style_fill->value.color); + } else if ( style_fill->isNone() ) { fill.clear(); + } else if ( style_fill->paintOrigin == SP_CSS_PAINT_ORIGIN_CONTEXT_FILL ) { + // A marker in the defs section will result in ending up here. + //std::cerr << "NRStyle::set: fill: context-fill: Double" << std::endl; + } else if ( style_fill->paintOrigin == SP_CSS_PAINT_ORIGIN_CONTEXT_STROKE ) { + //std::cerr << "NRStyle::set: fill: context-stroke: Double" << std::endl; } else { g_assert_not_reached(); } + fill.opacity = SP_SCALE24_TO_FLOAT(style->fill_opacity.value); switch (style->fill_rule.computed) { @@ -124,22 +147,42 @@ void NRStyle::set(SPStyle *style) g_assert_not_reached(); } - if ( style->stroke.isPaintserver() ) { + const SPIPaint *style_stroke = &(style->stroke); + if( style_stroke->paintOrigin == SP_CSS_PAINT_ORIGIN_CONTEXT_FILL ) { + if( context_style != NULL ) { + style_stroke = &(context_style->fill); + } else { + //std::cerr << "NRStyle::set: 'context-fill': 'context_style' is NULL" << std::endl; + } + } else if ( style_stroke->paintOrigin == SP_CSS_PAINT_ORIGIN_CONTEXT_STROKE ) { + if( context_style != NULL ) { + style_stroke = &(context_style->stroke); + } else { + //std::cerr << "NRStyle::set: 'context-stroke': 'context_style' is NULL" << std::endl; + } + } + + if ( style_stroke->isPaintserver() ) { SPPaintServer* server = style->getStrokePaintServer(); if ( server && server->isValid() ) { stroke.set(server); - } else if ( style->stroke.isColor() ) { - stroke.set(style->stroke.colorSet); + } else if ( style_stroke->isColor() ) { + stroke.set(style_stroke->colorSet); } else { stroke.clear(); } - } else if ( style->stroke.isColor() ) { - stroke.set(style->stroke.value.color); - } else if ( style->stroke.isNone() ) { + } else if ( style_stroke->isColor() ) { + stroke.set(style_stroke->value.color); + } else if ( style_stroke->isNone() ) { stroke.clear(); + } else if ( style_stroke->paintOrigin == SP_CSS_PAINT_ORIGIN_CONTEXT_FILL ) { + //std::cerr << "NRStyle::set: stroke: context-fill: Double" << std::endl; + } else if ( style_stroke->paintOrigin == SP_CSS_PAINT_ORIGIN_CONTEXT_STROKE ) { + //std::cerr << "NRStyle::set: stroke: context-stroke: Double" << std::endl; } else { g_assert_not_reached(); } + stroke.opacity = SP_SCALE24_TO_FLOAT(style->stroke_opacity.value); stroke_width = style->stroke_width.computed; switch (style->stroke_linecap.computed) { @@ -266,7 +309,7 @@ void NRStyle::set(SPStyle *style) } else if ( style_td->fill.isNone() ) { text_decoration_fill.clear(); } else { - g_assert_not_reached(); + //g_assert_not_reached(); } if ( style_td->stroke.isPaintserver() ) { @@ -276,7 +319,7 @@ void NRStyle::set(SPStyle *style) } else if ( style_td->stroke.isNone() ) { text_decoration_stroke.clear(); } else { - g_assert_not_reached(); + //g_assert_not_reached(); } } @@ -310,13 +353,16 @@ bool NRStyle::prepareFill(Inkscape::DrawingContext &dc, Geom::OptRect const &pai fill_pattern = pattern->renderPattern(fill.opacity); } else { fill_pattern = fill.server->pattern_new(dc.raw(), paintbox, fill.opacity); - } break; + } + break; case PAINT_COLOR: { SPColor const &c = fill.color; fill_pattern = cairo_pattern_create_rgba( c.v.c[0], c.v.c[1], c.v.c[2], fill.opacity); - } break; - default: break; + } + break; + default: + break; } } if (!fill_pattern) return false; diff --git a/src/display/nr-style.h b/src/display/nr-style.h index f324fdb56..5f78795d3 100644 --- a/src/display/nr-style.h +++ b/src/display/nr-style.h @@ -1,6 +1,7 @@ /** * @file * Style information for rendering. + * Only used by classes DrawingShape and DrawingText *//* * Authors: * Krzysztof KosiĆski <tweenk.pl@gmail.com> @@ -28,7 +29,7 @@ struct NRStyle { NRStyle(); ~NRStyle(); - void set(SPStyle *); + void set(SPStyle *style, SPStyle *context_style = NULL); bool prepareFill(Inkscape::DrawingContext &dc, Geom::OptRect const &paintbox, Inkscape::DrawingPattern *pattern); bool prepareStroke(Inkscape::DrawingContext &dc, Geom::OptRect const &paintbox, Inkscape::DrawingPattern *pattern); bool prepareTextDecorationFill(Inkscape::DrawingContext &dc, Geom::OptRect const &paintbox, Inkscape::DrawingPattern *pattern); diff --git a/src/display/snap-indicator.cpp b/src/display/snap-indicator.cpp index 2632d69db..bcce81f0b 100644 --- a/src/display/snap-indicator.cpp +++ b/src/display/snap-indicator.cpp @@ -14,7 +14,7 @@ #include "display/snap-indicator.h" #include "desktop.h" -#include "desktop-handles.h" + #include "display/sodipodi-ctrl.h" #include "display/sodipodi-ctrlrect.h" #include "display/canvas-text.h" @@ -246,7 +246,7 @@ SnapIndicator::set_new_snaptarget(Inkscape::SnappedPoint const &p, bool pre_snap // Display the snap indicator (i.e. the cross) SPCanvasItem * canvasitem = NULL; - canvasitem = sp_canvas_item_new(sp_desktop_tempgroup (_desktop), + canvasitem = sp_canvas_item_new(_desktop->getTempGroup(), SP_TYPE_CTRL, "anchor", SP_ANCHOR_CENTER, "size", 10.0, @@ -280,7 +280,7 @@ SnapIndicator::set_new_snaptarget(Inkscape::SnappedPoint const &p, bool pre_snap tooltip_pos += _desktop->w2d(Geom::Point(0, -2*fontsize)); } - SPCanvasItem *canvas_tooltip = sp_canvastext_new(sp_desktop_tempgroup(_desktop), _desktop, tooltip_pos, tooltip_str); + SPCanvasItem *canvas_tooltip = sp_canvastext_new(_desktop->getTempGroup(), _desktop, tooltip_pos, tooltip_str); sp_canvastext_set_fontsize(SP_CANVASTEXT(canvas_tooltip), fontsize); SP_CANVASTEXT(canvas_tooltip)->rgba = 0xffffffff; SP_CANVASTEXT(canvas_tooltip)->outline = false; @@ -299,7 +299,7 @@ SnapIndicator::set_new_snaptarget(Inkscape::SnappedPoint const &p, bool pre_snap // Display the bounding box, if we snapped to one Geom::OptRect const bbox = p.getTargetBBox(); if (bbox) { - SPCanvasItem* box = sp_canvas_item_new(sp_desktop_tempgroup (_desktop), + SPCanvasItem* box = sp_canvas_item_new(_desktop->getTempGroup(), SP_TYPE_CTRLRECT, NULL); @@ -348,7 +348,7 @@ SnapIndicator::set_new_snapsource(Inkscape::SnapCandidatePoint const &p) bool value = prefs->getBool("/options/snapindicator/value", true); if (value) { - SPCanvasItem * canvasitem = sp_canvas_item_new( sp_desktop_tempgroup (_desktop), + SPCanvasItem * canvasitem = sp_canvas_item_new( _desktop->getTempGroup(), SP_TYPE_CTRL, "anchor", SP_ANCHOR_CENTER, "size", 6.0, @@ -367,7 +367,7 @@ void SnapIndicator::set_new_debugging_point(Geom::Point const &p) { g_assert(_desktop != NULL); - SPCanvasItem * canvasitem = sp_canvas_item_new( sp_desktop_tempgroup (_desktop), + SPCanvasItem * canvasitem = sp_canvas_item_new( _desktop->getTempGroup(), SP_TYPE_CTRL, "anchor", SP_ANCHOR_CENTER, "size", 10.0, |
