[poppler] 2 commits - poppler/SplashOutputDev.cc splash/SplashClip.cc splash/SplashClip.h
poppler/SplashOutputDev.cc |1 + splash/SplashClip.cc | 16 splash/SplashClip.h| 22 +++--- 3 files changed, 20 insertions(+), 19 deletions(-) New commits: commit 194e57f21e6a7fe2a5eb3cf687599978b09e03f9 Author: Stefan Brüns Date: Mon Oct 7 20:46:33 2019 +0200 Move the non-trivial part of the clip test to the implementation file This allows to only have a SplashXPathScanner forward declaration in the header file. diff --git a/splash/SplashClip.cc b/splash/SplashClip.cc index a58fd29e..a4c2e73e 100644 --- a/splash/SplashClip.cc +++ b/splash/SplashClip.cc @@ -406,3 +406,18 @@ void SplashClip::clipAALine(SplashBitmap *aaBuf, int *x0, int *x1, int y, bool a } } } + +bool SplashClip::testClipPaths(int x, int y) { + if (antialias) { +x *= splashAASize; +y *= splashAASize; + } + + for (int i = 0; i < length; ++i) { +if (!scanners[i]->test(x, y)) { + return false; +} + } + + return true; +} diff --git a/splash/SplashClip.h b/splash/SplashClip.h index a6ab1870..77b5e6c3 100644 --- a/splash/SplashClip.h +++ b/splash/SplashClip.h @@ -23,10 +23,10 @@ #define SPLASHCLIP_H #include "SplashTypes.h" -#include "SplashXPathScanner.h" class SplashPath; class SplashXPath; +class SplashXPathScanner; class SplashBitmap; // @@ -72,29 +72,13 @@ public: // Returns true if (,) is inside the clip. bool test(int x, int y) { -int i; - // check the rectangle if (x < xMinI || x > xMaxI || y < yMinI || y > yMaxI) { return false; } // check the paths -if (antialias) { - for (i = 0; i < length; ++i) { -if (!scanners[i]->test(x * splashAASize, y * splashAASize)) { - return false; -} - } -} else { - for (i = 0; i < length; ++i) { -if (!scanners[i]->test(x, y)) { - return false; -} - } -} - -return true; +return testClipPaths(x, y); } // Tests a rectangle against the clipping region. Returns one of: @@ -137,6 +121,7 @@ protected: SplashClip(SplashClip *clip); void grow(int nPaths); + bool testClipPaths(int x, int y); bool antialias; SplashCoord xMin, yMin, xMax, yMax; commit 9d875adabdc94f50de78d72528d373b46a8ed280 Author: Stefan Brüns Date: Mon Oct 7 19:57:32 2019 +0200 Include SplashMath.h only where needed diff --git a/poppler/SplashOutputDev.cc b/poppler/SplashOutputDev.cc index 440ee307..214302a7 100644 --- a/poppler/SplashOutputDev.cc +++ b/poppler/SplashOutputDev.cc @@ -74,6 +74,7 @@ #include "splash/SplashFont.h" #include "splash/SplashFontFile.h" #include "splash/SplashFontFileID.h" +#include "splash/SplashMath.h" #include "splash/Splash.h" #include "SplashOutputDev.h" #include diff --git a/splash/SplashClip.cc b/splash/SplashClip.cc index 8a07f24f..a58fd29e 100644 --- a/splash/SplashClip.cc +++ b/splash/SplashClip.cc @@ -25,6 +25,7 @@ #include #include "goo/gmem.h" #include "SplashErrorCodes.h" +#include "SplashMath.h" #include "SplashPath.h" #include "SplashXPath.h" #include "SplashXPathScanner.h" diff --git a/splash/SplashClip.h b/splash/SplashClip.h index ddc48974..a6ab1870 100644 --- a/splash/SplashClip.h +++ b/splash/SplashClip.h @@ -23,7 +23,6 @@ #define SPLASHCLIP_H #include "SplashTypes.h" -#include "SplashMath.h" #include "SplashXPathScanner.h" class SplashPath; ___ poppler mailing list poppler@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/poppler
[poppler] 2 commits - poppler/SplashOutputDev.cc poppler/SplashOutputDev.h
poppler/SplashOutputDev.cc |9 ++--- poppler/SplashOutputDev.h |6 ++ 2 files changed, 4 insertions(+), 11 deletions(-) New commits: commit 73130ae1125c86ebd0ee504d0681d9911ff2cfbd Author: Albert Astals CidDate: Wed Feb 14 17:40:23 2018 +0100 SplashGouraudPattern: Remove mode member variable We don't need it anymore, was introduced in the initial overprint implementation and was forgotten to be removed when merging xpdf 3.03 diff --git a/poppler/SplashOutputDev.cc b/poppler/SplashOutputDev.cc index 50b78245..efc0aaec 100644 --- a/poppler/SplashOutputDev.cc +++ b/poppler/SplashOutputDev.cc @@ -197,15 +197,10 @@ static inline void convertGfxShortColor(SplashColorPtr dest, // SplashGouraudPattern // SplashGouraudPattern::SplashGouraudPattern(GBool bDirectColorTranslationA, - GfxState *stateA, GfxGouraudTriangleShading *shadingA, SplashColorMode modeA) { - SplashColor defaultColor; - GfxColor srcColor; + GfxState *stateA, GfxGouraudTriangleShading *shadingA) { state = stateA; shading = shadingA; - mode = modeA; bDirectColorTranslation = bDirectColorTranslationA; - shadingA->getColorSpace()->getDefaultColor(); - convertGfxColor(defaultColor, mode, shadingA->getColorSpace(), ); gfxMode = shadingA->getColorSpace()->getMode(); } @@ -4754,7 +4749,7 @@ GBool SplashOutputDev::gouraudTriangleShadedFill(GfxState *state, GfxGouraudTria } // restore vector antialias because we support it here if (shading->isParameterized()) { -SplashGouraudColor *splashShading = new SplashGouraudPattern(bDirectColorTranslation, state, shading, colorMode); +SplashGouraudColor *splashShading = new SplashGouraudPattern(bDirectColorTranslation, state, shading); GBool vaa = getVectorAntialias(); GBool retVal = gFalse; setVectorAntialias(gTrue); diff --git a/poppler/SplashOutputDev.h b/poppler/SplashOutputDev.h index 4dc97e82..3a5883c4 100644 --- a/poppler/SplashOutputDev.h +++ b/poppler/SplashOutputDev.h @@ -135,9 +135,9 @@ private: class SplashGouraudPattern: public SplashGouraudColor { public: - SplashGouraudPattern(GBool bDirectColorTranslation, GfxState *state, GfxGouraudTriangleShading *shading, SplashColorMode mode); + SplashGouraudPattern(GBool bDirectColorTranslation, GfxState *state, GfxGouraudTriangleShading *shading); - SplashPattern *copy() override { return new SplashGouraudPattern(bDirectColorTranslation, state, shading, mode); } + SplashPattern *copy() override { return new SplashGouraudPattern(bDirectColorTranslation, state, shading); } ~SplashGouraudPattern(); @@ -162,7 +162,6 @@ private: GfxGouraudTriangleShading *shading; GfxState *state; GBool bDirectColorTranslation; - SplashColorMode mode; GfxColorSpaceMode gfxMode; }; commit 37efb98d77c14c27a22806ec676c13f0a8b99490 Author: Albert Astals Cid Date: Wed Feb 14 17:43:41 2018 +0100 SplashOutputDev:: Remove unused maskBitmap member diff --git a/poppler/SplashOutputDev.h b/poppler/SplashOutputDev.h index 89655d66..4dc97e82 100644 --- a/poppler/SplashOutputDev.h +++ b/poppler/SplashOutputDev.h @@ -466,7 +466,6 @@ private: SplashTransparencyGroup *// transparency group stack transpGroupStack; - SplashBitmap *maskBitmap; // for image masks in pattern colorspace int nestCount; }; ___ poppler mailing list poppler@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/poppler
[poppler] 2 commits - poppler/SplashOutputDev.cc splash/Splash.cc
poppler/SplashOutputDev.cc |4 ++-- splash/Splash.cc | 38 -- 2 files changed, 22 insertions(+), 20 deletions(-) New commits: commit 2a09ec47aef8870dba345f4045e691ffb5a59f4d Author: Albert Astals CidDate: Mon Oct 24 20:04:22 2016 +0200 Fix memory leak in parametrized gouraudTriangleShadedFill diff --git a/poppler/SplashOutputDev.cc b/poppler/SplashOutputDev.cc index 688540b..d454e0e 100644 --- a/poppler/SplashOutputDev.cc +++ b/poppler/SplashOutputDev.cc @@ -4762,17 +4762,17 @@ GBool SplashOutputDev::gouraudTriangleShadedFill(GfxState *state, GfxGouraudTria default: break; } - SplashGouraudColor *splashShading = new SplashGouraudPattern(bDirectColorTranslation, state, shading, colorMode); // restore vector antialias because we support it here if (shading->isParameterized()) { +SplashGouraudColor *splashShading = new SplashGouraudPattern(bDirectColorTranslation, state, shading, colorMode); GBool vaa = getVectorAntialias(); GBool retVal = gFalse; setVectorAntialias(gTrue); retVal = splash->gouraudTriangleShadedFill(splashShading); setVectorAntialias(vaa); +delete splashShading; return retVal; } - delete splashShading; return gFalse; } commit 169889b8e196cfcd288e6555fb048fbbf95ba3f6 Author: Albert Astals Cid Date: Mon Oct 24 20:04:00 2016 +0200 Fix crash on broken files diff --git a/splash/Splash.cc b/splash/Splash.cc index e179c1c..46b8ce2 100644 --- a/splash/Splash.cc +++ b/splash/Splash.cc @@ -5745,24 +5745,26 @@ GBool Splash::gouraudTriangleShadedFill(SplashGouraudColor *shading) colorinterp = scanColorMap[0] * scanLimitL + scanColorMap[1]; bitmapOff = scanLineOff + scanLimitL * colorComps; -for (int X = scanLimitL; X <= scanLimitR && bitmapOff + colorComps <= bitmapOffLimit; ++X, colorinterp += scanColorMap[0], bitmapOff += colorComps) { - // FIXME : standard rectangular clipping can be done for a - // complete scanline which is faster - // --> see SplashClip and its methods - if (!clip->test(X, Y)) -continue; - - assert(fabs(colorinterp - (scanColorMap[0] * X + scanColorMap[1])) < 1e-10); - assert(bitmapOff == Y * rowSize + colorComps * X && scanLineOff == Y * rowSize); - - shading->getParameterizedColor(colorinterp, bitmapMode, [bitmapOff]); - - // make the shading visible. - // Note that opacity is handled by the bDirectBlit stuff, see - // above for comments and below for implementation. - if (hasAlpha) -bitmapAlpha[Y * bitmapWidth + X] = 255; -} +if (likely(bitmapOff >= 0)) { + for (int X = scanLimitL; X <= scanLimitR && bitmapOff + colorComps <= bitmapOffLimit; ++X, colorinterp += scanColorMap[0], bitmapOff += colorComps) { + // FIXME : standard rectangular clipping can be done for a + // complete scanline which is faster + // --> see SplashClip and its methods + if (!clip->test(X, Y)) + continue; + + assert(fabs(colorinterp - (scanColorMap[0] * X + scanColorMap[1])) < 1e-10); + assert(bitmapOff == Y * rowSize + colorComps * X && scanLineOff == Y * rowSize); + + shading->getParameterizedColor(colorinterp, bitmapMode, [bitmapOff]); + + // make the shading visible. + // Note that opacity is handled by the bDirectBlit stuff, see + // above for comments and below for implementation. + if (hasAlpha) + bitmapAlpha[Y * bitmapWidth + X] = 255; + } + } } } } else { ___ poppler mailing list poppler@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/poppler
Re: [poppler] 2 commits - poppler/SplashOutputDev.cc test/perf-test.cc
Hi, I noticed that this patch changed every single line of perf-test.cc, making it hard to review properly. This happened certainly because of the strange line endlings (DOS style) of perf-test.cc. A quick search showed that the following files also have DOS line endings: test/perf-test-preview-dummy.cc test/perf-test-preview-win.cc splash/SplashState.h I propose to convert those from DOS to Unix line endings to prevent similar issues in the future. See attached patch. While I was at it, I noticed some strange empty lines at EOF which make no sense to me. See second patch. Regards, Volker Albert Astals Cid schrieb: poppler/SplashOutputDev.cc |3 test/perf-test.cc | 2559 ++--- 2 files changed, 1283 insertions(+), 1279 deletions(-) New commits: commit d3fe0661c6dc6050e14cd5cb4afa089b7d7d66b0 Author: Richard PALO rich...@netbsd.org Date: Sun Nov 30 22:46:22 2014 +0100 warning: _FILE_OFFSET_BITS redefined Bug #86870 diff --git a/test/perf-test.cc b/test/perf-test.cc index 04adec3..4fb15d9 100644 --- a/test/perf-test.cc +++ b/test/perf-test.cc @@ -1,1279 +1,1280 @@ -/* Copyright Krzysztof Kowalczyk 2006-2007 - Copyright Hib Eris h...@hiberis.nl 2008, 2013 - License: GPLv2 */ -/* - A tool to stress-test poppler rendering and measure rendering times for - very simplistic performance measuring. - - TODO: - * make it work with cairo output as well - * print more info about document like e.g. enumarate images, - streams, compression, encryption, password-protection. Each should have - a command-line arguments to turn it on/off - * never over-write file given as -out argument (optionally, provide -force - option to force writing the -out file). It's way too easy too lose results - of a previous run. -*/ - -#ifdef _MSC_VER -// this sucks but I don't know any other way -#pragma comment(linker,/manifestdependency:\type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='x86' publicKeyToken='6595b64144ccf1df' language='*'\) -#endif - -#ifdef _WIN32 -#include windows.h -#else -#include strings.h -#endif - -// Define COPY_FILE if you want the file to be copied to a local disk first -// before it's tested. This is desired if a file is on a slow drive. -// Currently copying only works on Windows. -// Not enabled by default. -//#define COPY_FILE 1 - -#include assert.h -#include config.h -#include stdio.h -#include stdarg.h -#include ctype.h -#include stdlib.h -#include string.h -#include errno.h -#include time.h - -#ifdef HAVE_DIRENT_H -#include dirent.h -#endif - -#include Error.h -#include ErrorCodes.h -#include goo/GooString.h -#include goo/GooList.h -#include goo/GooTimer.h -#include GlobalParams.h -#include splash/SplashBitmap.h -#include Object.h /* must be included before SplashOutputDev.h because of sloppiness in SplashOutputDev.h */ -#include SplashOutputDev.h -#include TextOutputDev.h -#include PDFDoc.h -#include Link.h - -#ifdef _MSC_VER -#define strdup _strdup -#define strcasecmp _stricmp -#endif - -#define dimof(X)(sizeof(X)/sizeof((X)[0])) - -#define INVALID_PAGE_NO -1 - -/* Those must be implemented in order to provide preview during execution. - They can be no-ops. An implementation for windows is in - perf-test-preview-win.cc -*/ -extern void PreviewBitmapInit(void); -extern void PreviewBitmapDestroy(void); -extern void PreviewBitmapSplash(SplashBitmap *bmpSplash); - -class PdfEnginePoppler { -public: -PdfEnginePoppler(); -~PdfEnginePoppler(); - -const char *fileName(void) const { return _fileName; }; - -void setFileName(const char *fileName) { -assert(!_fileName); -_fileName = (char*)strdup(fileName); -} - -int pageCount(void) const { return _pageCount; } - -bool load(const char *fileName); -SplashBitmap *renderBitmap(int pageNo, double zoomReal, int rotation); - -SplashOutputDev * outputDevice(); -private: -char * _fileName; -int _pageCount; - -PDFDoc *_pdfDoc; -SplashOutputDev * _outputDev; -}; - -typedef struct StrList { -struct StrList *next; -char * str; -} StrList; - -/* List of all command-line arguments that are not switches. - We assume those are: - - names of PDF files - - names of a file with a list of PDF files - - names of directories with PDF files -*/ -static StrList *gArgsListRoot = NULL; - -/* Names of all command-line switches we recognize */ -#define TIMINGS_ARG -timings -#define RESOLUTION_ARG -resolution -#define RECURSIVE_ARG -recursive -#define OUT_ARG -out -#define PREVIEW_ARG -preview -#define SLOW_PREVIEW_ARG-slowpreview -#define LOAD_ONLY_ARG -loadonly -#define PAGE_ARG
Re: [poppler] 2 commits - poppler/SplashOutputDev.cc test/perf-test.cc
El Dilluns, 1 de desembre de 2014, a les 09:29:44, Volker Grabsch va escriure: Hi, I noticed that this patch changed every single line of perf-test.cc, making it hard to review properly. This happened certainly because of the strange line endlings (DOS style) of perf-test.cc. A quick search showed that the following files also have DOS line endings: test/perf-test-preview-dummy.cc test/perf-test-preview-win.cc splash/SplashState.h I propose to convert those from DOS to Unix line endings to prevent similar issues in the future. See attached patch. While I was at it, I noticed some strange empty lines at EOF which make no sense to me. See second patch. You can use git diff -b to ignore whitespace changes. Cheers, Albert Regards, Volker Albert Astals Cid schrieb: poppler/SplashOutputDev.cc |3 test/perf-test.cc | 2559 ++--- 2 files changed, 1283 insertions(+), 1279 deletions(-) New commits: commit d3fe0661c6dc6050e14cd5cb4afa089b7d7d66b0 Author: Richard PALO rich...@netbsd.org Date: Sun Nov 30 22:46:22 2014 +0100 warning: _FILE_OFFSET_BITS redefined Bug #86870 diff --git a/test/perf-test.cc b/test/perf-test.cc index 04adec3..4fb15d9 100644 --- a/test/perf-test.cc +++ b/test/perf-test.cc @@ -1,1279 +1,1280 @@ -/* Copyright Krzysztof Kowalczyk 2006-2007 - Copyright Hib Eris h...@hiberis.nl 2008, 2013 - License: GPLv2 */ -/* - A tool to stress-test poppler rendering and measure rendering times for - very simplistic performance measuring. - - TODO: - * make it work with cairo output as well - * print more info about document like e.g. enumarate images, - streams, compression, encryption, password-protection. Each should have - a command-line arguments to turn it on/off - * never over-write file given as -out argument (optionally, provide -force - option to force writing the -out file). It's way too easy too lose results - of a previous run. -*/ - -#ifdef _MSC_VER -// this sucks but I don't know any other way -#pragma comment(linker,/manifestdependency:\type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='x86' publicKeyToken='6595b64144ccf1df' language='*'\) -#endif - -#ifdef _WIN32 -#include windows.h -#else -#include strings.h -#endif - -// Define COPY_FILE if you want the file to be copied to a local disk first -// before it's tested. This is desired if a file is on a slow drive. -// Currently copying only works on Windows. -// Not enabled by default. -//#define COPY_FILE 1 - -#include assert.h -#include config.h -#include stdio.h -#include stdarg.h -#include ctype.h -#include stdlib.h -#include string.h -#include errno.h -#include time.h - -#ifdef HAVE_DIRENT_H -#include dirent.h -#endif - -#include Error.h -#include ErrorCodes.h -#include goo/GooString.h -#include goo/GooList.h -#include goo/GooTimer.h -#include GlobalParams.h -#include splash/SplashBitmap.h -#include Object.h /* must be included before SplashOutputDev.h because of sloppiness in SplashOutputDev.h */ -#include SplashOutputDev.h -#include TextOutputDev.h -#include PDFDoc.h -#include Link.h - -#ifdef _MSC_VER -#define strdup _strdup -#define strcasecmp _stricmp -#endif - -#define dimof(X)(sizeof(X)/sizeof((X)[0])) - -#define INVALID_PAGE_NO -1 - -/* Those must be implemented in order to provide preview during execution. - They can be no-ops. An implementation for windows is in - perf-test-preview-win.cc -*/ -extern void PreviewBitmapInit(void); -extern void PreviewBitmapDestroy(void); -extern void PreviewBitmapSplash(SplashBitmap *bmpSplash); - -class PdfEnginePoppler { -public: -PdfEnginePoppler(); -~PdfEnginePoppler(); - -const char *fileName(void) const { return _fileName; }; - -void setFileName(const char *fileName) { -assert(!_fileName); -_fileName = (char*)strdup(fileName); -} - -int pageCount(void) const { return _pageCount; } - -bool load(const char *fileName); -SplashBitmap *renderBitmap(int pageNo, double zoomReal, int rotation); - -SplashOutputDev * outputDevice(); -private: -char * _fileName; -int _pageCount; - -PDFDoc *_pdfDoc; -SplashOutputDev * _outputDev; -}; - -typedef struct StrList { -struct StrList *next; -char * str; -} StrList; - -/* List of all command-line arguments that are not switches. - We assume those are: - - names of PDF files - - names of a file with a list of PDF files - - names of directories with PDF files -*/ -static StrList *gArgsListRoot = NULL; - -/* Names of all command-line switches we recognize
[poppler] 2 commits - poppler/SplashOutputDev.cc
poppler/SplashOutputDev.cc |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) New commits: commit c2453fc1307ebb222747f976e1311ecc5e99abfa Merge: 3bb8c2e 70298a0 Author: Albert Astals Cid aa...@kde.org Date: Tue Aug 20 19:53:17 2013 +0200 Merge remote-tracking branch 'origin/poppler-0.24' commit 70298a021657a72ae80389687a86247144e6d6b6 Author: Thomas Freitag thomas.frei...@alfa.de Date: Tue Aug 20 19:46:01 2013 +0200 Don't copy not needed bitmap Speeds up rendering of fixes from bug 67105 As example one file is down from 130s to 6.5s diff --git a/poppler/SplashOutputDev.cc b/poppler/SplashOutputDev.cc index d9ea990..8c69502 100644 --- a/poppler/SplashOutputDev.cc +++ b/poppler/SplashOutputDev.cc @@ -3802,7 +3802,7 @@ void SplashOutputDev::beginTransparencyGroup(GfxState *state, double *bbox, transpGroup-ty = ty; transpGroup-blendingColorSpace = blendingColorSpace; transpGroup-isolated = isolated; - transpGroup-shape = (knockout) ? SplashBitmap::copy(bitmap) : NULL; + transpGroup-shape = (knockout !isolated) ? SplashBitmap::copy(bitmap) : NULL; transpGroup-knockout = gFalse; transpGroup-knockoutOpacity = 1.0; transpGroup-next = transpGroupStack; ___ poppler mailing list poppler@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/poppler
[poppler] 2 commits - poppler/SplashOutputDev.cc
poppler/SplashOutputDev.cc | 30 +++--- 1 file changed, 19 insertions(+), 11 deletions(-) New commits: commit 3bb8c2e34039cf473bf72ed9dab55664deab3ab7 Merge: 71c1d16 fc78330 Author: Albert Astals Cid aa...@kde.org Date: Tue Aug 20 00:41:13 2013 +0200 Merge remote-tracking branch 'origin/poppler-0.24' commit fc78330072b9771fa39d21896703adb4836e5398 Author: Albert Astals Cid aa...@kde.org Date: Tue Aug 20 00:37:56 2013 +0200 use getRGBLine images if available Speeds up greatly files from bug #66928 E.g. some file went from 21s to 2s in my computer diff --git a/poppler/SplashOutputDev.cc b/poppler/SplashOutputDev.cc index 4d4e945..d9ea990 100644 --- a/poppler/SplashOutputDev.cc +++ b/poppler/SplashOutputDev.cc @@ -2862,20 +2862,28 @@ GBool SplashOutputDev::imageSrc(void *data, SplashColorPtr colorLine, break; case splashModeRGB8: case splashModeBGR8: - for (x = 0, q = colorLine; x imgData-width; ++x, p += nComps) { - imgData-colorMap-getRGB(p, rgb); - *q++ = colToByte(rgb.r); - *q++ = colToByte(rgb.g); - *q++ = colToByte(rgb.b); + if (imgData-colorMap-useRGBLine()) { + imgData-colorMap-getRGBLine(p, (Guchar *) colorLine, imgData-width); + } else { + for (x = 0, q = colorLine; x imgData-width; ++x, p += nComps) { + imgData-colorMap-getRGB(p, rgb); + *q++ = colToByte(rgb.r); + *q++ = colToByte(rgb.g); + *q++ = colToByte(rgb.b); + } } break; case splashModeXBGR8: - for (x = 0, q = colorLine; x imgData-width; ++x, p += nComps) { - imgData-colorMap-getRGB(p, rgb); - *q++ = colToByte(rgb.r); - *q++ = colToByte(rgb.g); - *q++ = colToByte(rgb.b); - *q++ = 255; + if (imgData-colorMap-useRGBLine()) { + imgData-colorMap-getRGBXLine(p, (Guchar *) colorLine, imgData-width); + } else { + for (x = 0, q = colorLine; x imgData-width; ++x, p += nComps) { + imgData-colorMap-getRGB(p, rgb); + *q++ = colToByte(rgb.r); + *q++ = colToByte(rgb.g); + *q++ = colToByte(rgb.b); + *q++ = 255; + } } break; #if SPLASH_CMYK ___ poppler mailing list poppler@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/poppler
[poppler] 2 commits - poppler/SplashOutputDev.cc
poppler/SplashOutputDev.cc |7 ++- 1 file changed, 6 insertions(+), 1 deletion(-) New commits: commit fd648e83e60db7157b7273ffddc02308b0c5813b Merge: 970e9f6 53b9cec Author: Albert Astals Cid aa...@kde.org Date: Sun Apr 21 23:30:16 2013 +0200 Merge remote-tracking branch 'origin/poppler-0.22' commit 53b9cec6c1334020f90b885cff6fc30293437e5f Author: Thomas Freitag thomas.frei...@alfa.de Date: Sun Apr 21 23:28:40 2013 +0200 Splash: Always consider a softmask transfer function Fixes bug 63587 in splash diff --git a/poppler/SplashOutputDev.cc b/poppler/SplashOutputDev.cc index 0426b18..6e62720 100644 --- a/poppler/SplashOutputDev.cc +++ b/poppler/SplashOutputDev.cc @@ -3975,7 +3975,12 @@ void SplashOutputDev::setSoftMask(GfxState *state, double *bbox, for (y = 0; y yMax; ++y) { for (x = 0; x xMax; ++x) { if (alpha) { - p[x] = tBitmap-getAlpha(x, y); + if (transferFunc) { + lum = tBitmap-getAlpha(x, y) / 255.0; + transferFunc-transform(lum, lum2); + p[x] = (int)(lum2 * 255.0 + 0.5); + } else + p[x] = tBitmap-getAlpha(x, y); } else { tBitmap-getPixel(x, y, color); // convert to luminosity ___ poppler mailing list poppler@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/poppler
[poppler] 2 commits - poppler/SplashOutputDev.cc
poppler/SplashOutputDev.cc | 12 +--- 1 file changed, 9 insertions(+), 3 deletions(-) New commits: commit 1f4a012f7570ffd2120e3e8c2236de5408f3dda3 Merge: 15d4039 a766740 Author: Albert Astals Cid aa...@kde.org Date: Fri Mar 1 19:16:52 2013 +0100 Merge remote-tracking branch 'origin/poppler-0.22' commit a766740cf5a5a7580935a026bf15fbd668aa0fdf Author: Thomas Freitag thomas.frei...@alfa.de Date: Fri Mar 1 19:12:22 2013 +0100 Restore CTM on early exits Bug #61413 diff --git a/poppler/SplashOutputDev.cc b/poppler/SplashOutputDev.cc index 6f2d4d6..0426b18 100644 --- a/poppler/SplashOutputDev.cc +++ b/poppler/SplashOutputDev.cc @@ -20,7 +20,7 @@ // Copyright (C) 2006 Scott Turner scotty1...@mac.com // Copyright (C) 2007 Koji Otani s...@bbr.jp // Copyright (C) 2009 Petr Gajdos pgaj...@novell.com -// Copyright (C) 2009-2012 Thomas Freitag thomas.frei...@alfa.de +// Copyright (C) 2009-2013 Thomas Freitag thomas.frei...@alfa.de // Copyright (C) 2009 Carlos Garcia Campos carlo...@gnome.org // Copyright (C) 2009 William Bader williamba...@hotmail.com // Copyright (C) 2010 Patrick Spendrin ps...@gmx.de @@ -4109,8 +4109,10 @@ GBool SplashOutputDev::tilingPatternFill(GfxState *state, Gfx *gfx1, Catalog *ca state-concatCTM(1, 0, 0, 1, bbox[0], bbox[1]); ctm = state-getCTM(); for (i = 0; i 6; ++i) { -if (!isfinite(ctm[i])) +if (!isfinite(ctm[i])) { + state-setCTM(savedCTM[0], savedCTM[1], savedCTM[2], savedCTM[3], savedCTM[4], savedCTM[5]); return gFalse; +} } matc[4] = x0 * xStep * ctm[0] + y0 * yStep * ctm[2] + ctm[4]; matc[5] = x0 * xStep * ctm[1] + y0 * yStep * ctm[3] + ctm[5]; @@ -4152,8 +4154,10 @@ GBool SplashOutputDev::tilingPatternFill(GfxState *state, Gfx *gfx1, Catalog *ca repeatX = x1 - x0; repeatY = y1 - y0; } else { -if ((unsigned long) result_width * result_height 0x80L) +if ((unsigned long) result_width * result_height 0x80L) { + state-setCTM(savedCTM[0], savedCTM[1], savedCTM[2], savedCTM[3], savedCTM[4], savedCTM[5]); return gFalse; +} while(fabs(kx) 16384 || fabs(ky) 16384) { // limit pattern bitmap size m1.m[0] /= 2; @@ -4184,8 +4188,10 @@ GBool SplashOutputDev::tilingPatternFill(GfxState *state, Gfx *gfx1, Catalog *ca matc[2] = ctm[2]; matc[3] = ctm[3]; - if (surface_width == 0 || surface_height == 0) + if (surface_width == 0 || surface_height == 0) { +state-setCTM(savedCTM[0], savedCTM[1], savedCTM[2], savedCTM[3], savedCTM[4], savedCTM[5]); return gFalse; + } m1.transform(bbox[0], bbox[1], kx, ky); m1.m[4] = -kx; m1.m[5] = -ky; ___ poppler mailing list poppler@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/poppler
[poppler] 2 commits - poppler/SplashOutputDev.cc poppler/TextOutputDev.cc
poppler/SplashOutputDev.cc |7 +-- poppler/TextOutputDev.cc |1 + 2 files changed, 6 insertions(+), 2 deletions(-) New commits: commit cb93d51ccb6b1f6938946ae5d38fb9817005fd7a Author: Albert Astals Cid aa...@kde.org Date: Wed Sep 12 00:12:07 2012 +0200 Make gcc happy It is stupid and can't see that we only use them when we init them and complains they might be used un-initialized diff --git a/poppler/TextOutputDev.cc b/poppler/TextOutputDev.cc index 1c1a348..452a5ac 100644 --- a/poppler/TextOutputDev.cc +++ b/poppler/TextOutputDev.cc @@ -277,6 +277,7 @@ void TextWord::addChar(GfxState *state, TextFontInfo *fontA, double x, double y, CharCode c, Unicode u) { GfxFont *gfxFont; double ascent, descent; + ascent = descent = 0; // make gcc happy if (len == size) { size += 16; commit 3349a8dd7e0469cc5b5aaa8dd929c6078183ef86 Author: Thomas Freitag thomas.frei...@alfa.de Date: Wed Sep 12 00:04:45 2012 +0200 Splash: Avoid bogus memory error for tilingPattern just return gFalse if the resulting tiling pattern bitmap reaches a memory limit and so the Gfx implemention of tiling patterns will be used. I think that this is an acceptable approach also concerning performance, because it would take also a while to paint such a huge bitmap and then draw it to splash. diff --git a/poppler/SplashOutputDev.cc b/poppler/SplashOutputDev.cc index 05e9dea..a915f68 100644 --- a/poppler/SplashOutputDev.cc +++ b/poppler/SplashOutputDev.cc @@ -4084,6 +4084,7 @@ GBool SplashOutputDev::tilingPatternFill(GfxState *state, Gfx *gfx1, Catalog *ca Matrix m1; double *ctm, savedCTM[6]; double kx, ky, sx, sy; + GBool retValue = gFalse; width = bbox[2] - bbox[0]; height = bbox[3] - bbox[1]; @@ -4143,6 +4144,8 @@ GBool SplashOutputDev::tilingPatternFill(GfxState *state, Gfx *gfx1, Catalog *ca repeatX = x1 - x0; repeatY = y1 - y0; } else { +if ((unsigned long) result_width * result_height 0x80L) + return gFalse; while(fabs(kx) 16384 || fabs(ky) 16384) { // limit pattern bitmap size m1.m[0] /= 2; @@ -4230,10 +4233,10 @@ GBool SplashOutputDev::tilingPatternFill(GfxState *state, Gfx *gfx1, Catalog *ca matc[1] = ctm[1]; matc[2] = ctm[2]; matc[3] = ctm[3]; - splash-drawImage(tilingBitmapSrc, imgData, colorMode, gTrue, result_width, result_height, matc, gTrue); + retValue = splash-drawImage(tilingBitmapSrc, imgData, colorMode, gTrue, result_width, result_height, matc, gTrue) == splashOk; delete tBitmap; delete gfx; - return gTrue; + return retValue; } GBool SplashOutputDev::gouraudTriangleShadedFill(GfxState *state, GfxGouraudTriangleShading *shading) ___ poppler mailing list poppler@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/poppler
[poppler] 2 commits - poppler/SplashOutputDev.cc splash/Splash.cc
poppler/SplashOutputDev.cc |2 +- splash/Splash.cc |5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) New commits: commit 0ca5453fea9e5342188f772acd6f31af1778f236 Author: Albert Astals Cid aa...@kde.org Date: Tue Aug 30 16:20:17 2011 +0200 Compile when defining USE_FIXEDPOINT diff --git a/splash/Splash.cc b/splash/Splash.cc index e5c8096..9deec10 100644 --- a/splash/Splash.cc +++ b/splash/Splash.cc @@ -32,6 +32,7 @@ #include string.h #include limits.h #include assert.h +#include math.h #include goo/gmem.h #include goo/GooLikely.h #include poppler/Error.h @@ -3370,8 +3371,8 @@ GBool Splash::gouraudTriangleShadedFill(SplashGouraudColor *shading) xdbl + 1, ydbl + 1, color + 1, xdbl + 2, ydbl + 2, color + 2); for (int m = 0; m 3; ++m) { -xt = xdbl[m] * userToCanvasMatrix[0] + ydbl[m] * userToCanvasMatrix[2] + userToCanvasMatrix[4]; -yt = xdbl[m] * userToCanvasMatrix[1] + ydbl[m] * userToCanvasMatrix[3] + userToCanvasMatrix[5]; +xt = xdbl[m] * (double)userToCanvasMatrix[0] + ydbl[m] * (double)userToCanvasMatrix[2] + (double)userToCanvasMatrix[4]; +yt = xdbl[m] * (double)userToCanvasMatrix[1] + ydbl[m] * (double)userToCanvasMatrix[3] + (double)userToCanvasMatrix[5]; xdbl[m] = xt; ydbl[m] = yt; // we operate on scanlines which are integer offsets into the commit bd7a53bc2f27fc3979f8de306e2dcaca53d4570a Author: Albert Astals Cid aa...@kde.org Date: Tue Aug 30 16:20:08 2011 +0200 match function definition diff --git a/poppler/SplashOutputDev.cc b/poppler/SplashOutputDev.cc index 96cb3c4..7bacdba 100644 --- a/poppler/SplashOutputDev.cc +++ b/poppler/SplashOutputDev.cc @@ -426,7 +426,7 @@ SplashRadialPattern::~SplashRadialPattern() { delete opPattern; } -GBool SplashRadialPattern::getParameter(double xs, double ys, SplashCoord *t) { +GBool SplashRadialPattern::getParameter(double xs, double ys, double *t) { double b, c, s0, s1; // We want to solve this system of equations: ___ poppler mailing list poppler@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/poppler
[poppler] 2 commits - poppler/SplashOutputDev.cc qt4/tests splash/SplashFontFile.cc splash/SplashFontFile.h splash/SplashFont.h splash/SplashFTFont.cc splash/SplashFTFont.h
poppler/SplashOutputDev.cc | 37 +++ qt4/tests/test-poppler-qt4.cpp |2 + splash/SplashFTFont.cc | 55 - splash/SplashFTFont.h |4 ++ splash/SplashFont.h|4 ++ splash/SplashFontFile.cc |1 splash/SplashFontFile.h|2 + 7 files changed, 104 insertions(+), 1 deletion(-) New commits: commit 4c738cc6bd51f9d9e23ba83949c490c5c8691345 Author: Albert Astals Cid [EMAIL PROTECTED] Date: Tue Jan 29 23:45:52 2008 +0100 Scale text to match 'm' size Fixes bug 12304 diff --git a/poppler/SplashOutputDev.cc b/poppler/SplashOutputDev.cc index c810dc7..5315bfc 100644 --- a/poppler/SplashOutputDev.cc +++ b/poppler/SplashOutputDev.cc @@ -965,6 +965,7 @@ void SplashOutputDev::doUpdateFont(GfxState *state) { SplashCoord mat[4]; int substIdx, n; int faceIndex = 0; + GBool recreateFont = gFalse; needFontUpdate = gFalse; font = NULL; @@ -1142,6 +1143,7 @@ void SplashOutputDev::doUpdateFont(GfxState *state) { // this shouldn't happen goto err2; } +fontFile-doAdjustMatrix = gTrue; } // get the font matrix @@ -1157,6 +1159,41 @@ void SplashOutputDev::doUpdateFont(GfxState *state) { mat[2] = m21; mat[3] = m22; font = fontEngine-getFont(fontFile, mat, splash-getMatrix()); + // for substituted fonts: adjust the font matrix -- compare the + // width of 'm' in the original font and the substituted font + if (fontFile-doAdjustMatrix !gfxFont-isCIDFont()) { +double w1, w2; +CharCode code; +char *name; +for (code = 0; code 256; ++code) { + if ((name = ((Gfx8BitFont *)gfxFont)-getCharName(code)) + name[0] == 'm' name[1] == '\0') { +break; + } +} +if (code 256) { + w1 = ((Gfx8BitFont *)gfxFont)-getWidth(code); + w2 = font-getGlyphAdvance(code); + if (!gfxFont-isSymbolic() w2 0) { +// if real font is substantially narrower than substituted +// font, reduce the font size accordingly +if (w1 0.01 w1 0.9 * w2) { + w1 /= w2; + m11 *= w1; + m21 *= w1; + recreateFont = gTrue; +} + } +} + } + + if (recreateFont) + { +mat[0] = m11; mat[1] = m12; +mat[2] = m21; mat[3] = m22; +font = fontEngine-getFont(fontFile, mat, splash-getMatrix()); + } + if (fontsrc !fontsrc-isFile) fontsrc-unref(); return; diff --git a/splash/SplashFTFont.cc b/splash/SplashFTFont.cc index 0241df0..28e48d7 100644 --- a/splash/SplashFTFont.cc +++ b/splash/SplashFTFont.cc @@ -42,7 +42,7 @@ SplashFTFont::SplashFTFont(SplashFTFontFile *fontFileA, SplashCoord *matA, SplashFont(fontFileA, matA, textMatA, fontFileA-engine-aa) { FT_Face face; - double size, div; + double div; int x, y; face = fontFileA-face; @@ -239,6 +239,59 @@ GBool SplashFTFont::makeGlyph(int c, int xFrac, int yFrac, return gTrue; } +double SplashFTFont::getGlyphAdvance(int c) +{ + SplashFTFontFile *ff; + FT_Vector offset; + FT_UInt gid; + FT_Matrix identityMatrix; + + ff = (SplashFTFontFile *)fontFile; + + // init the matrix + identityMatrix.xx = 65536; // 1 in 16.16 format + identityMatrix.xy = 0; + identityMatrix.yx = 0; + identityMatrix.yy = 65536; // 1 in 16.16 format + + // init the offset + offset.x = 0; + offset.y = 0; + + FT_Set_Transform(ff-face, identityMatrix, offset); + + if (ff-codeToGID c ff-codeToGIDLen) { +gid = (FT_UInt)ff-codeToGID[c]; + } else { +gid = (FT_UInt)c; + } + if (ff-trueType gid == 0) { +// skip the TrueType notdef glyph +return -1; + } + + // if we have the FT2 bytecode interpreter, autohinting won't be used +#ifdef TT_CONFIG_OPTION_BYTECODE_INTERPRETER + if (FT_Load_Glyph(ff-face, gid, + aa ? FT_LOAD_NO_BITMAP : FT_LOAD_DEFAULT)) { +return -1; + } +#else + // FT2's autohinting doesn't always work very well (especially with + // font subsets), so turn it off if anti-aliasing is enabled; if + // anti-aliasing is disabled, this seems to be a tossup - some fonts + // look better with hinting, some without, so leave hinting on + if (FT_Load_Glyph(ff-face, gid, + aa ? FT_LOAD_NO_HINTING | FT_LOAD_NO_BITMAP + : FT_LOAD_DEFAULT)) { +return -1; + } +#endif + + // 64.0 is 1 in 26.6 format + return ff-face-glyph-metrics.horiAdvance / 64.0 / size; +} + struct SplashFTFontPath { SplashPath *path; SplashCoord textScale; diff --git a/splash/SplashFTFont.h b/splash/SplashFTFont.h index 70c01d3..4e22026 100644 --- a/splash/SplashFTFont.h +++ b/splash/SplashFTFont.h @@ -43,12 +43,16 @@ public: // Return the path for a glyph. virtual SplashPath *getGlyphPath(int c); + // Return the advance of a glyph. (in 0..1 range) + virtual double getGlyphAdvance(int c); + private: FT_Size sizeObj; FT_Matrix matrix; FT_Matrix textMatrix; SplashCoord textScale;