[Libreoffice-commits] libvisio.git: 2 commits - src/lib
Fridrich Å trba
fridrich.strba at bluewin.ch
Wed Jul 10 01:43:33 PDT 2013
src/lib/VSDContentCollector.cpp | 22 +++++++++++-----------
1 file changed, 11 insertions(+), 11 deletions(-)
New commits:
commit 5a38774b5f9bfc2d58e8a7a06effb0bbe7d0debd
Author: Fridrich Å trba <fridrich.strba at bluewin.ch>
Date: Wed Jul 10 10:43:03 2013 +0200
Try not to go out of bonds
diff --git a/src/lib/VSDContentCollector.cpp b/src/lib/VSDContentCollector.cpp
index 5057370..09fc553 100644
--- a/src/lib/VSDContentCollector.cpp
+++ b/src/lib/VSDContentCollector.cpp
@@ -1392,24 +1392,23 @@ void libvisio::VSDContentCollector::_generateBezierSegmentsFromNURBS(unsigned de
* The NURBS Book, 2nd Edition, 1997
*/
- unsigned m = controlPoints.size() + degree + 1;
unsigned a = degree;
unsigned b = degree + 1;
std::vector< std::pair<double, double> > points(degree + 1), nextPoints(degree + 1);
unsigned i = 0;
for (; i <= degree; i++)
points[i] = controlPoints[i];
- while (b < m)
+ while (b < knotVector.size() - 1)
{
i = b;
- while (b < m && knotVector[b+1] == knotVector[b])
+ while (b < knotVector.size() - 1 && knotVector[b+1] == knotVector[b])
b++;
unsigned mult = b - i + 1;
if (mult < degree)
{
double numer = (double)(knotVector[b] - knotVector[a]);
unsigned j = degree;
- std::map<unsigned, double> alphas;
+ std::vector<double> alphas(degree - 1, 0.0);
for (; j >mult; j--)
alphas[j-mult-1] = numer/double(knotVector[a+j]-knotVector[a]);
unsigned r = degree - mult;
@@ -1423,7 +1422,7 @@ void libvisio::VSDContentCollector::_generateBezierSegmentsFromNURBS(unsigned de
points[k].first = alpha*points[k].first + (1.0-alpha)*points[k-1].first;
points[k].second = alpha*points[k].second + (1.0-alpha)*points[k-1].second;
}
- if (b < m)
+ if (b < knotVector.size() - 1)
{
nextPoints[save].first = points[degree].first;
nextPoints[save].second = points[degree].second;
@@ -1449,7 +1448,7 @@ void libvisio::VSDContentCollector::_generateBezierSegmentsFromNURBS(unsigned de
std::swap(points, nextPoints);
- if (b < m)
+ if (b < knotVector.size() - 1)
{
for (i=degree-mult; i <= degree; i++)
{
commit e7974026dd728d2882962de803c0cfbc29057283
Author: Fridrich Å trba <fridrich.strba at bluewin.ch>
Date: Wed Jul 10 10:09:50 2013 +0200
Fixing back some mistakes paid cash to valgrind
diff --git a/src/lib/VSDContentCollector.cpp b/src/lib/VSDContentCollector.cpp
index b5bb7d4..5057370 100644
--- a/src/lib/VSDContentCollector.cpp
+++ b/src/lib/VSDContentCollector.cpp
@@ -989,7 +989,6 @@ void libvisio::VSDContentCollector::collectRelCubBezTo(unsigned /* id */, unsign
transformPoint(x, y);
m_x = x;
m_y = y;
-
WPXPropertyList node;
node.insert("libwpg:path-action", "C");
node.insert("svg:x",m_scale*x);
@@ -1272,11 +1271,11 @@ void libvisio::VSDContentCollector::collectArcTo(unsigned /* id */, unsigned lev
transformPoint(x2, y2);
double angle = 0.0;
transformAngle(angle);
- m_x = x2;
- m_y = y2;
if (bow == 0)
{
+ m_x = x2;
+ m_y = y2;
WPXPropertyList end;
end.insert("svg:x", m_scale*m_x);
end.insert("svg:y", m_scale*m_y);
@@ -1295,6 +1294,8 @@ void libvisio::VSDContentCollector::collectArcTo(unsigned /* id */, unsigned lev
bool sweep = (bow < 0);
transformFlips(sweep, sweep);
+ m_x = x2;
+ m_y = y2;
arc.insert("svg:rx", m_scale*radius);
arc.insert("svg:ry", m_scale*radius);
arc.insert("libwpg:rotate", angle*180/M_PI, WPX_GENERIC);
@@ -2083,9 +2084,9 @@ void libvisio::VSDContentCollector::collectSplineEnd()
return;
}
m_splineKnotVector.push_back(m_splineLastKnot);
- std::vector<double> weights;
+ std::vector<double> weights(m_splineControlPoints.size()+2);
for (unsigned i=0; i < m_splineControlPoints.size()+2; i++)
- weights.push_back(1.0);
+ weights[i] = 1.0;
collectNURBSTo(0, m_splineLevel, m_splineX, m_splineY, 1, 1, m_splineDegree, m_splineControlPoints, m_splineKnotVector, weights);
m_splineKnotVector.clear();
m_splineControlPoints.clear();
More information about the Libreoffice-commits
mailing list