poppler/Page.h | 1 splash/SplashClip.h | 6 ++ splash/SplashMath.h | 118 ++++++++++++++++++++++++++++++++++++++++++++++++ utils/ImageOutputDev.cc | 9 +++ utils/ImageOutputDev.h | 12 ++++ 5 files changed, 145 insertions(+), 1 deletion(-)
New commits: commit f848edab849910b8291c7974e484ef5d02b2234c Author: Albert Astals Cid <[email protected]> Date: Thu Sep 1 16:42:30 2011 +0200 xpdf303: Do not extract the million tiles of a pattern diff --git a/utils/ImageOutputDev.cc b/utils/ImageOutputDev.cc index 99b3319..6ca5ef4 100644 --- a/utils/ImageOutputDev.cc +++ b/utils/ImageOutputDev.cc @@ -70,6 +70,15 @@ void ImageOutputDev::setFilename(const char *fileExt) { } } +GBool ImageOutputDev::tilingPatternFill(GfxState *state, Catalog *cat, Object *str, + double *pmat, int paintType, int tilingType, Dict *resDict, + double *mat, double *bbox, + int x0, int y0, int x1, int y1, + double xStep, double yStep) { + return gTrue; + // do nothing -- this avoids the potentially slow loop in Gfx.cc +} + void ImageOutputDev::drawImageMask(GfxState *state, Object *ref, Stream *str, int width, int height, GBool invert, GBool interpolate, GBool inlineImg) { diff --git a/utils/ImageOutputDev.h b/utils/ImageOutputDev.h index e5dacc9..1e43308 100644 --- a/utils/ImageOutputDev.h +++ b/utils/ImageOutputDev.h @@ -58,6 +58,11 @@ public: // Check if file was successfully created. virtual GBool isOk() { return ok; } + // Does this device use tilingPatternFill()? If this returns false, + // tiling pattern fills will be reduced to a series of other drawing + // operations. + virtual GBool useTilingPatternFill() { return gTrue; } + // Does this device use beginType3Char/endType3Char? Otherwise, // text in Type 3 fonts will be drawn with drawChar/drawString. virtual GBool interpretType3Chars() { return gFalse; } @@ -78,6 +83,13 @@ public: // Does this device use drawChar() or drawString()? virtual GBool useDrawChar() { return gFalse; } + //----- path painting + virtual GBool tilingPatternFill(GfxState *state, Catalog *cat, Object *str, + double *pmat, int paintType, int tilingType, Dict *resDict, + double *mat, double *bbox, + int x0, int y0, int x1, int y1, + double xStep, double yStep); + //----- image drawing virtual void drawImageMask(GfxState *state, Object *ref, Stream *str, int width, int height, GBool invert, commit 01adb7ef6a524d7313a45e7c5f441da4fd0250bd Author: Albert Astals Cid <[email protected]> Date: Thu Sep 1 16:31:50 2011 +0200 xpdf303: Assembler for some functions diff --git a/splash/SplashMath.h b/splash/SplashMath.h index 5aa3789..1886dec 100644 --- a/splash/SplashMath.h +++ b/splash/SplashMath.h @@ -45,6 +45,42 @@ static inline int splashFloor(SplashCoord x) { return FixedPoint::floor(x); #elif USE_FLOAT return (int)floorf(x); + #elif __GNUC__ && __i386__ + // floor() and (int)() are implemented separately, which results + // in changing the FPCW multiple times - so we optimize it with + // some inline assembly + Gushort oldCW, newCW, t; + int result; + + __asm__ volatile("fldl %4\n" + "fnstcw %0\n" + "movw %0, %3\n" + "andw $0xf3ff, %3\n" + "orw $0x0400, %3\n" + "movw %3, %1\n" // round down + "fldcw %1\n" + "fistpl %2\n" + "fldcw %0\n" + : "=m" (oldCW), "=m" (newCW), "=m" (result), "=r" (t) + : "m" (x)); + return result; + #elif defined(WIN32) && defined(_M_IX86) + // floor() and (int)() are implemented separately, which results + // in changing the FPCW multiple times - so we optimize it with + // some inline assembly + Gushort oldCW, newCW; + int result; + + __asm fld QWORD PTR x + __asm fnstcw WORD PTR oldCW + __asm mov ax, WORD PTR oldCW + __asm and ax, 0xf3ff + __asm or ax, 0x0400 + __asm mov WORD PTR newCW, ax // round down + __asm fldcw WORD PTR newCW + __asm fistp DWORD PTR result + __asm fldcw WORD PTR oldCW + return result; #else if (x > 0) return (int)x; else return (int)floor(x); @@ -56,6 +92,42 @@ static inline int splashCeil(SplashCoord x) { return FixedPoint::ceil(x); #elif USE_FLOAT return (int)ceilf(x); +#elif __GNUC__ && __i386__ + // ceil() and (int)() are implemented separately, which results + // in changing the FPCW multiple times - so we optimize it with + // some inline assembly + Gushort oldCW, newCW, t; + int result; + + __asm__ volatile("fldl %4\n" + "fnstcw %0\n" + "movw %0, %3\n" + "andw $0xf3ff, %3\n" + "orw $0x0800, %3\n" + "movw %3, %1\n" // round up + "fldcw %1\n" + "fistpl %2\n" + "fldcw %0\n" + : "=m" (oldCW), "=m" (newCW), "=m" (result), "=r" (t) + : "m" (x)); + return result; +#elif defined(WIN32) && defined(_M_IX86) + // ceil() and (int)() are implemented separately, which results + // in changing the FPCW multiple times - so we optimize it with + // some inline assembly + Gushort oldCW, newCW; + int result; + + __asm fld QWORD PTR x + __asm fnstcw WORD PTR oldCW + __asm mov ax, WORD PTR oldCW + __asm and ax, 0xf3ff + __asm or ax, 0x0800 + __asm mov WORD PTR newCW, ax // round up + __asm fldcw WORD PTR newCW + __asm fistp DWORD PTR result + __asm fldcw WORD PTR oldCW + return result; #else return (int)ceil(x); #endif @@ -64,6 +136,44 @@ static inline int splashCeil(SplashCoord x) { static inline int splashRound(SplashCoord x) { #if USE_FIXEDPOINT return FixedPoint::round(x); +#elif __GNUC__ && __i386__ + // this could use round-to-nearest mode and avoid the "+0.5", + // but that produces slightly different results (because i+0.5 + // sometimes rounds up and sometimes down using the even rule) + Gushort oldCW, newCW, t; + int result; + + x += 0.5; + __asm__ volatile("fldl %4\n" + "fnstcw %0\n" + "movw %0, %3\n" + "andw $0xf3ff, %3\n" + "orw $0x0400, %3\n" + "movw %3, %1\n" // round down + "fldcw %1\n" + "fistpl %2\n" + "fldcw %0\n" + : "=m" (oldCW), "=m" (newCW), "=m" (result), "=r" (t) + : "m" (x)); + return result; +#elif defined(WIN32) && defined(_M_IX86) + // this could use round-to-nearest mode and avoid the "+0.5", + // but that produces slightly different results (because i+0.5 + // sometimes rounds up and sometimes down using the even rule) + Gushort oldCW, newCW; + int result; + + x += 0.5; + __asm fld QWORD PTR x + __asm fnstcw WORD PTR oldCW + __asm mov ax, WORD PTR oldCW + __asm and ax, 0xf3ff + __asm or ax, 0x0400 + __asm mov WORD PTR newCW, ax // round down + __asm fldcw WORD PTR newCW + __asm fistp DWORD PTR result + __asm fldcw WORD PTR oldCW + return result; #else return (int)splashFloor(x + 0.5); #endif commit 4f87a3163f133565e8774ef416e67d05f906723d Author: Albert Astals Cid <[email protected]> Date: Thu Sep 1 16:25:19 2011 +0200 xpdf303: Add splashAvg diff --git a/splash/SplashMath.h b/splash/SplashMath.h index 0749c78..5aa3789 100644 --- a/splash/SplashMath.h +++ b/splash/SplashMath.h @@ -69,6 +69,14 @@ static inline int splashRound(SplashCoord x) { #endif } +static inline SplashCoord splashAvg(SplashCoord x, SplashCoord y) { +#if USE_FIXEDPOINT + return FixedPoint::avg(x, y); +#else + return 0.5 * (x + y); +#endif +} + static inline SplashCoord splashSqrt(SplashCoord x) { #if USE_FIXEDPOINT return FixedPoint::sqrt(x); commit 64cf42f89939763d105be4948a20e9ecb81a64c1 Author: Albert Astals Cid <[email protected]> Date: Thu Sep 1 16:23:08 2011 +0200 xpdf303: Add getters to SplashClip diff --git a/splash/SplashClip.h b/splash/SplashClip.h index 7933017..3eb2d78 100644 --- a/splash/SplashClip.h +++ b/splash/SplashClip.h @@ -118,6 +118,12 @@ public: // will update <x0> and <x1>. void clipAALine(SplashBitmap *aaBuf, int *x0, int *x1, int y); + // Get the rectangle part of the clip region. + SplashCoord getXMin() { return xMin; } + SplashCoord getXMax() { return xMax; } + SplashCoord getYMin() { return yMin; } + SplashCoord getYMax() { return yMax; } + // Get the rectangle part of the clip region, in integer coordinates. int getXMinI() { return xMinI; } int getXMaxI() { return xMaxI; } commit 28c6a55742f55a719ef63b8e0eff7c242653cf36 Author: Albert Astals Cid <[email protected]> Date: Thu Sep 1 16:17:56 2011 +0200 xpdf303: unneeded forward declare diff --git a/poppler/Page.h b/poppler/Page.h index f78be70..c5ff8d7 100644 --- a/poppler/Page.h +++ b/poppler/Page.h @@ -39,7 +39,6 @@ class PDFDoc; class XRef; class OutputDev; class Links; -class Catalog; class Annots; class Annot; class Gfx; _______________________________________________ poppler mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/poppler
