pushed El dissabte, 26 de maig de 2018, a les 19:51:20 CEST, Stefan Brüns va escriure: > Instead of iteratively growing the array reserve sufficient space > prior to populating the array. > --- > poppler/SplashOutputDev.cc | 1 + > splash/SplashPath.cc | 4 ++++ > splash/SplashPath.h | 3 +++ > 3 files changed, 8 insertions(+) > > diff --git a/poppler/SplashOutputDev.cc b/poppler/SplashOutputDev.cc > index b85a860c..ae93bddd 100644 > --- a/poppler/SplashOutputDev.cc > +++ b/poppler/SplashOutputDev.cc > @@ -2368,6 +2368,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..4a00e959 100644 > --- a/splash/SplashPath.cc > +++ b/splash/SplashPath.cc > @@ -62,6 +62,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..c85303a8 100644 > --- a/splash/SplashPath.h > +++ b/splash/SplashPath.h > @@ -115,6 +115,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 poppler@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/poppler