diff options
| author | Jabier Arraiza Cenoz <jabier.arraiza@marker.es> | 2013-09-26 20:59:57 +0000 |
|---|---|---|
| committer | Jabiertxof <jtx@jtx.marker.es> | 2013-09-26 20:59:57 +0000 |
| commit | 10b7fff1b81f5dca3733ff205beef6c0750bc82b (patch) | |
| tree | 535e4fa78ebd6e42971454e3c2dd56a998217c97 /src | |
| parent | update to trunk (diff) | |
| parent | cppcheck (diff) | |
| download | inkscape-10b7fff1b81f5dca3733ff205beef6c0750bc82b.tar.gz inkscape-10b7fff1b81f5dca3733ff205beef6c0750bc82b.zip | |
update to trunk
(bzr r12588.1.8)
Diffstat (limited to 'src')
| -rw-r--r-- | src/libuemf/uemf_print.c | 32 | ||||
| -rw-r--r-- | src/lpe-tool-context.cpp | 4 | ||||
| -rw-r--r-- | src/sp-ellipse.cpp | 10 | ||||
| -rw-r--r-- | src/sp-shape.cpp | 47 | ||||
| -rw-r--r-- | src/sp-spiral.cpp | 2 | ||||
| -rw-r--r-- | src/ui/tool/path-manipulator.cpp | 2 |
6 files changed, 43 insertions, 54 deletions
diff --git a/src/libuemf/uemf_print.c b/src/libuemf/uemf_print.c index 4ea9620cf..b4e1753c6 100644 --- a/src/libuemf/uemf_print.c +++ b/src/libuemf/uemf_print.c @@ -407,7 +407,7 @@ void extlogpen_print( printf("elpStyleEntry:"); elpStyleEntry = (uint32_t *) elp->elpStyleEntry; for(i=0;i<elp->elpNumEntries;i++){ - printf("%d:%u ",i,elpStyleEntry[i]); + printf("%u:%u ",i,elpStyleEntry[i]); } } } @@ -484,7 +484,7 @@ void rgndata_print( if(rd->rdh.nCount){ rects = (PU_RECTL) &(rd->Buffer); for(i=0;i<rd->rdh.nCount;i++){ - printf("%d:",i); rectl_print(rects[i]); + printf("%u:",i); rectl_print(rects[i]); } } } @@ -616,7 +616,7 @@ void core1_print(const char *name, const char *contents){ printf(" cptl: %d\n",pEmr->cptl ); printf(" Points: "); for(i=0;i<pEmr->cptl; i++){ - printf("[%d]:",i); pointl_print(pEmr->aptl[i]); + printf("[%u]:",i); pointl_print(pEmr->aptl[i]); } printf("\n"); } @@ -631,13 +631,13 @@ void core2_print(const char *name, const char *contents){ printf(" cptl: %d\n",pEmr->cptl ); printf(" Counts: "); for(i=0;i<pEmr->nPolys; i++){ - printf(" [%d]:%d ",i,pEmr->aPolyCounts[i] ); + printf(" [%u]:%d ",i,pEmr->aPolyCounts[i] ); } printf("\n"); PU_POINTL paptl = (PU_POINTL)((char *)pEmr->aPolyCounts + sizeof(uint32_t)* pEmr->nPolys); printf(" Points: "); for(i=0;i<pEmr->cptl; i++){ - printf(" [%d]:",i); pointl_print(paptl[i]); + printf(" [%u]:",i); pointl_print(paptl[i]); } printf("\n"); } @@ -675,7 +675,7 @@ void core6_print(const char *name, const char *contents){ printf(" Points: "); PU_POINT16 papts = (PU_POINT16)(&(pEmr->apts)); for(i=0; i<pEmr->cpts; i++){ - printf(" [%d]:",i); point16_print(papts[i]); + printf(" [%u]:",i); point16_print(papts[i]); } printf("\n"); } @@ -729,7 +729,7 @@ void core10_print(const char *name, const char *contents){ printf(" cpts: %d\n",pEmr->cpts ); printf(" Counts: "); for(i=0;i<pEmr->nPolys; i++){ - printf(" [%d]:%d ",i,pEmr->aPolyCounts[i] ); + printf(" [%u]:%d ",i,pEmr->aPolyCounts[i] ); } printf("\n"); printf(" Points: "); @@ -753,7 +753,7 @@ void core11_print(const char *name, const char *contents){ i=1; char *prd = (char *) &(pEmr->RgnData); while(roff + 28 < pEmr->emr.nSize){ // up to the end of the record - printf(" RegionData:%d",i); + printf(" RegionData:%u",i); rgndata_print((PU_RGNDATA) (prd + roff)); roff += (((PU_RGNDATA)prd)->rdh.dwSize + ((PU_RGNDATA)prd)->rdh.nRgnSize - 16); printf("\n"); @@ -1362,7 +1362,7 @@ void U_EMRSETPALETTEENTRIES_print(const char *contents){ printf(" PLTEntries:"); PU_LOGPLTNTRY aPalEntries = (PU_LOGPLTNTRY) &(pEmr->aPalEntries); for(i=0; i<pEmr->cEntries; i++){ - printf("%d:",i); logpltntry_print(aPalEntries[i]); + printf("%u:",i); logpltntry_print(aPalEntries[i]); } printf("\n"); } @@ -1428,13 +1428,13 @@ void U_EMRPOLYDRAW_print(const char *contents){ printf(" cptl: %d\n",pEmr->cptl ); printf(" Points: "); for(i=0;i<pEmr->cptl; i++){ - printf(" [%d]:",i); + printf(" [%u]:",i); pointl_print(pEmr->aptl[i]); } printf("\n"); printf(" Types: "); for(i=0;i<pEmr->cptl; i++){ - printf(" [%d]:%u ",i,pEmr->abTypes[i]); + printf(" [%u]:%u ",i,pEmr->abTypes[i]); } printf("\n"); } @@ -1619,7 +1619,7 @@ void U_EMRFILLRGN_print(const char *contents){ i=1; char *prd = (char *) &(pEmr->RgnData); while(roff + 28 < pEmr->emr.nSize){ // up to the end of the record - printf(" RegionData[%d]: ",i); rgndata_print((PU_RGNDATA) (prd + roff)); printf("\n"); + printf(" RegionData[%u]: ",i); rgndata_print((PU_RGNDATA) (prd + roff)); printf("\n"); roff += (((PU_RGNDATA)prd)->rdh.dwSize + ((PU_RGNDATA)prd)->rdh.nRgnSize - 16); } } @@ -1641,7 +1641,7 @@ void U_EMRFRAMERGN_print(const char *contents){ i=1; char *prd = (char *) &(pEmr->RgnData); while(roff + 28 < pEmr->emr.nSize){ // up to the end of the record - printf(" RegionData[%d]: ",i); rgndata_print((PU_RGNDATA) (prd + roff)); printf("\n"); + printf(" RegionData[%u]: ",i); rgndata_print((PU_RGNDATA) (prd + roff)); printf("\n"); roff += (((PU_RGNDATA)prd)->rdh.dwSize + ((PU_RGNDATA)prd)->rdh.nRgnSize - 16); } } @@ -1973,13 +1973,13 @@ void U_EMRPOLYDRAW16_print(const char *contents){ printf(" cpts: %d\n",pEmr->cpts ); printf(" Points: "); for(i=0;i<pEmr->cpts; i++){ - printf(" [%d]:",i); + printf(" [%u]:",i); point16_print(pEmr->apts[i]); } printf("\n"); printf(" Types: "); for(i=0;i<pEmr->cpts; i++){ - printf(" [%d]:%u ",i,pEmr->abTypes[i]); + printf(" [%u]:%u ",i,pEmr->abTypes[i]); } printf("\n"); } @@ -2218,7 +2218,7 @@ void U_EMRCREATECOLORSPACEW_print(const char *contents){ printf(" Data: "); if(pEmr->dwFlags & 1){ for(i=0; i<pEmr->cbData; i++){ - printf("[%d]:%2.2X ",i,pEmr->Data[i]); + printf("[%u]:%2.2X ",i,pEmr->Data[i]); } } printf("\n"); diff --git a/src/lpe-tool-context.cpp b/src/lpe-tool-context.cpp index 14a536b7d..bcf58aaf3 100644 --- a/src/lpe-tool-context.cpp +++ b/src/lpe-tool-context.cpp @@ -410,7 +410,7 @@ lpetool_create_measuring_items(SPLPEToolContext *lc, Inkscape::Selection *select for (GSList const *i = selection->itemList(); i != NULL; i = i->next) { if (SP_IS_PATH(i->data)) { path = SP_PATH(i->data); - curve = SP_SHAPE(path)->getCurve(); + curve = path->getCurve(); Geom::Piecewise<Geom::D2<Geom::SBasis> > pwd2 = paths_to_pw(curve->get_pathvector()); canvas_text = (SPCanvasText *) sp_canvastext_new(tmpgrp, lc->desktop, Geom::Point(0,0), ""); if (!show) @@ -453,7 +453,7 @@ lpetool_update_measuring_items(SPLPEToolContext *lc) ++i ) { SPPath *path = i->first; - SPCurve *curve = SP_SHAPE(path)->getCurve(); + SPCurve *curve = path->getCurve(); Geom::Piecewise<Geom::D2<Geom::SBasis> > pwd2 = Geom::paths_to_pw(curve->get_pathvector()); Inkscape::Util::Unit unit; if (prefs->getString("/tools/lpetool/unit").compare("")) { diff --git a/src/sp-ellipse.cpp b/src/sp-ellipse.cpp index 55f308c6b..fc78b9777 100644 --- a/src/sp-ellipse.cpp +++ b/src/sp-ellipse.cpp @@ -275,8 +275,6 @@ void SPGenericEllipse::snappoints(std::vector<Inkscape::SnapCandidatePoint> &p, double cx = this->cx.computed; double cy = this->cy.computed; - Geom::Point pt; - // Snap to the 4 quadrant points of the this, but only if the arc // spans far enough to include them if (snapprefs->isTargetSnappable(Inkscape::SNAPTARGET_ELLIPSE_QUADRANT_POINT)) { @@ -284,7 +282,7 @@ void SPGenericEllipse::snappoints(std::vector<Inkscape::SnapCandidatePoint> &p, for (angle = 0; angle < SP_2PI; angle += M_PI_2) { if (angle >= this->start && angle <= this->end) { - pt = Geom::Point(cx + cos(angle)*rx, cy + sin(angle)*ry) * i2dt; + Geom::Point pt = Geom::Point(cx + cos(angle)*rx, cy + sin(angle)*ry) * i2dt; p.push_back(Inkscape::SnapCandidatePoint(pt, Inkscape::SNAPSOURCE_ELLIPSE_QUADRANT_POINT, Inkscape::SNAPTARGET_ELLIPSE_QUADRANT_POINT)); } } @@ -295,7 +293,7 @@ void SPGenericEllipse::snappoints(std::vector<Inkscape::SnapCandidatePoint> &p, bool c2 = snapprefs->isTargetSnappable(Inkscape::SNAPTARGET_OBJECT_MIDPOINT); if (c1 || c2) { - pt = Geom::Point(cx, cy) * i2dt; + Geom::Point pt = Geom::Point(cx, cy) * i2dt; if (c1) { p.push_back(Inkscape::SnapCandidatePoint(pt, Inkscape::SNAPSOURCE_NODE_CUSP, Inkscape::SNAPTARGET_NODE_CUSP)); @@ -310,13 +308,13 @@ void SPGenericEllipse::snappoints(std::vector<Inkscape::SnapCandidatePoint> &p, if (snapprefs->isTargetSnappable(Inkscape::SNAPTARGET_NODE_CUSP) && slice) { // Add the start point, if it's not coincident with a quadrant point if (fmod(this->start, M_PI_2) != 0.0 ) { - pt = Geom::Point(cx + cos(this->start)*rx, cy + sin(this->start)*ry) * i2dt; + Geom::Point pt = Geom::Point(cx + cos(this->start)*rx, cy + sin(this->start)*ry) * i2dt; p.push_back(Inkscape::SnapCandidatePoint(pt, Inkscape::SNAPSOURCE_NODE_CUSP, Inkscape::SNAPTARGET_NODE_CUSP)); } // Add the end point, if it's not coincident with a quadrant point if (fmod(this->end, M_PI_2) != 0.0 ) { - pt = Geom::Point(cx + cos(this->end)*rx, cy + sin(this->end)*ry) * i2dt; + Geom::Point pt = Geom::Point(cx + cos(this->end)*rx, cy + sin(this->end)*ry) * i2dt; p.push_back(Inkscape::SnapCandidatePoint(pt, Inkscape::SNAPSOURCE_NODE_CUSP, Inkscape::SNAPTARGET_NODE_CUSP)); } } diff --git a/src/sp-shape.cpp b/src/sp-shape.cpp index 7efe28dd8..913e208aa 100644 --- a/src/sp-shape.cpp +++ b/src/sp-shape.cpp @@ -93,16 +93,13 @@ void SPShape::build(SPDocument *document, Inkscape::XML::Node *repr) { * \see SPObject::release() */ void SPShape::release() { - SPItemView *v; - int i; - - for (i = 0; i < SP_MARKER_LOC_QTY; i++) { + for (int i = 0; i < SP_MARKER_LOC_QTY; i++) { if (this->_marker[i]) { - - for (v = this->display; v != NULL; v = v->next) { + + for (SPItemView *v = this->display; v != NULL; v = v->next) { sp_marker_hide ((SPMarker *) this->_marker[i], v->arenaitem->key() + i); } - + this->_release_connect[i].disconnect(); this->_modified_connect[i].disconnect(); this->_marker[i] = sp_object_hunref (this->_marker[i], this); @@ -143,16 +140,14 @@ void SPShape::update(SPCtx* ctx, guint flags) { } if (flags & (SP_OBJECT_STYLE_MODIFIED_FLAG | SP_OBJECT_VIEWPORT_MODIFIED_FLAG)) { - SPStyle *style = this->style; - - if (style->stroke_width.unit == SP_CSS_UNIT_PERCENT) { + if (this->style->stroke_width.unit == SP_CSS_UNIT_PERCENT) { SPItemCtx *ictx = (SPItemCtx *) ctx; double const aw = 1.0 / ictx->i2vp.descrim(); - style->stroke_width.computed = style->stroke_width.value * aw; + this->style->stroke_width.computed = this->style->stroke_width.value * aw; for (SPItemView *v = ((SPItem *) (this))->display; v != NULL; v = v->next) { Inkscape::DrawingShape *sh = dynamic_cast<Inkscape::DrawingShape *>(v->arenaitem); - sh->setStyle(style); + sh->setStyle(this->style); } } } @@ -219,8 +214,7 @@ Geom::Affine sp_shape_marker_get_transform(Geom::Curve const & c1, Geom::Curve c double const angle1 = Geom::atan2(tang1); double const angle2 = Geom::atan2(tang2); - double ret_angle; - ret_angle = .5 * (angle1 + angle2); + double ret_angle = .5 * (angle1 + angle2); if ( fabs( angle2 - angle1 ) > M_PI ) { /* ret_angle is in the middle of the larger of the two sectors between angle1 and @@ -281,8 +275,6 @@ Geom::Affine sp_shape_marker_get_transform_at_end(Geom::Curve const & c) static void sp_shape_update_marker_view(SPShape *shape, Inkscape::DrawingItem *ai) { - SPStyle *style = ((SPObject *) shape)->style; - // position arguments to sp_marker_show_instance, basically counts the amount of markers. int counter[4] = {0}; @@ -300,7 +292,7 @@ sp_shape_update_marker_view(SPShape *shape, Inkscape::DrawingItem *ai) if ( shape->_marker[i] ) { sp_marker_show_instance ((SPMarker* ) shape->_marker[i], ai, ai->key() + i, counter[i], m, - style->stroke_width.computed); + shape->style->stroke_width.computed); counter[i]++; } } @@ -318,7 +310,7 @@ sp_shape_update_marker_view(SPShape *shape, Inkscape::DrawingItem *ai) if ( shape->_marker[i] ) { sp_marker_show_instance ((SPMarker* ) shape->_marker[i], ai, ai->key() + i, counter[i], m, - style->stroke_width.computed); + shape->style->stroke_width.computed); counter[i]++; } } @@ -338,7 +330,7 @@ sp_shape_update_marker_view(SPShape *shape, Inkscape::DrawingItem *ai) if (shape->_marker[i]) { sp_marker_show_instance ((SPMarker* ) shape->_marker[i], ai, ai->key() + i, counter[i], m, - style->stroke_width.computed); + shape->style->stroke_width.computed); counter[i]++; } } @@ -355,7 +347,7 @@ sp_shape_update_marker_view(SPShape *shape, Inkscape::DrawingItem *ai) if (shape->_marker[i]) { sp_marker_show_instance ((SPMarker* ) shape->_marker[i], ai, ai->key() + i, counter[i], m, - style->stroke_width.computed); + shape->style->stroke_width.computed); counter[i]++; } } @@ -379,7 +371,7 @@ sp_shape_update_marker_view(SPShape *shape, Inkscape::DrawingItem *ai) if (shape->_marker[i]) { sp_marker_show_instance ((SPMarker* ) shape->_marker[i], ai, ai->key() + i, counter[i], m, - style->stroke_width.computed); + shape->style->stroke_width.computed); counter[i]++; } } @@ -412,9 +404,8 @@ Geom::OptRect SPShape::bbox(Geom::Affine const &transform, SPItem::BBoxType bbox if (bboxtype == SPItem::VISUAL_BBOX) { // convert the stroke to a path and calculate that path's geometric bbox - SPStyle* style = this->style; - if (!style->stroke.isNone()) { + if (!this->style->stroke.isNone()) { Geom::PathVector *pathv = item_outline(this, true); // calculate bbox_only if (pathv) { @@ -442,7 +433,7 @@ Geom::OptRect SPShape::bbox(Geom::Affine const &transform, SPItem::BBoxType bbox } if (marker->markerUnits == SP_MARKER_UNITS_STROKEWIDTH) { - tr = Geom::Scale(style->stroke_width.computed) * tr; + tr = Geom::Scale(this->style->stroke_width.computed) * tr; } // total marker transform @@ -480,7 +471,7 @@ Geom::OptRect SPShape::bbox(Geom::Affine const &transform, SPItem::BBoxType bbox } if (marker->markerUnits == SP_MARKER_UNITS_STROKEWIDTH) { - tr = Geom::Scale(style->stroke_width.computed) * tr; + tr = Geom::Scale(this->style->stroke_width.computed) * tr; } tr = marker_item->transform * marker->c2p * tr * transform; @@ -510,7 +501,7 @@ Geom::OptRect SPShape::bbox(Geom::Affine const &transform, SPItem::BBoxType bbox } if (marker->markerUnits == SP_MARKER_UNITS_STROKEWIDTH) { - tr = Geom::Scale(style->stroke_width.computed) * tr; + tr = Geom::Scale(this->style->stroke_width.computed) * tr; } tr = marker_item->transform * marker->c2p * tr * transform; @@ -533,7 +524,7 @@ Geom::OptRect SPShape::bbox(Geom::Affine const &transform, SPItem::BBoxType bbox } if (marker->markerUnits == SP_MARKER_UNITS_STROKEWIDTH) { - tr = Geom::Scale(style->stroke_width.computed) * tr; + tr = Geom::Scale(this->style->stroke_width.computed) * tr; } tr = marker_item->transform * marker->c2p * tr * transform; @@ -568,7 +559,7 @@ Geom::OptRect SPShape::bbox(Geom::Affine const &transform, SPItem::BBoxType bbox } if (marker->markerUnits == SP_MARKER_UNITS_STROKEWIDTH) { - tr = Geom::Scale(style->stroke_width.computed) * tr; + tr = Geom::Scale(this->style->stroke_width.computed) * tr; } // total marker transform diff --git a/src/sp-spiral.cpp b/src/sp-spiral.cpp index b9d1d11da..5d80e43fe 100644 --- a/src/sp-spiral.cpp +++ b/src/sp-spiral.cpp @@ -339,7 +339,6 @@ void SPSpiral::set_shape() { } Geom::Point darray[SAMPLE_SIZE + 1]; - double t; this->requestModified(SP_OBJECT_MODIFIED_FLAG); @@ -365,6 +364,7 @@ void SPSpiral::set_shape() { Geom::Point hat1 = this->getTangent(this->t0); Geom::Point hat2; + double t; for (t = this->t0; t < (1.0 - tstep);) { this->fitAndDraw(c, dstep, darray, hat1, hat2, &t); diff --git a/src/ui/tool/path-manipulator.cpp b/src/ui/tool/path-manipulator.cpp index 673eba97a..6e14e8e97 100644 --- a/src/ui/tool/path-manipulator.cpp +++ b/src/ui/tool/path-manipulator.cpp @@ -1328,7 +1328,7 @@ void PathManipulator::_setGeometry() if (_path->getRepr()->attribute("inkscape:original-d")) _path->set_original_curve(_spcurve, false, false); else - SP_SHAPE(_path)->setCurve(_spcurve, false); + _path->setCurve(_spcurve, false); } } |
