summaryrefslogtreecommitdiffstats
path: root/src/sp-item.cpp
diff options
context:
space:
mode:
authorTavmjong Bah <tavmjong@free.fr>2015-03-16 20:22:36 +0000
committertavmjong-free <tavmjong@free.fr>2015-03-16 20:22:36 +0000
commit2d155893b65f971840cd61e693e881ddaa209cd5 (patch)
tree260306a9933a9be70719619b42ce5f2ec0f0cb3d /src/sp-item.cpp
parentFix a bug when update pointparaneter and no Knot (diff)
downloadinkscape-2d155893b65f971840cd61e693e881ddaa209cd5.tar.gz
inkscape-2d155893b65f971840cd61e693e881ddaa209cd5.zip
Partial fix for bug 1430873. Ellipses should behave properly with % values.
(bzr r14009)
Diffstat (limited to 'src/sp-item.cpp')
-rw-r--r--src/sp-item.cpp69
1 files changed, 30 insertions, 39 deletions
diff --git a/src/sp-item.cpp b/src/sp-item.cpp
index 5d181b80a..8c99e9bcf 100644
--- a/src/sp-item.cpp
+++ b/src/sp-item.cpp
@@ -75,18 +75,6 @@ static SPItemView* sp_item_view_list_remove(SPItemView *list,
SPItem::SPItem() : SPObject() {
- this->sensitive = 0;
- this->clip_ref = NULL;
- this->avoidRef = NULL;
- this->_is_evaluated = false;
- this->stop_paint = 0;
- this->_evaluated_status = StatusUnknown;
- this->bbox_valid = 0;
- this->freeze_stroke_width = false;
- this->transform_center_x = 0;
- this->transform_center_y = 0;
- this->display = NULL;
- this->mask_ref = NULL;
sensitive = TRUE;
bbox_valid = FALSE;
@@ -96,12 +84,13 @@ SPItem::SPItem() : SPObject() {
transform_center_x = 0;
transform_center_y = 0;
+ freeze_stroke_width = false;
+
_is_evaluated = true;
_evaluated_status = StatusUnknown;
transform = Geom::identity();
- doc_bbox = Geom::OptRect();
- freeze_stroke_width = false;
+ // doc_bbox = Geom::OptRect();
display = NULL;
@@ -670,54 +659,56 @@ void SPItem::stroke_ps_ref_changed(SPObject *old_ps, SPObject *ps, SPItem *item)
}
}
-void SPItem::update(SPCtx* /*ctx*/, guint flags) {
- SPItem *item = this;
- SPItem* object = item;
+void SPItem::update(SPCtx* ctx, guint flags) {
-// SPObject::onUpdate(ctx, flags);
+ SPItemCtx const *ictx = reinterpret_cast<SPItemCtx const *>(ctx);
- // any of the modifications defined in sp-object.h might change bbox,
+ // Any of the modifications defined in sp-object.h might change bbox,
// so we invalidate it unconditionally
- item->bbox_valid = FALSE;
+ bbox_valid = FALSE;
+
+ viewport = ictx->viewport; // Cache viewport
- if (flags & (SP_OBJECT_CHILD_MODIFIED_FLAG | SP_OBJECT_MODIFIED_FLAG | SP_OBJECT_STYLE_MODIFIED_FLAG)) {
+ if (flags & (SP_OBJECT_CHILD_MODIFIED_FLAG |
+ SP_OBJECT_MODIFIED_FLAG |
+ SP_OBJECT_STYLE_MODIFIED_FLAG) ) {
if (flags & SP_OBJECT_MODIFIED_FLAG) {
- for (SPItemView *v = item->display; v != NULL; v = v->next) {
- v->arenaitem->setTransform(item->transform);
+ for (SPItemView *v = display; v != NULL; v = v->next) {
+ v->arenaitem->setTransform(transform);
}
}
- SPClipPath *clip_path = item->clip_ref ? item->clip_ref->getObject() : NULL;
- SPMask *mask = item->mask_ref ? item->mask_ref->getObject() : NULL;
+ SPClipPath *clip_path = clip_ref ? clip_ref->getObject() : NULL;
+ SPMask *mask = mask_ref ? mask_ref->getObject() : NULL;
if ( clip_path || mask ) {
- Geom::OptRect bbox = item->geometricBounds();
+ Geom::OptRect bbox = geometricBounds();
if (clip_path) {
- for (SPItemView *v = item->display; v != NULL; v = v->next) {
+ for (SPItemView *v = display; v != NULL; v = v->next) {
clip_path->setBBox(v->arenaitem->key(), bbox);
}
}
if (mask) {
- for (SPItemView *v = item->display; v != NULL; v = v->next) {
+ for (SPItemView *v = display; v != NULL; v = v->next) {
mask->sp_mask_set_bbox(v->arenaitem->key(), bbox);
}
}
}
if (flags & SP_OBJECT_STYLE_MODIFIED_FLAG) {
- for (SPItemView *v = item->display; v != NULL; v = v->next) {
- v->arenaitem->setOpacity(SP_SCALE24_TO_FLOAT(object->style->opacity.value));
- v->arenaitem->setAntialiasing(object->style->shape_rendering.computed != SP_CSS_SHAPE_RENDERING_CRISPEDGES);
- v->arenaitem->setIsolation( object->style->isolation.value );
- v->arenaitem->setBlendMode( object->style->mix_blend_mode.value );
- v->arenaitem->setVisible(!item->isHidden());
+ for (SPItemView *v = display; v != NULL; v = v->next) {
+ v->arenaitem->setOpacity(SP_SCALE24_TO_FLOAT(style->opacity.value));
+ v->arenaitem->setAntialiasing(style->shape_rendering.computed != SP_CSS_SHAPE_RENDERING_CRISPEDGES);
+ v->arenaitem->setIsolation( style->isolation.value );
+ v->arenaitem->setBlendMode( style->mix_blend_mode.value );
+ v->arenaitem->setVisible(!isHidden());
}
}
}
/* Update bounding box in user space, used for filter and objectBoundingBox units */
- if (item->style->filter.set && item->display) {
- Geom::OptRect item_bbox = item->geometricBounds();
- SPItemView *itemview = item->display;
+ if (style->filter.set && display) {
+ Geom::OptRect item_bbox = geometricBounds();
+ SPItemView *itemview = display;
do {
if (itemview->arenaitem)
itemview->arenaitem->setItemBounds(item_bbox);
@@ -725,8 +716,8 @@ void SPItem::update(SPCtx* /*ctx*/, guint flags) {
}
// Update libavoid with item geometry (for connector routing).
- if (item->avoidRef)
- item->avoidRef->handleSettingChange();
+ if (avoidRef)
+ avoidRef->handleSettingChange();
}
void SPItem::modified(unsigned int /*flags*/)