summaryrefslogtreecommitdiffstats
path: root/src/sp-flowregion.cpp
diff options
context:
space:
mode:
authorJabier Arraiza Cenoz <jabier.arraiza@marker.es>2014-11-23 23:36:49 +0000
committerJabiertxof <jtx@jtx.marker.es>2014-11-23 23:36:49 +0000
commit0969085ddf607a7a98cf7fd6d9b10da5fbebe62d (patch)
tree59b2bc9ed3412ab2de4c703ef30342dfe2401704 /src/sp-flowregion.cpp
parentrefactor from lastApplied (diff)
parentFixed a bug pointed by suv running from comand line, also removed another des... (diff)
downloadinkscape-0969085ddf607a7a98cf7fd6d9b10da5fbebe62d.tar.gz
inkscape-0969085ddf607a7a98cf7fd6d9b10da5fbebe62d.zip
fixing to trunk
(bzr r12588.1.34)
Diffstat (limited to 'src/sp-flowregion.cpp')
-rw-r--r--src/sp-flowregion.cpp65
1 files changed, 40 insertions, 25 deletions
diff --git a/src/sp-flowregion.cpp b/src/sp-flowregion.cpp
index 709e9e464..580945d74 100644
--- a/src/sp-flowregion.cpp
+++ b/src/sp-flowregion.cpp
@@ -42,15 +42,12 @@ static void GetDest(SPObject* child,Shape **computed);
SPFlowregion::SPFlowregion() : SPItem() {
- //new (&this->computed) std::vector<Shape*>;
}
SPFlowregion::~SPFlowregion() {
for (std::vector<Shape*>::iterator it = this->computed.begin() ; it != this->computed.end() ; ++it) {
delete *it;
}
-
- //this->computed.~vector<Shape*>();
}
void SPFlowregion::child_added(Inkscape::XML::Node *child, Inkscape::XML::Node *ref) {
@@ -88,12 +85,14 @@ void SPFlowregion::update(SPCtx *ctx, unsigned int flags) {
l = g_slist_reverse(l);
while (l) {
- SPObject *child = SP_OBJECT(l->data);
+ SPObject *child = reinterpret_cast<SPObject *>(l->data);
+ g_assert(child != NULL);
l = g_slist_remove(l, child);
+ SPItem *item = dynamic_cast<SPItem *>(child);
if (childflags || (child->uflags & (SP_OBJECT_MODIFIED_FLAG | SP_OBJECT_CHILD_MODIFIED_FLAG))) {
- if (SP_IS_ITEM (child)) {
- SPItem const &chi = *SP_ITEM(child);
+ if (item) {
+ SPItem const &chi = *item;
cctx.i2doc = chi.transform * ictx->i2doc;
cctx.i2vp = chi.transform * ictx->i2vp;
child->updateDisplay((SPCtx *)&cctx, childflags);
@@ -141,7 +140,8 @@ void SPFlowregion::modified(guint flags) {
l = g_slist_reverse(l);
while (l) {
- SPObject *child = SP_OBJECT(l->data);
+ SPObject *child = reinterpret_cast<SPObject *>(l->data);
+ g_assert(child != NULL);
l = g_slist_remove(l, child);
if (flags || (child->mflags & (SP_OBJECT_MODIFIED_FLAG | SP_OBJECT_CHILD_MODIFIED_FLAG))) {
@@ -160,7 +160,7 @@ Inkscape::XML::Node *SPFlowregion::write(Inkscape::XML::Document *xml_doc, Inksc
GSList *l = NULL;
for ( SPObject *child = this->firstChild() ; child; child = child->getNext() ) {
- if ( !SP_IS_TITLE(child) && !SP_IS_DESC(child) ) {
+ if ( !dynamic_cast<SPTitle *>(child) && !dynamic_cast<SPDesc *>(child) ) {
Inkscape::XML::Node *crepr = child->updateRepr(xml_doc, NULL, flags);
if (crepr) {
@@ -177,7 +177,7 @@ Inkscape::XML::Node *SPFlowregion::write(Inkscape::XML::Document *xml_doc, Inksc
} else {
for ( SPObject *child = this->firstChild() ; child; child = child->getNext() ) {
- if ( !SP_IS_TITLE(child) && !SP_IS_DESC(child) ) {
+ if ( !dynamic_cast<SPTitle *>(child) && !dynamic_cast<SPDesc *>(child) ) {
child->updateRepr(flags);
}
}
@@ -185,6 +185,8 @@ Inkscape::XML::Node *SPFlowregion::write(Inkscape::XML::Document *xml_doc, Inksc
SPItem::write(xml_doc, repr, flags);
+ this->UpdateComputed(); // copied from update(), see LP Bug 1339305
+
return repr;
}
@@ -241,12 +243,14 @@ void SPFlowregionExclude::update(SPCtx *ctx, unsigned int flags) {
l = g_slist_reverse (l);
while (l) {
- SPObject *child = SP_OBJECT(l->data);
+ SPObject *child = reinterpret_cast<SPObject *>(l->data);
+ g_assert(child != NULL);
l = g_slist_remove(l, child);
if (flags || (child->uflags & (SP_OBJECT_MODIFIED_FLAG | SP_OBJECT_CHILD_MODIFIED_FLAG))) {
- if (SP_IS_ITEM (child)) {
- SPItem const &chi = *SP_ITEM(child);
+ SPItem *item = dynamic_cast<SPItem *>(child);
+ if (item) {
+ SPItem const &chi = *item;
cctx.i2doc = chi.transform * ictx->i2doc;
cctx.i2vp = chi.transform * ictx->i2vp;
child->updateDisplay((SPCtx *)&cctx, flags);
@@ -291,7 +295,8 @@ void SPFlowregionExclude::modified(guint flags) {
l = g_slist_reverse (l);
while (l) {
- SPObject *child = SP_OBJECT(l->data);
+ SPObject *child = reinterpret_cast<SPObject *>(l->data);
+ g_assert(child != NULL);
l = g_slist_remove(l, child);
if (flags || (child->mflags & (SP_OBJECT_MODIFIED_FLAG | SP_OBJECT_CHILD_MODIFIED_FLAG))) {
@@ -364,18 +369,28 @@ static void GetDest(SPObject* child,Shape **computed)
SPCurve *curve=NULL;
Geom::Affine tr_mat;
- SPObject* u_child=child;
- if ( SP_IS_USE(u_child) ) {
- u_child=SP_USE(u_child)->child;
- tr_mat = SP_ITEM(u_child)->getRelativeTransform(child->parent);
- } else {
- tr_mat = SP_ITEM(u_child)->transform;
- }
- if ( SP_IS_SHAPE (u_child) ) {
- curve = SP_SHAPE (u_child)->getCurve ();
- } else if ( SP_IS_TEXT (u_child) ) {
- curve = SP_TEXT (u_child)->getNormalizedBpath ();
- }
+ SPObject* u_child = child;
+ SPItem *item = dynamic_cast<SPItem *>(u_child);
+ g_assert(item != NULL);
+ SPUse *use = dynamic_cast<SPUse *>(item);
+ if ( use ) {
+ u_child = use->child;
+ tr_mat = use->getRelativeTransform(child->parent);
+ } else {
+ tr_mat = item->transform;
+ }
+ SPShape *shape = dynamic_cast<SPShape *>(u_child);
+ if ( shape ) {
+ if (!(shape->_curve)) {
+ shape->set_shape();
+ }
+ curve = shape->getCurve();
+ } else {
+ SPText *text = dynamic_cast<SPText *>(u_child);
+ if ( text ) {
+ curve = text->getNormalizedBpath();
+ }
+ }
if ( curve ) {
Path* temp=new Path;