Hello community,
here is the log from the commit of package libvisio for openSUSE:Factory checked in at 2013-07-10 23:24:56
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/libvisio (Old)
and /work/SRC/openSUSE:Factory/.libvisio.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "libvisio"
Changes:
--------
--- /work/SRC/openSUSE:Factory/libvisio/libvisio.changes 2013-07-03 10:24:33.000000000 +0200
+++ /work/SRC/openSUSE:Factory/.libvisio.new/libvisio.changes 2013-07-10 23:24:58.000000000 +0200
@@ -1,0 +2,12 @@
+Wed Jul 10 16:54:11 UTC 2013 - fridrich.strba@suse.com
+
+- Bump version to 0.0.30
+ * Fix building with older boosts
+ * Considerable performance improvement due to diminished
+ memory consumption.
+ * Implemented B-Spline conversion for xml-based formats
+ * For NURBS and B-Splines where it is possible, lossless
+ conversion to bezier segments.
+ * Coverity fixes.
+
+-------------------------------------------------------------------
Old:
----
libvisio-0.0.29.tar.xz
New:
----
libvisio-0.0.30.tar.xz
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ libvisio.spec ++++++
--- /var/tmp/diff_new_pack.3Tvanr/_old 2013-07-10 23:25:00.000000000 +0200
+++ /var/tmp/diff_new_pack.3Tvanr/_new 2013-07-10 23:25:00.000000000 +0200
@@ -19,7 +19,7 @@
%define libname libvisio-0_0-0
Name: libvisio
-Version: 0.0.29
+Version: 0.0.30
Release: 0
License: MPL-1.1 or GPL-2.0+ or LGPL-2.1+
Summary: Library for parsing the MS Visio file format structure
++++++ libvisio-0.0.29.tar.xz -> libvisio-0.0.30.tar.xz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libvisio-0.0.29/ChangeLog new/libvisio-0.0.30/ChangeLog
--- old/libvisio-0.0.29/ChangeLog 2013-07-02 14:20:53.000000000 +0200
+++ new/libvisio-0.0.30/ChangeLog 2013-07-10 15:16:31.000000000 +0200
@@ -1,3 +1,79 @@
+2013-07-10 Fridrich Štrba [0c2293c7b1e0793f61a396d5bb3e9161f965b8e3]
+
+ Add support of SplineStart and SplineKnot to xml-based formats
+
+
+2013-07-10 Fridrich Štrba [5a38774b5f9bfc2d58e8a7a06effb0bbe7d0debd]
+
+ Try not to go out of bonds
+
+
+2013-07-10 Fridrich Štrba [e7974026dd728d2882962de803c0cfbc29057283]
+
+ Fixing back some mistakes paid cash to valgrind
+
+
+2013-07-10 David Tardon [d8e22ac854217d647753c2f5c4943e167f45b6be]
+
+ fix condition
+
+
+2013-07-10 Fridrich Štrba [31b9a3540b83bf0cbceb70ae3acadfc1a800e54e]
+
+ SplineStart ends previous spline
+
+
+2013-07-10 Fridrich Štrba [f611310868933279a8d6899e6eabb9c5f820e929]
+
+ Some more trying of refactoring of nurbs-related code
+
+
+2013-07-09 Fridrich Štrba [0e8734be3d3294454d3f6f8f9de282c31bdf28bf]
+
+ De-uglify a tiny bit the NURBS code
+
+
+2013-07-09 Fridrich Štrba [98f9d25aae4de36c75656935da2909d044344398]
+
+ Bump version to 0.0.30 (not release yet)
+
+
+2013-07-09 Fridrich Štrba [b49fb988a458c84869abc30376def886d4d3cc7f]
+
+ Don't add a trailing M-segment when emulating NURBS by curves
+
+
+2013-07-09 Fridrich Štrba [29d671d0cd7a1b777d9c5172c5794d59b8048402]
+
+ Handling in a special ways uniform NURBS of degree 2 and 3
+
+
+2013-07-09 Fridrich Štrba [78fdaaf690c6aa37e56cb8a06f29be02fcd140a1]
+
+ astyle
+
+
+2013-07-06 Fridrich Štrba [688aa1eb357b41e26d0a12f0d34dca426a50feb7]
+
+ Proper fix for older boost and remove_whitespace
+
+
+2013-07-06 Fridrich Štrba [0cde479e62ce80a8a619f2e11b77f7f64b970802]
+
+ Revert "Some older versions of boost have a buggy remove_whitespace and original code was not removing either"
+
+ This reverts commit 6fe924aae90c7aed8a3ad6e172a90a341f7a82ca.
+
+2013-07-06 David Tardon [73a17a5730bfbfb738cf0fa4fe59ad4b478f9731]
+
+ coverity: gmtime can return NULL
+
+
+2013-07-02 Fridrich Štrba [6fe924aae90c7aed8a3ad6e172a90a341f7a82ca]
+
+ Some older versions of boost have a buggy remove_whitespace and original code was not removing either
+
+
2013-07-02 Fridrich Štrba [a55e97f84fdd51632f1fb29fbc438d1baa0c8e64]
Bump version to 0.0.29
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libvisio-0.0.29/configure new/libvisio-0.0.30/configure
--- old/libvisio-0.0.29/configure 2013-07-02 14:18:55.000000000 +0200
+++ new/libvisio-0.0.30/configure 2013-07-10 13:15:52.000000000 +0200
@@ -1,6 +1,6 @@
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.69 for libvisio 0.0.29.
+# Generated by GNU Autoconf 2.69 for libvisio 0.0.30.
#
#
# Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc.
@@ -587,8 +587,8 @@
# Identity of this package.
PACKAGE_NAME='libvisio'
PACKAGE_TARNAME='libvisio'
-PACKAGE_VERSION='0.0.29'
-PACKAGE_STRING='libvisio 0.0.29'
+PACKAGE_VERSION='0.0.30'
+PACKAGE_STRING='libvisio 0.0.30'
PACKAGE_BUGREPORT=''
PACKAGE_URL=''
@@ -1380,7 +1380,7 @@
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
-\`configure' configures libvisio 0.0.29 to adapt to many kinds of systems.
+\`configure' configures libvisio 0.0.30 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
@@ -1450,7 +1450,7 @@
if test -n "$ac_init_help"; then
case $ac_init_help in
- short | recursive ) echo "Configuration of libvisio 0.0.29:";;
+ short | recursive ) echo "Configuration of libvisio 0.0.30:";;
esac
cat <<\_ACEOF
@@ -1582,7 +1582,7 @@
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
-libvisio configure 0.0.29
+libvisio configure 0.0.30
generated by GNU Autoconf 2.69
Copyright (C) 2012 Free Software Foundation, Inc.
@@ -2099,7 +2099,7 @@
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
-It was created by libvisio $as_me 0.0.29, which was
+It was created by libvisio $as_me 0.0.30, which was
generated by GNU Autoconf 2.69. Invocation command line was
$ $0 $@
@@ -2965,7 +2965,7 @@
# Define the identity of the package.
PACKAGE='libvisio'
- VERSION='0.0.29'
+ VERSION='0.0.30'
cat >>confdefs.h <<_ACEOF
@@ -17143,9 +17143,9 @@
VSD_MINOR_VERSION=0
-VSD_MICRO_VERSION=29
+VSD_MICRO_VERSION=30
-VSD_VERSION=0.0.29
+VSD_VERSION=0.0.30
# AC_SUBST(LT_RELEASE, [libvisio_version_major.libvisio_version_minor])
LT_CURRENT=`expr 100 '*' 0 + 0`
@@ -17153,7 +17153,7 @@
LT_AGE=0
# LT_AGE=libvisio_version_minor
-LT_REVISION=29
+LT_REVISION=30
@@ -18149,7 +18149,7 @@
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
-This file was extended by libvisio $as_me 0.0.29, which was
+This file was extended by libvisio $as_me 0.0.30, which was
generated by GNU Autoconf 2.69. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
@@ -18215,7 +18215,7 @@
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
ac_cs_version="\\
-libvisio config.status 0.0.29
+libvisio config.status 0.0.30
configured by $0, generated by GNU Autoconf 2.69,
with options \\"\$ac_cs_config\\"
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libvisio-0.0.29/configure.ac new/libvisio-0.0.30/configure.ac
--- old/libvisio-0.0.29/configure.ac 2013-07-02 14:18:41.000000000 +0200
+++ new/libvisio-0.0.30/configure.ac 2013-07-10 07:05:54.000000000 +0200
@@ -7,7 +7,7 @@
# ====================
m4_define([libvisio_version_major],[0])
m4_define([libvisio_version_minor],[0])
-m4_define([libvisio_version_micro],[29])
+m4_define([libvisio_version_micro],[30])
m4_define([libvisio_version],[libvisio_version_major.libvisio_version_minor.libvisio_version_micro])
# =============
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libvisio-0.0.29/libvisio.spec new/libvisio-0.0.30/libvisio.spec
--- old/libvisio-0.0.29/libvisio.spec 2013-07-02 14:19:13.000000000 +0200
+++ new/libvisio-0.0.30/libvisio.spec 2013-07-10 13:16:17.000000000 +0200
@@ -1,5 +1,5 @@
%define name libvisio
-%define version 0.0.29
+%define version 0.0.30
%define RELEASE 1
%define release %{?CUSTOM_RELEASE} %{!?CUSTOM_RELEASE:%RELEASE}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libvisio-0.0.29/src/lib/VSDCollector.h new/libvisio-0.0.30/src/lib/VSDCollector.h
--- old/libvisio-0.0.29/src/lib/VSDCollector.h 2013-04-22 08:31:25.000000000 +0200
+++ new/libvisio-0.0.30/src/lib/VSDCollector.h 2013-07-10 07:05:54.000000000 +0200
@@ -65,7 +65,7 @@
virtual void collectLineTo(unsigned id, unsigned level, double x, double y) = 0;
virtual void collectArcTo(unsigned id, unsigned level, double x2, double y2, double bow) = 0;
virtual void collectNURBSTo(unsigned id, unsigned level, double x2, double y2, unsigned char xType, unsigned char yType, unsigned degree,
- std::vector > controlPoints, std::vector<double> knotVector, std::vector<double> weights) = 0;
+ const std::vector > &ctrlPnts, const std::vector<double> &kntVec, const std::vector<double> &weights) = 0;
virtual void collectNURBSTo(unsigned id, unsigned level, double x2, double y2, double knot, double knotPrev, double weight, double weightPrev, unsigned dataID) = 0;
virtual void collectNURBSTo(unsigned id, unsigned level, double x2, double y2, double knot, double knotPrev, double weight, double weightPrev, const NURBSData &data) = 0;
virtual void collectPolylineTo(unsigned id, unsigned level, double x, double y, unsigned char xType, unsigned char yType, const std::vector > &points) = 0;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libvisio-0.0.29/src/lib/VSDContentCollector.cpp new/libvisio-0.0.30/src/lib/VSDContentCollector.cpp
--- old/libvisio-0.0.29/src/lib/VSDContentCollector.cpp 2013-07-01 15:47:44.000000000 +0200
+++ new/libvisio-0.0.30/src/lib/VSDContentCollector.cpp 2013-07-10 10:43:14.000000000 +0200
@@ -1311,80 +1311,154 @@
}
}
-#define VSD_NUM_POLYLINES_PER_NURBS 200
-void libvisio::VSDContentCollector::collectNURBSTo(unsigned /* id */, unsigned level, double x2, double y2, unsigned char xType, unsigned char yType, unsigned degree, std::vector > controlPoints, std::vector<double> knotVector, std::vector<double> weights)
+void libvisio::VSDContentCollector::_outputCubicBezierSegment(const std::vector > &points)
{
- _handleLevelChange(level);
+ if (points.size() < 4)
+ return;
+ WPXPropertyList node;
+ node.insert("libwpg:path-action", "C");
+ double x = points[1].first;
+ double y = points[1].second;
+ transformPoint(x, y);
+ node.insert("svg:x1", m_scale*x);
+ node.insert("svg:y1", m_scale*y);
+ x = points[2].first;
+ y = points[2].second;
+ transformPoint(x, y);
+ node.insert("svg:x2", m_scale*x);
+ node.insert("svg:y2", m_scale*y);
+ x = points[3].first;
+ y = points[3].second;
+ transformPoint(x, y);
+ node.insert("svg:x", m_scale*x);
+ node.insert("svg:y", m_scale*y);
- if (knotVector.empty() || controlPoints.empty() || weights.empty())
- // Here, maybe we should just draw line to (x2,y2)
+ if (!m_noFill && !m_noShow)
+ m_currentFillGeometry.push_back(node);
+ if (!m_noLine && !m_noShow)
+ m_currentLineGeometry.push_back(node);
+}
+
+void libvisio::VSDContentCollector::_outputQuadraticBezierSegment(const std::vector > &points)
+{
+ if (points.size() < 3)
return;
+ WPXPropertyList node;
+ node.insert("libwpg:path-action", "Q");
+ double x = points[1].first;
+ double y = points[1].second;
+ transformPoint(x, y);
+ node.insert("svg:x1", m_scale*x);
+ node.insert("svg:y1", m_scale*y);
+ x = points[2].first;
+ y = points[2].second;
+ transformPoint(x, y);
+ node.insert("svg:x", m_scale*x);
+ node.insert("svg:y", m_scale*y);
- // Fill in end knots
- while (knotVector.size() < (controlPoints.size() + degree + 2))
- {
- double tmpBack = knotVector.back();
- knotVector.push_back(tmpBack);
- }
+ if (!m_noFill && !m_noShow)
+ m_currentFillGeometry.push_back(node);
+ if (!m_noLine && !m_noShow)
+ m_currentLineGeometry.push_back(node);
+}
- // Convert control points to static co-ordinates
- for (std::vector >::iterator it = controlPoints.begin();
- it != controlPoints.end(); ++it)
- {
- if (xType == 0) // Percentage
- (*it).first *= m_xform.width;
+void libvisio::VSDContentCollector::_outputLinearBezierSegment(const std::vector > &points)
+{
+ if (points.size() < 2)
+ return;
+ WPXPropertyList node;
+ node.insert("libwpg:path-action", "L");
+ double x = points[1].first;
+ double y = points[1].second;
+ transformPoint(x, y);
+ node.insert("svg:x", m_scale*x);
+ node.insert("svg:y", m_scale*y);
- if (yType == 0) // Percentage
- (*it).second *= m_xform.height;
- }
+ if (!m_noFill && !m_noShow)
+ m_currentFillGeometry.push_back(node);
+ if (!m_noLine && !m_noShow)
+ m_currentLineGeometry.push_back(node);
+}
- controlPoints.push_back(std::pair(x2, y2));
- controlPoints.insert(controlPoints.begin(), std::pair(m_originalX, m_originalY));
+void libvisio::VSDContentCollector::_generateBezierSegmentsFromNURBS(unsigned degree,
+ const std::vector > &controlPoints, const std::vector<double> &knotVector)
+{
+ if (controlPoints.empty() || knotVector.empty() || !degree)
+ return;
- // Generate NURBS using VSD_NUM_POLYLINES_PER_NURBS polylines
- WPXPropertyList NURBS;
- double step = (knotVector.back() - knotVector[0]) / VSD_NUM_POLYLINES_PER_NURBS;
-
- for (unsigned i = 0; i < VSD_NUM_POLYLINES_PER_NURBS; i++)
- {
- NURBS.clear();
- NURBS.insert("libwpg:path-action", "L");
- double nextX = 0;
- double nextY = 0;
- double denominator = LIBVISIO_EPSILON;
+ /* Decomposition of a uniform spline of a given degree into Bezier segments
+ * adapted from the algorithm DecomposeCurve (Les Piegl, Wayne Tiller:
+ * The NURBS Book, 2nd Edition, 1997
+ */
+
+ unsigned a = degree;
+ unsigned b = degree + 1;
+ std::vector< std::pair > points(degree + 1), nextPoints(degree + 1);
+ unsigned i = 0;
+ for (; i <= degree; i++)
+ points[i] = controlPoints[i];
+ while (b < knotVector.size() - 1)
+ {
+ i = 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::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;
+ for (j=1; j<=r; j++)
+ {
+ unsigned save = r - j;
+ unsigned s = mult+j;
+ for (unsigned k = degree; k>=s; k--)
+ {
+ double alpha = alphas[k-s];
+ 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 < knotVector.size() - 1)
+ {
+ nextPoints[save].first = points[degree].first;
+ nextPoints[save].second = points[degree].second;
+ }
+ }
+ }
+ // Pass the segment to the path
- for (unsigned p = 0; p < controlPoints.size() && p < weights.size(); p++)
+ switch (degree)
{
- double basis = _NURBSBasis(p, degree, knotVector[0] + i * step, knotVector);
- nextX += basis * controlPoints[p].first * weights[p];
- nextY += basis * controlPoints[p].second * weights[p];
- denominator += weights[p] * basis;
+ case 1:
+ _outputLinearBezierSegment(points);
+ break;
+ case 2:
+ _outputQuadraticBezierSegment(points);
+ break;
+ case 3:
+ _outputCubicBezierSegment(points);
+ break;
+ default:
+ break;
}
- nextX = (nextX/denominator);
- nextY = (nextY/denominator);
- transformPoint(nextX, nextY);
- NURBS.insert("svg:x", m_scale*nextX);
- NURBS.insert("svg:y", m_scale*nextY);
- if (!m_noFill && !m_noShow)
- m_currentFillGeometry.push_back(NURBS);
- if (!m_noLine && !m_noShow)
- m_currentLineGeometry.push_back(NURBS);
- }
- m_originalX = x2;
- m_originalY = y2;
- m_x = x2;
- m_y = y2;
- transformPoint(m_x, m_y);
- NURBS.clear();
- NURBS.insert("libwpg:path-action", "L");
- NURBS.insert("svg:x", m_scale*m_x);
- NURBS.insert("svg:y", m_scale*m_y);
- if (!m_noFill && !m_noShow)
- m_currentFillGeometry.push_back(NURBS);
- if (!m_noLine && !m_noShow)
- m_currentLineGeometry.push_back(NURBS);
+ std::swap(points, nextPoints);
+
+ if (b < knotVector.size() - 1)
+ {
+ for (i=degree-mult; i <= degree; i++)
+ {
+ points[i].first = controlPoints[b-degree+i].first;
+ points[i].second = controlPoints[b-degree+i].second;
+ }
+ a = b;
+ b++;
+ }
+ }
}
double libvisio::VSDContentCollector::_NURBSBasis(unsigned knot, unsigned degree, double point, const std::vector<double> &knotVector)
@@ -1408,6 +1482,123 @@
return basis;
}
+#define VSD_NUM_POLYLINES_PER_KNOT 100
+
+void libvisio::VSDContentCollector::_generatePolylineFromNURBS(unsigned degree, const std::vector > &controlPoints,
+ const std::vector<double> &knotVector, const std::vector<double> &weights)
+{
+ if (m_noShow)
+ return;
+
+ WPXPropertyList node;
+
+ for (unsigned i = 0; i < VSD_NUM_POLYLINES_PER_KNOT * knotVector.size(); i++)
+ {
+ node.clear();
+ node.insert("libwpg:path-action", "L");
+ double x = 0;
+ double y = 0;
+ double denominator = LIBVISIO_EPSILON;
+
+ for (unsigned p = 0; p < controlPoints.size() && p < weights.size(); p++)
+ {
+ double basis = _NURBSBasis(p, degree, (double)i / (VSD_NUM_POLYLINES_PER_KNOT * knotVector.size()), knotVector);
+ x += basis * controlPoints[p].first * weights[p];
+ y += basis * controlPoints[p].second * weights[p];
+ denominator += weights[p] * basis;
+ }
+ x /= denominator;
+ y /= denominator;
+ transformPoint(x, y);
+ node.insert("svg:x", m_scale*x);
+ node.insert("svg:y", m_scale*y);
+
+ if (!m_noFill && !m_noShow)
+ m_currentFillGeometry.push_back(node);
+ if (!m_noLine && !m_noShow)
+ m_currentLineGeometry.push_back(node);
+ }
+}
+
+bool libvisio::VSDContentCollector::_isUniform(const std::vector<double> weights) const
+{
+ if (weights.empty())
+ return true;
+ double previousValue = weights[0];
+ for (std::vector<double>::size_type i = 0; i < weights.size(); ++i)
+ {
+ if (fabs(weights[i] - previousValue) < LIBVISIO_EPSILON)
+ previousValue = weights[i];
+ else
+ return false;
+ }
+ return true;
+}
+
+void libvisio::VSDContentCollector::collectNURBSTo(unsigned /* id */, unsigned level, double x2, double y2,
+ unsigned char xType, unsigned char yType, unsigned degree, const std::vector > &ctrlPnts,
+ const std::vector<double> &kntVec, const std::vector<double> &weights)
+{
+ _handleLevelChange(level);
+
+ if (kntVec.empty() || ctrlPnts.empty() || weights.empty())
+ // Here, maybe we should just draw line to (x2,y2)
+ return;
+
+ std::vector > controlPoints(ctrlPnts);
+
+ // Convert control points to static co-ordinates
+ for (std::vector >::iterator iter = controlPoints.begin(); iter != controlPoints.end(); ++iter)
+ {
+ if (xType == 0) // Percentage
+ iter->first *= m_xform.width;
+ if (yType == 0) // Percentage
+ iter->second *= m_xform.height;
+ }
+
+ controlPoints.push_back(std::pair(x2, y2));
+ controlPoints.insert(controlPoints.begin(), std::pair(m_originalX, m_originalY));
+
+ std::vector<double> knotVector(kntVec);
+
+ // Fill in end knots
+ while (knotVector.size() < (controlPoints.size() + degree + 1))
+ {
+ double tmpBack = knotVector.back();
+ knotVector.push_back(tmpBack);
+ }
+
+ // Let knotVector run from 0 to 1
+ double firstKnot = knotVector[0];
+ double lastKnot = knotVector.back()-knotVector[0];
+ for(std::vector<double>::iterator knot = knotVector.begin(); knot != knotVector.end(); ++knot)
+ {
+ *knot -= firstKnot;
+ *knot /= lastKnot;
+ }
+
+ if (degree <= 3 && _isUniform(weights))
+ _generateBezierSegmentsFromNURBS(degree, controlPoints, knotVector);
+ else
+ _generatePolylineFromNURBS(degree, controlPoints, knotVector, weights);
+
+ m_originalX = x2;
+ m_originalY = y2;
+ m_x = x2;
+ m_y = y2;
+ transformPoint(m_x, m_y);
+#if 1
+ WPXPropertyList node;
+ node.insert("libwpg:path-action", "L");
+ node.insert("svg:x", m_scale*m_x);
+ node.insert("svg:y", m_scale*m_y);
+ if (!m_noFill && !m_noShow)
+ m_currentFillGeometry.push_back(node);
+ if (!m_noLine && !m_noShow)
+ m_currentLineGeometry.push_back(node);
+#endif
+}
+
void libvisio::VSDContentCollector::collectNURBSTo(unsigned id, unsigned level, double x2, double y2, double knot, double knotPrev, double weight, double weightPrev, const NURBSData &data)
{
NURBSData newData(data);
@@ -1892,9 +2083,9 @@
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();
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libvisio-0.0.29/src/lib/VSDContentCollector.h new/libvisio-0.0.30/src/lib/VSDContentCollector.h
--- old/libvisio-0.0.29/src/lib/VSDContentCollector.h 2013-05-12 19:07:41.000000000 +0200
+++ new/libvisio-0.0.30/src/lib/VSDContentCollector.h 2013-07-10 07:05:54.000000000 +0200
@@ -85,7 +85,7 @@
void collectLineTo(unsigned id, unsigned level, double x, double y);
void collectArcTo(unsigned id, unsigned level, double x2, double y2, double bow);
void collectNURBSTo(unsigned id, unsigned level, double x2, double y2, unsigned char xType, unsigned char yType, unsigned degree,
- std::vector > controlPoints, std::vector<double> knotVector, std::vector<double> weights);
+ const std::vector > &ctrlPnts, const std::vector<double> &kntVec, const std::vector<double> &weights);
void collectNURBSTo(unsigned id, unsigned level, double x2, double y2, double knot, double knotPrev, double weight, double weightPrev, unsigned dataID);
void collectNURBSTo(unsigned id, unsigned level, double x2, double y2, double knot, double knotPrev, double weight, double weightPrev, const NURBSData &data);
void collectPolylineTo(unsigned id, unsigned level, double x, double y, unsigned char xType, unsigned char yType,
@@ -220,6 +220,16 @@
bool parseFormatId( const char *formatString, unsigned short &result );
void _appendField(WPXString &text);
+ // NURBS processing functions
+ bool _isUniform(const std::vector<double> weights) const;
+ void _generatePolylineFromNURBS(unsigned degree, const std::vector > &controlPoints,
+ const std::vector<double> &knotVector, const std::vector<double> &weights);
+ void _generateBezierSegmentsFromNURBS(unsigned degree, const std::vector > &controlPoints,
+ const std::vector<double> &knotVector);
+ void _outputCubicBezierSegment(const std::vector > &points);
+ void _outputQuadraticBezierSegment(const std::vector > &points);
+ void _outputLinearBezierSegment(const std::vector > &points);
+
bool m_isPageStarted;
double m_pageWidth;
double m_pageHeight;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libvisio-0.0.29/src/lib/VSDFieldList.cpp new/libvisio-0.0.30/src/lib/VSDFieldList.cpp
--- old/libvisio-0.0.29/src/lib/VSDFieldList.cpp 2013-04-19 16:04:31.000000000 +0200
+++ new/libvisio-0.0.30/src/lib/VSDFieldList.cpp 2013-07-06 14:40:22.000000000 +0200
@@ -74,8 +74,12 @@
WPXString result;
char buffer[MAX_BUFFER];
time_t timer = (time_t)(86400 * datetime - 2209161600.0);
- strftime(&buffer[0], MAX_BUFFER-1, format, gmtime(&timer));
- result.append(&buffer[0]);
+ const struct tm *const time = gmtime(&timer);
+ if (time)
+ {
+ strftime(&buffer[0], MAX_BUFFER-1, format, time);
+ result.append(&buffer[0]);
+ }
return result;
}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libvisio-0.0.29/src/lib/VSDGeometryList.cpp new/libvisio-0.0.30/src/lib/VSDGeometryList.cpp
--- old/libvisio-0.0.29/src/lib/VSDGeometryList.cpp 2013-06-25 10:35:43.000000000 +0200
+++ new/libvisio-0.0.30/src/lib/VSDGeometryList.cpp 2013-07-10 09:28:14.000000000 +0200
@@ -491,6 +491,7 @@
void libvisio::VSDSplineStart::handle(VSDCollector *collector) const
{
+ collector->collectSplineEnd();
collector->collectSplineStart(m_id, m_level, m_x, m_y, m_secondKnot, m_firstKnot, m_lastKnot, m_degree);
}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libvisio-0.0.29/src/lib/VSDStylesCollector.cpp new/libvisio-0.0.30/src/lib/VSDStylesCollector.cpp
--- old/libvisio-0.0.29/src/lib/VSDStylesCollector.cpp 2013-04-22 08:31:25.000000000 +0200
+++ new/libvisio-0.0.30/src/lib/VSDStylesCollector.cpp 2013-07-10 07:05:54.000000000 +0200
@@ -117,9 +117,8 @@
}
void libvisio::VSDStylesCollector::collectNURBSTo(unsigned /* id */, unsigned level, double /* x2 */, double /* y2 */,
- unsigned char /* xType */, unsigned char /* yType */, unsigned /* degree */,
- std::vector > /* controlPoints */,
- std::vector<double> /* knotVector */, std::vector<double> /* weights */)
+ unsigned char /* xType */, unsigned char /* yType */, unsigned /* degree */, const std::vector > & /* ctrlPts */,
+ const std::vector<double> & /* kntVec */, const std::vector<double> & /* weights */)
{
_handleLevelChange(level);
}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libvisio-0.0.29/src/lib/VSDStylesCollector.h new/libvisio-0.0.30/src/lib/VSDStylesCollector.h
--- old/libvisio-0.0.29/src/lib/VSDStylesCollector.h 2013-04-22 08:31:25.000000000 +0200
+++ new/libvisio-0.0.30/src/lib/VSDStylesCollector.h 2013-07-10 07:05:54.000000000 +0200
@@ -75,9 +75,8 @@
void collectMoveTo(unsigned id, unsigned level, double x, double y);
void collectLineTo(unsigned id, unsigned level, double x, double y);
void collectArcTo(unsigned id, unsigned level, double x2, double y2, double bow);
- void collectNURBSTo(unsigned id, unsigned level, double x2, double y2, unsigned char xType, unsigned char yType,
- unsigned degree, std::vector > controlPoints,
- std::vector<double> knotVector, std::vector<double> weights);
+ void collectNURBSTo(unsigned id, unsigned level, double x2, double y2, unsigned char xType, unsigned char yType, unsigned degree,
+ const std::vector > &ctrlPnts, const std::vector<double> &kntVec, const std::vector<double> &weights);
void collectNURBSTo(unsigned id, unsigned level, double x2, double y2, double knot, double knotPrev, double weight, double weightPrev, unsigned dataID);
void collectNURBSTo(unsigned id, unsigned level, double x2, double y2, double knot, double knotPrev, double weight, double weightPrev, const NURBSData &data);
void collectPolylineTo(unsigned id, unsigned level, double x, double y, unsigned char xType, unsigned char yType, const std::vector > &points);
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libvisio-0.0.29/src/lib/VSDXMLParserBase.cpp new/libvisio-0.0.30/src/lib/VSDXMLParserBase.cpp
--- old/libvisio-0.0.29/src/lib/VSDXMLParserBase.cpp 2013-04-22 08:31:25.000000000 +0200
+++ new/libvisio-0.0.30/src/lib/VSDXMLParserBase.cpp 2013-07-10 14:13:53.000000000 +0200
@@ -168,6 +168,14 @@
if (XML_READER_TYPE_ELEMENT == tokenType)
readRelQuadBezTo(reader);
break;
+ case XML_SPLINESTART:
+ if (XML_READER_TYPE_ELEMENT == tokenType)
+ readSplineStart(reader);
+ break;
+ case XML_SPLINEKNOT:
+ if (XML_READER_TYPE_ELEMENT == tokenType)
+ readSplineKnot(reader);
+ break;
default:
break;
}
@@ -1589,7 +1597,7 @@
break;
}
}
- while (((XML_ELLIPTICALARCTO != tokenId && XML_ROW != tokenId) || XML_READER_TYPE_END_ELEMENT != tokenType) && 1 == ret);
+ while (((XML_SPLINESTART != tokenId && XML_ROW != tokenId) || XML_READER_TYPE_END_ELEMENT != tokenType) && 1 == ret);
if (ret == 1)
m_currentGeometryList->addSplineStart(ix, level, x, y, a, b, c, d);
}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libvisio-0.0.29/src/lib/libvisio_utils.cpp new/libvisio-0.0.30/src/lib/libvisio_utils.cpp
--- old/libvisio-0.0.29/src/lib/libvisio_utils.cpp 2013-06-25 09:37:41.000000000 +0200
+++ new/libvisio-0.0.30/src/lib/libvisio_utils.cpp 2013-07-09 15:21:23.000000000 +0200
@@ -123,14 +123,15 @@
return tmpUnion.d;
}
-void libvisio::appendFromBase64(WPXBinaryData &data, const unsigned char *base64String, size_t base64StringLength)
+void libvisio::appendFromBase64(WPXBinaryData &data, const unsigned char *base64Data, size_t base64DataLength)
{
+ std::string base64String((const char *)base64Data, base64DataLength);
typedef boost::archive::iterators::transform_width<
boost::archive::iterators::binary_from_base64<
- boost::archive::iterators::remove_whitespace< const char * > >, 8, 6 > base64_decoder;
+ boost::archive::iterators::remove_whitespace< std::string::const_iterator > >, 8, 6 > base64_decoder;
std::vector<unsigned char> buffer;
- std::copy(base64_decoder(base64String), base64_decoder(base64String + base64StringLength), std::back_inserter(buffer));
+ std::copy(base64_decoder(base64String.begin()), base64_decoder(base64String.end()), std::back_inserter(buffer));
if (!buffer.empty())
data.append(&buffer[0], buffer.size());
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libvisio-0.0.29/src/lib/libvisio_utils.h new/libvisio-0.0.30/src/lib/libvisio_utils.h
--- old/libvisio-0.0.29/src/lib/libvisio_utils.h 2012-11-16 11:45:33.000000000 +0100
+++ new/libvisio-0.0.30/src/lib/libvisio_utils.h 2013-07-08 06:42:26.000000000 +0200
@@ -98,7 +98,7 @@
double readDouble(WPXInputStream *input);
-void appendFromBase64(WPXBinaryData &data, const unsigned char *base64String, size_t base64StringLength);
+void appendFromBase64(WPXBinaryData &data, const unsigned char *base64Data, size_t base64DataLength);
const ::WPXString getColourString(const Colour &c);
--
To unsubscribe, e-mail: opensuse-commit+unsubscribe@opensuse.org
For additional commands, e-mail: opensuse-commit+help@opensuse.org