diff options
Diffstat (limited to 'Build/source/texk/dvisvgm/dvisvgm-src/src')
7 files changed, 141 insertions, 91 deletions
diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/Color.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/Color.cpp index d2a475cf815..6e0152cc15e 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/Color.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/Color.cpp @@ -18,7 +18,6 @@ ** along with this program; if not, see <http://www.gnu.org/licenses/>. ** *************************************************************************/ -#define _USE_MATH_DEFINES #include <array> #include <algorithm> #include <cctype> @@ -612,7 +611,7 @@ void Color::RGB2Lab (const valarray<double> &rgb, valarray<double> &lab) { #if 0 -static constexpr double deg2rad (double x) {return x*M_PI/180.0;} +static constexpr double deg2rad (double x) {return x*math::PI/180.0;} /** Returns the Delta E difference (CIE 2000) between this and another color. */ double Color::deltaE (const Color &c) const { diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/Makefile.am b/Build/source/texk/dvisvgm/dvisvgm-src/src/Makefile.am index 1552414b393..512f66dbb00 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/Makefile.am +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/Makefile.am @@ -11,10 +11,7 @@ dvisvgm_SOURCES = dvisvgm.cpp dvisvgm_LDADD = \ $(noinst_LIBRARIES) \ ../libs/clipper/libclipper.a \ - ../libs/xxHash/libxxhash.a \ - $(FREETYPE_LIBS) \ - $(FONTFORGE_LIBS) \ - $(ZLIB_LIBS) + ../libs/xxHash/libxxhash.a if ENABLE_WOFF dvisvgm_LDADD += \ @@ -23,7 +20,16 @@ dvisvgm_LDADD += \ ../libs/woff2/brotli/libbrotli.a endif +dvisvgm_LDADD += \ + $(KPATHSEA_LIBS) \ + $(POTRACE_LIBS) \ + $(FREETYPE2_LIBS) \ + $(FONTFORGE_LIBS) \ + $(ZLIB_LIBS) \ + $(LIBGS_LIBS) + dvisvgm_DEPENDENCIES = $(noinst_LIBRARIES) +dvisvgm_DEPENDENCIES += $(KPATHSEA_DEPEND) $(ZLIB_DEPEND) $(FREETYPE2_DEPEND) libdvisvgm_a_SOURCES = \ AGLTable.hpp \ @@ -231,29 +237,42 @@ endif EXTRA_DIST = options.xml options.dtd iapi.h ierrors.h MiKTeXCom.hpp MiKTeXCom.cpp -AM_CFLAGS = -Wall \ - $(ZLIB_CFLAGS) \ - $(CODE_COVERAGE_CFLAGS) +dvisvgm_srcdir = $(top_srcdir)/dvisvgm-src -AM_CXXFLAGS = -Wall -Wnon-virtual-dtor \ - -I$(top_srcdir)/libs/clipper \ - -I$(top_srcdir)/libs/xxHash \ - $(FREETYPE_CFLAGS) \ - $(ZLIB_CFLAGS) \ +AM_CFLAGS = $(WARNING_CFLAGS) \ + $(ZLIB_INCLUDES) \ $(CODE_COVERAGE_CFLAGS) +AM_CXXFLAGS = $(WARNING_CFLAGS) -Wnon-virtual-dtor \ + -I$(dvisvgm_srcdir)/libs/clipper \ + -I$(dvisvgm_srcdir)/libs/xxHash + if ENABLE_WOFF AM_CFLAGS += \ - -I$(top_srcdir)/libs/ff-woff/fontforge \ - -I$(top_srcdir)/libs/ff-woff/inc + -I$(dvisvgm_srcdir)/libs/ff-woff/fontforge \ + -I$(dvisvgm_srcdir)/libs/ff-woff/inc AM_CXXFLAGS += \ - -I$(top_srcdir)/libs/woff2/brotli/enc \ - -I$(top_srcdir)/libs/woff2/src + -I$(dvisvgm_srcdir)/libs/woff2/brotli/enc \ + -I$(dvisvgm_srcdir)/libs/woff2/src endif +AM_CXXFLAGS += \ + $(KPATHSEA_INCLUDES) \ + $(POTRACE_INCLUDES) \ + $(FREETYPE2_INCLUDES) \ + $(ZLIB_INCLUDES) \ + $(LIBGS_INCLUDES) \ + $(CODE_COVERAGE_CFLAGS) + +if WIN32 +AM_CXXFLAGS += -DTEXLIVEWIN32 +endif WIN32 + AM_LDFLAGS = $(CODE_COVERAGE_LDFLAGS) +if ! TEXLIVE_BUILD +# TL: do not try to rebuild these source files. # the command-line parser class is generated from options.xml by opt2cpp $(srcdir)/CommandLine.hpp: options.xml rm -f $@ $*.hpp @@ -266,7 +285,17 @@ $(srcdir)/psdefs.cpp: psdefs.ps fi psdefs.ps: ; +endif ! TEXLIVE_BUILD @CODE_COVERAGE_RULES@ CLEANFILES = *.gcda *.gcno + +## Rebuild libkpathsea +@KPATHSEA_RULE@ +## Rebuild libpotrace +@POTRACE_RULE@ +## Rebuild libfreetype +@FREETYPE2_RULE@ +## Rebuild libz +@ZLIB_RULE@ diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/Makefile.in b/Build/source/texk/dvisvgm/dvisvgm-src/src/Makefile.in index 110478594e3..94267fdd929 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/Makefile.in +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/Makefile.in @@ -89,7 +89,6 @@ PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ -target_triplet = @target@ bin_PROGRAMS = dvisvgm$(EXEEXT) @ENABLE_WOFF_TRUE@am__append_1 = \ @ENABLE_WOFF_TRUE@ ../libs/ff-woff/libfontforge.a \ @@ -98,20 +97,31 @@ bin_PROGRAMS = dvisvgm$(EXEEXT) @ENABLE_WOFF_TRUE@am__append_2 = ffwrapper.c ffwrapper.h @ENABLE_WOFF_TRUE@am__append_3 = \ -@ENABLE_WOFF_TRUE@ -I$(top_srcdir)/libs/ff-woff/fontforge \ -@ENABLE_WOFF_TRUE@ -I$(top_srcdir)/libs/ff-woff/inc +@ENABLE_WOFF_TRUE@ -I$(dvisvgm_srcdir)/libs/ff-woff/fontforge \ +@ENABLE_WOFF_TRUE@ -I$(dvisvgm_srcdir)/libs/ff-woff/inc @ENABLE_WOFF_TRUE@am__append_4 = \ -@ENABLE_WOFF_TRUE@ -I$(top_srcdir)/libs/woff2/brotli/enc \ -@ENABLE_WOFF_TRUE@ -I$(top_srcdir)/libs/woff2/src +@ENABLE_WOFF_TRUE@ -I$(dvisvgm_srcdir)/libs/woff2/brotli/enc \ +@ENABLE_WOFF_TRUE@ -I$(dvisvgm_srcdir)/libs/woff2/src -subdir = src +@WIN32_TRUE@am__append_5 = -DTEXLIVEWIN32 +subdir = dvisvgm-src/src ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/m4/ax_code_coverage.m4 \ - $(top_srcdir)/m4/ax_cxx_compile_stdcxx.m4 \ - $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ - $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ - $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/configure.ac +am__aclocal_m4_deps = $(top_srcdir)/m4/ax_cxx_compile_stdcxx.m4 \ + $(top_srcdir)/../../m4/kpse-common.m4 \ + $(top_srcdir)/../../m4/kpse-cxx-hack.m4 \ + $(top_srcdir)/../../m4/kpse-freetype2-flags.m4 \ + $(top_srcdir)/../../m4/kpse-kpathsea-flags.m4 \ + $(top_srcdir)/../../m4/kpse-potrace-flags.m4 \ + $(top_srcdir)/../../m4/kpse-warnings.m4 \ + $(top_srcdir)/../../m4/kpse-win32.m4 \ + $(top_srcdir)/../../m4/kpse-zlib-flags.m4 \ + $(top_srcdir)/../../m4/libtool.m4 \ + $(top_srcdir)/../../m4/ltoptions.m4 \ + $(top_srcdir)/../../m4/ltsugar.m4 \ + $(top_srcdir)/../../m4/ltversion.m4 \ + $(top_srcdir)/../../m4/lt~obsolete.m4 $(top_srcdir)/version.ac \ + $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) @@ -248,7 +258,7 @@ am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) -depcomp = $(SHELL) $(top_srcdir)/depcomp +depcomp = $(SHELL) $(top_srcdir)/../../build-aux/depcomp am__depfiles_maybe = depfiles am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ @@ -279,7 +289,6 @@ AM_V_CXX = $(am__v_CXX_@AM_V@) am__v_CXX_ = $(am__v_CXX_@AM_DEFAULT_V@) am__v_CXX_0 = @echo " CXX " $@; am__v_CXX_1 = -CXXLD = $(CXX) CXXLINK = $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CXXLD) $(AM_CXXFLAGS) \ $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ @@ -314,14 +323,13 @@ am__define_uniq_tagged_files = \ ETAGS = etags CTAGS = ctags am__DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/version.hpp.in \ - $(top_srcdir)/depcomp + $(top_srcdir)/../../build-aux/depcomp DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ -AM_CPPFLAGS = @AM_CPPFLAGS@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ -AM_LDFLAGS = $(CODE_COVERAGE_LDFLAGS) AR = @AR@ +AS = @AS@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ @@ -329,35 +337,31 @@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ -CODE_COVERAGE_CFLAGS = @CODE_COVERAGE_CFLAGS@ -CODE_COVERAGE_CPPFLAGS = @CODE_COVERAGE_CPPFLAGS@ -CODE_COVERAGE_CXXFLAGS = @CODE_COVERAGE_CXXFLAGS@ -CODE_COVERAGE_ENABLED = @CODE_COVERAGE_ENABLED@ -CODE_COVERAGE_LDFLAGS = @CODE_COVERAGE_LDFLAGS@ -CODE_COVERAGE_LIBS = @CODE_COVERAGE_LIBS@ +CODE_COVERAGE_RULES = @CODE_COVERAGE_RULES@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ +CXXLD = @CXXLD@ CYGPATH_W = @CYGPATH_W@ -DATE = @DATE@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ +DVISVGM_TREE = @DVISVGM_TREE@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ -FREETYPE_CFLAGS = @FREETYPE_CFLAGS@ -FREETYPE_LIBS = @FREETYPE_LIBS@ -GCOV = @GCOV@ -GENHTML = @GENHTML@ +FREETYPE2_DEPEND = @FREETYPE2_DEPEND@ +FREETYPE2_INCLUDES = @FREETYPE2_INCLUDES@ +FREETYPE2_LIBS = @FREETYPE2_LIBS@ +FT2_CONFIG = @FT2_CONFIG@ GREP = @GREP@ HAVE_CXX11 = @HAVE_CXX11@ INSTALL = @INSTALL@ @@ -365,9 +369,13 @@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ -LCOV = @LCOV@ +KPATHSEA_DEPEND = @KPATHSEA_DEPEND@ +KPATHSEA_INCLUDES = @KPATHSEA_INCLUDES@ +KPATHSEA_LIBS = @KPATHSEA_LIBS@ LD = @LD@ LDFLAGS = @LDFLAGS@ +LIBGS_INCLUDES = @LIBGS_INCLUDES@ +LIBGS_LIBS = @LIBGS_LIBS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ @@ -375,6 +383,7 @@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ +MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ @@ -393,15 +402,19 @@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PKG_CONFIG = @PKG_CONFIG@ -PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ -PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ +POTRACE_DEPEND = @POTRACE_DEPEND@ +POTRACE_INCLUDES = @POTRACE_INCLUDES@ +POTRACE_LIBS = @POTRACE_LIBS@ RANLIB = @RANLIB@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ -ZLIB_CFLAGS = @ZLIB_CFLAGS@ +WARNING_CFLAGS = @WARNING_CFLAGS@ +WARNING_CXXFLAGS = @WARNING_CXXFLAGS@ +ZLIB_DEPEND = @ZLIB_DEPEND@ +ZLIB_INCLUDES = @ZLIB_INCLUDES@ ZLIB_LIBS = @ZLIB_LIBS@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ @@ -448,25 +461,22 @@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ -runstatedir = @runstatedir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ -target = @target@ target_alias = @target_alias@ -target_cpu = @target_cpu@ -target_os = @target_os@ -target_vendor = @target_vendor@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ noinst_LIBRARIES = libdvisvgm.a dvisvgm_SOURCES = dvisvgm.cpp dvisvgm_LDADD = $(noinst_LIBRARIES) ../libs/clipper/libclipper.a \ - ../libs/xxHash/libxxhash.a $(FREETYPE_LIBS) $(FONTFORGE_LIBS) \ - $(ZLIB_LIBS) $(am__append_1) -dvisvgm_DEPENDENCIES = $(noinst_LIBRARIES) + ../libs/xxHash/libxxhash.a $(am__append_1) $(KPATHSEA_LIBS) \ + $(POTRACE_LIBS) $(FREETYPE2_LIBS) $(FONTFORGE_LIBS) \ + $(ZLIB_LIBS) $(LIBGS_LIBS) +dvisvgm_DEPENDENCIES = $(noinst_LIBRARIES) $(KPATHSEA_DEPEND) \ + $(ZLIB_DEPEND) $(FREETYPE2_DEPEND) libdvisvgm_a_SOURCES = AGLTable.hpp BasicDVIReader.cpp \ BasicDVIReader.hpp Bezier.cpp Bezier.hpp \ BgColorSpecialHandler.cpp BgColorSpecialHandler.hpp Bitmap.cpp \ @@ -527,17 +537,22 @@ libdvisvgm_a_SOURCES = AGLTable.hpp BasicDVIReader.cpp \ XMLNode.hpp XMLString.cpp XMLString.hpp ZLibOutputStream.hpp \ $(am__append_2) EXTRA_DIST = options.xml options.dtd iapi.h ierrors.h MiKTeXCom.hpp MiKTeXCom.cpp -AM_CFLAGS = -Wall $(ZLIB_CFLAGS) $(CODE_COVERAGE_CFLAGS) \ +dvisvgm_srcdir = $(top_srcdir)/dvisvgm-src +AM_CFLAGS = $(WARNING_CFLAGS) $(ZLIB_INCLUDES) $(CODE_COVERAGE_CFLAGS) \ $(am__append_3) -AM_CXXFLAGS = -Wall -Wnon-virtual-dtor -I$(top_srcdir)/libs/clipper \ - -I$(top_srcdir)/libs/xxHash $(FREETYPE_CFLAGS) $(ZLIB_CFLAGS) \ - $(CODE_COVERAGE_CFLAGS) $(am__append_4) +AM_CXXFLAGS = $(WARNING_CFLAGS) -Wnon-virtual-dtor \ + -I$(dvisvgm_srcdir)/libs/clipper \ + -I$(dvisvgm_srcdir)/libs/xxHash $(am__append_4) \ + $(KPATHSEA_INCLUDES) $(POTRACE_INCLUDES) $(FREETYPE2_INCLUDES) \ + $(ZLIB_INCLUDES) $(LIBGS_INCLUDES) $(CODE_COVERAGE_CFLAGS) \ + $(am__append_5) +AM_LDFLAGS = $(CODE_COVERAGE_LDFLAGS) CLEANFILES = *.gcda *.gcno all: all-am .SUFFIXES: .SUFFIXES: .c .cpp .lo .o .obj -$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ @@ -546,9 +561,9 @@ $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) exit 1;; \ esac; \ done; \ - echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign src/Makefile'; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign dvisvgm-src/src/Makefile'; \ $(am__cd) $(top_srcdir) && \ - $(AUTOMAKE) --foreign src/Makefile + $(AUTOMAKE) --foreign dvisvgm-src/src/Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ @@ -561,9 +576,9 @@ Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(top_srcdir)/configure: $(am__configure_deps) +$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(ACLOCAL_M4): $(am__aclocal_m4_deps) +$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): version.hpp: $(top_builddir)/config.status $(srcdir)/version.hpp.in @@ -992,21 +1007,27 @@ uninstall-am: uninstall-binPROGRAMS .PRECIOUS: Makefile +# TL: do not try to rebuild these source files. # the command-line parser class is generated from options.xml by opt2cpp -$(srcdir)/CommandLine.hpp: options.xml - rm -f $@ $*.hpp - python $(srcdir)/opt2cpp.py $< >$@ +@TEXLIVE_BUILD_FALSE@$(srcdir)/CommandLine.hpp: options.xml +@TEXLIVE_BUILD_FALSE@ rm -f $@ $*.hpp +@TEXLIVE_BUILD_FALSE@ python $(srcdir)/opt2cpp.py $< >$@ # Create a C string definition containing the PostScript routines psdefs.ps needed by class PSInterpreter -$(srcdir)/psdefs.cpp: psdefs.ps - if test -f $<; then \ - ps2c PSInterpreter::PSDEFS $< >$@; \ - fi +@TEXLIVE_BUILD_FALSE@$(srcdir)/psdefs.cpp: psdefs.ps +@TEXLIVE_BUILD_FALSE@ if test -f $<; then \ +@TEXLIVE_BUILD_FALSE@ ps2c PSInterpreter::PSDEFS $< >$@; \ +@TEXLIVE_BUILD_FALSE@ fi -psdefs.ps: ; +@TEXLIVE_BUILD_FALSE@psdefs.ps: ; @CODE_COVERAGE_RULES@ +@KPATHSEA_RULE@ +@POTRACE_RULE@ +@FREETYPE2_RULE@ +@ZLIB_RULE@ + # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/MapLine.hpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/MapLine.hpp index 04b209db8bf..f5fea478ad7 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/MapLine.hpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/MapLine.hpp @@ -53,7 +53,7 @@ class MapLine SubfontDefinition* sfd () const {return _sfd;} protected: - explicit MapLine (); + MapLine (); void init (); bool isDVIPSFormat (const char *line) const; void parse (const char *line); diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/Matrix.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/Matrix.cpp index fcb48e397ad..645b3158579 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/Matrix.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/Matrix.cpp @@ -18,14 +18,12 @@ ** along with this program; if not, see <http://www.gnu.org/licenses/>. ** *************************************************************************/ -#define _USE_MATH_DEFINES -#include <config.h> #include <algorithm> -#include <cmath> #include <limits> #include <sstream> #include "Calculator.hpp" #include "Matrix.hpp" +#include "utility.hpp" #include "XMLString.hpp" using namespace std; @@ -59,7 +57,7 @@ double det (const Matrix &m, int row, int col) { static inline double deg2rad (double deg) { - return M_PI*deg/180.0; + return math::PI*deg/180.0; } diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/TpicSpecialHandler.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/TpicSpecialHandler.cpp index 6e1fcb62940..ecccf636906 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/TpicSpecialHandler.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/TpicSpecialHandler.cpp @@ -18,9 +18,7 @@ ** along with this program; if not, see <http://www.gnu.org/licenses/>. ** *************************************************************************/ -#define _USE_MATH_DEFINES #include <config.h> -#include <cmath> #include <cstring> #include <sstream> #include "Color.hpp" @@ -30,7 +28,7 @@ #include "SpecialActions.hpp" #include "SVGTree.hpp" #include "TpicSpecialHandler.hpp" - +#include "utility.hpp" using namespace std; @@ -182,19 +180,18 @@ void TpicSpecialHandler::drawSplines (double ddist, SpecialActions &actions) { * @param[in] angle2 ending angle (clockwise) relative to x-axis * @param[in] actions object providing the actions that can be performed by the SpecialHandler */ void TpicSpecialHandler::drawArc (double cx, double cy, double rx, double ry, double angle1, double angle2, SpecialActions &actions) { - const double PI2 = 2*M_PI; angle1 *= -1; angle2 *= -1; - if (fabs(angle1) > PI2) { - int n = (int)(angle1/PI2); - angle1 = angle1 - n*PI2; - angle2 = angle2 - n*PI2; + if (fabs(angle1) > math::TWO_PI) { + int n = (int)(angle1/math::TWO_PI); + angle1 = angle1 - n*math::TWO_PI; + angle2 = angle2 - n*math::TWO_PI; } double x = cx + actions.getX(); double y = cy + actions.getY(); XMLElementNode *elem=0; - if (fabs(angle1-angle2) >= PI2) { // closed ellipse? + if (fabs(angle1-angle2) >= math::TWO_PI) { // closed ellipse? elem = new XMLElementNode("ellipse"); elem->addAttribute("cx", XMLString(x)); elem->addAttribute("cy", XMLString(y)); @@ -203,11 +200,11 @@ void TpicSpecialHandler::drawArc (double cx, double cy, double rx, double ry, do } else { if (angle1 < 0) - angle1 = PI2+angle1; + angle1 = math::TWO_PI+angle1; if (angle2 < 0) - angle2 = PI2+angle2; + angle2 = math::TWO_PI+angle2; elem = new XMLElementNode("path"); - int large_arg = fabs(angle1-angle2) > M_PI ? 0 : 1; + int large_arg = fabs(angle1-angle2) > math::PI ? 0 : 1; int sweep_flag = angle1 > angle2 ? 0 : 1; if (angle1 > angle2) { large_arg = 1-large_arg; diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/utility.hpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/utility.hpp index 63d12087e71..f12b1174d7a 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/utility.hpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/utility.hpp @@ -23,6 +23,12 @@ #include <string> +namespace math { +constexpr const double PI = 3.141592653589793238462643383279502884; +constexpr const double HALF_PI = 1.570796326794896619231321691639751442; +constexpr const double TWO_PI = 6.283185307179586476925286766559005768; +} + namespace util { std::string trim (const std::string &str, const char *ws=" \t\n\r\f"); |