From d463240d8fd961d45b47ba96e0d93c37e1719da7 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Wed, 21 Nov 2012 09:55:55 +1100 Subject: code cleanup: quiet warnings with gcc. (bzr r11888) --- src/livarot/ShapeMisc.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/livarot/ShapeMisc.cpp') diff --git a/src/livarot/ShapeMisc.cpp b/src/livarot/ShapeMisc.cpp index 7b170e8a0..a7e5a6cdc 100644 --- a/src/livarot/ShapeMisc.cpp +++ b/src/livarot/ShapeMisc.cpp @@ -406,7 +406,7 @@ Shape::ConvertToFormeNested (Path * dest, int nbP, Path * *orig, int wildPath,in if (startBord >= 0) { // parcours en profondeur pour mettre les leF et riF a leurs valeurs - swdData[startBord].misc = (void *) (1+nbNest); + swdData[startBord].misc = (void *)(intptr_t)(1 + nbNest); //printf("part de %d\n",startBord); int curBord = startBord; bool back = false; @@ -507,7 +507,7 @@ Shape::ConvertToFormeNested (Path * dest, int nbP, Path * *orig, int wildPath,in startBord=nb; } } - swdData[nb].misc = (void *) (1+nbNest); + swdData[nb].misc = (void *)(intptr_t)(1 + nbNest); swdData[nb].ind = searchInd++; swdData[nb].precParc = curBord; swdData[curBord].suivParc = nb; -- cgit v1.2.3 From fa90512487d3efef01c614cd4c7552fd984e46a4 Mon Sep 17 00:00:00 2001 From: Alvin Penner Date: Sat, 25 May 2013 18:27:46 -0400 Subject: boolops. allow Division to create hole (Bug 499744) Fixed bugs: - https://launchpad.net/bugs/499744 (bzr r12342) --- src/livarot/ShapeMisc.cpp | 60 +++++++++++++++++++++++++++-------------------- 1 file changed, 35 insertions(+), 25 deletions(-) (limited to 'src/livarot/ShapeMisc.cpp') diff --git a/src/livarot/ShapeMisc.cpp b/src/livarot/ShapeMisc.cpp index a7e5a6cdc..6fd40790f 100644 --- a/src/livarot/ShapeMisc.cpp +++ b/src/livarot/ShapeMisc.cpp @@ -374,6 +374,8 @@ Shape::ConvertToFormeNested (Path * dest, int nbP, Path * *orig, int wildPath,in do { int dadContour=-1; + int childEdge = -1; + bool foundChild = false; int startBord = -1; { int fi = 0; @@ -389,6 +391,7 @@ Shape::ConvertToFormeNested (Path * dest, int nbP, Path * *orig, int wildPath,in } else { dadContour = GPOINTER_TO_INT(swdData[askTo].misc); dadContour-=1; // pour compenser le decalage + childEdge = getPoint(fi).incidentEdge[FIRST]; } } lastPtUsed = fi + 1; @@ -407,6 +410,9 @@ Shape::ConvertToFormeNested (Path * dest, int nbP, Path * *orig, int wildPath,in { // parcours en profondeur pour mettre les leF et riF a leurs valeurs swdData[startBord].misc = (void *)(intptr_t)(1 + nbNest); + if (startBord == childEdge) { + foundChild = true; + } //printf("part de %d\n",startBord); int curBord = startBord; bool back = false; @@ -444,22 +450,23 @@ Shape::ConvertToFormeNested (Path * dest, int nbP, Path * *orig, int wildPath,in } else { - bool escapePath=false; - int tb=curBord; - while ( tb >= 0 && tb < numberOfEdges() ) { - if ( ebData[tb].pathID == wildPath ) { - escapePath=true; - break; - } - tb=swdData[tb].precParc; - } +// bool escapePath=false; +// int tb=curBord; +// while ( tb >= 0 && tb < numberOfEdges() ) { +// if ( ebData[tb].pathID == wildPath ) { +// escapePath=true; +// break; +// } +// tb=swdData[tb].precParc; +// } nesting=(int*)g_realloc(nesting,(nbNest+1)*sizeof(int)); contStart=(int*)g_realloc(contStart,(nbNest+1)*sizeof(int)); contStart[nbNest]=dest->descr_cmd.size(); - if ( escapePath ) { - nesting[nbNest++]=-1; // contient des bouts de coupure -> a part - } else { + if (foundChild) { nesting[nbNest++]=dadContour; + foundChild = false; + } else { + nesting[nbNest++]=-1; // contient des bouts de coupure -> a part } swdData[curBord].suivParc = -1; AddContour (dest, nbP, orig, startBord, curBord,splitWhenForced); @@ -484,24 +491,24 @@ Shape::ConvertToFormeNested (Path * dest, int nbP, Path * *orig, int wildPath,in if ( getEdge(curBord).en == curStartPt ) { //printf("contour %i ",curStartPt); - bool escapePath=false; - int tb=curBord; - while ( tb >= 0 && tb < numberOfEdges() ) { - if ( ebData[tb].pathID == wildPath ) { - escapePath=true; - break; - } - tb=swdData[tb].precParc; - } +// bool escapePath=false; +// int tb=curBord; +// while ( tb >= 0 && tb < numberOfEdges() ) { +// if ( ebData[tb].pathID == wildPath ) { +// escapePath=true; +// break; +// } +// tb=swdData[tb].precParc; +// } nesting=(int*)g_realloc(nesting,(nbNest+1)*sizeof(int)); contStart=(int*)g_realloc(contStart,(nbNest+1)*sizeof(int)); contStart[nbNest]=dest->descr_cmd.size(); - if ( escapePath ) { - nesting[nbNest++]=-1; // contient des bouts de coupure -> a part - } else { + if (foundChild) { nesting[nbNest++]=dadContour; + foundChild = false; + } else { + nesting[nbNest++]=-1; // contient des bouts de coupure -> a part } - swdData[curBord].suivParc = -1; AddContour (dest, nbP, orig, startBord, curBord,splitWhenForced); startBord=nb; @@ -512,6 +519,9 @@ Shape::ConvertToFormeNested (Path * dest, int nbP, Path * *orig, int wildPath,in swdData[nb].precParc = curBord; swdData[curBord].suivParc = nb; curBord = nb; + if (nb == childEdge) { + foundChild = true; + } //printf("suite %d\n",curBord); } } -- cgit v1.2.3 From ced7761e69301a40944684fd295a04ea9e736c24 Mon Sep 17 00:00:00 2001 From: Alvin Penner Date: Mon, 1 Jul 2013 17:51:53 -0400 Subject: Shape calculations. do not quantize the coordinates. (Bug 168158) Fixed bugs: - https://launchpad.net/bugs/168158 (bzr r12399) --- src/livarot/ShapeMisc.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'src/livarot/ShapeMisc.cpp') diff --git a/src/livarot/ShapeMisc.cpp b/src/livarot/ShapeMisc.cpp index 6fd40790f..5bb8a25ef 100644 --- a/src/livarot/ShapeMisc.cpp +++ b/src/livarot/ShapeMisc.cpp @@ -49,8 +49,8 @@ Shape::ConvertToForme (Path * dest) for (int i = 0; i < numberOfPoints(); i++) { - pData[i].rx[0] = Round (getPoint(i).x[0]); - pData[i].rx[1] = Round (getPoint(i).x[1]); + pData[i].rx[0] = /*Round*/ (getPoint(i).x[0]); + pData[i].rx[1] = /*Round*/ (getPoint(i).x[1]); } for (int i = 0; i < numberOfEdges(); i++) { @@ -199,8 +199,8 @@ Shape::ConvertToForme (Path * dest, int nbP, Path * *orig, bool splitWhenForced) for (int i = 0; i < numberOfPoints(); i++) { - pData[i].rx[0] = Round (getPoint(i).x[0]); - pData[i].rx[1] = Round (getPoint(i).x[1]); + pData[i].rx[0] = /*Round*/ (getPoint(i).x[0]); + pData[i].rx[1] = /*Round*/ (getPoint(i).x[1]); } for (int i = 0; i < numberOfEdges(); i++) { @@ -352,8 +352,8 @@ Shape::ConvertToFormeNested (Path * dest, int nbP, Path * *orig, int wildPath,in for (int i = 0; i < numberOfPoints(); i++) { - pData[i].rx[0] = Round (getPoint(i).x[0]); - pData[i].rx[1] = Round (getPoint(i).x[1]); + pData[i].rx[0] = /*Round*/ (getPoint(i).x[0]); + pData[i].rx[1] = /*Round*/ (getPoint(i).x[1]); } for (int i = 0; i < numberOfEdges(); i++) { -- cgit v1.2.3 From 4e088d33c04329fe57ef987d577f5aa57f83b644 Mon Sep 17 00:00:00 2001 From: Alvin Penner Date: Tue, 16 Jul 2013 15:46:56 -0400 Subject: Shape calculations. re-introduce grid of a smaller size. (http://article.gmane.org/gmane.comp.graphics.inkscape.devel/40786) (bzr r12420) --- src/livarot/ShapeMisc.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'src/livarot/ShapeMisc.cpp') diff --git a/src/livarot/ShapeMisc.cpp b/src/livarot/ShapeMisc.cpp index 5bb8a25ef..6fd40790f 100644 --- a/src/livarot/ShapeMisc.cpp +++ b/src/livarot/ShapeMisc.cpp @@ -49,8 +49,8 @@ Shape::ConvertToForme (Path * dest) for (int i = 0; i < numberOfPoints(); i++) { - pData[i].rx[0] = /*Round*/ (getPoint(i).x[0]); - pData[i].rx[1] = /*Round*/ (getPoint(i).x[1]); + pData[i].rx[0] = Round (getPoint(i).x[0]); + pData[i].rx[1] = Round (getPoint(i).x[1]); } for (int i = 0; i < numberOfEdges(); i++) { @@ -199,8 +199,8 @@ Shape::ConvertToForme (Path * dest, int nbP, Path * *orig, bool splitWhenForced) for (int i = 0; i < numberOfPoints(); i++) { - pData[i].rx[0] = /*Round*/ (getPoint(i).x[0]); - pData[i].rx[1] = /*Round*/ (getPoint(i).x[1]); + pData[i].rx[0] = Round (getPoint(i).x[0]); + pData[i].rx[1] = Round (getPoint(i).x[1]); } for (int i = 0; i < numberOfEdges(); i++) { @@ -352,8 +352,8 @@ Shape::ConvertToFormeNested (Path * dest, int nbP, Path * *orig, int wildPath,in for (int i = 0; i < numberOfPoints(); i++) { - pData[i].rx[0] = /*Round*/ (getPoint(i).x[0]); - pData[i].rx[1] = /*Round*/ (getPoint(i).x[1]); + pData[i].rx[0] = Round (getPoint(i).x[0]); + pData[i].rx[1] = Round (getPoint(i).x[1]); } for (int i = 0; i < numberOfEdges(); i++) { -- cgit v1.2.3 From 4aa096a5a8537b6e28c4502d817e546b8b7fdd9b Mon Sep 17 00:00:00 2001 From: Kris De Gussem Date: Sun, 27 Oct 2013 20:57:50 +0100 Subject: "fix" some "unused parameter" warnings (bzr r12736) --- src/livarot/ShapeMisc.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/livarot/ShapeMisc.cpp') diff --git a/src/livarot/ShapeMisc.cpp b/src/livarot/ShapeMisc.cpp index 6fd40790f..e40915cba 100644 --- a/src/livarot/ShapeMisc.cpp +++ b/src/livarot/ShapeMisc.cpp @@ -327,7 +327,7 @@ Shape::ConvertToForme (Path * dest, int nbP, Path * *orig, bool splitWhenForced) MakeSweepDestData (false); } void -Shape::ConvertToFormeNested (Path * dest, int nbP, Path * *orig, int wildPath,int &nbNest,int *&nesting,int *&contStart,bool splitWhenForced) +Shape::ConvertToFormeNested (Path * dest, int nbP, Path * *orig, int /*wildPath*/,int &nbNest,int *&nesting,int *&contStart,bool splitWhenForced) { nesting=NULL; contStart=NULL; -- cgit v1.2.3 From 90bb2311a8e87439c8ae845fcf22755e40030d1d Mon Sep 17 00:00:00 2001 From: Alvin Penner Date: Sat, 2 Nov 2013 09:04:00 -0400 Subject: more conversions from radians to degrees for arcs (Bug 1239462) Fixed bugs: - https://launchpad.net/bugs/1239462 (bzr r12763) --- src/livarot/ShapeMisc.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/livarot/ShapeMisc.cpp') diff --git a/src/livarot/ShapeMisc.cpp b/src/livarot/ShapeMisc.cpp index e40915cba..e5a98f0cf 100644 --- a/src/livarot/ShapeMisc.cpp +++ b/src/livarot/ShapeMisc.cpp @@ -1056,7 +1056,7 @@ Shape::ReFormeArcTo (int bord, int /*curBord*/, Path * dest, Path * from) PathDescrArcTo* nData = dynamic_cast(from->descr_cmd[nPiece]); bool nLarge = nData->large; bool nClockwise = nData->clockwise; - Path::ArcAngles (from->PrevPoint (nPiece - 1), nData->p,nData->rx,nData->ry,nData->angle, nLarge, nClockwise, sang, eang); + Path::ArcAngles (from->PrevPoint (nPiece - 1), nData->p,nData->rx,nData->ry,nData->angle*M_PI/180.0, nLarge, nClockwise, sang, eang); if (nClockwise) { if (sang < eang) -- cgit v1.2.3 From c7731033ef400fccb6a49d830ded86068fcd3432 Mon Sep 17 00:00:00 2001 From: Nicolas Dufour Date: Wed, 5 Feb 2014 12:29:11 +0100 Subject: Fix for Bug #1250685 (Unnecessary gender-specific terms in code). Fixed bugs: - https://launchpad.net/bugs/1250685 (bzr r12997) --- src/livarot/ShapeMisc.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'src/livarot/ShapeMisc.cpp') diff --git a/src/livarot/ShapeMisc.cpp b/src/livarot/ShapeMisc.cpp index e5a98f0cf..c0bfe9428 100644 --- a/src/livarot/ShapeMisc.cpp +++ b/src/livarot/ShapeMisc.cpp @@ -373,7 +373,7 @@ Shape::ConvertToFormeNested (Path * dest, int nbP, Path * *orig, int /*wildPath* int lastPtUsed = 0; do { - int dadContour=-1; + int parentContour=-1; int childEdge = -1; bool foundChild = false; int startBord = -1; @@ -387,10 +387,10 @@ Shape::ConvertToFormeNested (Path * dest, int nbP, Path * *orig, int /*wildPath* { int askTo = pData[fi].askForWindingB; if (askTo < 0 || askTo >= numberOfEdges() ) { - dadContour=-1; + parentContour=-1; } else { - dadContour = GPOINTER_TO_INT(swdData[askTo].misc); - dadContour-=1; // pour compenser le decalage + parentContour = GPOINTER_TO_INT(swdData[askTo].misc); + parentContour-=1; // pour compenser le decalage childEdge = getPoint(fi).incidentEdge[FIRST]; } } @@ -463,7 +463,7 @@ Shape::ConvertToFormeNested (Path * dest, int nbP, Path * *orig, int /*wildPath* contStart=(int*)g_realloc(contStart,(nbNest+1)*sizeof(int)); contStart[nbNest]=dest->descr_cmd.size(); if (foundChild) { - nesting[nbNest++]=dadContour; + nesting[nbNest++]=parentContour; foundChild = false; } else { nesting[nbNest++]=-1; // contient des bouts de coupure -> a part @@ -504,7 +504,7 @@ Shape::ConvertToFormeNested (Path * dest, int nbP, Path * *orig, int /*wildPath* contStart=(int*)g_realloc(contStart,(nbNest+1)*sizeof(int)); contStart[nbNest]=dest->descr_cmd.size(); if (foundChild) { - nesting[nbNest++]=dadContour; + nesting[nbNest++]=parentContour; foundChild = false; } else { nesting[nbNest++]=-1; // contient des bouts de coupure -> a part -- cgit v1.2.3