splash/SplashClip.cc | 10 +--------- splash/SplashXPathScanner.cc | 12 ++++++++++++ splash/SplashXPathScanner.h | 6 ++++++ 3 files changed, 19 insertions(+), 9 deletions(-)
New commits: commit bfe82d7c2dba2ec3c97855232b75bde29cbdff44 Author: Thomas Freitag <[email protected]> Date: Fri Aug 20 15:36:49 2021 +0200 instead of creating new scanner just copy the existing ones diff --git a/splash/SplashClip.cc b/splash/SplashClip.cc index 71256735..b98936dc 100644 --- a/splash/SplashClip.cc +++ b/splash/SplashClip.cc @@ -72,7 +72,6 @@ SplashClip::SplashClip(SplashCoord x0, SplashCoord y0, SplashCoord x1, SplashCoo SplashClip::SplashClip(SplashClip *clip) { - int yMinAA, yMaxAA; int i; antialias = clip->antialias; @@ -92,14 +91,7 @@ SplashClip::SplashClip(SplashClip *clip) for (i = 0; i < length; ++i) { paths[i] = clip->paths[i]->copy(); flags[i] = clip->flags[i]; - if (antialias) { - yMinAA = yMinI * splashAASize; - yMaxAA = (yMaxI + 1) * splashAASize - 1; - } else { - yMinAA = yMinI; - yMaxAA = yMaxI; - } - scanners[i] = new SplashXPathScanner(paths[i], flags[i] & splashClipEO, yMinAA, yMaxAA); + scanners[i] = clip->scanners[i]->copy(); } } diff --git a/splash/SplashXPathScanner.cc b/splash/SplashXPathScanner.cc index 98a49912..65a5a7c0 100644 --- a/splash/SplashXPathScanner.cc +++ b/splash/SplashXPathScanner.cc @@ -112,6 +112,18 @@ SplashXPathScanner::SplashXPathScanner(SplashXPath *xPathA, bool eoA, int clipYM computeIntersections(); } +SplashXPathScanner::SplashXPathScanner(SplashXPathScanner *scanner) +{ + xPath = scanner->xPath; + eo = scanner->eo; + xMin = scanner->xMin; + yMin = scanner->yMin; + xMax = scanner->xMax; + yMax = scanner->yMax; + partialClip = scanner->partialClip; + allIntersections = scanner->allIntersections; +} + SplashXPathScanner::~SplashXPathScanner() { } void SplashXPathScanner::getBBoxAA(int *xMinA, int *yMinA, int *xMaxA, int *yMaxA) diff --git a/splash/SplashXPathScanner.h b/splash/SplashXPathScanner.h index d05b66ad..5c840dab 100644 --- a/splash/SplashXPathScanner.h +++ b/splash/SplashXPathScanner.h @@ -53,6 +53,9 @@ public: // Create a new SplashXPathScanner object. <xPathA> must be sorted. SplashXPathScanner(SplashXPath *xPathA, bool eoA, int clipYMin, int clipYMax); + // Copy a scanner. + SplashXPathScanner *copy() { return new SplashXPathScanner(this); } + ~SplashXPathScanner(); SplashXPathScanner(const SplashXPathScanner &) = delete; @@ -93,6 +96,9 @@ public: // will update <x0> and <x1>. void clipAALine(SplashBitmap *aaBuf, int *x0, int *x1, int y); +protected: + SplashXPathScanner(SplashXPathScanner *scanner); + private: void computeIntersections(); bool addIntersection(double segYMin, double segYMax, int y, int x0, int x1, int count);
