[poppler] poppler/SplashOutputDev.cc splash/Splash.cc splash/Splash.h
Albert Astals Cid
aacid at kemper.freedesktop.org
Thu Jun 6 14:58:42 PDT 2013
poppler/SplashOutputDev.cc | 15 ++++++++++++++-
splash/Splash.cc | 15 +++++++++++----
splash/Splash.h | 3 ++-
3 files changed, 27 insertions(+), 6 deletions(-)
New commits:
commit bbd27c92b5e5034dc2899ea26b47fcb983209f82
Author: Thomas Freitag <Thomas.Freitag at alfa.de>
Date: Thu Jun 6 23:52:36 2013 +0200
Speed-up some tiling on a 10x factor
Bug #64892
diff --git a/poppler/SplashOutputDev.cc b/poppler/SplashOutputDev.cc
index 765b892..b11b695 100644
--- a/poppler/SplashOutputDev.cc
+++ b/poppler/SplashOutputDev.cc
@@ -4268,7 +4268,20 @@ GBool SplashOutputDev::tilingPatternFill(GfxState *state, Gfx *gfxA, Catalog *ca
matc[1] = ctm[1];
matc[2] = ctm[2];
matc[3] = ctm[3];
- retValue = splash->drawImage(&tilingBitmapSrc, &imgData, colorMode, gTrue, result_width, result_height, matc, gTrue) == splashOk;
+ GBool minorAxisZero = matc[1] == 0 && matc[2] == 0;
+ if (matc[0] > 0 && minorAxisZero && matc[3] > 0) {
+ // draw the tiles
+ for (int y = 0; y < imgData.repeatY; ++y) {
+ for (int x = 0; x < imgData.repeatX; ++x) {
+ x0 = splashFloor(matc[4]) + x * tBitmap->getWidth();
+ y0 = splashFloor(matc[5]) + y * tBitmap->getHeight();
+ splash->blitImage(tBitmap, gTrue, x0, y0);
+ }
+ }
+ retValue = gTrue;
+ } else {
+ retValue = splash->drawImage(&tilingBitmapSrc, &imgData, colorMode, gTrue, result_width, result_height, matc, gFalse, gTrue) == splashOk;
+ }
delete tBitmap;
delete gfx;
return retValue;
diff --git a/splash/Splash.cc b/splash/Splash.cc
index 6a1891e..bc7d79f 100644
--- a/splash/Splash.cc
+++ b/splash/Splash.cc
@@ -3682,7 +3682,7 @@ SplashError Splash::drawImage(SplashImageSource src, void *srcData,
return splashErrBadArg;
}
scaledImg = scaleImage(src, srcData, srcMode, nComps, srcAlpha, w, h,
- scaledWidth, scaledHeight, interpolate);
+ scaledWidth, scaledHeight, interpolate, tilingPattern);
if (scaledImg == NULL) {
return splashErrBadArg;
}
@@ -3720,7 +3720,7 @@ SplashError Splash::drawImage(SplashImageSource src, void *srcData,
return splashErrBadArg;
}
scaledImg = scaleImage(src, srcData, srcMode, nComps, srcAlpha, w, h,
- scaledWidth, scaledHeight, interpolate);
+ scaledWidth, scaledHeight, interpolate, tilingPattern);
if (scaledImg == NULL) {
return splashErrBadArg;
}
@@ -4063,7 +4063,7 @@ static GBool isImageInterpolationRequired(int srcWidth, int srcHeight,
SplashBitmap *Splash::scaleImage(SplashImageSource src, void *srcData,
SplashColorMode srcMode, int nComps,
GBool srcAlpha, int srcWidth, int srcHeight,
- int scaledWidth, int scaledHeight, GBool interpolate) {
+ int scaledWidth, int scaledHeight, GBool interpolate, GBool tilingPattern) {
SplashBitmap *dest;
dest = new SplashBitmap(scaledWidth, scaledHeight, 1, srcMode, srcAlpha, gTrue, bitmap->getSeparationList());
@@ -4081,7 +4081,7 @@ SplashBitmap *Splash::scaleImage(SplashImageSource src, void *srcData,
scaleImageYuXd(src, srcData, srcMode, nComps, srcAlpha,
srcWidth, srcHeight, scaledWidth, scaledHeight, dest);
} else {
- if (isImageInterpolationRequired(srcWidth, srcHeight, scaledWidth, scaledHeight, interpolate)) {
+ if (!tilingPattern && isImageInterpolationRequired(srcWidth, srcHeight, scaledWidth, scaledHeight, interpolate)) {
scaleImageYuXuBilinear(src, srcData, srcMode, nComps, srcAlpha,
srcWidth, srcHeight, scaledWidth, scaledHeight, dest);
} else {
@@ -4971,6 +4971,13 @@ void Splash::vertFlipImage(SplashBitmap *img, int width, int height,
gfree(lineBuf);
}
+void Splash::blitImage(SplashBitmap *src, GBool srcAlpha, int xDest, int yDest) {
+ SplashClipResult clipRes = state->clip->testRect(xDest, yDest, xDest + src->getWidth() - 1, yDest + src->getHeight() - 1);
+ if (clipRes != splashClipAllOutside) {
+ blitImage(src, srcAlpha, xDest, yDest, clipRes);
+ }
+}
+
void Splash::blitImage(SplashBitmap *src, GBool srcAlpha, int xDest, int yDest,
SplashClipResult clipRes) {
SplashPipe pipe;
diff --git a/splash/Splash.h b/splash/Splash.h
index 8bcd1db..cf98e6c 100644
--- a/splash/Splash.h
+++ b/splash/Splash.h
@@ -232,6 +232,7 @@ public:
// zero.
SplashError blitTransparent(SplashBitmap *src, int xSrc, int ySrc,
int xDest, int yDest, int w, int h);
+ void blitImage(SplashBitmap *src, GBool srcAlpha, int xDest, int yDest);
//----- misc
@@ -364,7 +365,7 @@ private:
SplashBitmap *scaleImage(SplashImageSource src, void *srcData,
SplashColorMode srcMode, int nComps,
GBool srcAlpha, int srcWidth, int srcHeight,
- int scaledWidth, int scaledHeight, GBool interpolate);
+ int scaledWidth, int scaledHeight, GBool interpolate, GBool tilingPattern = gFalse);
void scaleImageYdXd(SplashImageSource src, void *srcData,
SplashColorMode srcMode, int nComps,
GBool srcAlpha, int srcWidth, int srcHeight,
More information about the poppler
mailing list