[Libreoffice-commits] libvisio.git: 4 commits - src/lib
David Tardon
dtardon at redhat.com
Tue Oct 17 11:32:16 UTC 2017
src/lib/VSDContentCollector.cpp | 17 ++++++++++-------
1 file changed, 10 insertions(+), 7 deletions(-)
New commits:
commit 20e3d231bed64917a9f683541100cf53e98c26c5
Author: David Tardon <dtardon at redhat.com>
Date: Tue Oct 17 10:36:06 2017 +0200
drop always-true tests
Change-Id: I1788036303edb2837bbb1d77dbbc5a431f3293c3
diff --git a/src/lib/VSDContentCollector.cpp b/src/lib/VSDContentCollector.cpp
index f6a7e73..4d0bde7 100644
--- a/src/lib/VSDContentCollector.cpp
+++ b/src/lib/VSDContentCollector.cpp
@@ -2085,9 +2085,9 @@ void libvisio::VSDContentCollector::_generatePolylineFromNURBS(unsigned degree,
node.insert("svg:x", m_scale*x);
node.insert("svg:y", m_scale*y);
- if (!m_noFill && !m_noShow)
+ if (!m_noFill)
m_currentFillGeometry.push_back(node);
- if (!m_noLine && !m_noShow)
+ if (!m_noLine)
m_currentLineGeometry.push_back(node);
}
}
commit 329afd8d1461b28a0ef5fcf9da21bec960eb7257
Author: David Tardon <dtardon at redhat.com>
Date: Tue Oct 17 10:26:23 2017 +0200
avoid needless reallocations
Change-Id: Id6af494bb71734f52a4d8c3ac094f917ff448538
diff --git a/src/lib/VSDContentCollector.cpp b/src/lib/VSDContentCollector.cpp
index da19cf5..f6a7e73 100644
--- a/src/lib/VSDContentCollector.cpp
+++ b/src/lib/VSDContentCollector.cpp
@@ -2139,11 +2139,9 @@ void libvisio::VSDContentCollector::collectNURBSTo(unsigned /* id */, unsigned l
std::vector<double> knotVector(kntVec);
// Fill in end knots
+ knotVector.reserve(controlPoints.size() + degree + 1);
while (knotVector.size() < (controlPoints.size() + degree + 1))
- {
- double tmpBack = knotVector.back();
- knotVector.push_back(tmpBack);
- }
+ knotVector.push_back(knotVector.back());
// Let knotVector run from 0 to 1
double firstKnot = knotVector[0];
commit 879c3044e33c1b971cf9146a3ea4571a9ae60b4d
Author: David Tardon <dtardon at redhat.com>
Date: Tue Oct 17 10:23:35 2017 +0200
this cannot happen here
Change-Id: Ibecaa5e63fee6ee23657ef395b6fe5aa920a7da1
diff --git a/src/lib/VSDContentCollector.cpp b/src/lib/VSDContentCollector.cpp
index e5ef1f6..da19cf5 100644
--- a/src/lib/VSDContentCollector.cpp
+++ b/src/lib/VSDContentCollector.cpp
@@ -1953,7 +1953,7 @@ void libvisio::VSDContentCollector::_outputLinearBezierSegment(const std::vector
void libvisio::VSDContentCollector::_generateBezierSegmentsFromNURBS(unsigned degree,
const std::vector<std::pair<double, double> > &controlPoints, const std::vector<double> &knotVector)
{
- if (controlPoints.size() <= degree || knotVector.empty() || degree == 0 || degree > 3)
+ if (controlPoints.size() <= degree || knotVector.empty() || degree == 0)
return;
/* Decomposition of a uniform spline of a given degree into Bezier segments
commit dc367e0d199940c55469dcb73649f326872375f3
Author: David Tardon <dtardon at redhat.com>
Date: Tue Oct 17 10:09:40 2017 +0200
ofz#3520 limit the possible NURBS degree
Change-Id: If64244416d30e6356828c68e95cb22f318afeea9
diff --git a/src/lib/VSDContentCollector.cpp b/src/lib/VSDContentCollector.cpp
index 6f4e85d..e5ef1f6 100644
--- a/src/lib/VSDContentCollector.cpp
+++ b/src/lib/VSDContentCollector.cpp
@@ -2107,6 +2107,8 @@ bool libvisio::VSDContentCollector::_isUniform(const std::vector<double> &weight
return true;
}
+#define MAX_ALLOWED_NURBS_DEGREE 16
+
void libvisio::VSDContentCollector::collectNURBSTo(unsigned /* id */, unsigned level, double x2, double y2,
unsigned char xType, unsigned char yType, unsigned degree, const std::vector<std::pair<double, double> > &ctrlPnts,
const std::vector<double> &kntVec, const std::vector<double> &weights)
@@ -2117,6 +2119,9 @@ void libvisio::VSDContentCollector::collectNURBSTo(unsigned /* id */, unsigned l
// Here, maybe we should just draw line to (x2,y2)
return;
+ if (degree > MAX_ALLOWED_NURBS_DEGREE)
+ degree = MAX_ALLOWED_NURBS_DEGREE;
+
std::vector<std::pair<double, double> > controlPoints(ctrlPnts);
// Convert control points to static co-ordinates
More information about the Libreoffice-commits
mailing list