poppler/SplashOutputDev.cc | 2 ++ splash/SplashPath.cc | 18 ++++++++++++++++++ splash/SplashPath.h | 4 ++++ 3 files changed, 24 insertions(+)
New commits: commit b4f0e2b27a0880801c7af0c82fe17894797511b2 Author: Stefan Brüns <[email protected]> Date: Sat May 26 19:51:20 2018 +0200 Splash: Reserve space for path segments upfront Instead of iteratively growing the array reserve sufficient space prior to populating the array. diff --git a/poppler/SplashOutputDev.cc b/poppler/SplashOutputDev.cc index b85a860c..74953839 100644 --- a/poppler/SplashOutputDev.cc +++ b/poppler/SplashOutputDev.cc @@ -39,6 +39,7 @@ // Copyright (C) 2016 Takahiro Hashimoto <[email protected]> // Copyright (C) 2017 Even Rouault <[email protected]> // Copyright (C) 2018 Klarälvdalens Datakonsult AB, a KDAB Group company, <[email protected]>. Work sponsored by the LiMux project of the city of Munich +// Copyright (C) 2018 Stefan Brüns <[email protected]> // // To see a description of the changes please see the Changelog file that // came with your tarball or type make ChangeLog if you are building from git @@ -2368,6 +2369,7 @@ SplashPath *SplashOutputDev::convertPath(GfxState *state, GfxPath *path, for (i = 0; i < path->getNumSubpaths(); ++i) { subpath = path->getSubpath(i); if (subpath->getNumPoints() > n) { + sPath->reserve(subpath->getNumPoints() + 1); sPath->moveTo((SplashCoord)subpath->getX(0), (SplashCoord)subpath->getY(0)); j = 1; diff --git a/splash/SplashPath.cc b/splash/SplashPath.cc index 09b2a76e..5a333161 100644 --- a/splash/SplashPath.cc +++ b/splash/SplashPath.cc @@ -4,6 +4,20 @@ // //======================================================================== +//======================================================================== +// +// Modified under the Poppler project - http://poppler.freedesktop.org +// +// All changes made under the Poppler project to this file are licensed +// under GPL version 2 or later +// +// Copyright (C) 2018 Stefan Brüns <[email protected]> +// +// To see a description of the changes please see the Changelog file that +// came with your tarball or type make ChangeLog if you are building from git +// +//======================================================================== + #include <config.h> #ifdef USE_GCC_PRAGMAS @@ -62,6 +76,10 @@ SplashPath::~SplashPath() { gfree(hints); } +void SplashPath::reserve(int nPts) { + grow(nPts - size); +} + // Add space for <nPts> more points. void SplashPath::grow(int nPts) { if (length + nPts > size) { diff --git a/splash/SplashPath.h b/splash/SplashPath.h index c8164a8b..54331372 100644 --- a/splash/SplashPath.h +++ b/splash/SplashPath.h @@ -12,6 +12,7 @@ // under GPL version 2 or later // // Copyright (C) 2018 Albert Astals Cid <[email protected]> +// Copyright (C) 2018 Stefan Brüns <[email protected]> // // To see a description of the changes please see the Changelog file that // came with your tarball or type make ChangeLog if you are building from git @@ -115,6 +116,9 @@ public: // Get the current point. GBool getCurPt(SplashCoord *x, SplashCoord *y); + // Reserve space for at least n points + void reserve(int n); + protected: SplashPath(SplashPath *path); _______________________________________________ poppler mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/poppler
