diff options
author | Peter Breitenlohner <peb@mppmu.mpg.de> | 2013-12-13 07:15:20 +0000 |
---|---|---|
committer | Peter Breitenlohner <peb@mppmu.mpg.de> | 2013-12-13 07:15:20 +0000 |
commit | 4dae4c2de2d28a839e38ee72d2cd7a54ec143d02 (patch) | |
tree | 61b4af1da3c3f00678377c7ad278a86ff6165311 /Build/source/libs/poppler | |
parent | 811021c573d8737fa4dee8bf257dbf3d89de0b3e (diff) |
poppler 0.25.0
git-svn-id: svn://tug.org/texlive/trunk@32399 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/libs/poppler')
-rw-r--r-- | Build/source/libs/poppler/ChangeLog | 8 | ||||
-rw-r--r-- | Build/source/libs/poppler/Makefile.am | 3 | ||||
-rw-r--r-- | Build/source/libs/poppler/Makefile.in | 22 | ||||
-rwxr-xr-x | Build/source/libs/poppler/configure | 30 | ||||
-rw-r--r-- | Build/source/libs/poppler/poppler-0.25.0-PATCHES/ChangeLog (renamed from Build/source/libs/poppler/poppler-0.24.4-PATCHES/ChangeLog) | 7 | ||||
-rw-r--r-- | Build/source/libs/poppler/poppler-0.25.0-PATCHES/TL-Changes (renamed from Build/source/libs/poppler/poppler-0.24.4-PATCHES/TL-Changes) | 3 | ||||
-rw-r--r-- | Build/source/libs/poppler/poppler-0.25.0-PATCHES/patch-02-LLONG_MAX (renamed from Build/source/libs/poppler/poppler-0.24.4-PATCHES/patch-02-LLONG_MAX) | 8 | ||||
-rw-r--r-- | Build/source/libs/poppler/poppler-0.25.0/AUTHORS (renamed from Build/source/libs/poppler/poppler-0.24.4/AUTHORS) | 0 | ||||
-rw-r--r-- | Build/source/libs/poppler/poppler-0.25.0/CMakeLists.txt (renamed from Build/source/libs/poppler/poppler-0.24.4/CMakeLists.txt) | 13 | ||||
-rw-r--r-- | Build/source/libs/poppler/poppler-0.25.0/COPYING (renamed from Build/source/libs/poppler/poppler-0.24.4/COPYING) | 0 | ||||
-rw-r--r-- | Build/source/libs/poppler/poppler-0.25.0/ChangeLog (renamed from Build/source/libs/poppler/poppler-0.24.4/ChangeLog) | 1949 | ||||
-rw-r--r-- | Build/source/libs/poppler/poppler-0.25.0/ConfigureChecks.cmake (renamed from Build/source/libs/poppler/poppler-0.24.4/ConfigureChecks.cmake) | 0 | ||||
-rw-r--r-- | Build/source/libs/poppler/poppler-0.25.0/INSTALL (renamed from Build/source/libs/poppler/poppler-0.24.4/INSTALL) | 0 | ||||
-rw-r--r-- | Build/source/libs/poppler/poppler-0.25.0/Makefile.am (renamed from Build/source/libs/poppler/poppler-0.24.4/Makefile.am) | 0 | ||||
-rw-r--r-- | Build/source/libs/poppler/poppler-0.25.0/NEWS (renamed from Build/source/libs/poppler/poppler-0.24.4/NEWS) | 23 | ||||
-rw-r--r-- | Build/source/libs/poppler/poppler-0.25.0/README (renamed from Build/source/libs/poppler/poppler-0.24.4/README) | 0 | ||||
-rw-r--r-- | Build/source/libs/poppler/poppler-0.25.0/README-XPDF (renamed from Build/source/libs/poppler/poppler-0.24.4/README-XPDF) | 0 | ||||
-rw-r--r-- | Build/source/libs/poppler/poppler-0.25.0/TODO (renamed from Build/source/libs/poppler/poppler-0.24.4/TODO) | 0 | ||||
-rw-r--r-- | Build/source/libs/poppler/poppler-0.25.0/config.h.cmake (renamed from Build/source/libs/poppler/poppler-0.24.4/config.h.cmake) | 0 | ||||
-rw-r--r-- | Build/source/libs/poppler/poppler-0.25.0/config.h.in (renamed from Build/source/libs/poppler/poppler-0.24.4/config.h.in) | 0 | ||||
-rw-r--r-- | Build/source/libs/poppler/poppler-0.25.0/configure.ac (renamed from Build/source/libs/poppler/poppler-0.24.4/configure.ac) | 4 | ||||
-rw-r--r-- | Build/source/libs/poppler/poppler-0.25.0/fofi/FoFiBase.cc (renamed from Build/source/libs/poppler/poppler-0.24.4/fofi/FoFiBase.cc) | 0 | ||||
-rw-r--r-- | Build/source/libs/poppler/poppler-0.25.0/fofi/FoFiBase.h (renamed from Build/source/libs/poppler/poppler-0.24.4/fofi/FoFiBase.h) | 0 | ||||
-rw-r--r-- | Build/source/libs/poppler/poppler-0.25.0/fofi/FoFiEncodings.cc (renamed from Build/source/libs/poppler/poppler-0.24.4/fofi/FoFiEncodings.cc) | 0 | ||||
-rw-r--r-- | Build/source/libs/poppler/poppler-0.25.0/fofi/FoFiEncodings.h (renamed from Build/source/libs/poppler/poppler-0.24.4/fofi/FoFiEncodings.h) | 0 | ||||
-rw-r--r-- | Build/source/libs/poppler/poppler-0.25.0/fofi/FoFiIdentifier.cc (renamed from Build/source/libs/poppler/poppler-0.24.4/fofi/FoFiIdentifier.cc) | 0 | ||||
-rw-r--r-- | Build/source/libs/poppler/poppler-0.25.0/fofi/FoFiIdentifier.h (renamed from Build/source/libs/poppler/poppler-0.24.4/fofi/FoFiIdentifier.h) | 0 | ||||
-rw-r--r-- | Build/source/libs/poppler/poppler-0.25.0/fofi/FoFiTrueType.cc (renamed from Build/source/libs/poppler/poppler-0.24.4/fofi/FoFiTrueType.cc) | 0 | ||||
-rw-r--r-- | Build/source/libs/poppler/poppler-0.25.0/fofi/FoFiTrueType.h (renamed from Build/source/libs/poppler/poppler-0.24.4/fofi/FoFiTrueType.h) | 0 | ||||
-rw-r--r-- | Build/source/libs/poppler/poppler-0.25.0/fofi/FoFiType1.cc (renamed from Build/source/libs/poppler/poppler-0.24.4/fofi/FoFiType1.cc) | 0 | ||||
-rw-r--r-- | Build/source/libs/poppler/poppler-0.25.0/fofi/FoFiType1.h (renamed from Build/source/libs/poppler/poppler-0.24.4/fofi/FoFiType1.h) | 0 | ||||
-rw-r--r-- | Build/source/libs/poppler/poppler-0.25.0/fofi/FoFiType1C.cc (renamed from Build/source/libs/poppler/poppler-0.24.4/fofi/FoFiType1C.cc) | 0 | ||||
-rw-r--r-- | Build/source/libs/poppler/poppler-0.25.0/fofi/FoFiType1C.h (renamed from Build/source/libs/poppler/poppler-0.24.4/fofi/FoFiType1C.h) | 0 | ||||
-rw-r--r-- | Build/source/libs/poppler/poppler-0.25.0/fofi/Makefile.am (renamed from Build/source/libs/poppler/poppler-0.24.4/fofi/Makefile.am) | 0 | ||||
-rw-r--r-- | Build/source/libs/poppler/poppler-0.25.0/goo/FixedPoint.cc (renamed from Build/source/libs/poppler/poppler-0.24.4/goo/FixedPoint.cc) | 0 | ||||
-rw-r--r-- | Build/source/libs/poppler/poppler-0.25.0/goo/FixedPoint.h (renamed from Build/source/libs/poppler/poppler-0.24.4/goo/FixedPoint.h) | 0 | ||||
-rw-r--r-- | Build/source/libs/poppler/poppler-0.25.0/goo/GooHash.cc (renamed from Build/source/libs/poppler/poppler-0.24.4/goo/GooHash.cc) | 0 | ||||
-rw-r--r-- | Build/source/libs/poppler/poppler-0.25.0/goo/GooHash.h (renamed from Build/source/libs/poppler/poppler-0.24.4/goo/GooHash.h) | 0 | ||||
-rw-r--r-- | Build/source/libs/poppler/poppler-0.25.0/goo/GooLikely.h (renamed from Build/source/libs/poppler/poppler-0.24.4/goo/GooLikely.h) | 0 | ||||
-rw-r--r-- | Build/source/libs/poppler/poppler-0.25.0/goo/GooList.cc (renamed from Build/source/libs/poppler/poppler-0.24.4/goo/GooList.cc) | 0 | ||||
-rw-r--r-- | Build/source/libs/poppler/poppler-0.25.0/goo/GooList.h (renamed from Build/source/libs/poppler/poppler-0.24.4/goo/GooList.h) | 0 | ||||
-rw-r--r-- | Build/source/libs/poppler/poppler-0.25.0/goo/GooMutex.h (renamed from Build/source/libs/poppler/poppler-0.24.4/goo/GooMutex.h) | 0 | ||||
-rw-r--r-- | Build/source/libs/poppler/poppler-0.25.0/goo/GooString.cc (renamed from Build/source/libs/poppler/poppler-0.24.4/goo/GooString.cc) | 10 | ||||
-rw-r--r-- | Build/source/libs/poppler/poppler-0.25.0/goo/GooString.h (renamed from Build/source/libs/poppler/poppler-0.24.4/goo/GooString.h) | 4 | ||||
-rw-r--r-- | Build/source/libs/poppler/poppler-0.25.0/goo/GooTimer.cc (renamed from Build/source/libs/poppler/poppler-0.24.4/goo/GooTimer.cc) | 0 | ||||
-rw-r--r-- | Build/source/libs/poppler/poppler-0.25.0/goo/GooTimer.h (renamed from Build/source/libs/poppler/poppler-0.24.4/goo/GooTimer.h) | 0 | ||||
-rw-r--r-- | Build/source/libs/poppler/poppler-0.25.0/goo/ImgWriter.cc (renamed from Build/source/libs/poppler/poppler-0.24.4/goo/ImgWriter.cc) | 0 | ||||
-rw-r--r-- | Build/source/libs/poppler/poppler-0.25.0/goo/ImgWriter.h (renamed from Build/source/libs/poppler/poppler-0.24.4/goo/ImgWriter.h) | 0 | ||||
-rw-r--r-- | Build/source/libs/poppler/poppler-0.25.0/goo/JpegWriter.cc (renamed from Build/source/libs/poppler/poppler-0.24.4/goo/JpegWriter.cc) | 0 | ||||
-rw-r--r-- | Build/source/libs/poppler/poppler-0.25.0/goo/JpegWriter.h (renamed from Build/source/libs/poppler/poppler-0.24.4/goo/JpegWriter.h) | 0 | ||||
-rw-r--r-- | Build/source/libs/poppler/poppler-0.25.0/goo/Makefile.am (renamed from Build/source/libs/poppler/poppler-0.24.4/goo/Makefile.am) | 2 | ||||
-rw-r--r-- | Build/source/libs/poppler/poppler-0.25.0/goo/NetPBMWriter.cc | 84 | ||||
-rw-r--r-- | Build/source/libs/poppler/poppler-0.25.0/goo/NetPBMWriter.h | 52 | ||||
-rw-r--r-- | Build/source/libs/poppler/poppler-0.25.0/goo/PNGWriter.cc (renamed from Build/source/libs/poppler/poppler-0.24.4/goo/PNGWriter.cc) | 6 | ||||
-rw-r--r-- | Build/source/libs/poppler/poppler-0.25.0/goo/PNGWriter.h (renamed from Build/source/libs/poppler/poppler-0.24.4/goo/PNGWriter.h) | 8 | ||||
-rw-r--r-- | Build/source/libs/poppler/poppler-0.25.0/goo/TiffWriter.cc (renamed from Build/source/libs/poppler/poppler-0.24.4/goo/TiffWriter.cc) | 0 | ||||
-rw-r--r-- | Build/source/libs/poppler/poppler-0.25.0/goo/TiffWriter.h (renamed from Build/source/libs/poppler/poppler-0.24.4/goo/TiffWriter.h) | 0 | ||||
-rw-r--r-- | Build/source/libs/poppler/poppler-0.25.0/goo/gfile.cc (renamed from Build/source/libs/poppler/poppler-0.24.4/goo/gfile.cc) | 0 | ||||
-rw-r--r-- | Build/source/libs/poppler/poppler-0.25.0/goo/gfile.h (renamed from Build/source/libs/poppler/poppler-0.24.4/goo/gfile.h) | 0 | ||||
-rw-r--r-- | Build/source/libs/poppler/poppler-0.25.0/goo/gmem.cc (renamed from Build/source/libs/poppler/poppler-0.24.4/goo/gmem.cc) | 0 | ||||
-rw-r--r-- | Build/source/libs/poppler/poppler-0.25.0/goo/gmem.h (renamed from Build/source/libs/poppler/poppler-0.24.4/goo/gmem.h) | 0 | ||||
-rw-r--r-- | Build/source/libs/poppler/poppler-0.25.0/goo/gmempp.cc (renamed from Build/source/libs/poppler/poppler-0.24.4/goo/gmempp.cc) | 0 | ||||
-rw-r--r-- | Build/source/libs/poppler/poppler-0.25.0/goo/grandom.cc (renamed from Build/source/libs/poppler/poppler-0.24.4/goo/grandom.cc) | 0 | ||||
-rw-r--r-- | Build/source/libs/poppler/poppler-0.25.0/goo/grandom.h (renamed from Build/source/libs/poppler/poppler-0.24.4/goo/grandom.h) | 0 | ||||
-rw-r--r-- | Build/source/libs/poppler/poppler-0.25.0/goo/gstrtod.cc (renamed from Build/source/libs/poppler/poppler-0.24.4/goo/gstrtod.cc) | 0 | ||||
-rw-r--r-- | Build/source/libs/poppler/poppler-0.25.0/goo/gstrtod.h (renamed from Build/source/libs/poppler/poppler-0.24.4/goo/gstrtod.h) | 0 | ||||
-rw-r--r-- | Build/source/libs/poppler/poppler-0.25.0/goo/gtypes.h (renamed from Build/source/libs/poppler/poppler-0.24.4/goo/gtypes.h) | 0 | ||||
-rw-r--r-- | Build/source/libs/poppler/poppler-0.25.0/goo/gtypes_p.h (renamed from Build/source/libs/poppler/poppler-0.24.4/goo/gtypes_p.h) | 0 | ||||
-rw-r--r-- | Build/source/libs/poppler/poppler-0.25.0/gtk-doc.make (renamed from Build/source/libs/poppler/poppler-0.24.4/gtk-doc.make) | 0 | ||||
-rw-r--r-- | Build/source/libs/poppler/poppler-0.25.0/poppler-cairo-uninstalled.pc.in (renamed from Build/source/libs/poppler/poppler-0.24.4/poppler-cairo-uninstalled.pc.in) | 0 | ||||
-rw-r--r-- | Build/source/libs/poppler/poppler-0.25.0/poppler-cairo.pc.cmake (renamed from Build/source/libs/poppler/poppler-0.24.4/poppler-cairo.pc.cmake) | 0 | ||||
-rw-r--r-- | Build/source/libs/poppler/poppler-0.25.0/poppler-cairo.pc.in (renamed from Build/source/libs/poppler/poppler-0.24.4/poppler-cairo.pc.in) | 0 | ||||
-rw-r--r-- | Build/source/libs/poppler/poppler-0.25.0/poppler-cpp-uninstalled.pc.in (renamed from Build/source/libs/poppler/poppler-0.24.4/poppler-cpp-uninstalled.pc.in) | 0 | ||||
-rw-r--r-- | Build/source/libs/poppler/poppler-0.25.0/poppler-cpp.pc.cmake (renamed from Build/source/libs/poppler/poppler-0.24.4/poppler-cpp.pc.cmake) | 0 | ||||
-rw-r--r-- | Build/source/libs/poppler/poppler-0.25.0/poppler-cpp.pc.in (renamed from Build/source/libs/poppler/poppler-0.24.4/poppler-cpp.pc.in) | 0 | ||||
-rw-r--r-- | Build/source/libs/poppler/poppler-0.25.0/poppler-glib-uninstalled.pc.in (renamed from Build/source/libs/poppler/poppler-0.24.4/poppler-glib-uninstalled.pc.in) | 0 | ||||
-rw-r--r-- | Build/source/libs/poppler/poppler-0.25.0/poppler-glib.pc.cmake (renamed from Build/source/libs/poppler/poppler-0.24.4/poppler-glib.pc.cmake) | 0 | ||||
-rw-r--r-- | Build/source/libs/poppler/poppler-0.25.0/poppler-glib.pc.in (renamed from Build/source/libs/poppler/poppler-0.24.4/poppler-glib.pc.in) | 0 | ||||
-rw-r--r-- | Build/source/libs/poppler/poppler-0.25.0/poppler-qt4-uninstalled.pc.in (renamed from Build/source/libs/poppler/poppler-0.24.4/poppler-qt4-uninstalled.pc.in) | 0 | ||||
-rw-r--r-- | Build/source/libs/poppler/poppler-0.25.0/poppler-qt4.pc.cmake (renamed from Build/source/libs/poppler/poppler-0.24.4/poppler-qt4.pc.cmake) | 0 | ||||
-rw-r--r-- | Build/source/libs/poppler/poppler-0.25.0/poppler-qt4.pc.in (renamed from Build/source/libs/poppler/poppler-0.24.4/poppler-qt4.pc.in) | 0 | ||||
-rw-r--r-- | Build/source/libs/poppler/poppler-0.25.0/poppler-qt5-uninstalled.pc.in (renamed from Build/source/libs/poppler/poppler-0.24.4/poppler-qt5-uninstalled.pc.in) | 0 | ||||
-rw-r--r-- | Build/source/libs/poppler/poppler-0.25.0/poppler-qt5.pc.cmake (renamed from Build/source/libs/poppler/poppler-0.24.4/poppler-qt5.pc.cmake) | 0 | ||||
-rw-r--r-- | Build/source/libs/poppler/poppler-0.25.0/poppler-qt5.pc.in (renamed from Build/source/libs/poppler/poppler-0.24.4/poppler-qt5.pc.in) | 0 | ||||
-rw-r--r-- | Build/source/libs/poppler/poppler-0.25.0/poppler-splash-uninstalled.pc.in (renamed from Build/source/libs/poppler/poppler-0.24.4/poppler-splash-uninstalled.pc.in) | 0 | ||||
-rw-r--r-- | Build/source/libs/poppler/poppler-0.25.0/poppler-splash.pc.cmake (renamed from Build/source/libs/poppler/poppler-0.24.4/poppler-splash.pc.cmake) | 0 | ||||
-rw-r--r-- | Build/source/libs/poppler/poppler-0.25.0/poppler-splash.pc.in (renamed from Build/source/libs/poppler/poppler-0.24.4/poppler-splash.pc.in) | 0 | ||||
-rw-r--r-- | Build/source/libs/poppler/poppler-0.25.0/poppler-uninstalled.pc.in (renamed from Build/source/libs/poppler/poppler-0.24.4/poppler-uninstalled.pc.in) | 0 | ||||
-rw-r--r-- | Build/source/libs/poppler/poppler-0.25.0/poppler.pc.cmake (renamed from Build/source/libs/poppler/poppler-0.24.4/poppler.pc.cmake) | 0 | ||||
-rw-r--r-- | Build/source/libs/poppler/poppler-0.25.0/poppler.pc.in (renamed from Build/source/libs/poppler/poppler-0.24.4/poppler.pc.in) | 0 | ||||
-rw-r--r-- | Build/source/libs/poppler/poppler-0.25.0/poppler/Annot.cc (renamed from Build/source/libs/poppler/poppler-0.24.4/poppler/Annot.cc) | 397 | ||||
-rw-r--r-- | Build/source/libs/poppler/poppler-0.25.0/poppler/Annot.h (renamed from Build/source/libs/poppler/poppler-0.24.4/poppler/Annot.h) | 32 | ||||
-rw-r--r-- | Build/source/libs/poppler/poppler-0.25.0/poppler/Array.cc (renamed from Build/source/libs/poppler/poppler-0.24.4/poppler/Array.cc) | 0 | ||||
-rw-r--r-- | Build/source/libs/poppler/poppler-0.25.0/poppler/Array.h (renamed from Build/source/libs/poppler/poppler-0.24.4/poppler/Array.h) | 0 | ||||
-rw-r--r-- | Build/source/libs/poppler/poppler-0.25.0/poppler/BuiltinFont.cc (renamed from Build/source/libs/poppler/poppler-0.24.4/poppler/BuiltinFont.cc) | 0 | ||||
-rw-r--r-- | Build/source/libs/poppler/poppler-0.25.0/poppler/BuiltinFont.h (renamed from Build/source/libs/poppler/poppler-0.24.4/poppler/BuiltinFont.h) | 0 | ||||
-rw-r--r-- | Build/source/libs/poppler/poppler-0.25.0/poppler/BuiltinFontTables.cc (renamed from Build/source/libs/poppler/poppler-0.24.4/poppler/BuiltinFontTables.cc) | 0 | ||||
-rw-r--r-- | Build/source/libs/poppler/poppler-0.25.0/poppler/BuiltinFontTables.h (renamed from Build/source/libs/poppler/poppler-0.24.4/poppler/BuiltinFontTables.h) | 0 | ||||
-rw-r--r-- | Build/source/libs/poppler/poppler-0.25.0/poppler/CMap.cc (renamed from Build/source/libs/poppler/poppler-0.24.4/poppler/CMap.cc) | 0 | ||||
-rw-r--r-- | Build/source/libs/poppler/poppler-0.25.0/poppler/CMap.h (renamed from Build/source/libs/poppler/poppler-0.24.4/poppler/CMap.h) | 0 | ||||
-rw-r--r-- | Build/source/libs/poppler/poppler-0.25.0/poppler/CachedFile.cc (renamed from Build/source/libs/poppler/poppler-0.24.4/poppler/CachedFile.cc) | 0 | ||||
-rw-r--r-- | Build/source/libs/poppler/poppler-0.25.0/poppler/CachedFile.h (renamed from Build/source/libs/poppler/poppler-0.24.4/poppler/CachedFile.h) | 0 | ||||
-rw-r--r-- | Build/source/libs/poppler/poppler-0.25.0/poppler/CairoFontEngine.cc (renamed from Build/source/libs/poppler/poppler-0.24.4/poppler/CairoFontEngine.cc) | 0 | ||||
-rw-r--r-- | Build/source/libs/poppler/poppler-0.25.0/poppler/CairoFontEngine.h (renamed from Build/source/libs/poppler/poppler-0.24.4/poppler/CairoFontEngine.h) | 0 | ||||
-rw-r--r-- | Build/source/libs/poppler/poppler-0.25.0/poppler/CairoOutputDev.cc (renamed from Build/source/libs/poppler/poppler-0.24.4/poppler/CairoOutputDev.cc) | 0 | ||||
-rw-r--r-- | Build/source/libs/poppler/poppler-0.25.0/poppler/CairoOutputDev.h (renamed from Build/source/libs/poppler/poppler-0.24.4/poppler/CairoOutputDev.h) | 0 | ||||
-rw-r--r-- | Build/source/libs/poppler/poppler-0.25.0/poppler/CairoRescaleBox.cc (renamed from Build/source/libs/poppler/poppler-0.24.4/poppler/CairoRescaleBox.cc) | 0 | ||||
-rw-r--r-- | Build/source/libs/poppler/poppler-0.25.0/poppler/CairoRescaleBox.h (renamed from Build/source/libs/poppler/poppler-0.24.4/poppler/CairoRescaleBox.h) | 0 | ||||
-rw-r--r-- | Build/source/libs/poppler/poppler-0.25.0/poppler/Catalog.cc (renamed from Build/source/libs/poppler/poppler-0.24.4/poppler/Catalog.cc) | 107 | ||||
-rw-r--r-- | Build/source/libs/poppler/poppler-0.25.0/poppler/Catalog.h (renamed from Build/source/libs/poppler/poppler-0.24.4/poppler/Catalog.h) | 30 | ||||
-rw-r--r-- | Build/source/libs/poppler/poppler-0.25.0/poppler/CharCodeToUnicode.cc (renamed from Build/source/libs/poppler/poppler-0.24.4/poppler/CharCodeToUnicode.cc) | 0 | ||||
-rw-r--r-- | Build/source/libs/poppler/poppler-0.25.0/poppler/CharCodeToUnicode.h (renamed from Build/source/libs/poppler/poppler-0.24.4/poppler/CharCodeToUnicode.h) | 0 | ||||
-rw-r--r-- | Build/source/libs/poppler/poppler-0.25.0/poppler/CharTypes.h (renamed from Build/source/libs/poppler/poppler-0.24.4/poppler/CharTypes.h) | 0 | ||||
-rw-r--r-- | Build/source/libs/poppler/poppler-0.25.0/poppler/CompactFontTables.h (renamed from Build/source/libs/poppler/poppler-0.24.4/poppler/CompactFontTables.h) | 0 | ||||
-rw-r--r-- | Build/source/libs/poppler/poppler-0.25.0/poppler/CurlCachedFile.cc (renamed from Build/source/libs/poppler/poppler-0.24.4/poppler/CurlCachedFile.cc) | 0 | ||||
-rw-r--r-- | Build/source/libs/poppler/poppler-0.25.0/poppler/CurlCachedFile.h (renamed from Build/source/libs/poppler/poppler-0.24.4/poppler/CurlCachedFile.h) | 0 | ||||
-rw-r--r-- | Build/source/libs/poppler/poppler-0.25.0/poppler/CurlPDFDocBuilder.cc (renamed from Build/source/libs/poppler/poppler-0.24.4/poppler/CurlPDFDocBuilder.cc) | 0 | ||||
-rw-r--r-- | Build/source/libs/poppler/poppler-0.25.0/poppler/CurlPDFDocBuilder.h (renamed from Build/source/libs/poppler/poppler-0.24.4/poppler/CurlPDFDocBuilder.h) | 0 | ||||
-rw-r--r-- | Build/source/libs/poppler/poppler-0.25.0/poppler/DCTStream.cc (renamed from Build/source/libs/poppler/poppler-0.24.4/poppler/DCTStream.cc) | 0 | ||||
-rw-r--r-- | Build/source/libs/poppler/poppler-0.25.0/poppler/DCTStream.h (renamed from Build/source/libs/poppler/poppler-0.24.4/poppler/DCTStream.h) | 0 | ||||
-rw-r--r-- | Build/source/libs/poppler/poppler-0.25.0/poppler/DateInfo.cc (renamed from Build/source/libs/poppler/poppler-0.24.4/poppler/DateInfo.cc) | 0 | ||||
-rw-r--r-- | Build/source/libs/poppler/poppler-0.25.0/poppler/DateInfo.h (renamed from Build/source/libs/poppler/poppler-0.24.4/poppler/DateInfo.h) | 0 | ||||
-rw-r--r-- | Build/source/libs/poppler/poppler-0.25.0/poppler/Decrypt.cc (renamed from Build/source/libs/poppler/poppler-0.24.4/poppler/Decrypt.cc) | 0 | ||||
-rw-r--r-- | Build/source/libs/poppler/poppler-0.25.0/poppler/Decrypt.h (renamed from Build/source/libs/poppler/poppler-0.24.4/poppler/Decrypt.h) | 0 | ||||
-rw-r--r-- | Build/source/libs/poppler/poppler-0.25.0/poppler/Dict.cc (renamed from Build/source/libs/poppler/poppler-0.24.4/poppler/Dict.cc) | 0 | ||||
-rw-r--r-- | Build/source/libs/poppler/poppler-0.25.0/poppler/Dict.h (renamed from Build/source/libs/poppler/poppler-0.24.4/poppler/Dict.h) | 0 | ||||
-rw-r--r-- | Build/source/libs/poppler/poppler-0.25.0/poppler/Error.cc (renamed from Build/source/libs/poppler/poppler-0.24.4/poppler/Error.cc) | 0 | ||||
-rw-r--r-- | Build/source/libs/poppler/poppler-0.25.0/poppler/Error.h (renamed from Build/source/libs/poppler/poppler-0.24.4/poppler/Error.h) | 0 | ||||
-rw-r--r-- | Build/source/libs/poppler/poppler-0.25.0/poppler/ErrorCodes.h (renamed from Build/source/libs/poppler/poppler-0.24.4/poppler/ErrorCodes.h) | 0 | ||||
-rw-r--r-- | Build/source/libs/poppler/poppler-0.25.0/poppler/FileSpec.cc (renamed from Build/source/libs/poppler/poppler-0.24.4/poppler/FileSpec.cc) | 0 | ||||
-rw-r--r-- | Build/source/libs/poppler/poppler-0.25.0/poppler/FileSpec.h (renamed from Build/source/libs/poppler/poppler-0.24.4/poppler/FileSpec.h) | 0 | ||||
-rw-r--r-- | Build/source/libs/poppler/poppler-0.25.0/poppler/FlateStream.cc (renamed from Build/source/libs/poppler/poppler-0.24.4/poppler/FlateStream.cc) | 0 | ||||
-rw-r--r-- | Build/source/libs/poppler/poppler-0.25.0/poppler/FlateStream.h (renamed from Build/source/libs/poppler/poppler-0.24.4/poppler/FlateStream.h) | 0 | ||||
-rw-r--r-- | Build/source/libs/poppler/poppler-0.25.0/poppler/FontEncodingTables.cc (renamed from Build/source/libs/poppler/poppler-0.24.4/poppler/FontEncodingTables.cc) | 0 | ||||
-rw-r--r-- | Build/source/libs/poppler/poppler-0.25.0/poppler/FontEncodingTables.h (renamed from Build/source/libs/poppler/poppler-0.24.4/poppler/FontEncodingTables.h) | 0 | ||||
-rw-r--r-- | Build/source/libs/poppler/poppler-0.25.0/poppler/FontInfo.cc (renamed from Build/source/libs/poppler/poppler-0.24.4/poppler/FontInfo.cc) | 0 | ||||
-rw-r--r-- | Build/source/libs/poppler/poppler-0.25.0/poppler/FontInfo.h (renamed from Build/source/libs/poppler/poppler-0.24.4/poppler/FontInfo.h) | 0 | ||||
-rw-r--r-- | Build/source/libs/poppler/poppler-0.25.0/poppler/Form.cc (renamed from Build/source/libs/poppler/poppler-0.24.4/poppler/Form.cc) | 6 | ||||
-rw-r--r-- | Build/source/libs/poppler/poppler-0.25.0/poppler/Form.h (renamed from Build/source/libs/poppler/poppler-0.24.4/poppler/Form.h) | 3 | ||||
-rw-r--r-- | Build/source/libs/poppler/poppler-0.25.0/poppler/Function.cc (renamed from Build/source/libs/poppler/poppler-0.24.4/poppler/Function.cc) | 0 | ||||
-rw-r--r-- | Build/source/libs/poppler/poppler-0.25.0/poppler/Function.h (renamed from Build/source/libs/poppler/poppler-0.24.4/poppler/Function.h) | 0 | ||||
-rw-r--r-- | Build/source/libs/poppler/poppler-0.25.0/poppler/Gfx.cc (renamed from Build/source/libs/poppler/poppler-0.24.4/poppler/Gfx.cc) | 114 | ||||
-rw-r--r-- | Build/source/libs/poppler/poppler-0.25.0/poppler/Gfx.h (renamed from Build/source/libs/poppler/poppler-0.24.4/poppler/Gfx.h) | 8 | ||||
-rw-r--r-- | Build/source/libs/poppler/poppler-0.25.0/poppler/GfxFont.cc (renamed from Build/source/libs/poppler/poppler-0.24.4/poppler/GfxFont.cc) | 15 | ||||
-rw-r--r-- | Build/source/libs/poppler/poppler-0.25.0/poppler/GfxFont.h (renamed from Build/source/libs/poppler/poppler-0.24.4/poppler/GfxFont.h) | 0 | ||||
-rw-r--r-- | Build/source/libs/poppler/poppler-0.25.0/poppler/GfxState.cc (renamed from Build/source/libs/poppler/poppler-0.24.4/poppler/GfxState.cc) | 841 | ||||
-rw-r--r-- | Build/source/libs/poppler/poppler-0.25.0/poppler/GfxState.h (renamed from Build/source/libs/poppler/poppler-0.24.4/poppler/GfxState.h) | 106 | ||||
-rw-r--r-- | Build/source/libs/poppler/poppler-0.25.0/poppler/GfxState_helpers.h (renamed from Build/source/libs/poppler/poppler-0.24.4/poppler/GfxState_helpers.h) | 0 | ||||
-rw-r--r-- | Build/source/libs/poppler/poppler-0.25.0/poppler/GlobalParams.cc (renamed from Build/source/libs/poppler/poppler-0.24.4/poppler/GlobalParams.cc) | 33 | ||||
-rw-r--r-- | Build/source/libs/poppler/poppler-0.25.0/poppler/GlobalParams.h (renamed from Build/source/libs/poppler/poppler-0.24.4/poppler/GlobalParams.h) | 16 | ||||
-rw-r--r-- | Build/source/libs/poppler/poppler-0.25.0/poppler/GlobalParamsWin.cc (renamed from Build/source/libs/poppler/poppler-0.24.4/poppler/GlobalParamsWin.cc) | 0 | ||||
-rw-r--r-- | Build/source/libs/poppler/poppler-0.25.0/poppler/Hints.cc (renamed from Build/source/libs/poppler/poppler-0.24.4/poppler/Hints.cc) | 0 | ||||
-rw-r--r-- | Build/source/libs/poppler/poppler-0.25.0/poppler/Hints.h (renamed from Build/source/libs/poppler/poppler-0.24.4/poppler/Hints.h) | 3 | ||||
-rw-r--r-- | Build/source/libs/poppler/poppler-0.25.0/poppler/JArithmeticDecoder.cc (renamed from Build/source/libs/poppler/poppler-0.24.4/poppler/JArithmeticDecoder.cc) | 0 | ||||
-rw-r--r-- | Build/source/libs/poppler/poppler-0.25.0/poppler/JArithmeticDecoder.h (renamed from Build/source/libs/poppler/poppler-0.24.4/poppler/JArithmeticDecoder.h) | 0 | ||||
-rw-r--r-- | Build/source/libs/poppler/poppler-0.25.0/poppler/JBIG2Stream.cc (renamed from Build/source/libs/poppler/poppler-0.24.4/poppler/JBIG2Stream.cc) | 2 | ||||
-rw-r--r-- | Build/source/libs/poppler/poppler-0.25.0/poppler/JBIG2Stream.h (renamed from Build/source/libs/poppler/poppler-0.24.4/poppler/JBIG2Stream.h) | 1 | ||||
-rw-r--r-- | Build/source/libs/poppler/poppler-0.25.0/poppler/JPEG2000Stream.cc (renamed from Build/source/libs/poppler/poppler-0.24.4/poppler/JPEG2000Stream.cc) | 0 | ||||
-rw-r--r-- | Build/source/libs/poppler/poppler-0.25.0/poppler/JPEG2000Stream.h (renamed from Build/source/libs/poppler/poppler-0.24.4/poppler/JPEG2000Stream.h) | 0 | ||||
-rw-r--r-- | Build/source/libs/poppler/poppler-0.25.0/poppler/JPXStream.cc (renamed from Build/source/libs/poppler/poppler-0.24.4/poppler/JPXStream.cc) | 0 | ||||
-rw-r--r-- | Build/source/libs/poppler/poppler-0.25.0/poppler/JPXStream.h (renamed from Build/source/libs/poppler/poppler-0.24.4/poppler/JPXStream.h) | 0 | ||||
-rw-r--r-- | Build/source/libs/poppler/poppler-0.25.0/poppler/Lexer.cc (renamed from Build/source/libs/poppler/poppler-0.24.4/poppler/Lexer.cc) | 0 | ||||
-rw-r--r-- | Build/source/libs/poppler/poppler-0.25.0/poppler/Lexer.h (renamed from Build/source/libs/poppler/poppler-0.24.4/poppler/Lexer.h) | 0 | ||||
-rw-r--r-- | Build/source/libs/poppler/poppler-0.25.0/poppler/Linearization.cc (renamed from Build/source/libs/poppler/poppler-0.24.4/poppler/Linearization.cc) | 0 | ||||
-rw-r--r-- | Build/source/libs/poppler/poppler-0.25.0/poppler/Linearization.h (renamed from Build/source/libs/poppler/poppler-0.24.4/poppler/Linearization.h) | 0 | ||||
-rw-r--r-- | Build/source/libs/poppler/poppler-0.25.0/poppler/Link.cc (renamed from Build/source/libs/poppler/poppler-0.24.4/poppler/Link.cc) | 0 | ||||
-rw-r--r-- | Build/source/libs/poppler/poppler-0.25.0/poppler/Link.h (renamed from Build/source/libs/poppler/poppler-0.24.4/poppler/Link.h) | 0 | ||||
-rw-r--r-- | Build/source/libs/poppler/poppler-0.25.0/poppler/LocalPDFDocBuilder.cc (renamed from Build/source/libs/poppler/poppler-0.24.4/poppler/LocalPDFDocBuilder.cc) | 0 | ||||
-rw-r--r-- | Build/source/libs/poppler/poppler-0.25.0/poppler/LocalPDFDocBuilder.h (renamed from Build/source/libs/poppler/poppler-0.24.4/poppler/LocalPDFDocBuilder.h) | 0 | ||||
-rw-r--r-- | Build/source/libs/poppler/poppler-0.25.0/poppler/Makefile.am (renamed from Build/source/libs/poppler/poppler-0.24.4/poppler/Makefile.am) | 8 | ||||
-rw-r--r-- | Build/source/libs/poppler/poppler-0.25.0/poppler/MarkedContentOutputDev.cc | 212 | ||||
-rw-r--r-- | Build/source/libs/poppler/poppler-0.25.0/poppler/MarkedContentOutputDev.h | 130 | ||||
-rw-r--r-- | Build/source/libs/poppler/poppler-0.25.0/poppler/Movie.cc (renamed from Build/source/libs/poppler/poppler-0.24.4/poppler/Movie.cc) | 0 | ||||
-rw-r--r-- | Build/source/libs/poppler/poppler-0.25.0/poppler/Movie.h (renamed from Build/source/libs/poppler/poppler-0.24.4/poppler/Movie.h) | 0 | ||||
-rw-r--r-- | Build/source/libs/poppler/poppler-0.25.0/poppler/NameToCharCode.cc (renamed from Build/source/libs/poppler/poppler-0.24.4/poppler/NameToCharCode.cc) | 0 | ||||
-rw-r--r-- | Build/source/libs/poppler/poppler-0.25.0/poppler/NameToCharCode.h (renamed from Build/source/libs/poppler/poppler-0.24.4/poppler/NameToCharCode.h) | 0 | ||||
-rw-r--r-- | Build/source/libs/poppler/poppler-0.25.0/poppler/NameToUnicodeTable.h (renamed from Build/source/libs/poppler/poppler-0.24.4/poppler/NameToUnicodeTable.h) | 415 | ||||
-rw-r--r-- | Build/source/libs/poppler/poppler-0.25.0/poppler/Object.cc (renamed from Build/source/libs/poppler/poppler-0.24.4/poppler/Object.cc) | 0 | ||||
-rw-r--r-- | Build/source/libs/poppler/poppler-0.25.0/poppler/Object.h (renamed from Build/source/libs/poppler/poppler-0.24.4/poppler/Object.h) | 5 | ||||
-rw-r--r-- | Build/source/libs/poppler/poppler-0.25.0/poppler/OptionalContent.cc (renamed from Build/source/libs/poppler/poppler-0.24.4/poppler/OptionalContent.cc) | 0 | ||||
-rw-r--r-- | Build/source/libs/poppler/poppler-0.25.0/poppler/OptionalContent.h (renamed from Build/source/libs/poppler/poppler-0.24.4/poppler/OptionalContent.h) | 2 | ||||
-rw-r--r-- | Build/source/libs/poppler/poppler-0.25.0/poppler/Outline.cc (renamed from Build/source/libs/poppler/poppler-0.24.4/poppler/Outline.cc) | 0 | ||||
-rw-r--r-- | Build/source/libs/poppler/poppler-0.25.0/poppler/Outline.h (renamed from Build/source/libs/poppler/poppler-0.24.4/poppler/Outline.h) | 0 | ||||
-rw-r--r-- | Build/source/libs/poppler/poppler-0.25.0/poppler/OutputDev.cc (renamed from Build/source/libs/poppler/poppler-0.24.4/poppler/OutputDev.cc) | 0 | ||||
-rw-r--r-- | Build/source/libs/poppler/poppler-0.25.0/poppler/OutputDev.h (renamed from Build/source/libs/poppler/poppler-0.24.4/poppler/OutputDev.h) | 0 | ||||
-rw-r--r-- | Build/source/libs/poppler/poppler-0.25.0/poppler/PDFDoc.cc (renamed from Build/source/libs/poppler/poppler-0.24.4/poppler/PDFDoc.cc) | 0 | ||||
-rw-r--r-- | Build/source/libs/poppler/poppler-0.25.0/poppler/PDFDoc.h (renamed from Build/source/libs/poppler/poppler-0.24.4/poppler/PDFDoc.h) | 4 | ||||
-rw-r--r-- | Build/source/libs/poppler/poppler-0.25.0/poppler/PDFDocBuilder.h (renamed from Build/source/libs/poppler/poppler-0.24.4/poppler/PDFDocBuilder.h) | 0 | ||||
-rw-r--r-- | Build/source/libs/poppler/poppler-0.25.0/poppler/PDFDocEncoding.cc (renamed from Build/source/libs/poppler/poppler-0.24.4/poppler/PDFDocEncoding.cc) | 0 | ||||
-rw-r--r-- | Build/source/libs/poppler/poppler-0.25.0/poppler/PDFDocEncoding.h (renamed from Build/source/libs/poppler/poppler-0.24.4/poppler/PDFDocEncoding.h) | 0 | ||||
-rw-r--r-- | Build/source/libs/poppler/poppler-0.25.0/poppler/PDFDocFactory.cc (renamed from Build/source/libs/poppler/poppler-0.24.4/poppler/PDFDocFactory.cc) | 0 | ||||
-rw-r--r-- | Build/source/libs/poppler/poppler-0.25.0/poppler/PDFDocFactory.h (renamed from Build/source/libs/poppler/poppler-0.24.4/poppler/PDFDocFactory.h) | 0 | ||||
-rw-r--r-- | Build/source/libs/poppler/poppler-0.25.0/poppler/PSOutputDev.cc (renamed from Build/source/libs/poppler/poppler-0.24.4/poppler/PSOutputDev.cc) | 0 | ||||
-rw-r--r-- | Build/source/libs/poppler/poppler-0.25.0/poppler/PSOutputDev.h (renamed from Build/source/libs/poppler/poppler-0.24.4/poppler/PSOutputDev.h) | 0 | ||||
-rw-r--r-- | Build/source/libs/poppler/poppler-0.25.0/poppler/PSTokenizer.cc (renamed from Build/source/libs/poppler/poppler-0.24.4/poppler/PSTokenizer.cc) | 0 | ||||
-rw-r--r-- | Build/source/libs/poppler/poppler-0.25.0/poppler/PSTokenizer.h (renamed from Build/source/libs/poppler/poppler-0.24.4/poppler/PSTokenizer.h) | 0 | ||||
-rw-r--r-- | Build/source/libs/poppler/poppler-0.25.0/poppler/Page.cc (renamed from Build/source/libs/poppler/poppler-0.24.4/poppler/Page.cc) | 23 | ||||
-rw-r--r-- | Build/source/libs/poppler/poppler-0.25.0/poppler/Page.h (renamed from Build/source/libs/poppler/poppler-0.24.4/poppler/Page.h) | 11 | ||||
-rw-r--r-- | Build/source/libs/poppler/poppler-0.25.0/poppler/PageLabelInfo.cc (renamed from Build/source/libs/poppler/poppler-0.24.4/poppler/PageLabelInfo.cc) | 0 | ||||
-rw-r--r-- | Build/source/libs/poppler/poppler-0.25.0/poppler/PageLabelInfo.h (renamed from Build/source/libs/poppler/poppler-0.24.4/poppler/PageLabelInfo.h) | 0 | ||||
-rw-r--r-- | Build/source/libs/poppler/poppler-0.25.0/poppler/PageLabelInfo_p.h (renamed from Build/source/libs/poppler/poppler-0.24.4/poppler/PageLabelInfo_p.h) | 0 | ||||
-rw-r--r-- | Build/source/libs/poppler/poppler-0.25.0/poppler/PageTransition.cc (renamed from Build/source/libs/poppler/poppler-0.24.4/poppler/PageTransition.cc) | 0 | ||||
-rw-r--r-- | Build/source/libs/poppler/poppler-0.25.0/poppler/PageTransition.h (renamed from Build/source/libs/poppler/poppler-0.24.4/poppler/PageTransition.h) | 0 | ||||
-rw-r--r-- | Build/source/libs/poppler/poppler-0.25.0/poppler/Parser.cc (renamed from Build/source/libs/poppler/poppler-0.24.4/poppler/Parser.cc) | 0 | ||||
-rw-r--r-- | Build/source/libs/poppler/poppler-0.25.0/poppler/Parser.h (renamed from Build/source/libs/poppler/poppler-0.24.4/poppler/Parser.h) | 0 | ||||
-rw-r--r-- | Build/source/libs/poppler/poppler-0.25.0/poppler/PopplerCache.cc (renamed from Build/source/libs/poppler/poppler-0.24.4/poppler/PopplerCache.cc) | 0 | ||||
-rw-r--r-- | Build/source/libs/poppler/poppler-0.25.0/poppler/PopplerCache.h (renamed from Build/source/libs/poppler/poppler-0.24.4/poppler/PopplerCache.h) | 0 | ||||
-rw-r--r-- | Build/source/libs/poppler/poppler-0.25.0/poppler/PreScanOutputDev.cc (renamed from Build/source/libs/poppler/poppler-0.24.4/poppler/PreScanOutputDev.cc) | 0 | ||||
-rw-r--r-- | Build/source/libs/poppler/poppler-0.25.0/poppler/PreScanOutputDev.h (renamed from Build/source/libs/poppler/poppler-0.24.4/poppler/PreScanOutputDev.h) | 0 | ||||
-rw-r--r-- | Build/source/libs/poppler/poppler-0.25.0/poppler/ProfileData.cc (renamed from Build/source/libs/poppler/poppler-0.24.4/poppler/ProfileData.cc) | 0 | ||||
-rw-r--r-- | Build/source/libs/poppler/poppler-0.25.0/poppler/ProfileData.h (renamed from Build/source/libs/poppler/poppler-0.24.4/poppler/ProfileData.h) | 0 | ||||
-rw-r--r-- | Build/source/libs/poppler/poppler-0.25.0/poppler/Rendition.cc (renamed from Build/source/libs/poppler/poppler-0.24.4/poppler/Rendition.cc) | 0 | ||||
-rw-r--r-- | Build/source/libs/poppler/poppler-0.25.0/poppler/Rendition.h (renamed from Build/source/libs/poppler/poppler-0.24.4/poppler/Rendition.h) | 0 | ||||
-rw-r--r-- | Build/source/libs/poppler/poppler-0.25.0/poppler/SecurityHandler.cc (renamed from Build/source/libs/poppler/poppler-0.24.4/poppler/SecurityHandler.cc) | 0 | ||||
-rw-r--r-- | Build/source/libs/poppler/poppler-0.25.0/poppler/SecurityHandler.h (renamed from Build/source/libs/poppler/poppler-0.24.4/poppler/SecurityHandler.h) | 0 | ||||
-rw-r--r-- | Build/source/libs/poppler/poppler-0.25.0/poppler/Sound.cc (renamed from Build/source/libs/poppler/poppler-0.24.4/poppler/Sound.cc) | 0 | ||||
-rw-r--r-- | Build/source/libs/poppler/poppler-0.25.0/poppler/Sound.h (renamed from Build/source/libs/poppler/poppler-0.24.4/poppler/Sound.h) | 0 | ||||
-rw-r--r-- | Build/source/libs/poppler/poppler-0.25.0/poppler/SplashOutputDev.cc (renamed from Build/source/libs/poppler/poppler-0.24.4/poppler/SplashOutputDev.cc) | 46 | ||||
-rw-r--r-- | Build/source/libs/poppler/poppler-0.25.0/poppler/SplashOutputDev.h (renamed from Build/source/libs/poppler/poppler-0.24.4/poppler/SplashOutputDev.h) | 0 | ||||
-rw-r--r-- | Build/source/libs/poppler/poppler-0.25.0/poppler/StdinCachedFile.cc (renamed from Build/source/libs/poppler/poppler-0.24.4/poppler/StdinCachedFile.cc) | 0 | ||||
-rw-r--r-- | Build/source/libs/poppler/poppler-0.25.0/poppler/StdinCachedFile.h (renamed from Build/source/libs/poppler/poppler-0.24.4/poppler/StdinCachedFile.h) | 0 | ||||
-rw-r--r-- | Build/source/libs/poppler/poppler-0.25.0/poppler/StdinPDFDocBuilder.cc (renamed from Build/source/libs/poppler/poppler-0.24.4/poppler/StdinPDFDocBuilder.cc) | 0 | ||||
-rw-r--r-- | Build/source/libs/poppler/poppler-0.25.0/poppler/StdinPDFDocBuilder.h (renamed from Build/source/libs/poppler/poppler-0.24.4/poppler/StdinPDFDocBuilder.h) | 0 | ||||
-rw-r--r-- | Build/source/libs/poppler/poppler-0.25.0/poppler/Stream-CCITT.h (renamed from Build/source/libs/poppler/poppler-0.24.4/poppler/Stream-CCITT.h) | 0 | ||||
-rw-r--r-- | Build/source/libs/poppler/poppler-0.25.0/poppler/Stream.cc (renamed from Build/source/libs/poppler/poppler-0.24.4/poppler/Stream.cc) | 0 | ||||
-rw-r--r-- | Build/source/libs/poppler/poppler-0.25.0/poppler/Stream.h (renamed from Build/source/libs/poppler/poppler-0.24.4/poppler/Stream.h) | 5 | ||||
-rw-r--r-- | Build/source/libs/poppler/poppler-0.25.0/poppler/StructElement.cc | 1382 | ||||
-rw-r--r-- | Build/source/libs/poppler/poppler-0.25.0/poppler/StructElement.h | 306 | ||||
-rw-r--r-- | Build/source/libs/poppler/poppler-0.25.0/poppler/StructTreeRoot.cc | 174 | ||||
-rw-r--r-- | Build/source/libs/poppler/poppler-0.25.0/poppler/StructTreeRoot.h | 83 | ||||
-rw-r--r-- | Build/source/libs/poppler/poppler-0.25.0/poppler/TextOutputDev.cc (renamed from Build/source/libs/poppler/poppler-0.24.4/poppler/TextOutputDev.cc) | 40 | ||||
-rw-r--r-- | Build/source/libs/poppler/poppler-0.25.0/poppler/TextOutputDev.h (renamed from Build/source/libs/poppler/poppler-0.24.4/poppler/TextOutputDev.h) | 20 | ||||
-rw-r--r-- | Build/source/libs/poppler/poppler-0.25.0/poppler/UTF.cc (renamed from Build/source/libs/poppler/poppler-0.24.4/poppler/UTF.cc) | 0 | ||||
-rw-r--r-- | Build/source/libs/poppler/poppler-0.25.0/poppler/UTF.h (renamed from Build/source/libs/poppler/poppler-0.24.4/poppler/UTF.h) | 0 | ||||
-rw-r--r-- | Build/source/libs/poppler/poppler-0.25.0/poppler/UTF8.h (renamed from Build/source/libs/poppler/poppler-0.24.4/poppler/UTF8.h) | 0 | ||||
-rw-r--r-- | Build/source/libs/poppler/poppler-0.25.0/poppler/UnicodeCClassTables.h (renamed from Build/source/libs/poppler/poppler-0.24.4/poppler/UnicodeCClassTables.h) | 0 | ||||
-rw-r--r-- | Build/source/libs/poppler/poppler-0.25.0/poppler/UnicodeCompTables.h (renamed from Build/source/libs/poppler/poppler-0.24.4/poppler/UnicodeCompTables.h) | 0 | ||||
-rw-r--r-- | Build/source/libs/poppler/poppler-0.25.0/poppler/UnicodeDecompTables.h (renamed from Build/source/libs/poppler/poppler-0.24.4/poppler/UnicodeDecompTables.h) | 0 | ||||
-rw-r--r-- | Build/source/libs/poppler/poppler-0.25.0/poppler/UnicodeMap.cc (renamed from Build/source/libs/poppler/poppler-0.24.4/poppler/UnicodeMap.cc) | 0 | ||||
-rw-r--r-- | Build/source/libs/poppler/poppler-0.25.0/poppler/UnicodeMap.h (renamed from Build/source/libs/poppler/poppler-0.24.4/poppler/UnicodeMap.h) | 0 | ||||
-rw-r--r-- | Build/source/libs/poppler/poppler-0.25.0/poppler/UnicodeMapTables.h (renamed from Build/source/libs/poppler/poppler-0.24.4/poppler/UnicodeMapTables.h) | 0 | ||||
-rw-r--r-- | Build/source/libs/poppler/poppler-0.25.0/poppler/UnicodeTypeTable.cc (renamed from Build/source/libs/poppler/poppler-0.24.4/poppler/UnicodeTypeTable.cc) | 0 | ||||
-rw-r--r-- | Build/source/libs/poppler/poppler-0.25.0/poppler/UnicodeTypeTable.h (renamed from Build/source/libs/poppler/poppler-0.24.4/poppler/UnicodeTypeTable.h) | 0 | ||||
-rw-r--r-- | Build/source/libs/poppler/poppler-0.25.0/poppler/ViewerPreferences.cc (renamed from Build/source/libs/poppler/poppler-0.24.4/poppler/ViewerPreferences.cc) | 0 | ||||
-rw-r--r-- | Build/source/libs/poppler/poppler-0.25.0/poppler/ViewerPreferences.h (renamed from Build/source/libs/poppler/poppler-0.24.4/poppler/ViewerPreferences.h) | 0 | ||||
-rw-r--r-- | Build/source/libs/poppler/poppler-0.25.0/poppler/XRef.cc (renamed from Build/source/libs/poppler/poppler-0.24.4/poppler/XRef.cc) | 0 | ||||
-rw-r--r-- | Build/source/libs/poppler/poppler-0.25.0/poppler/XRef.h (renamed from Build/source/libs/poppler/poppler-0.24.4/poppler/XRef.h) | 0 | ||||
-rw-r--r-- | Build/source/libs/poppler/poppler-0.25.0/poppler/XpdfPluginAPI.cc (renamed from Build/source/libs/poppler/poppler-0.24.4/poppler/XpdfPluginAPI.cc) | 0 | ||||
-rw-r--r-- | Build/source/libs/poppler/poppler-0.25.0/poppler/XpdfPluginAPI.h (renamed from Build/source/libs/poppler/poppler-0.24.4/poppler/XpdfPluginAPI.h) | 0 | ||||
-rw-r--r-- | Build/source/libs/poppler/poppler-0.25.0/poppler/gen-unicode-tables.py (renamed from Build/source/libs/poppler/poppler-0.24.4/poppler/gen-unicode-tables.py) | 0 | ||||
-rw-r--r-- | Build/source/libs/poppler/poppler-0.25.0/poppler/poppler-config.h.cmake (renamed from Build/source/libs/poppler/poppler-0.24.4/poppler/poppler-config.h.cmake) | 0 | ||||
-rw-r--r-- | Build/source/libs/poppler/poppler-0.25.0/poppler/poppler-config.h.in (renamed from Build/source/libs/poppler/poppler-0.24.4/poppler/poppler-config.h.in) | 0 | ||||
-rw-r--r-- | Build/source/libs/poppler/poppler-0.25.0/poppler/strtok_r.cpp (renamed from Build/source/libs/poppler/poppler-0.24.4/poppler/strtok_r.cpp) | 0 | ||||
-rw-r--r-- | Build/source/libs/poppler/poppler-0.25.0/splash/Makefile.am | 73 | ||||
-rw-r--r-- | Build/source/libs/poppler/poppler-0.25.0/splash/Makefile.in | 816 | ||||
-rw-r--r-- | Build/source/libs/poppler/poppler-0.25.0/splash/Splash.cc | 6409 | ||||
-rw-r--r-- | Build/source/libs/poppler/poppler-0.25.0/splash/Splash.h | 426 | ||||
-rw-r--r-- | Build/source/libs/poppler/poppler-0.25.0/splash/SplashBitmap.cc | 750 | ||||
-rw-r--r-- | Build/source/libs/poppler/poppler-0.25.0/splash/SplashBitmap.h | 108 | ||||
-rw-r--r-- | Build/source/libs/poppler/poppler-0.25.0/splash/SplashClip.cc | 411 | ||||
-rw-r--r-- | Build/source/libs/poppler/poppler-0.25.0/splash/SplashClip.h | 152 | ||||
-rw-r--r-- | Build/source/libs/poppler/poppler-0.25.0/splash/SplashErrorCodes.h | 50 | ||||
-rw-r--r-- | Build/source/libs/poppler/poppler-0.25.0/splash/SplashFTFont.cc | 513 | ||||
-rw-r--r-- | Build/source/libs/poppler/poppler-0.25.0/splash/SplashFTFont.h | 80 | ||||
-rw-r--r-- | Build/source/libs/poppler/poppler-0.25.0/splash/SplashFTFontEngine.cc | 180 | ||||
-rw-r--r-- | Build/source/libs/poppler/poppler-0.25.0/splash/SplashFTFontEngine.h | 81 | ||||
-rw-r--r-- | Build/source/libs/poppler/poppler-0.25.0/splash/SplashFTFontFile.cc | 140 | ||||
-rw-r--r-- | Build/source/libs/poppler/poppler-0.25.0/splash/SplashFTFontFile.h | 86 | ||||
-rw-r--r-- | Build/source/libs/poppler/poppler-0.25.0/splash/SplashFont.cc | 219 | ||||
-rw-r--r-- | Build/source/libs/poppler/poppler-0.25.0/splash/SplashFont.h | 121 | ||||
-rw-r--r-- | Build/source/libs/poppler/poppler-0.25.0/splash/SplashFontEngine.cc | 344 | ||||
-rw-r--r-- | Build/source/libs/poppler/poppler-0.25.0/splash/SplashFontEngine.h | 110 | ||||
-rw-r--r-- | Build/source/libs/poppler/poppler-0.25.0/splash/SplashFontFile.cc | 124 | ||||
-rw-r--r-- | Build/source/libs/poppler/poppler-0.25.0/splash/SplashFontFile.h | 95 | ||||
-rw-r--r-- | Build/source/libs/poppler/poppler-0.25.0/splash/SplashFontFileID.cc | 23 | ||||
-rw-r--r-- | Build/source/libs/poppler/poppler-0.25.0/splash/SplashFontFileID.h | 28 | ||||
-rw-r--r-- | Build/source/libs/poppler/poppler-0.25.0/splash/SplashGlyphBitmap.h | 24 | ||||
-rw-r--r-- | Build/source/libs/poppler/poppler-0.25.0/splash/SplashMath.h | 245 | ||||
-rw-r--r-- | Build/source/libs/poppler/poppler-0.25.0/splash/SplashPath.cc | 185 | ||||
-rw-r--r-- | Build/source/libs/poppler/poppler-0.25.0/splash/SplashPath.h | 123 | ||||
-rw-r--r-- | Build/source/libs/poppler/poppler-0.25.0/splash/SplashPattern.cc | 55 | ||||
-rw-r--r-- | Build/source/libs/poppler/poppler-0.25.0/splash/SplashPattern.h | 100 | ||||
-rw-r--r-- | Build/source/libs/poppler/poppler-0.25.0/splash/SplashScreen.cc | 387 | ||||
-rw-r--r-- | Build/source/libs/poppler/poppler-0.25.0/splash/SplashScreen.h | 80 | ||||
-rw-r--r-- | Build/source/libs/poppler/poppler-0.25.0/splash/SplashState.cc | 263 | ||||
-rw-r--r-- | Build/source/libs/poppler/poppler-0.25.0/splash/SplashState.h | 139 | ||||
-rw-r--r-- | Build/source/libs/poppler/poppler-0.25.0/splash/SplashT1Font.cc | 309 | ||||
-rw-r--r-- | Build/source/libs/poppler/poppler-0.25.0/splash/SplashT1Font.h | 69 | ||||
-rw-r--r-- | Build/source/libs/poppler/poppler-0.25.0/splash/SplashT1FontEngine.cc | 138 | ||||
-rw-r--r-- | Build/source/libs/poppler/poppler-0.25.0/splash/SplashT1FontEngine.h | 50 | ||||
-rw-r--r-- | Build/source/libs/poppler/poppler-0.25.0/splash/SplashT1FontFile.cc | 134 | ||||
-rw-r--r-- | Build/source/libs/poppler/poppler-0.25.0/splash/SplashT1FontFile.h | 70 | ||||
-rw-r--r-- | Build/source/libs/poppler/poppler-0.25.0/splash/SplashTypes.h | 199 | ||||
-rw-r--r-- | Build/source/libs/poppler/poppler-0.25.0/splash/SplashXPath.cc | 472 | ||||
-rw-r--r-- | Build/source/libs/poppler/poppler-0.25.0/splash/SplashXPath.h | 107 | ||||
-rw-r--r-- | Build/source/libs/poppler/poppler-0.25.0/splash/SplashXPathScanner.cc | 535 | ||||
-rw-r--r-- | Build/source/libs/poppler/poppler-0.25.0/splash/SplashXPathScanner.h | 108 | ||||
-rw-r--r-- | Build/source/libs/poppler/version.ac | 2 |
298 files changed, 21023 insertions, 926 deletions
diff --git a/Build/source/libs/poppler/ChangeLog b/Build/source/libs/poppler/ChangeLog index 97ae6a9e640..de4cf3cb718 100644 --- a/Build/source/libs/poppler/ChangeLog +++ b/Build/source/libs/poppler/ChangeLog @@ -1,3 +1,11 @@ +2013-12-13 Peter Breitenlohner <peb@mppmu.mpg.de> + + Import poppler-0.25.0. + * Makefile.am (poppler_libpoppler_a_sources): Add + MarkedContentOutputDev.cc, StructElement.cc, and + StructTreeRoot.cc (new files). + * version.ac: Adjust. + 2013-12-02 Peter Breitenlohner <peb@mppmu.mpg.de> Import poppler-0.24.4. diff --git a/Build/source/libs/poppler/Makefile.am b/Build/source/libs/poppler/Makefile.am index e2fb830c3b1..fc6098a32bc 100644 --- a/Build/source/libs/poppler/Makefile.am +++ b/Build/source/libs/poppler/Makefile.am @@ -90,6 +90,7 @@ poppler_libpoppler_a_sources = \ @POPPLER_TREE@/poppler/Lexer.cc \ @POPPLER_TREE@/poppler/Linearization.cc \ @POPPLER_TREE@/poppler/Link.cc \ + @POPPLER_TREE@/poppler/MarkedContentOutputDev.cc \ @POPPLER_TREE@/poppler/Movie.cc \ @POPPLER_TREE@/poppler/NameToCharCode.cc \ @POPPLER_TREE@/poppler/Object.cc \ @@ -113,6 +114,8 @@ poppler_libpoppler_a_sources = \ @POPPLER_TREE@/poppler/StdinCachedFile.cc \ @POPPLER_TREE@/poppler/StdinPDFDocBuilder.cc \ @POPPLER_TREE@/poppler/Stream.cc \ + @POPPLER_TREE@/poppler/StructElement.cc \ + @POPPLER_TREE@/poppler/StructTreeRoot.cc \ @POPPLER_TREE@/poppler/UTF.cc \ @POPPLER_TREE@/poppler/UnicodeMap.cc \ @POPPLER_TREE@/poppler/UnicodeTypeTable.cc \ diff --git a/Build/source/libs/poppler/Makefile.in b/Build/source/libs/poppler/Makefile.in index c5203697395..292a3430725 100644 --- a/Build/source/libs/poppler/Makefile.in +++ b/Build/source/libs/poppler/Makefile.in @@ -80,7 +80,7 @@ DIST_COMMON = $(srcdir)/../../am/reconfig.am \ $(srcdir)/../../am/rebuild.am $(srcdir)/Makefile.in \ $(srcdir)/Makefile.am $(top_srcdir)/configure \ $(am__configure_deps) $(srcdir)/config.h.in \ - $(top_srcdir)/poppler-0.24.4/poppler/poppler-config.h.in \ + $(top_srcdir)/poppler-0.25.0/poppler/poppler-config.h.in \ $(top_srcdir)/../../build-aux/depcomp ChangeLog \ ../../build-aux/compile ../../build-aux/config.guess \ ../../build-aux/config.sub ../../build-aux/depcomp \ @@ -160,6 +160,7 @@ am__objects_3 = @POPPLER_TREE@/poppler/Annot.$(OBJEXT) \ @POPPLER_TREE@/poppler/Lexer.$(OBJEXT) \ @POPPLER_TREE@/poppler/Linearization.$(OBJEXT) \ @POPPLER_TREE@/poppler/Link.$(OBJEXT) \ + @POPPLER_TREE@/poppler/MarkedContentOutputDev.$(OBJEXT) \ @POPPLER_TREE@/poppler/Movie.$(OBJEXT) \ @POPPLER_TREE@/poppler/NameToCharCode.$(OBJEXT) \ @POPPLER_TREE@/poppler/Object.$(OBJEXT) \ @@ -183,6 +184,8 @@ am__objects_3 = @POPPLER_TREE@/poppler/Annot.$(OBJEXT) \ @POPPLER_TREE@/poppler/StdinCachedFile.$(OBJEXT) \ @POPPLER_TREE@/poppler/StdinPDFDocBuilder.$(OBJEXT) \ @POPPLER_TREE@/poppler/Stream.$(OBJEXT) \ + @POPPLER_TREE@/poppler/StructElement.$(OBJEXT) \ + @POPPLER_TREE@/poppler/StructTreeRoot.$(OBJEXT) \ @POPPLER_TREE@/poppler/UTF.$(OBJEXT) \ @POPPLER_TREE@/poppler/UnicodeMap.$(OBJEXT) \ @POPPLER_TREE@/poppler/UnicodeTypeTable.$(OBJEXT) \ @@ -476,6 +479,7 @@ poppler_libpoppler_a_sources = \ @POPPLER_TREE@/poppler/Lexer.cc \ @POPPLER_TREE@/poppler/Linearization.cc \ @POPPLER_TREE@/poppler/Link.cc \ + @POPPLER_TREE@/poppler/MarkedContentOutputDev.cc \ @POPPLER_TREE@/poppler/Movie.cc \ @POPPLER_TREE@/poppler/NameToCharCode.cc \ @POPPLER_TREE@/poppler/Object.cc \ @@ -499,6 +503,8 @@ poppler_libpoppler_a_sources = \ @POPPLER_TREE@/poppler/StdinCachedFile.cc \ @POPPLER_TREE@/poppler/StdinPDFDocBuilder.cc \ @POPPLER_TREE@/poppler/Stream.cc \ + @POPPLER_TREE@/poppler/StructElement.cc \ + @POPPLER_TREE@/poppler/StructTreeRoot.cc \ @POPPLER_TREE@/poppler/UTF.cc \ @POPPLER_TREE@/poppler/UnicodeMap.cc \ @POPPLER_TREE@/poppler/UnicodeTypeTable.cc \ @@ -573,7 +579,7 @@ poppler-config.h: stamp-h2 @test -f $@ || rm -f stamp-h2 @test -f $@ || $(MAKE) $(AM_MAKEFLAGS) stamp-h2 -stamp-h2: $(top_srcdir)/poppler-0.24.4/poppler/poppler-config.h.in $(top_builddir)/config.status +stamp-h2: $(top_srcdir)/poppler-0.25.0/poppler/poppler-config.h.in $(top_builddir)/config.status @rm -f stamp-h2 cd $(top_builddir) && $(SHELL) ./config.status poppler-config.h @@ -734,6 +740,9 @@ clean-noinstLIBRARIES: @POPPLER_TREE@/poppler/Link.$(OBJEXT): \ @POPPLER_TREE@/poppler/$(am__dirstamp) \ @POPPLER_TREE@/poppler/$(DEPDIR)/$(am__dirstamp) +@POPPLER_TREE@/poppler/MarkedContentOutputDev.$(OBJEXT): \ + @POPPLER_TREE@/poppler/$(am__dirstamp) \ + @POPPLER_TREE@/poppler/$(DEPDIR)/$(am__dirstamp) @POPPLER_TREE@/poppler/Movie.$(OBJEXT): \ @POPPLER_TREE@/poppler/$(am__dirstamp) \ @POPPLER_TREE@/poppler/$(DEPDIR)/$(am__dirstamp) @@ -803,6 +812,12 @@ clean-noinstLIBRARIES: @POPPLER_TREE@/poppler/Stream.$(OBJEXT): \ @POPPLER_TREE@/poppler/$(am__dirstamp) \ @POPPLER_TREE@/poppler/$(DEPDIR)/$(am__dirstamp) +@POPPLER_TREE@/poppler/StructElement.$(OBJEXT): \ + @POPPLER_TREE@/poppler/$(am__dirstamp) \ + @POPPLER_TREE@/poppler/$(DEPDIR)/$(am__dirstamp) +@POPPLER_TREE@/poppler/StructTreeRoot.$(OBJEXT): \ + @POPPLER_TREE@/poppler/$(am__dirstamp) \ + @POPPLER_TREE@/poppler/$(DEPDIR)/$(am__dirstamp) @POPPLER_TREE@/poppler/UTF.$(OBJEXT): \ @POPPLER_TREE@/poppler/$(am__dirstamp) \ @POPPLER_TREE@/poppler/$(DEPDIR)/$(am__dirstamp) @@ -884,6 +899,7 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@@POPPLER_TREE@/poppler/$(DEPDIR)/Lexer.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@@POPPLER_TREE@/poppler/$(DEPDIR)/Linearization.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@@POPPLER_TREE@/poppler/$(DEPDIR)/Link.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@@POPPLER_TREE@/poppler/$(DEPDIR)/MarkedContentOutputDev.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@@POPPLER_TREE@/poppler/$(DEPDIR)/Movie.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@@POPPLER_TREE@/poppler/$(DEPDIR)/NameToCharCode.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@@POPPLER_TREE@/poppler/$(DEPDIR)/Object.Po@am__quote@ @@ -907,6 +923,8 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@@POPPLER_TREE@/poppler/$(DEPDIR)/StdinCachedFile.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@@POPPLER_TREE@/poppler/$(DEPDIR)/StdinPDFDocBuilder.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@@POPPLER_TREE@/poppler/$(DEPDIR)/Stream.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@@POPPLER_TREE@/poppler/$(DEPDIR)/StructElement.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@@POPPLER_TREE@/poppler/$(DEPDIR)/StructTreeRoot.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@@POPPLER_TREE@/poppler/$(DEPDIR)/UTF.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@@POPPLER_TREE@/poppler/$(DEPDIR)/UnicodeMap.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@@POPPLER_TREE@/poppler/$(DEPDIR)/UnicodeTypeTable.Po@am__quote@ diff --git a/Build/source/libs/poppler/configure b/Build/source/libs/poppler/configure index 590759e11d9..e07d8390a5c 100755 --- a/Build/source/libs/poppler/configure +++ b/Build/source/libs/poppler/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.69 for poppler (TeX Live) 0.24.4. +# Generated by GNU Autoconf 2.69 for poppler (TeX Live) 0.25.0. # # Report bugs to <tex-k@tug.org>. # @@ -580,12 +580,12 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='poppler (TeX Live)' PACKAGE_TARNAME='poppler--tex-live-' -PACKAGE_VERSION='0.24.4' -PACKAGE_STRING='poppler (TeX Live) 0.24.4' +PACKAGE_VERSION='0.25.0' +PACKAGE_STRING='poppler (TeX Live) 0.25.0' PACKAGE_BUGREPORT='tex-k@tug.org' PACKAGE_URL='' -ac_unique_file="poppler-0.24.4/poppler/Array.cc" +ac_unique_file="poppler-0.25.0/poppler/Array.cc" # Factoring default headers for most tests. ac_includes_default="\ #include <stdio.h> @@ -1304,7 +1304,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures poppler (TeX Live) 0.24.4 to adapt to many kinds of systems. +\`configure' configures poppler (TeX Live) 0.25.0 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1371,7 +1371,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of poppler (TeX Live) 0.24.4:";; + short | recursive ) echo "Configuration of poppler (TeX Live) 0.25.0:";; esac cat <<\_ACEOF @@ -1484,7 +1484,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -poppler (TeX Live) configure 0.24.4 +poppler (TeX Live) configure 0.25.0 generated by GNU Autoconf 2.69 Copyright (C) 2012 Free Software Foundation, Inc. @@ -2074,7 +2074,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by poppler (TeX Live) $as_me 0.24.4, which was +It was created by poppler (TeX Live) $as_me 0.25.0, which was generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ @@ -3997,7 +3997,7 @@ fi # Define the identity of the package. PACKAGE='poppler--tex-live-' - VERSION='0.24.4' + VERSION='0.25.0' # Some tools Automake needs. @@ -6473,12 +6473,12 @@ fi ac_config_headers="$ac_config_headers config.h" -ac_config_headers="$ac_config_headers poppler-config.h:poppler-0.24.4/poppler/poppler-config.h.in" +ac_config_headers="$ac_config_headers poppler-config.h:poppler-0.25.0/poppler/poppler-config.h.in" cat >>confdefs.h <<_ACEOF -#define POPPLER_VERSION "0.24.4" +#define POPPLER_VERSION "0.25.0" _ACEOF @@ -6612,7 +6612,7 @@ fi $as_echo "#define ENABLE_ZLIB 1" >>confdefs.h -POPPLER_TREE=poppler-0.24.4 +POPPLER_TREE=poppler-0.25.0 ac_config_files="$ac_config_files Makefile include/Makefile include/goo/Makefile include/fofi/Makefile" @@ -7172,7 +7172,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by poppler (TeX Live) $as_me 0.24.4, which was +This file was extended by poppler (TeX Live) $as_me 0.25.0, which was generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -7238,7 +7238,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -poppler (TeX Live) config.status 0.24.4 +poppler (TeX Live) config.status 0.25.0 configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" @@ -7369,7 +7369,7 @@ do case $ac_config_target in "depfiles") CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;; "config.h") CONFIG_HEADERS="$CONFIG_HEADERS config.h" ;; - "poppler-config.h") CONFIG_HEADERS="$CONFIG_HEADERS poppler-config.h:poppler-0.24.4/poppler/poppler-config.h.in" ;; + "poppler-config.h") CONFIG_HEADERS="$CONFIG_HEADERS poppler-config.h:poppler-0.25.0/poppler/poppler-config.h.in" ;; "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; "include/Makefile") CONFIG_FILES="$CONFIG_FILES include/Makefile" ;; "include/goo/Makefile") CONFIG_FILES="$CONFIG_FILES include/goo/Makefile" ;; diff --git a/Build/source/libs/poppler/poppler-0.24.4-PATCHES/ChangeLog b/Build/source/libs/poppler/poppler-0.25.0-PATCHES/ChangeLog index db9b0f32320..9de8396fa58 100644 --- a/Build/source/libs/poppler/poppler-0.24.4-PATCHES/ChangeLog +++ b/Build/source/libs/poppler/poppler-0.25.0-PATCHES/ChangeLog @@ -1,3 +1,10 @@ +2013-12-12 Peter Breitenlohner <peb@mppmu.mpg.de> + + Imported poppler-0.25.0 source tree from: + http://poppler.freedesktop.org/ + + * patch-02-LLONG_MAX: Adapted. + 2013-12-02 Peter Breitenlohner <peb@mppmu.mpg.de> Imported poppler-0.24.4 source tree from: diff --git a/Build/source/libs/poppler/poppler-0.24.4-PATCHES/TL-Changes b/Build/source/libs/poppler/poppler-0.25.0-PATCHES/TL-Changes index 4eb3284e19b..2536b5d06d7 100644 --- a/Build/source/libs/poppler/poppler-0.24.4-PATCHES/TL-Changes +++ b/Build/source/libs/poppler/poppler-0.25.0-PATCHES/TL-Changes @@ -1,4 +1,4 @@ -Changes applied to the poppler-0.24.4 tree as obtained from: +Changes applied to the poppler-0.25.0 tree as obtained from: http://poppler.freedesktop.org/ Removed: @@ -24,7 +24,6 @@ Removed unused dirs: m4 qt4 qt5 - splash test utils diff --git a/Build/source/libs/poppler/poppler-0.24.4-PATCHES/patch-02-LLONG_MAX b/Build/source/libs/poppler/poppler-0.25.0-PATCHES/patch-02-LLONG_MAX index 9d0d551435f..8d246ea8b67 100644 --- a/Build/source/libs/poppler/poppler-0.24.4-PATCHES/patch-02-LLONG_MAX +++ b/Build/source/libs/poppler/poppler-0.25.0-PATCHES/patch-02-LLONG_MAX @@ -1,7 +1,7 @@ -diff -ur poppler-0.24.4.orig/goo/GooString.h poppler-0.24.3/goo/GooString.h ---- poppler-0.24.4.orig/goo/GooString.h 2013-08-17 01:20:41.000000000 +0200 -+++ poppler-0.24.4/goo/GooString.h 2013-09-10 09:57:02.000000000 +0200 -@@ -33,6 +33,21 @@ +diff -ur poppler-0.25.0.orig/goo/GooString.h poppler-0.25.0/goo/GooString.h +--- poppler-0.25.0.orig/goo/GooString.h 2013-12-01 18:16:34.000000000 +0100 ++++ poppler-0.25.0/goo/GooString.h 2013-12-12 17:05:26.000000000 +0100 +@@ -34,6 +34,21 @@ #endif #include <limits.h> // for LLONG_MAX and ULLONG_MAX diff --git a/Build/source/libs/poppler/poppler-0.24.4/AUTHORS b/Build/source/libs/poppler/poppler-0.25.0/AUTHORS index a785e403211..a785e403211 100644 --- a/Build/source/libs/poppler/poppler-0.24.4/AUTHORS +++ b/Build/source/libs/poppler/poppler-0.25.0/AUTHORS diff --git a/Build/source/libs/poppler/poppler-0.24.4/CMakeLists.txt b/Build/source/libs/poppler/poppler-0.25.0/CMakeLists.txt index 9b66a694b5d..f2eb0aa4d01 100644 --- a/Build/source/libs/poppler/poppler-0.24.4/CMakeLists.txt +++ b/Build/source/libs/poppler/poppler-0.25.0/CMakeLists.txt @@ -17,8 +17,8 @@ include(CheckFileOffsetBits) CHECK_FILE_OFFSET_BITS() set(POPPLER_MAJOR_VERSION "0") -set(POPPLER_MINOR_VERSION "24") -set(POPPLER_MICRO_VERSION "4") +set(POPPLER_MINOR_VERSION "25") +set(POPPLER_MICRO_VERSION "0") set(POPPLER_VERSION "${POPPLER_MAJOR_VERSION}.${POPPLER_MINOR_VERSION}.${POPPLER_MICRO_VERSION}") # command line switches @@ -264,6 +264,7 @@ set(poppler_SRCS goo/GooString.cc goo/gmem.cc goo/FixedPoint.cc + goo/NetPBMWriter.cc goo/PNGWriter.cc goo/TiffWriter.cc goo/JpegWriter.cc @@ -304,6 +305,7 @@ set(poppler_SRCS poppler/Link.cc poppler/Linearization.cc poppler/LocalPDFDocBuilder.cc + poppler/MarkedContentOutputDev.cc poppler/NameToCharCode.cc poppler/Object.cc poppler/OptionalContent.cc @@ -320,6 +322,8 @@ set(poppler_SRCS poppler/PreScanOutputDev.cc poppler/PSTokenizer.cc poppler/Stream.cc + poppler/StructTreeRoot.cc + poppler/StructElement.cc poppler/strtok_r.cpp poppler/UnicodeMap.cc poppler/UnicodeTypeTable.cc @@ -423,7 +427,7 @@ add_library(poppler STATIC ${poppler_SRCS}) else(MSVC) add_library(poppler SHARED ${poppler_SRCS}) endif(MSVC) -set_target_properties(poppler PROPERTIES VERSION 44.0.0 SOVERSION 44) +set_target_properties(poppler PROPERTIES VERSION 45.0.0 SOVERSION 45) target_link_libraries(poppler ${poppler_LIBS}) target_link_libraries(poppler LINK_INTERFACE_LIBRARIES "") install(TARGETS poppler RUNTIME DESTINATION bin LIBRARY DESTINATION lib${LIB_SUFFIX} ARCHIVE DESTINATION lib${LIB_SUFFIX}) @@ -460,6 +464,7 @@ if(ENABLE_XPDF_HEADERS) poppler/Link.h poppler/Linearization.h poppler/LocalPDFDocBuilder.h + poppler/MarkedContentOutputDev.h poppler/Movie.h poppler/NameToCharCode.h poppler/Object.h @@ -480,6 +485,8 @@ if(ENABLE_XPDF_HEADERS) poppler/Rendition.h poppler/Stream-CCITT.h poppler/Stream.h + poppler/StructElement.h + poppler/StructTreeRoot.h poppler/UnicodeMap.h poppler/UnicodeMapTables.h poppler/UnicodeTypeTable.h diff --git a/Build/source/libs/poppler/poppler-0.24.4/COPYING b/Build/source/libs/poppler/poppler-0.25.0/COPYING index d511905c164..d511905c164 100644 --- a/Build/source/libs/poppler/poppler-0.24.4/COPYING +++ b/Build/source/libs/poppler/poppler-0.25.0/COPYING diff --git a/Build/source/libs/poppler/poppler-0.24.4/ChangeLog b/Build/source/libs/poppler/poppler-0.25.0/ChangeLog index 37c41b15283..478049f5b5b 100644 --- a/Build/source/libs/poppler/poppler-0.24.4/ChangeLog +++ b/Build/source/libs/poppler/poppler-0.25.0/ChangeLog @@ -1,6 +1,419 @@ +commit 018892d4ceccd5e2994cdb74cd2d401293fc929d +Author: Albert Astals Cid <aacid@kde.org> +Date: Wed Dec 11 23:05:53 2013 +0100 + + 0.25.0 + + CMakeLists.txt | 6 +++--- + configure.ac | 4 ++-- + cpp/Doxyfile | 2 +- + poppler/Makefile.am | 2 +- + qt4/src/Doxyfile | 2 +- + qt5/src/Doxyfile | 2 +- + 6 files changed, 9 insertions(+), 9 deletions(-) + +commit a1b99b26da9124fa55f773af55ae7382bd911d47 +Author: Albert Astals Cid <aacid@kde.org> +Date: Wed Dec 11 23:00:00 2013 +0100 + + NEWS + + NEWS | 23 +++++++++++++++++++++++ + 1 file changed, 23 insertions(+) + +commit 10a0c45676ef56bee5924e889a7e7c21244b4339 +Author: Albert Astals Cid <aacid@kde.org> +Date: Tue Dec 10 20:48:36 2013 +0100 + + Update copyrights + + cpp/poppler-image.cpp | 1 + + goo/PNGWriter.cc | 2 +- + poppler/MarkedContentOutputDev.cc | 2 ++ + poppler/MarkedContentOutputDev.h | 2 ++ + poppler/Object.h | 1 + + poppler/PDFDoc.h | 1 + + utils/ImageOutputDev.h | 2 +- + 7 files changed, 9 insertions(+), 2 deletions(-) + +commit 6c0e7d35f273583acc2aa818860e3120b0cab64f +Author: Thomas Freitag <Thomas.Freitag@alfa.de> +Date: Tue Dec 10 20:14:39 2013 +0100 + + correction for knockout transparency groups + + Fixes test "G" in eci_altona-test-suite-v2_technical2_x4.pdf + + poppler/SplashOutputDev.cc | 18 ++++++++++--- + splash/Splash.cc | 63 + +++++++++++++++++++++++++++++++++------------ + splash/SplashFTFontEngine.h | 3 +++ + splash/SplashFontEngine.cc | 13 ++++++++++ + splash/SplashFontEngine.h | 5 ++++ + 5 files changed, 82 insertions(+), 20 deletions(-) + +commit f77bc21813ae7234ec4ce94ce4e92230fe5c174a +Merge: 06e9dc9 58e04a0 +Author: Albert Astals Cid <aacid@kde.org> +Date: Sat Dec 7 16:56:11 2013 +0000 + + Merge remote-tracking branch 'origin/poppler-0.24' + + Conflicts: + utils/pdfimages.cc + utils/pdfinfo.cc + utils/pdfseparate.cc + +commit 06e9dc917650f562cd6f6666190a8c25756514a3 +Author: Albert Astals Cid <aacid@kde.org> +Date: Sat Dec 7 16:39:02 2013 +0000 + + Compile++ + + CMakeLists.txt | 2 ++ + 1 file changed, 2 insertions(+) + +commit 58e04a08afee39370283c494ee2e4e392fd3b684 +Author: Fabio D'Urso <fabiodurso@hotmail.it> +Date: Sat Dec 7 16:33:09 2013 +0000 + + segExtraBytes is a goffset not an int so use lld + + Fixes KDE bug #328511 + + poppler/JBIG2Stream.cc | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +commit 3335d5e52fd7527bba7368ad6e87f1188808582f +Author: Carlos Garcia Campos <carlosgc@gnome.org> +Date: Fri Dec 6 17:28:13 2013 +0100 + + regtest: Limit the stderr files to ~1MB + + Some tests send a lot of information to stderr, usually due to parsing + errors in buggy documents. More than 1MB of stderr output is + diffcult to + hanlde and in most cases it's redundant with a lot of duplicated + messages. + This patch reduced the size of the refs dir for the complete test + suite + by 1GB. + + regtest/backends/__init__.py | 6 +++++- + 1 file changed, 5 insertions(+), 1 deletion(-) + +commit 24107ac47625438837d7c29053bff795f986a6bb +Author: Carlos Garcia Campos <carlosgc@gnome.org> +Date: Fri Dec 6 13:24:47 2013 +0100 + + regtest: Save checksum results sorted in md5 files + + We are using os.listdir() to get the list of test results that returns + files in arbitrary order. + + regtest/backends/__init__.py | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +commit f1c9993d58fb9d191a7b3e26bfcaf7b5eec5323d +Author: Carlos Garcia Campos <carlosgc@gnome.org> +Date: Fri Dec 6 13:03:24 2013 +0100 + + regtest: Show also the tests expected to crash/fail to run but + don't fail + + regtest/TestRun.py | 8 +++++++- + 1 file changed, 7 insertions(+), 1 deletion(-) + +commit 64d1e79c863d12b12b87ed0e3139d364f503e026 +Author: Carlos Garcia Campos <carlosgc@gnome.org> +Date: Fri Dec 6 12:51:48 2013 +0100 + + regtest: Improve readability of test results + + Show a summary of tests failed per backend with the percentages and + use a + new line for every test in the result instead of using a comma + separated + line. + + regtest/TestRun.py | 67 + ++++++++++++++++++++++++++++++++++++++---------------- + 1 file changed, 47 insertions(+), 20 deletions(-) + +commit c35bc1da9402896c88999f9cffed6962a265f32e +Author: Carlos Garcia Campos <carlosgc@gnome.org> +Date: Fri Dec 6 10:04:48 2013 +0100 + + glib-demo: Increase the default size of the main window + + Some demos like annots that show a document view use more space than + they used to, requiring to manually resize the window everytime. + + glib/demo/main.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +commit ab7da0bf62bb5032c4683d9cd841075d26045aae +Author: Germán Poo-Caamaño <gpoo@gnome.org> +Date: Mon Oct 28 22:52:22 2013 -0700 + + glib-demo: Add Square and Circle annotations demo + + https://bugs.freedesktop.org/show_bug.cgi?id=70983 + + glib/demo/annots.c | 19 +++++++++++++++++++ + 1 file changed, 19 insertions(+) + +commit 2ec450567f27bba3ee4a08b5e69b7c9605bea4bb +Author: Germán Poo-Caamaño <gpoo@gnome.org> +Date: Mon Oct 28 22:48:39 2013 -0700 + + glib: Add implementation of Square and Circle annotations + + Square and Circle only differ in the constructor which defines + the subtype. Therefore, it uses the same name than Poppler's + Geometry class. + + https://bugs.freedesktop.org/show_bug.cgi?id=70983 + + glib/poppler-annot.cc | 263 + ++++++++++++++++++++++++++++++++---- + glib/poppler-annot.h | 23 ++++ + glib/poppler-page.cc | 6 + + glib/poppler-private.h | 2 + + glib/poppler.h | 2 + + glib/reference/poppler-sections.txt | 16 +++ + 6 files changed, 286 insertions(+), 26 deletions(-) + +commit e109cf2461d5be93d004593123d875a28fd79b61 +Author: Carlos Garcia Campos <carlosgc@gnome.org> +Date: Tue Nov 26 20:12:22 2013 +0100 + + annots: Make Annot::setBorder receive an AnnotBorder object + + Instead of receiving AnnotBorderArray. Also implement writeToObject in + both AnnotBorderArray and AnnotBorderBS to make sure that + Annot::setBorder will work for both cases. + + poppler/Annot.cc | 51 +++++++++++++++++++++++++++++++++++++++++++++------ + poppler/Annot.h | 10 +++++++--- + 2 files changed, 52 insertions(+), 9 deletions(-) + +commit 3979b82982e84107d93fbbe95350bf25ce47398d +Author: Carlos Garcia Campos <carlosgc@gnome.org> +Date: Tue Nov 26 14:44:57 2013 +0100 + + annots: Use a default border for annots that can have a BS entry + + According to the spec if neither the Border nor the BS entry is + present, + the border shall be drawn as a solid line with a width of 1 point. + However, acroread seems to ignore the Border entry for annots + that can't + have a BS entry. + + poppler/Annot.cc | 223 + ++++++++++++++++++++++++++++++++----------------------- + 1 file changed, 132 insertions(+), 91 deletions(-) + +commit 36c07c82bdff010695c5d615b67506922522d0e8 +Author: Carlos Garcia Campos <carlosgc@gnome.org> +Date: Tue Nov 26 14:07:21 2013 +0100 + + annots: Add helper function Annot::setLineStyleForBorder + + It sets the line dash and width based on the given AnnotBorder. Use it + only when the border width is greater than 0 for FreeText annotations + and always for annotations that use the border to set the line + width and + dash, but don't draw a border. + + poppler/Annot.cc | 110 + ++++++++++++++++--------------------------------------- + poppler/Annot.h | 1 + + 2 files changed, 32 insertions(+), 79 deletions(-) + +commit e7b1ff97318fd6c3a8fed3a33d45f1cb55208b28 +Author: Carlos Garcia Campos <carlosgc@gnome.org> +Date: Tue Nov 26 11:40:57 2013 +0100 + + annots: Remove unused typeUnknown AnnotBorderType from AnnotBorder + + Also make the AnnotBorder constructor protected to make sure it's not + possible to create AnnotBorder instances. + + poppler/Annot.cc | 3 --- + poppler/Annot.h | 12 ++++++++---- + 2 files changed, 8 insertions(+), 7 deletions(-) + +commit 17b2623360ed8917e94a8e5b880e92e6db70335e +Author: Adrian Perez de Castro <aperez@igalia.com> +Date: Tue Jun 18 00:35:51 2013 +0300 + + Tagged-PDF: Text content extraction from structure elements + + Implement StructElement::getText(), by using MCOutputDev. This + output device + captures pieces of text (aka "spans") which have the same attributes + into + a list of TextSpan objects. + + https://bugs.freedesktop.org/show_bug.cgi?id=64815 + + poppler/Makefile.am | 2 + + poppler/MarkedContentOutputDev.cc | 210 + ++++++++++++++++++++++++++++++++++++++ + poppler/MarkedContentOutputDev.h | 128 +++++++++++++++++++++++ + poppler/StructElement.cc | 50 +++++++++ + poppler/StructElement.h | 28 +++++ + 5 files changed, 418 insertions(+) + +commit 2c4320c26744ea28be10eac7cc54980c9eb4fc27 +Author: Carlos Garcia Campos <carlosgc@gnome.org> +Date: Tue Dec 3 19:07:09 2013 +0100 + + glib-demo: Show number of charcters and text layout units in text demo + + It helps to easily detect the cases where these values mismatch. + + glib/demo/text.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +commit 98d75dcdb9b73feb6f35d8ad76f5d0c428289f91 +Author: Jason Crain <jason@aquaticape.us> +Date: Sat Nov 30 17:29:50 2013 +0100 + + Limit use of ZapfDingbats character names + + Some PDFs use names from ZapfDingbats (a1-a206) without intending for + them to be used for text extraction. Only use these character names + to locate glyphs or for text extraction with ZapfDingbats fonts. + + Bug #60243 + + goo/GooString.cc | 10 ++ + goo/GooString.h | 4 + + poppler/GfxFont.cc | 15 +- + poppler/GlobalParams.cc | 33 +++- + poppler/GlobalParams.h | 16 +- + poppler/NameToUnicodeTable.h | 415 + ++++++++++++++++++++++--------------------- + 6 files changed, 274 insertions(+), 219 deletions(-) + +commit 817cc333ca8009998f2099583fd0a2fc703f3db3 +Author: Carlos Garcia Campos <carlosgc@gnome.org> +Date: Fri Nov 29 10:07:16 2013 +0100 + + regtest: Do not buffer stderr output + + Some buggy documents can produce a huge stderr output because + of parsing + errors or whatever. We could give a file directly to Popen to + write the + stderr file, but we only want to create the file when there's output, + because it's what we use to know whether the command produced + output or + not. So, instead of buffering the whole output and then write it + to the + file, now we read from the pipe while the command is running, writing + the output in chunks to the file. This improves a lot the memory + consumption when running some tests. + + regtest/backends/__init__.py | 40 + ++++++++++++++++++++++++++++++---------- + 1 file changed, 30 insertions(+), 10 deletions(-) + +commit f8f82f1cc3a948239a05d7762210a3f244299db6 +Author: Carlos Garcia Campos <carlosgc@gnome.org> +Date: Fri Nov 29 10:03:24 2013 +0100 + + regtest: Read test results in chunks to get the md5 digest + + Some backends can generate huge results, like huge postscript + files that + we don't want to load in memory to get the md5. So, instead of + creating + thr md5 object with the entire file, we feed it with chunks of data + using the update method. This improves a lot the memory consumption + and + performance as well. + + regtest/backends/__init__.py | 19 ++++++++++++------- + 1 file changed, 12 insertions(+), 7 deletions(-) + +commit 3444a44397a890dbeb1bd10357dbc8246fd21ad0 +Author: Carlos Garcia Campos <carlosgc@gnome.org> +Date: Fri Nov 29 10:01:20 2013 +0100 + + regtest: Remove unused method _check_exit_status2 + + It was used when the backends ran in parallel odd and even pages, but + it's no longer used since threads support was added. + + regtest/backends/__init__.py | 20 -------------------- + 1 file changed, 20 deletions(-) + +commit 5f825df417947c51943f1db327e1aa6c3faa15b0 +Author: Carlos Garcia Campos <carlosgc@gnome.org> +Date: Fri Nov 29 09:57:57 2013 +0100 + + regtest: Do not store the current line in Printer but only its length + + We are not using the line text anymore, but only the length. + + regtest/Printer.py | 10 +++++----- + 1 file changed, 5 insertions(+), 5 deletions(-) + +commit 1486d93f0f6418b37ccc57568717d9349a79935b +Author: Carlos Garcia Campos <carlosgc@gnome.org> +Date: Wed Nov 27 18:29:36 2013 +0100 + + regtest: Do not consider docs with no refs as skipped + + Handle them differently as new docs, and show them in the summary + suggesting to use create-refs command to include them in the test + suite. + + regtest/TestRun.py | 40 +++++++++++++++++++++++----------------- + 1 file changed, 23 insertions(+), 17 deletions(-) + +commit 5241c0cc730c380dc44c3a081e1de675e1915861 +Author: Carlos Garcia Campos <carlosgc@gnome.org> +Date: Wed Nov 27 17:18:37 2013 +0100 + + regtest: Use number of tests run to show the progress + + Instead of using the number of document tested. We don't really + need to + set a number to a particular document, we only want to know the + progress + of the whole process. This ensures that the progress is shown in the + correct order. It also simplifies the code a bit. + Also improved the output formatting to make it easier to read. + + regtest/Printer.py | 44 ++++----------- + regtest/TestReferences.py | 50 +++++++++++------ + regtest/TestRun.py | 136 + +++++++++++++++++++++++++--------------------- + 3 files changed, 118 insertions(+), 112 deletions(-) + +commit 0af3e009a702d0c6ca716565ab87b386baa0a1ed +Author: Albert Astals Cid <aacid@kde.org> +Date: Wed Nov 27 00:53:16 2013 +0100 + + 0.24.4 + + CMakeLists.txt | 4 ++-- + NEWS | 18 ++++++++++++++++++ + configure.ac | 2 +- + cpp/Doxyfile | 2 +- + poppler/Makefile.am | 2 +- + qt4/src/Doxyfile | 2 +- + qt5/src/Doxyfile | 2 +- + 7 files changed, 25 insertions(+), 7 deletions(-) + commit a42a13be0a0cda71dc230a73f7b16eb4eb066251 Author: suzuki toshiya <mpsuzuki@hiroshima-u.ac.jp> -Date: Wed Nov 27 00:05:57 2013 +0100 +Date: Wed Nov 27 00:05:57 2013 +0100 Warn the user if he provides a wrong range @@ -17,16 +430,89 @@ Date: Wed Nov 27 00:05:57 2013 +0100 commit 45552cafaeef6b883078db269437586add1dc32c Author: Albert Astals Cid <aacid@kde.org> -Date: Tue Nov 26 23:36:12 2013 +0100 +Date: Tue Nov 26 23:36:12 2013 +0100 Update copyrights utils/pdftotext.cc | 1 + 1 file changed, 1 insertion(+) +commit f20fe89d4f5a8f768e2019f25cecf40cd0e4f5f8 +Author: Carlos Garcia Campos <carlosgc@gnome.org> +Date: Mon Nov 25 09:05:41 2013 +0100 + + glib-demo: Add an area selector to text demo + + And use the for_area variants of the API to get the text, text layout + and text attributes. + + glib/demo/text.c | 114 + +++++++++++++++++++++++++++++++++++++++++++++++++++++-- + 1 file changed, 110 insertions(+), 4 deletions(-) + +commit bb2b7fb491fb72f0ea024d80df89680ede3457b4 +Author: Carlos Garcia Campos <carlosgc@gnome.org> +Date: Mon Nov 25 09:04:30 2013 +0100 + + glib: Add API to get text, text layout and text attributes for a + given area + + glib/poppler-page.cc | 107 + ++++++++++++++++++++++++++++++++++-- + glib/poppler-page.h | 8 +++ + glib/reference/poppler-sections.txt | 3 + + 3 files changed, 113 insertions(+), 5 deletions(-) + +commit f662973b0da52da84acc3668a0e037ee72498193 +Author: Carlos Garcia Campos <carlosgc@gnome.org> +Date: Sat Nov 2 14:07:07 2013 +0100 + + TextOutputDev: Honor the selection rectangle passed to + TextPage::getSelectionWords() + + Make TextPage::getSelectionWords() return a list of TextWordSelection + instead of a list of TextWord so that it's possible to know which + characters of the word are inside the given selection rectangle. + Adapt the glib frontend to the new API and use the selection bounds + instead of the whole word to build the list of characters in + poppler_page_get_text_layout() and poppler_page_get_text_attributes(), + which ensures the number of glyphs returned is in sync with the number + of characters returned by poppler_page_get_text(). + + https://bugs.freedesktop.org/show_bug.cgi?id=71160 + + glib/poppler-page.cc | 22 ++++++++++++++-------- + poppler/TextOutputDev.cc | 40 ++++++++-------------------------------- + poppler/TextOutputDev.h | 20 ++++++++++++++++++++ + 3 files changed, 42 insertions(+), 40 deletions(-) + +commit 18fab454c59b1c77c691617aaef99245eacd83b5 +Author: Germán Poo-Caamaño <gpoo@gnome.org> +Date: Mon Oct 28 22:41:41 2013 -0700 + + glib-demo: Simplify annotations list and its properties + + * Move the annotation's rectangle to properties to make the + list view of annotations cleaner. + * Remove duplicated information: flags and page are already + present in the UI. + + https://bugs.freedesktop.org/show_bug.cgi?id=70982 + + glib/demo/annots.c | 70 + ++++++++++++------------------------------------------ + 1 file changed, 15 insertions(+), 55 deletions(-) + +commit 770a7ac9833a3c4f4f0399093272d4d0bdc7923b +Merge: e7a0f2b 9ae29c7 +Author: Albert Astals Cid <aacid@kde.org> +Date: Thu Nov 21 23:58:29 2013 +0100 + + Merge remote-tracking branch 'origin/poppler-0.24' + commit 9ae29c7a07d0f372dbfc4aca17bbb646126aedb5 Author: Thomas Freitag <Thomas.Freitag@alfa.de> -Date: Thu Nov 21 23:53:53 2013 +0100 +Date: Thu Nov 21 23:53:53 2013 +0100 Don't end loop if reading from GooFile fails @@ -35,9 +521,86 @@ Date: Thu Nov 21 23:53:53 2013 +0100 poppler/Stream.cc | 3 +++ 1 file changed, 3 insertions(+) +commit e7a0f2b942fe621304275175324f7809d1c83d80 +Author: Hib Eris <hib@hiberis.nl> +Date: Wed Nov 20 00:43:27 2013 +0100 + + Fix warning on signed/unsigned comparison in GfxState.cc + + Bug #71641 + + poppler/GfxState.cc | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +commit c784c4c3a582aaa4e10c223665cb876e12b7c16f +Author: Germán Poo-Caamaño <gpoo@gnome.org> +Date: Mon Nov 18 00:57:53 2013 -0800 + + glib-demo: Add support for simple line annotations + + https://bugs.freedesktop.org/show_bug.cgi?id=70981 + + glib/demo/annots.c | 99 + +++++++++++++++++++++++++++++++++++++++++++++++++----- + 1 file changed, 91 insertions(+), 8 deletions(-) + +commit 2d164e06b8a84ade6689d85bba2d606c66bf62a9 +Author: Germán Poo-Caamaño <gpoo@gnome.org> +Date: Mon Nov 18 00:48:13 2013 -0800 + + glib-demo: add color selection for new annotations + + https://bugs.freedesktop.org/show_bug.cgi?id=71727 + + glib/demo/annots.c | 34 ++++++++++++++++++++++++++++++++++ + 1 file changed, 34 insertions(+) + +commit 7127a2c705787f6f44b0852efeabe9fdeae7e2c0 +Author: Germán Poo-Caamaño <gpoo@gnome.org> +Date: Sun Nov 17 23:38:32 2013 -0800 + + glib: Add support for simple line annotations + + https://bugs.freedesktop.org/show_bug.cgi?id=70981 + + glib/poppler-annot.cc | 79 + +++++++++++++++++++++++++++++++++++++ + glib/poppler-annot.h | 12 ++++++ + glib/poppler-page.cc | 3 ++ + glib/poppler-private.h | 1 + + glib/poppler.h | 1 + + glib/reference/poppler-sections.txt | 7 ++++ + 6 files changed, 103 insertions(+) + +commit 451bac9f05bab18f3aa0392ddf6eb6b569004cb8 +Author: Germán Poo-Caamaño <gpoo@gnome.org> +Date: Sun Nov 17 23:30:14 2013 -0800 + + glib: Add PopplerPoint boxed type + + https://bugs.freedesktop.org/show_bug.cgi?id=70981 + + glib/poppler-page.cc | 54 + +++++++++++++++++++++++++++++++++++++ + glib/poppler-page.h | 20 ++++++++++++++ + glib/poppler.h | 1 + + glib/reference/poppler-sections.txt | 5 ++++ + 4 files changed, 80 insertions(+) + +commit c01cee165392ba8297e4168111a66d2acb272a99 +Merge: 07c2554 47605a8 +Author: Albert Astals Cid <aacid@kde.org> +Date: Mon Nov 18 22:58:28 2013 +0100 + + Merge remote-tracking branch 'origin/poppler-0.24' + + Conflicts: + poppler/Catalog.cc + poppler/Catalog.h + commit 47605a8aaf85bee21601219b04c0c8e6cf982507 Author: José Aliste <jaliste@src.gnome.org> -Date: Mon Nov 18 22:52:08 2013 +0100 +Date: Mon Nov 18 22:52:08 2013 +0100 Catalog: sort entries of NameTrees to make sure lookup works @@ -47,18 +610,81 @@ Date: Mon Nov 18 22:52:08 2013 +0100 poppler/Catalog.h | 2 ++ 2 files changed, 14 insertions(+) +commit 07c255482f7ec8a8cfd4eaeaf7b07de317bbcc7a +Author: Germán Poo-Caamaño <gpoo@gnome.org> +Date: Sun Oct 27 13:30:22 2013 -0700 + + glib-demo: Add annotations interactively + + * Prepare UI to add multiple annotations type. + * Remove dialog and button add annotations. + + https://bugs.freedesktop.org/show_bug.cgi?id=69978 + + glib/demo/annots.c | 348 + ++++++++++++++++++++++++++++++++--------------------- + 1 file changed, 213 insertions(+), 135 deletions(-) + +commit 4b7c91ea697359751f9abe9ec5e63021c90a60ed +Author: Germán Poo-Caamaño <gpoo@gnome.org> +Date: Sat Sep 28 23:18:07 2013 -0700 + + glib: Add getter and setter for annotation's rectangle + + Annotation objects contain at least two keys, Rect and Subtype. + The former has the coordinates where the annotation is placed. + The getter and setter allows to obtain and modify the position + of a given annotation. + + https://bugs.freedesktop.org/show_bug.cgi?id=70901 + + glib/poppler-annot.cc | 48 + +++++++++++++++++++++++++++++++++++++ + glib/poppler-annot.h | 4 ++++ + glib/reference/poppler-sections.txt | 2 ++ + 3 files changed, 54 insertions(+) + commit 491f0a170c72271a7a9ce049fbcfe81f08cff162 Author: suzuki toshiya <mpsuzuki@hiroshima-u.ac.jp> -Date: Fri Nov 15 20:35:12 2013 +0100 +Date: Fri Nov 15 20:35:12 2013 +0100 pdftotext: Escape the text of the xml headers utils/pdftotext.cc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) +commit 4da94680d4d2d6b1bd3351d476a20f9c7ae565bc +Merge: 3ea3d7c 78c407a +Author: Albert Astals Cid <aacid@kde.org> +Date: Fri Nov 15 20:27:00 2013 +0100 + + Merge remote-tracking branch 'origin/poppler-0.24' + +commit 3ea3d7c6c7a0ede76428204ec11aec3a844117fc +Author: Hib Eris <hib@hiberis.nl> +Date: Fri Nov 15 19:59:52 2013 +0100 + + pdftotext: Silence warning for may be used uninitialized variable + + Bug #71640 + + utils/pdftotext.cc | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +commit 97910b9eb92df49757915bde02e0d54de04552d4 +Author: Hib Eris <hib@hiberis.nl> +Date: Fri Nov 15 19:55:19 2013 +0100 + + Do not close stdout in pdftotext + + Bug #71639 + + utils/pdftotext.cc | 6 ++++-- + 1 file changed, 4 insertions(+), 2 deletions(-) + commit 78c407ac7e8f48ae2d2c75ad0f5960390190d2e3 Author: Albert Astals Cid <aacid@kde.org> -Date: Fri Nov 15 20:25:52 2013 +0100 +Date: Fri Nov 15 20:25:52 2013 +0100 destionation -> destination @@ -71,9 +697,31 @@ Date: Fri Nov 15 20:25:52 2013 +0100 qt5/src/poppler-annotation.cc | 3 ++- 2 files changed, 5 insertions(+), 3 deletions(-) +commit a23c9ad4c0536d680bedc563444ce3adf6e1ee9e +Author: Hib Eris <hib@hiberis.nl> +Date: Fri Nov 15 11:38:45 2013 +0100 + + Silence warning for may be used uninitialized variable in + ImageOutputDec.cc + + Fixes warning: + + CXX ImageOutputDev.lo + ImageOutputDev.cc: In member function 'void + ImageOutputDev::writeImageFile(ImgWriter*, + ImageOutputDev::ImageFormat, const char*, Stream*, int, int, + GfxImageColorMap*)': + ImageOutputDev.cc:409:28: warning: 'imgStr' may be used uninitialized + in this function [-Wmaybe-uninitialized] + + Bug #71642 + + utils/ImageOutputDev.cc | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + commit c43a80e65fc570a8017892ba111a8c48ac33d9ad Author: Hib Eris <hib@hiberis.nl> -Date: Fri Nov 15 19:59:52 2013 +0100 +Date: Fri Nov 15 19:59:52 2013 +0100 pdftotext: Silence warning for may be used uninitialized variable @@ -84,7 +732,7 @@ Date: Fri Nov 15 19:59:52 2013 +0100 commit f905d804c0d1c715d8423938f41b5a002c0ef15d Author: Hib Eris <hib@hiberis.nl> -Date: Fri Nov 15 19:55:19 2013 +0100 +Date: Fri Nov 15 19:55:19 2013 +0100 Do not close stdout in pdftotext @@ -93,9 +741,16 @@ Date: Fri Nov 15 19:55:19 2013 +0100 utils/pdftotext.cc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) +commit 33e703ac9bb6cf69664d6c6fddd3bebd56336074 +Merge: 8294d18 7c74bcc +Author: Albert Astals Cid <aacid@kde.org> +Date: Fri Nov 15 19:50:10 2013 +0100 + + Merge remote-tracking branch 'origin/poppler-0.24' + commit 7c74bccdf514cce05987dde7fb1cce4ac65ff025 Author: Albert Astals Cid <aacid@kde.org> -Date: Fri Nov 15 19:48:07 2013 +0100 +Date: Fri Nov 15 19:48:07 2013 +0100 Forgot to update the copyrights @@ -107,7 +762,7 @@ Date: Fri Nov 15 19:48:07 2013 +0100 commit ebe49d597a62aa94601c2e4595dbad1895ea7ef0 Author: Albert Astals Cid <aacid@kde.org> -Date: Fri Nov 15 19:33:00 2013 +0100 +Date: Fri Nov 15 19:33:00 2013 +0100 Fix regression in broken endstream detection @@ -120,33 +775,118 @@ Date: Fri Nov 15 19:33:00 2013 +0100 poppler/Parser.h | 2 +- 4 files changed, 8 insertions(+), 11 deletions(-) +commit 8294d18ea96bd18be076bccbdbdaa015fc48aa12 +Author: Adrian Perez de Castro <aperez@igalia.com> +Date: Thu Sep 26 20:46:34 2013 +0300 + + Tagged-PDF: Parsing of StructElem standard types and attributes + + Parse attributes and standard types of StructElem nodes of the + document structure tree. Type name aliases are resolved via the + RoleMap (and cycles detected). Both standard attributes and user + properties are mapped to instances of the Attribute class. + Attributes are parsed both via ClassMap references and directly + referenced from the StructElem objects. + + https://bugs.freedesktop.org/show_bug.cgi?id=64815 + + poppler/StructElement.cc | 1018 + +++++++++++++++++++++++++++++++++++++++++++++- + poppler/StructElement.h | 113 ++++- + 2 files changed, 1126 insertions(+), 5 deletions(-) + +commit 4e0cbd37b964107c0fb531d48876a33ae843bf27 +Author: suzuki toshiya <mpsuzuki@hiroshima-u.ac.jp> +Date: Mon Nov 11 22:46:07 2013 +0100 + + pdftohtml: Add -? and --help + + utils/pdftohtml.cc | 6 +++++- + 1 file changed, 5 insertions(+), 1 deletion(-) + +commit 4dbd36f5b35dd0964e59d942242aecdc6b474c89 +Author: Andres Gomez <agomez@igalia.com> +Date: Tue Nov 5 09:52:23 2013 +0200 + + glib-demo: Fix conding style issue in main.c + + https://bugs.freedesktop.org/show_bug.cgi?id=71245 + + glib/demo/main.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +commit 02f3c235eaf60350c98e88dbe266378fccef59d7 +Author: Andres Gomez <agomez@igalia.com> +Date: Tue Nov 5 09:52:23 2013 +0200 + + glib-demo: Fix a typo in function name + + https://bugs.freedesktop.org/show_bug.cgi?id=71245 + + glib/demo/main.c | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +commit 5620b82e69335b7f12d877a24f1a463604f0e515 +Author: Andres Gomez <agomez@igalia.com> +Date: Tue Nov 5 09:52:23 2013 +0200 + + glib-demo: Fix trailing whitespaces in main.c + + https://bugs.freedesktop.org/show_bug.cgi?id=71245 + + glib/demo/main.c | 14 +++++++------- + 1 file changed, 7 insertions(+), 7 deletions(-) + +commit 43309d92d327b4ae8e89edb15482247045d726a4 +Author: Germán Poo-Caamaño <gpoo@gnome.org> +Date: Sat Sep 28 20:45:32 2013 -0700 + + glib-demo: Make the Remove annotation button prominent in demo + + Move out from Annotation properties to the top. This make better + use of the space. + Make the remove button active only if there is an annotation + selected. + + https://bugs.freedesktop.org/show_bug.cgi?id=69978 + + glib/demo/annots.c | 22 +++++++++++++--------- + 1 file changed, 13 insertions(+), 9 deletions(-) + commit f4a72fd3c61091d6b455af9a881c2390da19b506 Author: Albert Astals Cid <aacid@kde.org> -Date: Sat Oct 26 19:06:34 2013 +0200 +Date: Sat Oct 26 19:06:34 2013 +0200 0.24.3 CMakeLists.txt | 2 +- - NEWS | 14 ++++++++++++++ - configure.ac | 2 +- - cpp/Doxyfile | 2 +- + NEWS | 14 ++++++++++++++ + configure.ac | 2 +- + cpp/Doxyfile | 2 +- qt4/src/Doxyfile | 2 +- qt5/src/Doxyfile | 2 +- 6 files changed, 19 insertions(+), 5 deletions(-) commit 33a5af32cd5769cf1b6c6344077ac4a3f407ba21 Author: Albert Astals Cid <aacid@kde.org> -Date: Sat Oct 26 18:48:50 2013 +0200 +Date: Sat Oct 26 18:48:50 2013 +0200 Update copyrights qt4/src/poppler-document.cc | 2 +- - utils/pdfseparate.cc | 2 +- + utils/pdfseparate.cc | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) +commit 9f09b9596f1fc52481914019d68c8f9b85b5c438 +Merge: bd893d4 61f79b8 +Author: Albert Astals Cid <aacid@kde.org> +Date: Thu Oct 24 01:03:02 2013 +0200 + + Merge remote-tracking branch 'origin/poppler-0.24' + commit 61f79b8447c3ac8ab5a26e79e0c28053ffdccf75 Author: Albert Astals Cid <aacid@kde.org> -Date: Thu Oct 24 00:54:56 2013 +0200 +Date: Thu Oct 24 00:54:56 2013 +0200 Allow only one %d in the filename @@ -159,9 +899,16 @@ Date: Thu Oct 24 00:54:56 2013 +0200 utils/pdfseparate.cc | 31 ++++++++++++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) +commit bd893d4a543a6cc3a525655f37def38440944f28 +Merge: 93e8b05 daa0990 +Author: Albert Astals Cid <aacid@kde.org> +Date: Thu Oct 10 02:19:34 2013 +0200 + + Merge remote-tracking branch 'origin/poppler-0.24' + commit daa0990a7baf17d00d12574a4de815e070727a86 Author: Albert Astals Cid <aacid@kde.org> -Date: Thu Oct 10 02:16:25 2013 +0200 +Date: Thu Oct 10 02:16:25 2013 +0200 Return empty if getXRef()->copy() fails @@ -174,7 +921,18 @@ Date: Thu Oct 10 02:16:25 2013 +0200 commit f4bfa940aa40a82a1080cdaf765da1d1615ccfb1 Author: Carlos Garcia Campos <carlosgc@gnome.org> -Date: Sat Oct 5 11:20:04 2013 +0200 +Date: Sat Oct 5 11:20:04 2013 +0200 + + cairo: Do not set an invalid matrix in drawImage() + + https://bugs.freedesktop.org/show_bug.cgi?id=70085 + + poppler/CairoOutputDev.cc | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +commit 93e8b05fb2a6d225f048db6a3a735717433a5a13 +Author: Carlos Garcia Campos <carlosgc@gnome.org> +Date: Sat Oct 5 11:20:04 2013 +0200 cairo: Do not set an invalid matrix in drawImage() @@ -183,9 +941,171 @@ Date: Sat Oct 5 11:20:04 2013 +0200 poppler/CairoOutputDev.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) +commit 3084f8f4a5ad55937094b14e30169dccf1fa4ec9 +Author: Germán Poo-Caamaño <gpoo@gnome.org> +Date: Sat Sep 21 11:59:32 2013 -0700 + + glib-demo: Expand short names for annotations used in demo + + https://bugs.freedesktop.org/show_bug.cgi?id=69978 + + glib/demo/annots.c | 10 +++++----- + glib/demo/main.c | 2 +- + 2 files changed, 6 insertions(+), 6 deletions(-) + +commit ff674f57a3587142165fd56aec089d9840ceda36 +Author: Germán Poo-Caamaño <gpoo@gnome.org> +Date: Fri Sep 27 22:33:42 2013 -0700 + + glib-demo: Merge columns Type and Color in annotations demo + + Reduce the space used by both columns, makes the color + pixbuf smaller enough to give a clue of the annotation + color. + + https://bugs.freedesktop.org/show_bug.cgi?id=69978 + + glib/demo/annots.c | 28 ++++++++++++++++------------ + 1 file changed, 16 insertions(+), 12 deletions(-) + +commit 76d6e2d385e2cbad7f44bc8aee05147efd3970a4 +Author: Germán Poo-Caamaño <gpoo@gnome.org> +Date: Fri Sep 20 23:27:20 2013 -0700 + + glib-demo: Rearrange layout for annotations in demo + + Add render area to visualize the annotations per page. + + https://bugs.freedesktop.org/show_bug.cgi?id=69978 + + glib/demo/annots.c | 130 + ++++++++++++++++++++++++++++++++++++++++++++++++----- + 1 file changed, 118 insertions(+), 12 deletions(-) + +commit a6b1fc1a2ca83b3e4c52bcaa95b99d0289354f4b +Author: Germán Poo-Caamaño <gpoo@gnome.org> +Date: Sun Sep 29 22:50:42 2013 -0700 + + glib-demo: Fix rectangle calculation for new annotations in demo + + https://bugs.freedesktop.org/show_bug.cgi?id=69978 + + glib/demo/annots.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +commit bd49b3c0c6f2adccc5bda561edbaf9f00ed2917a +Author: Thomas Freitag <Thomas.Freitag@alfa.de> +Date: Wed Oct 2 23:32:09 2013 +0200 + + Use icc profile in OutputIntents + + Bug #34053 + + poppler/Gfx.cc | 114 +++++++++++--- + poppler/Gfx.h | 8 +- + poppler/GfxState.cc | 429 + +++++++++++++++++++++++++++++++++++++++++----------- + poppler/GfxState.h | 72 ++++++--- + poppler/Page.cc | 2 +- + 5 files changed, 490 insertions(+), 135 deletions(-) + +commit df947a0641082f530200880d46e20cd3e1fd962f +Author: Albert Astals Cid <aacid@kde.org> +Date: Wed Oct 2 20:53:32 2013 +0200 + + Compile++ + + CMakeLists.txt | 4 ++++ + 1 file changed, 4 insertions(+) + +commit fa83d7e4f36cfc11c7b4f81f5f5e8ed69eb6dbbe +Author: Daniel Kahn Gillmor <dkg@fifthhorseman.net> +Date: Wed Oct 2 20:35:58 2013 +0200 + + pdfseparate: allow zero-padded pagespecs + + Bug #50914 + + utils/pdfseparate.cc | 22 +++++++++++++++++++--- + 1 file changed, 19 insertions(+), 3 deletions(-) + +commit e04cabd878a0fd84faa5178f423fd828d010b664 +Author: Adrian Perez de Castro <aperez@igalia.com> +Date: Mon Jun 17 17:00:27 2013 +0300 + + Tagged-PDF: Implement parsing of StructTreeRoot + + Implement parsing of the StructTreeRoot entry of the Catalog. Also, + the + Catalog::getStructTreeRoot() and PDFDoc::getStructTreeRoot() + methods are + modified to return an instance of StructTreeRoot instead of an Object. + + All elements from the StructTreeRoot are parsed except for: + + - IDTree: it is a lookup tree to locate items by their ID, which would + be barely useful because the whole structure tree is to be kept in + memory, which should be fast enough to traverse. + - ParentTreeNextKey: This is needed only when the ParentTree object is + to be modified. For the moment the implementation deals only with + reading, so this has been deliberately left out. + + StructElem tree nodes from the document structure tree are parsed as a + StructElement instance. Attributes and extraction of content out from + elements are not yet handled. + + https://bugs.freedesktop.org/show_bug.cgi?id=64815 + + poppler/Catalog.cc | 36 +++--- + poppler/Catalog.h | 5 +- + poppler/Makefile.am | 4 + + poppler/PDFDoc.h | 3 +- + poppler/StructElement.cc | 322 + ++++++++++++++++++++++++++++++++++++++++++++++ + poppler/StructElement.h | 167 ++++++++++++++++++++++++ + poppler/StructTreeRoot.cc | 174 +++++++++++++++++++++++++ + poppler/StructTreeRoot.h | 83 ++++++++++++ + 8 files changed, 776 insertions(+), 18 deletions(-) + +commit 45e0fe56985f34e695c99a2f6ec1ffe14e239b9e +Author: Adrian Perez de Castro <aperez@igalia.com> +Date: Thu Sep 26 20:56:52 2013 +0300 + + Implement Object::takeString() method + + Object::takeString() behaves like Object::getString(), but transfers + ownership of the returned string to the caller. Also, it makes + sure that + calling Object::free() afterwards won't free the string that the + Object + is holding. + + poppler/Object.h | 4 ++++ + 1 file changed, 4 insertions(+) + +commit d80eb4a34c218de34633ee2f1b9dfd65504a0ad9 +Author: Thomas Freitag <Thomas.Freitag@alfa.de> +Date: Tue Oct 1 22:57:55 2013 +0200 + + cache cms values in getGray(), getRGB() and getCMYK() + + Bug #68420 + + poppler/GfxState.cc | 111 + ++++++++++++++++++++++++++++++++++++++++++++++++++++ + poppler/GfxState.h | 2 + + 2 files changed, 113 insertions(+) + +commit 9bc8f3240698d5a8ae4c0129e768840664d28c22 +Merge: a2742c8 e2fe851 +Author: Albert Astals Cid <aacid@kde.org> +Date: Tue Oct 1 19:19:32 2013 +0200 + + Merge remote-tracking branch 'origin/poppler-0.24' + commit e2fe85137ecb59eb0d177682c552febc64cda643 Author: Adrian Johnson <ajohnson@redneon.com> -Date: Tue Oct 1 19:15:08 2013 +0200 +Date: Tue Oct 1 19:15:08 2013 +0200 Fix PFB font embedding @@ -195,41 +1115,62 @@ Date: Tue Oct 1 19:15:08 2013 +0200 ++++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 46 insertions(+), 6 deletions(-) +commit a2742c8fce0594ccbdb036dd0c29c6e15d2229f3 +Merge: 6b30a52 06dabe1 +Author: Albert Astals Cid <aacid@kde.org> +Date: Mon Sep 30 19:32:41 2013 +0200 + + Merge remote-tracking branch 'origin/poppler-0.24' + commit 06dabe1eed912e5f5c96fe9f371ab459516e5a99 Author: Albert Astals Cid <aacid@kde.org> -Date: Fri Sep 27 12:41:23 2013 +0200 +Date: Fri Sep 27 12:41:23 2013 +0200 0.24.2 CMakeLists.txt | 2 +- - NEWS | 8 ++++++++ - configure.ac | 2 +- - cpp/Doxyfile | 2 +- + NEWS | 8 ++++++++ + configure.ac | 2 +- + cpp/Doxyfile | 2 +- qt4/src/Doxyfile | 2 +- qt5/src/Doxyfile | 2 +- 6 files changed, 13 insertions(+), 5 deletions(-) commit 78141da189c42a04b6a303767284de755a4a2d4d Author: Albert Astals Cid <aacid@kde.org> -Date: Fri Sep 27 12:39:00 2013 +0200 +Date: Fri Sep 27 12:39:00 2013 +0200 Update copyrights utils/pdfseparate.cc | 1 + 1 file changed, 1 insertion(+) +commit 6b30a5214e39993025cf2fb9f221e1360de7fa9c +Merge: 4966b6f dc344b4 +Author: Albert Astals Cid <aacid@kde.org> +Date: Sat Sep 21 10:38:45 2013 +0200 + + Merge remote-tracking branch 'origin/poppler-0.24' + commit dc344b410f49410174ee902b7649ebd8c2cb0fa2 Author: Lu Wang <coolwanglu@gmail.com> -Date: Sat Sep 21 10:37:30 2013 +0200 +Date: Sat Sep 21 10:37:30 2013 +0200 pdftocairo: check file opening failure in beginDocument() utils/pdftocairo.cc | 7 +++++++ 1 file changed, 7 insertions(+) +commit 4966b6f4193cc9d13f63e92bdc2aac0c8b78298d +Merge: 0f074b1 1e612d3 +Author: Albert Astals Cid <aacid@kde.org> +Date: Sat Sep 21 10:15:28 2013 +0200 + + Merge remote-tracking branch 'origin/poppler-0.24' + commit 1e612d331b79dabec66ad241d7ffe66674a10bc4 Author: Thomas Freitag <Thomas.Freitag@alfa.de> -Date: Sat Sep 21 10:10:16 2013 +0200 +Date: Sat Sep 21 10:10:16 2013 +0200 Windows: Fix CreateFile fails with ERROR_SHARING_VIOLATION @@ -238,9 +1179,19 @@ Date: Sat Sep 21 10:10:16 2013 +0200 goo/gfile.cc | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) +commit 0f074b16317d874fe58d7042f8434282786ca757 +Merge: d277432 b8682d8 +Author: Pino Toscano <pino@kde.org> +Date: Mon Sep 16 19:53:10 2013 +0200 + + Merge remote-tracking branch 'origin/poppler-0.24' + + Conflicts: + utils/pdfimages.1 + commit b8682d868ddf7f741e93b791588af0932893f95c Author: Pino Toscano <pino@kde.org> -Date: Mon Sep 16 19:46:55 2013 +0200 +Date: Mon Sep 16 19:46:55 2013 +0200 pdfseparate: improve the path building @@ -252,47 +1203,267 @@ Date: Mon Sep 16 19:46:55 2013 +0200 utils/pdfseparate.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) +commit d2774325f5248018977d3ab8f8dd7155ed972668 +Author: Adrian Johnson <ajohnson@redneon.com> +Date: Sat Sep 14 14:08:11 2013 +0930 + + pdfimages.1: fix typo + + utils/pdfimages.1 | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +commit 9b5957278c7f249fa1010e61a0ed79f0eb20e26d +Author: Adrian Johnson <ajohnson@redneon.com> +Date: Sat Aug 31 17:33:25 2013 +0930 + + pdfimages: ensure dump* variables are intialized + + utils/ImageOutputDev.cc | 3 +++ + 1 file changed, 3 insertions(+) + +commit e116ef32504b589001814f0f579309ecf7ec89d9 +Author: Adrian Johnson <ajohnson@redneon.com> +Date: Wed Aug 28 08:05:23 2013 +0930 + + Make cpp/poppler-image.cc use goo/NetPBMWriter + + cpp/CMakeLists.txt | 1 - + cpp/Makefile.am | 2 - + cpp/PNMWriter.cc | 119 + -------------------------------------------------- + cpp/PNMWriter.h | 43 ------------------ + cpp/poppler-image.cpp | 14 +++--- + 5 files changed, 6 insertions(+), 173 deletions(-) + +commit a87a11ee6bbd0f5707a3ac34ac2b9cc79f4e92d0 +Author: Adrian Johnson <ajohnson@redneon.com> +Date: Thu Aug 29 22:42:34 2013 +0930 + + pdfimages: support cmyk tiff output + + If -tiff is specified, CMYK images will be written as CMYK TIFF files + instead of converting to RGB. If both -png and -tiff are specified (as + is the case with the -all option), CMYK images are written as TIFF and + all other types as PNG. + + utils/ImageOutputDev.cc | 32 +++++++++++++++++++++++++++++++- + utils/ImageOutputDev.h | 3 ++- + utils/pdfimages.1 | 13 ++++++++----- + utils/pdfimages.cc | 3 ++- + 4 files changed, 43 insertions(+), 8 deletions(-) + +commit 63da26f8fb0b2b5ffaa127762d4e36d995c482ee +Author: Thomas Freitag <Thomas.Freitag@alfa.de> +Date: Tue Aug 27 20:40:29 2013 +0200 + + resolve copy&paste error + + poppler/GfxState.cc | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + commit 563da2d375c003478d398897796ecbf45ce03482 Author: Albert Astals Cid <aacid@kde.org> -Date: Mon Aug 26 22:33:10 2013 +0200 +Date: Mon Aug 26 22:33:10 2013 +0200 0.24.1 CMakeLists.txt | 2 +- - NEWS | 23 +++++++++++++++++++++++ - configure.ac | 2 +- - cpp/Doxyfile | 2 +- + NEWS | 23 +++++++++++++++++++++++ + configure.ac | 2 +- + cpp/Doxyfile | 2 +- qt4/src/Doxyfile | 2 +- qt5/src/Doxyfile | 2 +- 6 files changed, 28 insertions(+), 5 deletions(-) commit 2c73f1ea9116172692d8350cb7adf1b5376f795c Author: Albert Astals Cid <aacid@kde.org> -Date: Mon Aug 26 21:50:51 2013 +0200 +Date: Mon Aug 26 21:50:51 2013 +0200 Fix typo qt5/src/poppler-qt5.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) +commit f58e9b64d5cf62906876c5c0f8da0f3c2c6c2bac +Author: Albert Astals Cid <aacid@kde.org> +Date: Mon Aug 26 00:27:59 2013 +0200 + + Some more files Adrian has changed + + goo/PNGWriter.h | 2 +- + utils/HtmlOutputDev.cc | 2 +- + utils/pdftocairo.cc | 2 +- + 3 files changed, 3 insertions(+), 3 deletions(-) + commit 16da389c61c495111a5a49f62539a423a0655c28 Author: Adrian Johnson <ajohnson@redneon.com> -Date: Mon Aug 26 07:50:51 2013 +0930 +Date: Mon Aug 26 07:50:51 2013 +0930 fix typo in pdfimages.1 utils/pdfimages.1 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) +commit 56c0d4f3a231dca141c06493b50ab25959b5b15c +Author: Adrian Johnson <ajohnson@redneon.com> +Date: Mon Aug 26 07:47:46 2013 +0930 + + fix typo in pdfimages.1 + + utils/pdfimages.1 | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +commit af4f2b775946815b572622bf4c4d42ad3aea1141 +Author: Adrian Johnson <ajohnson@redneon.com> +Date: Sat Aug 24 21:25:51 2013 +0930 + + pdfimages: Add -all option to write all image in their native format + + utils/pdfimages.1 | 4 ++++ + utils/pdfimages.cc | 23 +++++++++++++++++------ + 2 files changed, 21 insertions(+), 6 deletions(-) + +commit 25e96b6ddbbe54a75ddb97d2e235c1bd6033fe79 +Author: Adrian Johnson <ajohnson@redneon.com> +Date: Wed Aug 21 22:22:28 2013 +0930 + + pdfimages: support ccitt output + + poppler/Stream.h | 5 +++++ + utils/ImageOutputDev.cc | 35 +++++++++++++++++++++++++++++++++++ + utils/ImageOutputDev.h | 4 ++++ + utils/pdfimages.1 | 39 ++++++++++++++++++++++++++++++++++++++- + utils/pdfimages.cc | 4 ++++ + 5 files changed, 86 insertions(+), 1 deletion(-) + +commit 086413263cb63a24d9492fbe534fdcc34b45951a +Author: Adrian Johnson <ajohnson@redneon.com> +Date: Sun Aug 18 20:37:01 2013 +0930 + + pdfimages: support JBIG2 output + + poppler/JBIG2Stream.h | 1 + + utils/ImageOutputDev.cc | 25 +++++++++++++++++++++++++ + utils/ImageOutputDev.h | 4 ++++ + utils/pdfimages.1 | 13 ++++++++----- + utils/pdfimages.cc | 4 ++++ + 5 files changed, 42 insertions(+), 5 deletions(-) + +commit 2845ebabd00a2755549b8db436e78a3e0e0c0713 +Author: Adrian Johnson <ajohnson@redneon.com> +Date: Sun Aug 18 20:07:31 2013 +0930 + + pdfimages: add support for writing JPEG2000 files + + utils/ImageOutputDev.cc | 4 ++++ + utils/ImageOutputDev.h | 4 ++++ + utils/pdfimages.1 | 12 ++++++++---- + utils/pdfimages.cc | 4 ++++ + 4 files changed, 20 insertions(+), 4 deletions(-) + +commit 2021c8ffcb36432049c4305e85ced2ae139086f3 +Author: Adrian Johnson <ajohnson@redneon.com> +Date: Sun Aug 18 17:29:00 2013 +0930 + + pdfimages: add support for png and tiff output + + utils/ImageOutputDev.cc | 67 + ++++++++++++++++++++++++++++++++++++++++++++++--- + utils/ImageOutputDev.h | 17 +++++++++++-- + utils/pdfimages.1 | 22 ++++++++++------ + utils/pdfimages.cc | 19 +++++++++++--- + 4 files changed, 110 insertions(+), 15 deletions(-) + +commit 8f466775c77b09a7114c688004317e6db05bcd3f +Author: Adrian Johnson <ajohnson@redneon.com> +Date: Sun Aug 18 16:08:02 2013 +0930 + + Change PNGWriter monochrome format to be 8 pixels/byte + + to be consistent with TiffWriter and NetPBMWriter + + goo/PNGWriter.cc | 4 ---- + goo/PNGWriter.h | 2 +- + utils/HtmlOutputDev.cc | 31 +++++++++++++++++++------------ + utils/ImageOutputDev.cc | 9 ++++++--- + utils/pdftocairo.cc | 2 +- + 5 files changed, 27 insertions(+), 21 deletions(-) + +commit e53aec2c61ba42cf0635dc05f8e27e3503c1eaac +Author: Adrian Johnson <ajohnson@redneon.com> +Date: Sun Aug 18 15:50:39 2013 +0930 + + Refactor ImageOutputDev to facilitate adding more output formats + + - Move PPM/PBM code into a NetPBMWriter class so PNGWriter and + TiffWritersupport be added. + + - Create generic WriteRawIMage function for writing jpeg files so + support for jpeg2000/jbig2 can be added. + + CMakeLists.txt | 1 + + goo/Makefile.am | 2 + + goo/NetPBMWriter.cc | 84 ++++++++++++++++ + goo/NetPBMWriter.h | 52 ++++++++++ + utils/ImageOutputDev.cc | 261 + +++++++++++++++++++++--------------------------- + utils/ImageOutputDev.h | 15 +-- + 6 files changed, 262 insertions(+), 153 deletions(-) + +commit 0ca0fcc9f536a57365048914cd8a8cc3eb5ed4fd +Author: Adrian Johnson <ajohnson@redneon.com> +Date: Sat Aug 17 15:24:43 2013 +0930 + + pdfimages: fix bug in -list output + + Images of type /ImageMask should have type 'stencil'. + + utils/ImageOutputDev.cc | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +commit f8ee5a931c795013d17f73f083b6e6f9a683d061 +Author: Adrian Johnson <ajohnson@redneon.com> +Date: Sat Aug 17 15:17:11 2013 +0930 + + pdfimages: print size, ratio, and ppi + + utils/ImageOutputDev.cc | 100 + ++++++++++++++++++++++++++++++++++++++++++++---- + utils/pdfimages.1 | 12 ++++++ + utils/pdfimages.cc | 2 +- + 3 files changed, 106 insertions(+), 8 deletions(-) + +commit b5321c4f40fb56b10f75c14c5c955c5775cf2ef9 +Author: Thomas Freitag <Thomas.Freitag@alfa.de> +Date: Sun Aug 25 20:13:12 2013 +0200 + + use getCMYK/DeviceNLine in CMYK mode if available + + Second part of bug 66928 + + poppler/GfxState.cc | 310 + ++++++++++++++++++++++++++++++++++++++++++++- + poppler/GfxState.h | 32 ++++- + poppler/SplashOutputDev.cc | 28 ++-- + splash/SplashTypes.h | 2 - + 4 files changed, 355 insertions(+), 17 deletions(-) + +commit d006ac567e59e82c4c6cb42c5e429a4aa516ac0b +Merge: d391af7 ed3585e +Author: Albert Astals Cid <aacid@kde.org> +Date: Sun Aug 25 19:36:33 2013 +0200 + + Merge remote-tracking branch 'origin/poppler-0.24' + commit ed3585efc8b259cb065eac361a6a499f9f26851f Author: William Bader <williambader@hotmail.com> -Date: Sun Aug 25 19:31:11 2013 +0200 +Date: Sun Aug 25 19:31:11 2013 +0200 Fix pdftops -eps -level1sep rendering of a file Since 8fb243bf11a979af8bfa36427436940706c9f71d we have - case splashModeXBGR8: - + cSrcNonIso[3] = 255; + case splashModeXBGR8: + + cSrcNonIso[3] = 255; and that means splashModeDeviceN8 and splashModeCMYK8 can't skip their breaks anymore otherwise the cSrcNonIso[3] gets overwritten @@ -302,9 +1473,70 @@ Date: Sun Aug 25 19:31:11 2013 +0200 splash/Splash.cc | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) +commit d391af7ea63c4bc884bb81895aea0cdd8f8b282a +Author: Albert Astals Cid <aacid@kde.org> +Date: Sat Aug 24 14:03:49 2013 +0200 + + Update copyrights + + poppler/Annot.cc | 1 + + poppler/Annot.h | 1 + + poppler/Catalog.cc | 2 ++ + poppler/Catalog.h | 2 ++ + poppler/Form.cc | 2 +- + poppler/Form.h | 1 + + poppler/Page.cc | 1 + + poppler/Page.h | 1 + + utils/pdfinfo.cc | 1 + + 9 files changed, 11 insertions(+), 1 deletion(-) + +commit a47b7f853174d6101f2b882a2db1a7dc95b33293 +Author: Adrian Johnson <ajohnson@redneon.com> +Date: Sat Aug 3 10:28:20 2013 +0930 + + Add pdfinfo option to print out javascript + + poppler/Catalog.h | 1 + + utils/JSInfo.cc | 164 + +++++++++++++++++++++++++++++++++++++++++------------- + utils/JSInfo.h | 12 +++- + utils/pdfinfo.1 | 3 + + utils/pdfinfo.cc | 10 ++++ + 5 files changed, 151 insertions(+), 39 deletions(-) + +commit 8f7155e7e3180bb1966a5e7df6af6acdd479939b +Author: Adrian Johnson <ajohnson@redneon.com> +Date: Sat Aug 3 09:05:21 2013 +0930 + + pdfinfo: indicate if pdf contains javascript + + poppler/Annot.cc | 27 ++++++++++ + poppler/Annot.h | 8 +++ + poppler/Catalog.cc | 26 +++++++++ + poppler/Catalog.h | 12 +++++ + poppler/Form.cc | 4 ++ + poppler/Form.h | 2 + + poppler/Page.cc | 20 +++++++ + poppler/Page.h | 10 +++- + utils/CMakeLists.txt | 4 ++ + utils/JSInfo.cc | 145 + +++++++++++++++++++++++++++++++++++++++++++++++++++ + utils/JSInfo.h | 50 ++++++++++++++++++ + utils/Makefile.am | 4 ++ + utils/pdfinfo.1 | 3 ++ + utils/pdfinfo.cc | 8 +++ + 14 files changed, 322 insertions(+), 1 deletion(-) + +commit c2453fc1307ebb222747f976e1311ecc5e99abfa +Merge: 3bb8c2e 70298a0 +Author: Albert Astals Cid <aacid@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.Freitag@alfa.de> -Date: Tue Aug 20 19:46:01 2013 +0200 +Date: Tue Aug 20 19:46:01 2013 +0200 Don't copy not needed bitmap @@ -314,9 +1546,16 @@ Date: Tue Aug 20 19:46:01 2013 +0200 poppler/SplashOutputDev.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) +commit 3bb8c2e34039cf473bf72ed9dab55664deab3ab7 +Merge: 71c1d16 fc78330 +Author: Albert Astals Cid <aacid@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 <aacid@kde.org> -Date: Tue Aug 20 00:37:56 2013 +0200 +Date: Tue Aug 20 00:37:56 2013 +0200 use getRGBLine images if available @@ -327,9 +1566,28 @@ Date: Tue Aug 20 00:37:56 2013 +0200 poppler/SplashOutputDev.cc | 30 +++++++++++++++++++----------- 1 file changed, 19 insertions(+), 11 deletions(-) +commit 71c1d162477a243db07b62ef3c056a2946f8986e +Merge: 7d1de78 678c767 +Author: Albert Astals Cid <aacid@kde.org> +Date: Sun Aug 18 16:41:20 2013 +0200 + + Merge remote-tracking branch 'origin/poppler-0.24' + +commit 7d1de78ad79162217ee0ca6c2e99ce51017a327d +Merge: 7e0d969 fbea224 +Author: Albert Astals Cid <aacid@kde.org> +Date: Sun Aug 18 16:40:34 2013 +0200 + + Merge commit 'origin/poppler-0.24~1' + + This is merging the revert commits with the "ours" strategy, so + it's virtually + doing nothing other than making the stable branch mergeable again + to master + commit 678c767584fa80620cc58a1d8a913cb3473209d4 Author: Albert Astals Cid <aacid@kde.org> -Date: Sun Aug 18 16:19:27 2013 +0200 +Date: Sun Aug 18 16:19:27 2013 +0200 Fix crash in 1026.asan.0.42.pdf @@ -340,7 +1598,7 @@ Date: Sun Aug 18 16:19:27 2013 +0200 commit fbea2241cccdde0106d2c34592b6ddda28a8d848 Author: Albert Astals Cid <aacid@kde.org> -Date: Sat Aug 17 01:32:51 2013 +0200 +Date: Sat Aug 17 01:32:51 2013 +0200 Revert "Tagged-PDF: Accessors in Catalog for the MarkInfo dictionary" @@ -354,7 +1612,7 @@ Date: Sat Aug 17 01:32:51 2013 +0200 commit 6d2771b8a8c0cb0f2288d0900fea3c9edc3dd172 Author: Albert Astals Cid <aacid@kde.org> -Date: Sat Aug 17 01:32:38 2013 +0200 +Date: Sat Aug 17 01:32:38 2013 +0200 Revert "pdfinfo: Use Catalog::getMarkInfo() to show mark info properties" @@ -366,9 +1624,16 @@ Date: Sat Aug 17 01:32:38 2013 +0200 utils/pdfinfo.cc | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) +commit 7e0d969dc2439637ab16e609df8223504316f87d +Merge: 6efc0c7 ef64206 +Author: Albert Astals Cid <aacid@kde.org> +Date: Sat Aug 17 01:13:30 2013 +0200 + + Merge remote-tracking branch 'origin/poppler-0.24' + commit ef6420656c7b88eb22a63ec2cb3e504e0bda0384 Author: Albert Astals Cid <aacid@kde.org> -Date: Sat Aug 17 01:11:37 2013 +0200 +Date: Sat Aug 17 01:11:37 2013 +0200 Fix jpeg image export @@ -380,7 +1645,7 @@ Date: Sat Aug 17 01:11:37 2013 +0200 commit 681f52a572b08c068cb376e5b2dc8a31676aad07 Author: Albert Astals Cid <aacid@kde.org> -Date: Fri Aug 16 23:58:44 2013 +0200 +Date: Fri Aug 16 23:58:44 2013 +0200 Fix exit(1) in 1026.asan.0.42.pdf @@ -391,7 +1656,7 @@ Date: Fri Aug 16 23:58:44 2013 +0200 commit 9f4d7796589e4c9c1645fbbcf0cfabd79a71bde9 Author: Thomas Freitag <Thomas.Freitag@alfa.de> -Date: Thu Aug 8 20:33:54 2013 +0200 +Date: Thu Aug 8 20:33:54 2013 +0200 use copyString where memory is freed with gfree @@ -403,7 +1668,7 @@ Date: Thu Aug 8 20:33:54 2013 +0200 commit 73cca518c479594e26605196d54b429fbf42dcdc Author: Adrian Perez de Castro <aperez@igalia.com> -Date: Thu Apr 25 09:52:56 2013 +0300 +Date: Thu Apr 25 09:52:56 2013 +0300 pdfinfo: Use Catalog::getMarkInfo() to show mark info properties @@ -412,7 +1677,7 @@ Date: Thu Apr 25 09:52:56 2013 +0300 commit 402ee8b4e31630a42a0a38db1d39164cc5789f3c Author: Adrian Perez de Castro <aperez@igalia.com> -Date: Thu Apr 25 09:52:56 2013 +0300 +Date: Thu Apr 25 09:52:56 2013 +0300 Tagged-PDF: Accessors in Catalog for the MarkInfo dictionary @@ -420,18 +1685,78 @@ Date: Thu Apr 25 09:52:56 2013 +0300 poppler/Catalog.h | 10 ++++++++++ 2 files changed, 55 insertions(+) +commit 6efc0c7ad97a82064a1e2c47e0b063b606e56bb7 +Author: Albert Astals Cid <aacid@kde.org> +Date: Fri Aug 16 23:31:54 2013 +0200 + + Remove unused xref member + + poppler/OptionalContent.h | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +commit cb5160aa74f64b78a20aaed4b89fead850b42e9b +Author: Albert Astals Cid <aacid@kde.org> +Date: Fri Aug 16 23:31:17 2013 +0200 + + Remove usnused objectNumberFirst member + + poppler/Hints.h | 3 +-- + 1 file changed, 1 insertion(+), 2 deletions(-) + +commit a642aad68733c25f4055c268d691eedcf4e14a22 +Author: Albert Astals Cid <aacid@kde.org> +Date: Fri Aug 16 23:30:50 2013 +0200 + + PNGWriterPrivate is actually a struct not a class + + goo/PNGWriter.h | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +commit 31947d413eae115acc147c33fc55b8ab4adccd91 +Author: Thomas Freitag <Thomas.Freitag@alfa.de> +Date: Tue Aug 13 19:39:30 2013 +0200 + + pdftoppm: Add thinlinemode option setting + + utils/pdftoppm.1 | 12 ++++++++++++ + utils/pdftoppm.cc | 17 +++++++++++++++-- + 2 files changed, 27 insertions(+), 2 deletions(-) + +commit 8a1740b0b6ee4b217ecbe9d0046e4afa491e9f17 +Merge: b27588c c3f953d +Author: Albert Astals Cid <aacid@kde.org> +Date: Mon Aug 12 22:47:44 2013 +0200 + + Merge remote-tracking branch 'origin/poppler-0.24' + commit c3f953dc87f83ac726f99cb8f1f959c486098391 Author: Yury G. Kudryashov <urkud.urkud@gmail.com> -Date: Sat Aug 10 21:43:57 2013 +0300 +Date: Sat Aug 10 21:43:57 2013 +0300 Fix a typo qt4/src/poppler-qt4.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) +commit b27588c4c946ef4f9a62248fbead4dffcb60b4d1 +Author: Yury G. Kudryashov <urkud.urkud@gmail.com> +Date: Mon Aug 12 22:42:13 2013 +0200 + + Fix indentation + + utils/pdftotext.cc | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +commit b8b5773386ee4f57e72c2b867421cdff8a2eab5a +Merge: 5f9d385 62d079b +Author: Albert Astals Cid <aacid@kde.org> +Date: Thu Aug 8 20:47:05 2013 +0200 + + Merge remote-tracking branch 'origin/poppler-0.24' + commit 62d079b40a2f816f59cc533b1624ea57458331f3 Author: Yury G. Kudryashov <urkud.urkud@gmail.com> -Date: Thu Aug 8 20:45:08 2013 +0200 +Date: Thu Aug 8 20:45:08 2013 +0200 Fix `pdftotext -bbox in.pdf -` @@ -442,9 +1767,16 @@ Date: Thu Aug 8 20:45:08 2013 +0200 utils/pdftotext.cc | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) +commit 5f9d385dbec3148614b84ae24cae47177e18dbfc +Merge: af450a8 86dbc5f +Author: Albert Astals Cid <aacid@kde.org> +Date: Thu Aug 8 20:41:25 2013 +0200 + + Merge remote-tracking branch 'origin/poppler-0.24' + commit 86dbc5f6f850ba3919bed9979386e5a4d0e7dba3 Author: Yury G. Kudryashov <urkud.urkud@gmail.com> -Date: Thu Aug 8 20:39:30 2013 +0200 +Date: Thu Aug 8 20:39:30 2013 +0200 pdfdetach: don't mention xpdfrc @@ -457,9 +1789,52 @@ Date: Thu Aug 8 20:39:30 2013 +0200 utils/pdfdetach.cc | 6 ++---- 2 files changed, 5 insertions(+), 24 deletions(-) +commit af450a885ede5a3eac1a12734310722963764d83 +Author: Thomas Freitag <Thomas.Freitag@alfa.de> +Date: Thu Aug 8 20:33:54 2013 +0200 + + use copyString where memory is freed with gfree + + Bug #67666 + + poppler/Annot.cc | 2 +- + poppler/Dict.cc | 2 +- + 2 files changed, 2 insertions(+), 2 deletions(-) + +commit 030ee12875a562f5976c5569d5c76783aadf89bd +Author: Adrian Perez de Castro <aperez@igalia.com> +Date: Thu Apr 25 09:52:56 2013 +0300 + + pdfinfo: Use Catalog::getMarkInfo() to show mark info properties + + utils/pdfinfo.cc | 8 ++++++-- + 1 file changed, 6 insertions(+), 2 deletions(-) + +commit 9a232273988c0d2fd752dc2016e5111227ae6646 +Author: Adrian Perez de Castro <aperez@igalia.com> +Date: Thu Apr 25 09:52:56 2013 +0300 + + Tagged-PDF: Accessors in Catalog for the MarkInfo dictionary + + poppler/Catalog.cc | 45 +++++++++++++++++++++++++++++++++++++++++++++ + poppler/Catalog.h | 10 ++++++++++ + 2 files changed, 55 insertions(+) + commit 2724a7b9f723789491b4991ce7fe0cfa3e5488c3 Author: Carlos Garcia Campos <carlosgc@gnome.org> -Date: Tue Jul 30 09:36:44 2013 +0200 +Date: Tue Jul 30 09:36:44 2013 +0200 + + glib-demo: Remove GTK_DISABLE_DEPRECATED compilation flag + + Deprecations are now compile warnings, there's no reason to make them + fatal. + + glib/demo/Makefile.am | 1 - + 1 file changed, 1 deletion(-) + +commit ef9d861486d54fb3dcf7b8bca01bd44c3b3361a9 +Author: Carlos Garcia Campos <carlosgc@gnome.org> +Date: Tue Jul 30 09:36:44 2013 +0200 glib-demo: Remove GTK_DISABLE_DEPRECATED compilation flag @@ -471,14 +1846,14 @@ Date: Tue Jul 30 09:36:44 2013 +0200 commit eac752dc25942439de3e1c7a4ff815500a41dd2a Author: Albert Astals Cid <aacid@kde.org> -Date: Mon Jul 29 19:11:55 2013 +0200 +Date: Mon Jul 29 19:11:55 2013 +0200 0.24.0 CMakeLists.txt | 6 +++--- - NEWS | 7 +++++++ - configure.ac | 4 ++-- - cpp/Doxyfile | 2 +- + NEWS | 7 +++++++ + configure.ac | 4 ++-- + cpp/Doxyfile | 2 +- poppler/Makefile.am | 2 +- qt4/src/Doxyfile | 2 +- qt5/src/Doxyfile | 2 +- @@ -486,7 +1861,7 @@ Date: Mon Jul 29 19:11:55 2013 +0200 commit 892433a068a8a11c09a7c4f57c5fc941747c4453 Author: Albert Astals Cid <aacid@kde.org> -Date: Mon Jul 29 19:08:10 2013 +0200 +Date: Mon Jul 29 19:08:10 2013 +0200 Update Ed's copyright @@ -495,7 +1870,7 @@ Date: Mon Jul 29 19:08:10 2013 +0200 commit 4637b1581286381c3d1c6963828d9cd8afc5b9e0 Author: Albert Astals Cid <aacid@kde.org> -Date: Mon Jul 29 01:08:06 2013 +0200 +Date: Mon Jul 29 01:08:06 2013 +0200 Make some pdftops conversions *much* faster @@ -513,12 +1888,12 @@ Date: Mon Jul 29 01:08:06 2013 +0200 This has passed the pdf->ps regression test without a single issue poppler/PSOutputDev.cc | 42 ++++++++++-------------------------------- - poppler/PSOutputDev.h | 6 +++--- + poppler/PSOutputDev.h | 6 +++--- 2 files changed, 13 insertions(+), 35 deletions(-) commit e04287f2682e46831c04e0ef8d60411f521a2572 Author: Albert Astals Cid <aacid@kde.org> -Date: Mon Jul 29 00:55:43 2013 +0200 +Date: Mon Jul 29 00:55:43 2013 +0200 Fallback to 1x1 bitmap If we fail to create the corrent one @@ -527,7 +1902,7 @@ Date: Mon Jul 29 00:55:43 2013 +0200 commit fe5ff20cb93a70fa1650ef5e00b67e35de20f0ca Author: Albert Astals Cid <aacid@kde.org> -Date: Mon Jul 29 00:54:07 2013 +0200 +Date: Mon Jul 29 00:54:07 2013 +0200 Initialize t3FillColorOnly @@ -536,7 +1911,7 @@ Date: Mon Jul 29 00:54:07 2013 +0200 commit 19930d9f104b63070dcd7636758eb8b90a86fc0d Author: Ed Catmur <ed@catmur.co.uk> -Date: Sun Jul 21 11:07:00 2013 +0200 +Date: Sun Jul 21 11:07:00 2013 +0200 TextOutputDev: Do not draw ligatures more than once when selected @@ -552,27 +1927,27 @@ Date: Sun Jul 21 11:07:00 2013 +0200 commit 6b451b2d3f785c28d98907ae338d58380db518d2 Author: Albert Astals Cid <aacid@kde.org> -Date: Fri Jul 19 02:55:29 2013 +0200 +Date: Fri Jul 19 02:55:29 2013 +0200 0.23.4 - CMakeLists.txt | 4 +-- - NEWS | 8 ++++++ - configure.ac | 2 +- - cpp/Doxyfile | 2 +- - gtk-doc.make | 70 + CMakeLists.txt | 4 +-- + NEWS | 8 ++++++ + configure.ac | 2 +- + cpp/Doxyfile | 2 +- + gtk-doc.make | 70 +++++++++++++++++++++++++++++++----------------- - m4/gtk-doc.m4 | 6 ++++- + m4/gtk-doc.m4 | 6 ++++- poppler/CairoOutputDev.h | 2 +- - poppler/Makefile.am | 2 +- + poppler/Makefile.am | 2 +- poppler/TextOutputDev.cc | 2 +- - qt4/src/Doxyfile | 2 +- - qt5/src/Doxyfile | 2 +- + qt4/src/Doxyfile | 2 +- + qt5/src/Doxyfile | 2 +- 11 files changed, 67 insertions(+), 35 deletions(-) commit 6cf43442e38c501b49293a28f38e06ab143852c6 Author: Ed Catmur <ed@catmur.co.uk> -Date: Thu Jul 18 10:34:29 2013 +0200 +Date: Thu Jul 18 10:34:29 2013 +0200 TextOutputDev: clip the selected text rendering to the selection box @@ -588,7 +1963,7 @@ Date: Thu Jul 18 10:34:29 2013 +0200 commit 269b3f3d572a15f1007f8cc84f758b1a293ef8af Author: Carlos Garcia Campos <carlosgc@gnome.org> -Date: Mon Jul 8 20:19:30 2013 +0200 +Date: Mon Jul 8 20:19:30 2013 +0200 build: Make -lpthread take preference over -pthread @@ -602,11 +1977,11 @@ Date: Mon Jul 8 20:19:30 2013 +0200 commit 40f857d27930aa002a99c96f3892c5e240e7ecb5 Author: Carlos Garcia Campos <carlosgc@gnome.org> -Date: Mon Jul 8 19:55:10 2013 +0200 +Date: Mon Jul 8 19:55:10 2013 +0200 m4: Replace old acx_pthread.m4 with new one ax_pthread.m4 - configure.ac | 2 +- + configure.ac | 2 +- m4/acx_pthread.m4 | 280 ----------------------------------------------- m4/ax_pthread.m4 | 317 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ @@ -614,7 +1989,7 @@ Date: Mon Jul 8 19:55:10 2013 +0200 commit 44b7070aa713b2e20eb97b868000d432e2f8504e Author: Pino Toscano <pino@kde.org> -Date: Mon Jul 8 19:42:15 2013 +0200 +Date: Mon Jul 8 19:42:15 2013 +0200 cmake: improve linking with pthreads @@ -626,7 +2001,7 @@ Date: Mon Jul 8 19:42:15 2013 +0200 commit 69c281fdcf23520151c0eb5471a4259c73fa1273 Author: Carlos Garcia Campos <carlosgc@gnome.org> -Date: Sun Jul 7 11:51:27 2013 +0200 +Date: Sun Jul 7 11:51:27 2013 +0200 cairo: Fix the bounding box of images saved in CairoImageOutputDev @@ -640,7 +2015,7 @@ Date: Sun Jul 7 11:51:27 2013 +0200 commit 759e0266b36c4ea9f66912f1e53ed6392dbfd6da Author: Albert Astals Cid <aacid@kde.org> -Date: Tue Jul 2 00:47:13 2013 +0200 +Date: Tue Jul 2 00:47:13 2013 +0200 News for 0.23.3 @@ -651,14 +2026,14 @@ Date: Tue Jul 2 00:47:13 2013 +0200 commit df1fe9dc7ade5228e37c16c6f0c9a2d4890fdc90 Author: Albert Astals Cid <aacid@kde.org> -Date: Tue Jul 2 00:33:04 2013 +0200 +Date: Tue Jul 2 00:33:04 2013 +0200 0.23.3 CMakeLists.txt | 4 ++-- - Makefile.am | 2 +- - configure.ac | 2 +- - cpp/Doxyfile | 2 +- + Makefile.am | 2 +- + configure.ac | 2 +- + cpp/Doxyfile | 2 +- poppler/Makefile.am | 2 +- qt4/src/Doxyfile | 2 +- qt5/src/Doxyfile | 2 +- @@ -666,25 +2041,25 @@ Date: Tue Jul 2 00:33:04 2013 +0200 commit df9d4fee17adfe003c822175b6921a3cd93675f6 Author: Albert Astals Cid <aacid@kde.org> -Date: Mon Jul 1 21:04:10 2013 +0200 +Date: Mon Jul 1 21:04:10 2013 +0200 Update copyrights - poppler/Annot.cc | 2 +- - poppler/Annot.h | 2 +- - poppler/Page.cc | 2 +- + poppler/Annot.cc | 2 +- + poppler/Annot.h | 2 +- + poppler/Page.cc | 2 +- poppler/TextOutputDev.cc | 2 +- poppler/TextOutputDev.h | 2 +- qt5/src/poppler-annotation.cc | 2 +- qt5/src/poppler-annotation.h | 2 +- qt5/src/poppler-document.cc | 2 +- qt5/src/poppler-link.cc | 2 +- - qt5/src/poppler-qt5.h | 2 +- + qt5/src/poppler-qt5.h | 2 +- 10 files changed, 10 insertions(+), 10 deletions(-) commit 67129e9db88e8332907407f14d3e09ee5c49e274 Author: Jason Crain <jason@aquaticape.us> -Date: Mon Jul 1 02:24:47 2013 -0500 +Date: Mon Jul 1 02:24:47 2013 -0500 Check for NULL in Page::getResourceDictCopy @@ -693,7 +2068,7 @@ Date: Mon Jul 1 02:24:47 2013 -0500 commit c376559bc412e90204162bb4b2d20cd586db70c1 Author: Carlos Garcia Campos <carlosgc@gnome.org> -Date: Sun Jun 30 13:14:07 2013 +0200 +Date: Sun Jun 30 13:14:07 2013 +0200 annots: Invalidate the appearance stream when annot properties change @@ -703,15 +2078,15 @@ Date: Sun Jun 30 13:14:07 2013 +0200 the core and fixes the appearance stream regeneration in the glib frontend too. - poppler/Annot.cc | 36 ++++++++++++++++++++++++++++++++++++ - poppler/Annot.h | 10 ++++++---- + poppler/Annot.cc | 36 ++++++++++++++++++++++++++++++++++++ + poppler/Annot.h | 10 ++++++---- qt4/src/poppler-annotation.cc | 34 ---------------------------------- qt5/src/poppler-annotation.cc | 34 ---------------------------------- 4 files changed, 42 insertions(+), 72 deletions(-) commit c746e8b38e821d1ebeaf52c4c816515bc3ddaaf6 Author: Carlos Garcia Campos <carlosgc@gnome.org> -Date: Sun Jun 30 11:44:59 2013 +0200 +Date: Sun Jun 30 11:44:59 2013 +0200 annots: Remove unused variable @@ -720,7 +2095,7 @@ Date: Sun Jun 30 11:44:59 2013 +0200 commit 7d9d5d2518f7760e6a4317a358040ddd9164fdef Author: Carlos Garcia Campos <carlosgc@gnome.org> -Date: Sun Jun 30 11:40:15 2013 +0200 +Date: Sun Jun 30 11:40:15 2013 +0200 annots: Do not update AP and AS entries if they are not present when invaliding the appaearance stream @@ -730,7 +2105,7 @@ Date: Sun Jun 30 11:40:15 2013 +0200 commit 347b53f7fca644564724c230fe6c0dcbffa0d6f9 Author: Carlos Garcia Campos <carlosgc@gnome.org> -Date: Sun Jun 30 11:23:54 2013 +0200 +Date: Sun Jun 30 11:23:54 2013 +0200 annots: do not set the default appearance state when invalidating appearances @@ -746,7 +2121,7 @@ Date: Sun Jun 30 11:23:54 2013 +0200 commit b5e9941c145fc99e03a28d92a50840638895908d Author: Albert Astals Cid <aacid@kde.org> -Date: Mon Jul 1 00:32:51 2013 +0200 +Date: Mon Jul 1 00:32:51 2013 +0200 Fix crash on malformed doc @@ -758,7 +2133,7 @@ Date: Mon Jul 1 00:32:51 2013 +0200 commit 19f8a88bba6022b8172477e6f52dfd36b2fc5e92 Author: Fabio D'Urso <fabiodurso@hotmail.it> -Date: Thu Mar 7 00:20:15 2013 +0100 +Date: Thu Mar 7 00:20:15 2013 +0100 qt5: Free some temporary memory in TextAnnotationPrivate::createNativeAnnot @@ -770,7 +2145,7 @@ Date: Thu Mar 7 00:20:15 2013 +0100 commit 8bac4d1e43ce9a4c66fddc8430d7bed2d9aabba1 Author: Fabio D'Urso <fabiodurso@hotmail.it> -Date: Tue Jun 25 20:09:00 2013 +0200 +Date: Tue Jun 25 20:09:00 2013 +0200 qt5: Some documentation about annotations @@ -793,7 +2168,7 @@ Date: Tue Jun 25 20:09:00 2013 +0200 commit 1d5fe3f20189fd3928121e954bcc8fa7278b39fb Author: Fabio D'Urso <fabiodurso@hotmail.it> -Date: Sat Mar 2 19:06:49 2013 +0100 +Date: Sat Mar 2 19:06:49 2013 +0100 qt5: FixedRotation annotations' coordinate conversion @@ -805,21 +2180,21 @@ Date: Sat Mar 2 19:06:49 2013 +0100 clients will need to set geometry-related annotation properties in the following order: 1) flags (because we need to know if this is a FixedRotation - annotation or not) + annotation or not) 2) boundary (because we need to know what the topleft corner is, - so that we can construct the conversion matrix) + so that we can construct the conversion matrix) 3) anything else This requirement will be documented in the next patch qt5/src/poppler-annotation-private.h | 7 ++- - qt5/src/poppler-annotation.cc | 111 + qt5/src/poppler-annotation.cc | 111 +++++++++++++++++++++++++++-------- 2 files changed, 92 insertions(+), 26 deletions(-) commit ab130c91492765f8be29ed112dd2e2e6f665641b Author: Fabio D'Urso <fabiodurso@hotmail.it> -Date: Sat Mar 2 00:55:58 2013 +0100 +Date: Sat Mar 2 00:55:58 2013 +0100 core: Remove geometry-related arguments from annotation constructors @@ -846,20 +2221,20 @@ Date: Sat Mar 2 00:55:58 2013 +0100 commit 35cfb6914e1be4c5eda2f355900b1a0a1fa69d19 Author: Fabio D'Urso <fabiodurso@hotmail.it> -Date: Fri Feb 15 12:24:18 2013 +0100 +Date: Fri Feb 15 12:24:18 2013 +0100 poppler_qt5viewer: Add combobox to select rotation qt5/demos/navigationtoolbar.cpp | 15 +++++++++++++++ - qt5/demos/navigationtoolbar.h | 4 ++++ - qt5/demos/pageview.cpp | 24 +++++++++++++++++++++++- - qt5/demos/pageview.h | 3 +++ - qt5/demos/viewer.cpp | 2 ++ + qt5/demos/navigationtoolbar.h | 4 ++++ + qt5/demos/pageview.cpp | 24 +++++++++++++++++++++++- + qt5/demos/pageview.h | 3 +++ + qt5/demos/viewer.cpp | 2 ++ 5 files changed, 47 insertions(+), 1 deletion(-) commit de2a93c0bc6e92a95c687796f59780c998b90ca4 Author: Fabio D'Urso <fabiodurso@hotmail.it> -Date: Thu Mar 7 00:20:15 2013 +0100 +Date: Thu Mar 7 00:20:15 2013 +0100 qt4: Free some temporary memory in TextAnnotationPrivate::createNativeAnnot @@ -871,7 +2246,7 @@ Date: Thu Mar 7 00:20:15 2013 +0100 commit 738b0b4fedaa2b2b28ea1c11622dfd880180d1c9 Author: Fabio D'Urso <fabiodurso@hotmail.it> -Date: Thu Mar 7 20:50:52 2013 +0100 +Date: Thu Mar 7 20:50:52 2013 +0100 qt4: Some documentation about annotations @@ -894,7 +2269,7 @@ Date: Thu Mar 7 20:50:52 2013 +0100 commit cf950a2b7e8278e70719c67b441b0d324ffd0399 Author: Fabio D'Urso <fabiodurso@hotmail.it> -Date: Sat Mar 2 19:06:49 2013 +0100 +Date: Sat Mar 2 19:06:49 2013 +0100 qt4: FixedRotation annotations' coordinate conversion @@ -906,23 +2281,23 @@ Date: Sat Mar 2 19:06:49 2013 +0100 clients will need to set geometry-related annotation properties in the following order: 1) flags (because we need to know if this is a FixedRotation - annotation or not) + annotation or not) 2) boundary (because we need to know what the topleft corner is, - so that we can construct the conversion matrix) + so that we can construct the conversion matrix) 3) anything else This requirement will be documented in the next patch - poppler/Annot.cc | 8 +++ - poppler/Annot.h | 2 + + poppler/Annot.cc | 8 +++ + poppler/Annot.h | 2 + qt4/src/poppler-annotation-private.h | 7 ++- - qt4/src/poppler-annotation.cc | 111 + qt4/src/poppler-annotation.cc | 111 +++++++++++++++++++++++++++-------- 4 files changed, 102 insertions(+), 26 deletions(-) commit 4b13085568df09d8b75099f6a5438f025a028fd5 Author: Fabio D'Urso <fabiodurso@hotmail.it> -Date: Sat Mar 2 00:55:58 2013 +0100 +Date: Sat Mar 2 00:55:58 2013 +0100 core: Remove geometry-related arguments from annotation constructors @@ -944,28 +2319,28 @@ Date: Sat Mar 2 00:55:58 2013 +0100 - AnnotPolygon - AnnotInk - poppler/Annot.cc | 56 + poppler/Annot.cc | 56 +++++++++++++------------------------------ - poppler/Annot.h | 9 ++++--- + poppler/Annot.h | 9 ++++--- qt4/src/poppler-annotation.cc | 34 +++++++++++++------------- 3 files changed, 39 insertions(+), 60 deletions(-) commit 5923cfb5f7e3a0703de17e21f4952f92a44f3c14 Author: Fabio D'Urso <fabiodurso@hotmail.it> -Date: Fri Feb 15 12:24:18 2013 +0100 +Date: Fri Feb 15 12:24:18 2013 +0100 poppler_qt4viewer: Add combobox to select rotation qt4/demos/navigationtoolbar.cpp | 15 +++++++++++++++ - qt4/demos/navigationtoolbar.h | 4 ++++ - qt4/demos/pageview.cpp | 24 +++++++++++++++++++++++- - qt4/demos/pageview.h | 3 +++ - qt4/demos/viewer.cpp | 2 ++ + qt4/demos/navigationtoolbar.h | 4 ++++ + qt4/demos/pageview.cpp | 24 +++++++++++++++++++++++- + qt4/demos/pageview.h | 3 +++ + qt4/demos/viewer.cpp | 2 ++ 5 files changed, 47 insertions(+), 1 deletion(-) commit 74ea15cc454f31b772e71b3525b71045dbfa5527 Author: Fabio D'Urso <fabiodurso@hotmail.it> -Date: Tue Jun 25 19:56:20 2013 +0200 +Date: Tue Jun 25 19:56:20 2013 +0200 core: Support for rendering annotations with flagNoRotate @@ -975,12 +2350,12 @@ Date: Tue Jun 25 19:56:20 2013 +0200 ++++++++++++++++++++++++++++++++++++------------------- poppler/Annot.h | 3 ++- poppler/Gfx.cc | 41 +++++++++++++++++++++++++++++++++++++---- - poppler/Gfx.h | 3 ++- + poppler/Gfx.h | 3 ++- 4 files changed, 77 insertions(+), 25 deletions(-) commit 2639957ba78defd2ab6282679375fb7969bad21f Author: Fabio D'Urso <fabiodurso@hotmail.it> -Date: Wed Jun 26 23:12:40 2013 +0200 +Date: Wed Jun 26 23:12:40 2013 +0200 Do not crash in page::removeAnnot if there are non-Ref entries in /Annots @@ -990,7 +2365,7 @@ Date: Wed Jun 26 23:12:40 2013 +0200 commit ae016aa263c218fbfbd607cc92feac1013348c7e Author: Albert Astals Cid <aacid@kde.org> -Date: Wed Jun 26 11:33:55 2013 +0200 +Date: Wed Jun 26 11:33:55 2013 +0200 Fix qt5 found/not found logic @@ -1000,13 +2375,13 @@ Date: Wed Jun 26 11:33:55 2013 +0200 commit e27c1057caf4d878a0dc43c92c9e0b565db8fe40 Merge: c55b577 ee8cfbc Author: Albert Astals Cid <aacid@kde.org> -Date: Tue Jun 25 19:17:13 2013 +0200 +Date: Tue Jun 25 19:17:13 2013 +0200 Merge remote-tracking branch 'origin/qt5' commit c55b577ce69ad4bb69f5261b3e120e92c9fdb3d0 Author: Carlos Garcia Campos <carlosgc@gnome.org> -Date: Tue Jun 25 10:01:38 2013 +0200 +Date: Tue Jun 25 10:01:38 2013 +0200 glib: Use TextPage::getSelectionWords to build text layout and attributes @@ -1026,7 +2401,7 @@ Date: Tue Jun 25 10:01:38 2013 +0200 commit fc534f571315c064005515c19d7d70ad3af1563e Author: Carlos Garcia Campos <carlosgc@gnome.org> -Date: Tue Jun 25 10:05:01 2013 +0200 +Date: Tue Jun 25 10:05:01 2013 +0200 TextOutputDev: add a method to TextPage to get the selection as a list of words @@ -1039,7 +2414,7 @@ Date: Tue Jun 25 10:05:01 2013 +0200 commit a924246b7534e86165f8e9ab6c60d56b73a17b94 Author: Carlos Garcia Campos <carlosgc@gnome.org> -Date: Tue Jun 25 09:57:48 2013 +0200 +Date: Tue Jun 25 09:57:48 2013 +0200 TextOutputDev: simplify the text selection dumper @@ -1052,7 +2427,7 @@ Date: Tue Jun 25 09:57:48 2013 +0200 commit c849094a2daf896d085937adff1f7659a09da062 Author: Carlos Garcia Campos <carlosgc@gnome.org> -Date: Mon Jun 24 18:29:11 2013 +0200 +Date: Mon Jun 24 18:29:11 2013 +0200 TextOutputDev: Move TextSelection class from TextSelectionPainter to TextSelectionVisitor @@ -1066,7 +2441,7 @@ Date: Mon Jun 24 18:29:11 2013 +0200 commit b3ff3f2c3e131556d2b27cbe52f0ddbbb4820c19 Author: Jason Crain <jason@aquaticape.us> -Date: Thu Jun 20 21:47:13 2013 -0500 +Date: Thu Jun 20 21:47:13 2013 -0500 Draw glyphs after selection background @@ -1084,7 +2459,7 @@ Date: Thu Jun 20 21:47:13 2013 -0500 commit ee8cfbc78fe9de109abbe0727a738870f6027a73 Author: Albert Astals Cid <aacid@kde.org> -Date: Tue Jun 18 23:20:01 2013 +0200 +Date: Tue Jun 18 23:20:01 2013 +0200 Fix indent @@ -1093,14 +2468,14 @@ Date: Tue Jun 18 23:20:01 2013 +0200 commit 9d0a5b6afb25a1273504383e108bdb95ca82f099 Author: Albert Astals Cid <aacid@kde.org> -Date: Tue Jun 18 23:19:30 2013 +0200 +Date: Tue Jun 18 23:19:30 2013 +0200 Bring changes from the qt4 dir - qt5/src/Doxyfile | 2 +- - qt5/src/poppler-private.h | 2 +- - qt5/tests/CMakeLists.txt | 1 + - qt5/tests/Makefile.am | 13 +- + qt5/src/Doxyfile | 2 +- + qt5/src/poppler-private.h | 2 +- + qt5/tests/CMakeLists.txt | 1 + + qt5/tests/Makefile.am | 13 +- qt5/tests/stress-threads-qt5.cpp | 304 +++++++++++++++++++++++++++++++++++++++ qt5/tests/test-poppler-qt5.cpp | 2 +- @@ -1108,30 +2483,30 @@ Date: Tue Jun 18 23:19:30 2013 +0200 commit 1adb1ab7aee026e227d25716a4b7be22b19b5b84 Author: Albert Astals Cid <aacid@kde.org> -Date: Tue Jun 18 20:50:49 2013 +0200 +Date: Tue Jun 18 20:50:49 2013 +0200 Make it build with autotools poppler/ArthurOutputDev.cc | 816 ------------------------------------------ poppler/ArthurOutputDev.h | 170 --------- - poppler/Makefile.am | 23 +- + poppler/Makefile.am | 23 +- qt4/src/ArthurOutputDev.cc | 816 ++++++++++++++++++++++++++++++++++++++++++ qt4/src/ArthurOutputDev.h | 170 +++++++++ qt4/src/CMakeLists.txt | 2 +- - qt4/src/Makefile.am | 5 +- + qt4/src/Makefile.am | 5 +- qt5/src/ArthurOutputDev.cc | 816 ++++++++++++++++++++++++++++++++++++++++++ qt5/src/ArthurOutputDev.h | 170 +++++++++ qt5/src/CMakeLists.txt | 2 +- - qt5/src/Makefile.am | 5 +- + qt5/src/Makefile.am | 5 +- qt5/src/poppler-optcontent.cc | 2 + 12 files changed, 1983 insertions(+), 1014 deletions(-) commit 93a1c2b768cc419c5bf9b3033bf85fb21326a65a Author: Albert Astals Cid <aacid@kde.org> -Date: Tue Jun 18 00:33:38 2013 +0200 +Date: Tue Jun 18 00:33:38 2013 +0200 If qmake gives us a Qt5 qmake try with qmake4 and qmake-qt4 @@ -1141,7 +2516,7 @@ Date: Tue Jun 18 00:33:38 2013 +0200 commit 7cc33a752ef864b595748ce7724ba553a8e3ba8e Author: Albert Astals Cid <aacid@kde.org> -Date: Mon Jun 17 22:57:56 2013 +0200 +Date: Mon Jun 17 22:57:56 2013 +0200 We are not compiling an executable @@ -1150,17 +2525,17 @@ Date: Mon Jun 17 22:57:56 2013 +0200 commit 87cfcd41e8e970186c6ce753aa660ef86aca8878 Author: Granger Anthony <grangeranthony@gmail.com> -Date: Mon Jun 17 09:17:51 2013 +0200 +Date: Mon Jun 17 09:17:51 2013 +0200 Allow to enable Qt5 support only with CMake >= 2.8.8 - CMakeLists.txt | 26 ++++++++++++++++---------- + CMakeLists.txt | 26 ++++++++++++++++---------- qt5/tests/CMakeLists.txt | 1 - 2 files changed, 16 insertions(+), 11 deletions(-) commit b44c70f04758000cf0e049b06cc7864287570f7b Author: Albert Astals Cid <aacid@kde.org> -Date: Mon Jun 17 22:10:05 2013 +0200 +Date: Mon Jun 17 22:10:05 2013 +0200 Bring PIC back to the toplevel, still have linking errors tohugh :-/ @@ -1169,7 +2544,7 @@ Date: Mon Jun 17 22:10:05 2013 +0200 commit be49073f5ce79f56b38197758a5cf1253b972306 Author: Albert Astals Cid <aacid@kde.org> -Date: Mon Jun 17 21:50:31 2013 +0200 +Date: Mon Jun 17 21:50:31 2013 +0200 Use qtchooser if available @@ -1178,7 +2553,7 @@ Date: Mon Jun 17 21:50:31 2013 +0200 commit b1958228d4bc6793a3606b5e31c61a57b9fac9f5 Author: Albert Astals Cid <aacid@kde.org> -Date: Mon Jun 17 20:21:08 2013 +0200 +Date: Mon Jun 17 20:21:08 2013 +0200 No distro ships moc-qt5 but make it work in case someone would @@ -1187,41 +2562,41 @@ Date: Mon Jun 17 20:21:08 2013 +0200 commit 06f45c7177afc67e02985be1a97cd976c530c4ae Author: Albert Astals Cid <aacid@kde.org> -Date: Mon Jun 17 20:04:49 2013 +0200 +Date: Mon Jun 17 20:04:49 2013 +0200 Build fixes Fix moc when moc-qt4 is qt4 moc but moc is qt5 one Do not add -fPIE everywhere, just -fPIC to qt5 - configure.ac | 10 ++++++---- - qt5/src/Makefile.am | 2 +- + configure.ac | 10 ++++++---- + qt5/src/Makefile.am | 2 +- 2 files changed, 7 insertions(+), 5 deletions(-) commit cb617c21fba727781f46278f5475b91d528a488b Author: Albert Astals Cid <aacid@kde.org> -Date: Mon Jun 17 18:12:18 2013 +0200 +Date: Mon Jun 17 18:12:18 2013 +0200 Files i forgot poppler-qt5-uninstalled.pc.in | 7 +++++++ - poppler-qt5.pc.cmake | 13 +++++++++++++ - poppler-qt5.pc.in | 13 +++++++++++++ + poppler-qt5.pc.cmake | 13 +++++++++++++ + poppler-qt5.pc.in | 13 +++++++++++++ 3 files changed, 33 insertions(+) commit 5c521bba427eb163e4b77d936865fbdd0e07faf3 Author: Albert Astals Cid <aacid@kde.org> -Date: Mon Jun 17 18:12:07 2013 +0200 +Date: Mon Jun 17 18:12:07 2013 +0200 soversion 1 qt5/src/CMakeLists.txt | 2 +- - qt5/src/Makefile.am | 2 +- + qt5/src/Makefile.am | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) commit 43786964946b4f4c005a0526e16fead3ffa6ba4a Author: Albert Astals Cid <aacid@kde.org> -Date: Mon Jun 17 00:23:31 2013 +0200 +Date: Mon Jun 17 00:23:31 2013 +0200 harmonize spaces @@ -1230,23 +2605,23 @@ Date: Mon Jun 17 00:23:31 2013 +0200 commit 2e2ea27fe3dc688c87003d170b82451a6a872b0d Author: Albert Astals Cid <aacid@kde.org> -Date: Mon Jun 17 00:22:18 2013 +0200 +Date: Mon Jun 17 00:22:18 2013 +0200 Remove qt4 mentions - qt5/src/poppler-converter-private.h | 6 +++--- + qt5/src/poppler-converter-private.h | 6 +++--- qt5/src/poppler-embeddedfile-private.h | 2 +- - qt5/src/poppler-form.cc | 2 +- - qt5/src/poppler-form.h | 6 +++--- - qt5/src/poppler-pdf-converter.cc | 2 +- - qt5/src/poppler-private.cc | 4 ++-- - qt5/src/poppler-private.h | 2 +- - qt5/src/poppler-qt5.h | 2 +- + qt5/src/poppler-form.cc | 2 +- + qt5/src/poppler-form.h | 6 +++--- + qt5/src/poppler-pdf-converter.cc | 2 +- + qt5/src/poppler-private.cc | 4 ++-- + qt5/src/poppler-private.h | 2 +- + qt5/src/poppler-qt5.h | 2 +- 8 files changed, 13 insertions(+), 13 deletions(-) commit e2264ce82af3e971e34930f5307b7c9b43a1e346 Author: Albert Astals Cid <aacid@kde.org> -Date: Mon Jun 17 00:19:27 2013 +0200 +Date: Mon Jun 17 00:19:27 2013 +0200 remove deprecated stuff @@ -1256,7 +2631,7 @@ Date: Mon Jun 17 00:19:27 2013 +0200 qt5/src/poppler-link.cc | 5 -- qt5/src/poppler-link.h | 10 ---- qt5/src/poppler-page.cc | 18 ------- - qt5/src/poppler-qt5.h | 41 ---------------- + qt5/src/poppler-qt5.h | 41 ---------------- qt5/tests/check_fonts.cpp | 21 ++------- qt5/tests/check_metadata.cpp | 1 - qt5/tests/check_search.cpp | 107 @@ -1265,7 +2640,7 @@ Date: Mon Jun 17 00:19:27 2013 +0200 commit 21808e203eed46e379954b58b7014998b3836573 Author: Albert Astals Cid <aacid@kde.org> -Date: Mon Jun 17 00:03:45 2013 +0200 +Date: Mon Jun 17 00:03:45 2013 +0200 remove commented stuff @@ -1274,122 +2649,122 @@ Date: Mon Jun 17 00:03:45 2013 +0200 commit 16e7033f18a8da8e27aaed6f63cce156abf8837a Author: Albert Astals Cid <aacid@kde.org> -Date: Mon Jun 17 00:01:27 2013 +0200 +Date: Mon Jun 17 00:01:27 2013 +0200 Initial Qt5 port - CMakeLists.txt | 20 + - Makefile.am | 18 +- - configure.ac | 66 +- - qt5/.gitignore | 4 + - qt5/CMakeLists.txt | 3 + - qt5/Makefile.am | 1 + - qt5/demos/.gitignore | 4 + - qt5/demos/CMakeLists.txt | 38 + - qt5/demos/Makefile.am | 67 + - qt5/demos/abstractinfodock.cpp | 57 + - qt5/demos/abstractinfodock.h | 48 + - qt5/demos/documentobserver.cpp | 50 + - qt5/demos/documentobserver.h | 50 + - qt5/demos/embeddedfiles.cpp | 82 + - qt5/demos/embeddedfiles.h | 44 + - qt5/demos/fonts.cpp | 72 + - qt5/demos/fonts.h | 43 + - qt5/demos/info.cpp | 72 + - qt5/demos/info.h | 43 + - qt5/demos/main_viewer.cpp | 33 + - qt5/demos/metadata.cpp | 50 + - qt5/demos/metadata.h | 43 + - qt5/demos/navigationtoolbar.cpp | 129 + - qt5/demos/navigationtoolbar.h | 61 + - qt5/demos/optcontent.cpp | 69 + - qt5/demos/optcontent.h | 47 + - qt5/demos/pageview.cpp | 79 + - qt5/demos/pageview.h | 50 + - qt5/demos/permissions.cpp | 66 + - qt5/demos/permissions.h | 43 + - qt5/demos/thumbnails.cpp | 84 + - qt5/demos/thumbnails.h | 48 + - qt5/demos/toc.cpp | 88 + - qt5/demos/toc.h | 43 + - qt5/demos/viewer.cpp | 317 ++ - qt5/demos/viewer.h | 73 + - qt5/src/.gitignore | 9 + - qt5/src/CMakeLists.txt | 54 + - qt5/src/Doxyfile | 1637 ++++++++++ - qt5/src/Mainpage.dox | 85 + - qt5/src/Makefile.am | 73 + - qt5/src/poppler-annotation-helper.h | 198 ++ - qt5/src/poppler-annotation-private.h | 111 + - qt5/src/poppler-annotation.cc | 4394 + CMakeLists.txt | 20 + + Makefile.am | 18 +- + configure.ac | 66 +- + qt5/.gitignore | 4 + + qt5/CMakeLists.txt | 3 + + qt5/Makefile.am | 1 + + qt5/demos/.gitignore | 4 + + qt5/demos/CMakeLists.txt | 38 + + qt5/demos/Makefile.am | 67 + + qt5/demos/abstractinfodock.cpp | 57 + + qt5/demos/abstractinfodock.h | 48 + + qt5/demos/documentobserver.cpp | 50 + + qt5/demos/documentobserver.h | 50 + + qt5/demos/embeddedfiles.cpp | 82 + + qt5/demos/embeddedfiles.h | 44 + + qt5/demos/fonts.cpp | 72 + + qt5/demos/fonts.h | 43 + + qt5/demos/info.cpp | 72 + + qt5/demos/info.h | 43 + + qt5/demos/main_viewer.cpp | 33 + + qt5/demos/metadata.cpp | 50 + + qt5/demos/metadata.h | 43 + + qt5/demos/navigationtoolbar.cpp | 129 + + qt5/demos/navigationtoolbar.h | 61 + + qt5/demos/optcontent.cpp | 69 + + qt5/demos/optcontent.h | 47 + + qt5/demos/pageview.cpp | 79 + + qt5/demos/pageview.h | 50 + + qt5/demos/permissions.cpp | 66 + + qt5/demos/permissions.h | 43 + + qt5/demos/thumbnails.cpp | 84 + + qt5/demos/thumbnails.h | 48 + + qt5/demos/toc.cpp | 88 + + qt5/demos/toc.h | 43 + + qt5/demos/viewer.cpp | 317 ++ + qt5/demos/viewer.h | 73 + + qt5/src/.gitignore | 9 + + qt5/src/CMakeLists.txt | 54 + + qt5/src/Doxyfile | 1637 ++++++++++ + qt5/src/Mainpage.dox | 85 + + qt5/src/Makefile.am | 73 + + qt5/src/poppler-annotation-helper.h | 198 ++ + qt5/src/poppler-annotation-private.h | 111 + + qt5/src/poppler-annotation.cc | 4394 ++++++++++++++++++++++++++ - qt5/src/poppler-annotation.h | 921 ++++++ - qt5/src/poppler-base-converter.cc | 105 + - qt5/src/poppler-converter-private.h | 49 + - qt5/src/poppler-document.cc | 679 ++++ + qt5/src/poppler-annotation.h | 921 ++++++ + qt5/src/poppler-base-converter.cc | 105 + + qt5/src/poppler-converter-private.h | 49 + + qt5/src/poppler-document.cc | 679 ++++ qt5/src/poppler-embeddedfile-private.h | 42 + - qt5/src/poppler-embeddedfile.cc | 135 + - qt5/src/poppler-export.h | 17 + - qt5/src/poppler-fontinfo.cc | 149 + - qt5/src/poppler-form.cc | 416 +++ - qt5/src/poppler-form.h | 343 ++ + qt5/src/poppler-embeddedfile.cc | 135 + + qt5/src/poppler-export.h | 17 + + qt5/src/poppler-fontinfo.cc | 149 + + qt5/src/poppler-form.cc | 416 +++ + qt5/src/poppler-form.h | 343 ++ qt5/src/poppler-link-extractor-private.h | 57 + - qt5/src/poppler-link-extractor.cc | 84 + - qt5/src/poppler-link.cc | 711 +++++ - qt5/src/poppler-link.h | 612 ++++ - qt5/src/poppler-media.cc | 168 + - qt5/src/poppler-media.h | 100 + - qt5/src/poppler-movie.cc | 110 + - qt5/src/poppler-optcontent-private.h | 121 + - qt5/src/poppler-optcontent.cc | 427 +++ - qt5/src/poppler-optcontent.h | 77 + - qt5/src/poppler-page-private.h | 54 + + qt5/src/poppler-link-extractor.cc | 84 + + qt5/src/poppler-link.cc | 711 +++++ + qt5/src/poppler-link.h | 612 ++++ + qt5/src/poppler-media.cc | 168 + + qt5/src/poppler-media.h | 100 + + qt5/src/poppler-movie.cc | 110 + + qt5/src/poppler-optcontent-private.h | 121 + + qt5/src/poppler-optcontent.cc | 427 +++ + qt5/src/poppler-optcontent.h | 77 + + qt5/src/poppler-page-private.h | 54 + qt5/src/poppler-page-transition-private.h | 28 + - qt5/src/poppler-page-transition.cc | 95 + - qt5/src/poppler-page-transition.h | 148 + - qt5/src/poppler-page.cc | 744 +++++ - qt5/src/poppler-pdf-converter.cc | 115 + - qt5/src/poppler-private.cc | 292 ++ - qt5/src/poppler-private.h | 240 ++ - qt5/src/poppler-ps-converter.cc | 273 ++ + qt5/src/poppler-page-transition.cc | 95 + + qt5/src/poppler-page-transition.h | 148 + + qt5/src/poppler-page.cc | 744 +++++ + qt5/src/poppler-pdf-converter.cc | 115 + + qt5/src/poppler-private.cc | 292 ++ + qt5/src/poppler-private.h | 240 ++ + qt5/src/poppler-ps-converter.cc | 273 ++ qt5/src/poppler-qiodeviceoutstream-private.h | 47 + - qt5/src/poppler-qiodeviceoutstream.cc | 64 + - qt5/src/poppler-qt5.h | 1812 +++++++++++ - qt5/src/poppler-sound.cc | 132 + - qt5/src/poppler-textbox.cc | 63 + - qt5/tests/.gitignore | 30 + - qt5/tests/CMakeLists.txt | 75 + - qt5/tests/Makefile.am | 152 + - qt5/tests/README.unittest | 23 + - qt5/tests/check_actualtext.cpp | 33 + - qt5/tests/check_attachments.cpp | 157 + - qt5/tests/check_dateConversion.cpp | 142 + - qt5/tests/check_fonts.cpp | 248 ++ - qt5/tests/check_goostring.cpp | 61 + - qt5/tests/check_lexer.cpp | 128 + - qt5/tests/check_links.cpp | 96 + - qt5/tests/check_metadata.cpp | 275 ++ - qt5/tests/check_optcontent.cpp | 484 +++ - qt5/tests/check_pagelabelinfo.cpp | 43 + - qt5/tests/check_pagelayout.cpp | 49 + - qt5/tests/check_pagemode.cpp | 73 + - qt5/tests/check_password.cpp | 88 + - qt5/tests/check_permissions.cpp | 44 + - qt5/tests/check_search.cpp | 91 + - qt5/tests/check_strings.cpp | 250 ++ - qt5/tests/poppler-attachments.cpp | 39 + - qt5/tests/poppler-fonts.cpp | 89 + - qt5/tests/poppler-forms.cpp | 166 + - qt5/tests/poppler-texts.cpp | 40 + - qt5/tests/stress-poppler-dir.cpp | 67 + - qt5/tests/stress-poppler-qt5.cpp | 74 + - qt5/tests/test-password-qt5.cpp | 136 + - qt5/tests/test-poppler-qt5.cpp | 235 ++ + qt5/src/poppler-qiodeviceoutstream.cc | 64 + + qt5/src/poppler-qt5.h | 1812 +++++++++++ + qt5/src/poppler-sound.cc | 132 + + qt5/src/poppler-textbox.cc | 63 + + qt5/tests/.gitignore | 30 + + qt5/tests/CMakeLists.txt | 75 + + qt5/tests/Makefile.am | 152 + + qt5/tests/README.unittest | 23 + + qt5/tests/check_actualtext.cpp | 33 + + qt5/tests/check_attachments.cpp | 157 + + qt5/tests/check_dateConversion.cpp | 142 + + qt5/tests/check_fonts.cpp | 248 ++ + qt5/tests/check_goostring.cpp | 61 + + qt5/tests/check_lexer.cpp | 128 + + qt5/tests/check_links.cpp | 96 + + qt5/tests/check_metadata.cpp | 275 ++ + qt5/tests/check_optcontent.cpp | 484 +++ + qt5/tests/check_pagelabelinfo.cpp | 43 + + qt5/tests/check_pagelayout.cpp | 49 + + qt5/tests/check_pagemode.cpp | 73 + + qt5/tests/check_password.cpp | 88 + + qt5/tests/check_permissions.cpp | 44 + + qt5/tests/check_search.cpp | 91 + + qt5/tests/check_strings.cpp | 250 ++ + qt5/tests/poppler-attachments.cpp | 39 + + qt5/tests/poppler-fonts.cpp | 89 + + qt5/tests/poppler-forms.cpp | 166 + + qt5/tests/poppler-texts.cpp | 40 + + qt5/tests/stress-poppler-dir.cpp | 67 + + qt5/tests/stress-poppler-qt5.cpp | 74 + + qt5/tests/test-password-qt5.cpp | 136 + + qt5/tests/test-poppler-qt5.cpp | 235 ++ 106 files changed, 21480 insertions(+), 4 deletions(-) commit 714ee1e61d853394818dca7155b1b882408ffc6a Author: Albert Astals Cid <aacid@kde.org> -Date: Sun Jun 16 19:00:01 2013 +0200 +Date: Sun Jun 16 19:00:01 2013 +0200 Pass down the recursion param @@ -1400,7 +2775,7 @@ Date: Sun Jun 16 19:00:01 2013 +0200 commit 1f3e3828b9a57e044b86640b9bf9ad2437cc5656 Author: Albert Astals Cid <aacid@kde.org> -Date: Sat Jun 15 17:21:36 2013 +0200 +Date: Sat Jun 15 17:21:36 2013 +0200 Add quotes since use_cairo can have spaces @@ -1411,7 +2786,7 @@ Date: Sat Jun 15 17:21:36 2013 +0200 commit fe3ffab19d54326052fd0ff8ee3ee1feb9fa928c Author: Adam Reichold <adamreichold@myopera.com> -Date: Tue Jun 11 23:08:07 2013 +0200 +Date: Tue Jun 11 23:08:07 2013 +0200 Windows compile fixes @@ -1420,33 +2795,33 @@ Date: Tue Jun 11 23:08:07 2013 +0200 commit 99908cb0c8a784791ffa0682c8f105acdef0d5ab Author: Peter Breitenlohner <peb@mppmu.mpg.de> -Date: Tue Jun 11 10:02:01 2013 +0200 +Date: Tue Jun 11 10:02:01 2013 +0200 MinGW32 may or may not define __MINGW_PRINTF_FORMAT Moreover __USE_MINGW_ANSI_STDIO might be defined as 0 poppler/poppler-config.h.cmake | 2 +- - poppler/poppler-config.h.in | 2 +- + poppler/poppler-config.h.in | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) commit 0673f3d8024554c414f578e0770086f475e6a605 Author: Albert Astals Cid <aacid@kde.org> -Date: Tue Jun 11 00:19:19 2013 +0200 +Date: Tue Jun 11 00:19:19 2013 +0200 0.23.2 - CMakeLists.txt | 4 ++-- - NEWS | 12 ++++++++++++ - configure.ac | 2 +- - cpp/Doxyfile | 2 +- - poppler/Makefile.am | 2 +- - qt4/src/Doxyfile | 2 +- + CMakeLists.txt | 4 ++-- + NEWS | 12 ++++++++++++ + configure.ac | 2 +- + cpp/Doxyfile | 2 +- + poppler/Makefile.am | 2 +- + qt4/src/Doxyfile | 2 +- 6 files changed, 18 insertions(+), 6 deletions(-) commit 7f1bf8d94302c15a2ff68debfb6fba49df526d16 Author: Christoph Duelli <duelli@melosgmbh.de> -Date: Thu May 16 16:16:32 2013 +0200 +Date: Thu May 16 16:16:32 2013 +0200 Do not pollute global namespace with internal classes @@ -1458,7 +2833,7 @@ Date: Thu May 16 16:16:32 2013 +0200 commit 07992075a6d1d29db57f997f67d5a4a6deacbbb4 Merge: 4a0bd6f 25f453e Author: Albert Astals Cid <aacid@kde.org> -Date: Sun Jun 9 12:17:53 2013 +0200 +Date: Sun Jun 9 12:17:53 2013 +0200 Merge remote-tracking branch 'origin/poppler-0.22' diff --git a/Build/source/libs/poppler/poppler-0.24.4/ConfigureChecks.cmake b/Build/source/libs/poppler/poppler-0.25.0/ConfigureChecks.cmake index d3f57325720..d3f57325720 100644 --- a/Build/source/libs/poppler/poppler-0.24.4/ConfigureChecks.cmake +++ b/Build/source/libs/poppler/poppler-0.25.0/ConfigureChecks.cmake diff --git a/Build/source/libs/poppler/poppler-0.24.4/INSTALL b/Build/source/libs/poppler/poppler-0.25.0/INSTALL index 56b077d6a0b..56b077d6a0b 100644 --- a/Build/source/libs/poppler/poppler-0.24.4/INSTALL +++ b/Build/source/libs/poppler/poppler-0.25.0/INSTALL diff --git a/Build/source/libs/poppler/poppler-0.24.4/Makefile.am b/Build/source/libs/poppler/poppler-0.25.0/Makefile.am index e7e5bace9d4..e7e5bace9d4 100644 --- a/Build/source/libs/poppler/poppler-0.24.4/Makefile.am +++ b/Build/source/libs/poppler/poppler-0.25.0/Makefile.am diff --git a/Build/source/libs/poppler/poppler-0.24.4/NEWS b/Build/source/libs/poppler/poppler-0.25.0/NEWS index ff38e7f6e6b..fb08f79a763 100644 --- a/Build/source/libs/poppler/poppler-0.24.4/NEWS +++ b/Build/source/libs/poppler/poppler-0.25.0/NEWS @@ -1,3 +1,26 @@ +Release 0.25.0 + core: + * Annotation improvements + * Tagged PDF work + * Improve speed on some files using ICC color space + * Use ICC profile in OutputIntents. Bug #34053 + * Limit use of ZapfDingbats character names. Bug #60243 + * Splash: correction for knockout transparency groups + * regression test improvements + + utils: + * pdftoppm: Added thinlinemode option setting + * pdfinfo: Indicate if pdf contains javascript + * pdfinfo: Add option to print out javascript + * pdfimages: Print size, ratio, and ppi + * pdfimages: More image output format support + * pdfseparate: allow zero-padded pagespecs + + glib: + * Annotation improvements + * Add API to get text, text layout and text attributes for a given area + * demo improvements + Release 0.24.4 core: * Fix regression in broken endstream detection. Bug #70854 diff --git a/Build/source/libs/poppler/poppler-0.24.4/README b/Build/source/libs/poppler/poppler-0.25.0/README index fa223900fbf..fa223900fbf 100644 --- a/Build/source/libs/poppler/poppler-0.24.4/README +++ b/Build/source/libs/poppler/poppler-0.25.0/README diff --git a/Build/source/libs/poppler/poppler-0.24.4/README-XPDF b/Build/source/libs/poppler/poppler-0.25.0/README-XPDF index e97791ce5b2..e97791ce5b2 100644 --- a/Build/source/libs/poppler/poppler-0.24.4/README-XPDF +++ b/Build/source/libs/poppler/poppler-0.25.0/README-XPDF diff --git a/Build/source/libs/poppler/poppler-0.24.4/TODO b/Build/source/libs/poppler/poppler-0.25.0/TODO index e067c2a3156..e067c2a3156 100644 --- a/Build/source/libs/poppler/poppler-0.24.4/TODO +++ b/Build/source/libs/poppler/poppler-0.25.0/TODO diff --git a/Build/source/libs/poppler/poppler-0.24.4/config.h.cmake b/Build/source/libs/poppler/poppler-0.25.0/config.h.cmake index b707ba72249..b707ba72249 100644 --- a/Build/source/libs/poppler/poppler-0.24.4/config.h.cmake +++ b/Build/source/libs/poppler/poppler-0.25.0/config.h.cmake diff --git a/Build/source/libs/poppler/poppler-0.24.4/config.h.in b/Build/source/libs/poppler/poppler-0.25.0/config.h.in index 12fb1a09ec6..12fb1a09ec6 100644 --- a/Build/source/libs/poppler/poppler-0.24.4/config.h.in +++ b/Build/source/libs/poppler/poppler-0.25.0/config.h.in diff --git a/Build/source/libs/poppler/poppler-0.24.4/configure.ac b/Build/source/libs/poppler/poppler-0.25.0/configure.ac index 2f44f71ed9d..62f2a501cb0 100644 --- a/Build/source/libs/poppler/poppler-0.24.4/configure.ac +++ b/Build/source/libs/poppler/poppler-0.25.0/configure.ac @@ -1,6 +1,6 @@ m4_define([poppler_version_major],[0]) -m4_define([poppler_version_minor],[24]) -m4_define([poppler_version_micro],[4]) +m4_define([poppler_version_minor],[25]) +m4_define([poppler_version_micro],[0]) m4_define([poppler_version],[poppler_version_major.poppler_version_minor.poppler_version_micro]) AC_PREREQ(2.59) diff --git a/Build/source/libs/poppler/poppler-0.24.4/fofi/FoFiBase.cc b/Build/source/libs/poppler/poppler-0.25.0/fofi/FoFiBase.cc index 86bafd80208..86bafd80208 100644 --- a/Build/source/libs/poppler/poppler-0.24.4/fofi/FoFiBase.cc +++ b/Build/source/libs/poppler/poppler-0.25.0/fofi/FoFiBase.cc diff --git a/Build/source/libs/poppler/poppler-0.24.4/fofi/FoFiBase.h b/Build/source/libs/poppler/poppler-0.25.0/fofi/FoFiBase.h index d613acd2bb1..d613acd2bb1 100644 --- a/Build/source/libs/poppler/poppler-0.24.4/fofi/FoFiBase.h +++ b/Build/source/libs/poppler/poppler-0.25.0/fofi/FoFiBase.h diff --git a/Build/source/libs/poppler/poppler-0.24.4/fofi/FoFiEncodings.cc b/Build/source/libs/poppler/poppler-0.25.0/fofi/FoFiEncodings.cc index 5cea6fab7f1..5cea6fab7f1 100644 --- a/Build/source/libs/poppler/poppler-0.24.4/fofi/FoFiEncodings.cc +++ b/Build/source/libs/poppler/poppler-0.25.0/fofi/FoFiEncodings.cc diff --git a/Build/source/libs/poppler/poppler-0.24.4/fofi/FoFiEncodings.h b/Build/source/libs/poppler/poppler-0.25.0/fofi/FoFiEncodings.h index ab80ad362a6..ab80ad362a6 100644 --- a/Build/source/libs/poppler/poppler-0.24.4/fofi/FoFiEncodings.h +++ b/Build/source/libs/poppler/poppler-0.25.0/fofi/FoFiEncodings.h diff --git a/Build/source/libs/poppler/poppler-0.24.4/fofi/FoFiIdentifier.cc b/Build/source/libs/poppler/poppler-0.25.0/fofi/FoFiIdentifier.cc index be28e2568eb..be28e2568eb 100644 --- a/Build/source/libs/poppler/poppler-0.24.4/fofi/FoFiIdentifier.cc +++ b/Build/source/libs/poppler/poppler-0.25.0/fofi/FoFiIdentifier.cc diff --git a/Build/source/libs/poppler/poppler-0.24.4/fofi/FoFiIdentifier.h b/Build/source/libs/poppler/poppler-0.25.0/fofi/FoFiIdentifier.h index af1323b76d6..af1323b76d6 100644 --- a/Build/source/libs/poppler/poppler-0.24.4/fofi/FoFiIdentifier.h +++ b/Build/source/libs/poppler/poppler-0.25.0/fofi/FoFiIdentifier.h diff --git a/Build/source/libs/poppler/poppler-0.24.4/fofi/FoFiTrueType.cc b/Build/source/libs/poppler/poppler-0.25.0/fofi/FoFiTrueType.cc index cd11d6ff2c6..cd11d6ff2c6 100644 --- a/Build/source/libs/poppler/poppler-0.24.4/fofi/FoFiTrueType.cc +++ b/Build/source/libs/poppler/poppler-0.25.0/fofi/FoFiTrueType.cc diff --git a/Build/source/libs/poppler/poppler-0.24.4/fofi/FoFiTrueType.h b/Build/source/libs/poppler/poppler-0.25.0/fofi/FoFiTrueType.h index b40a44a8d70..b40a44a8d70 100644 --- a/Build/source/libs/poppler/poppler-0.24.4/fofi/FoFiTrueType.h +++ b/Build/source/libs/poppler/poppler-0.25.0/fofi/FoFiTrueType.h diff --git a/Build/source/libs/poppler/poppler-0.24.4/fofi/FoFiType1.cc b/Build/source/libs/poppler/poppler-0.25.0/fofi/FoFiType1.cc index 8fa10a016b6..8fa10a016b6 100644 --- a/Build/source/libs/poppler/poppler-0.24.4/fofi/FoFiType1.cc +++ b/Build/source/libs/poppler/poppler-0.25.0/fofi/FoFiType1.cc diff --git a/Build/source/libs/poppler/poppler-0.24.4/fofi/FoFiType1.h b/Build/source/libs/poppler/poppler-0.25.0/fofi/FoFiType1.h index f4e29b4ef0b..f4e29b4ef0b 100644 --- a/Build/source/libs/poppler/poppler-0.24.4/fofi/FoFiType1.h +++ b/Build/source/libs/poppler/poppler-0.25.0/fofi/FoFiType1.h diff --git a/Build/source/libs/poppler/poppler-0.24.4/fofi/FoFiType1C.cc b/Build/source/libs/poppler/poppler-0.25.0/fofi/FoFiType1C.cc index c4595a3260e..c4595a3260e 100644 --- a/Build/source/libs/poppler/poppler-0.24.4/fofi/FoFiType1C.cc +++ b/Build/source/libs/poppler/poppler-0.25.0/fofi/FoFiType1C.cc diff --git a/Build/source/libs/poppler/poppler-0.24.4/fofi/FoFiType1C.h b/Build/source/libs/poppler/poppler-0.25.0/fofi/FoFiType1C.h index 698dccd77fd..698dccd77fd 100644 --- a/Build/source/libs/poppler/poppler-0.24.4/fofi/FoFiType1C.h +++ b/Build/source/libs/poppler/poppler-0.25.0/fofi/FoFiType1C.h diff --git a/Build/source/libs/poppler/poppler-0.24.4/fofi/Makefile.am b/Build/source/libs/poppler/poppler-0.25.0/fofi/Makefile.am index c4654dd28b9..c4654dd28b9 100644 --- a/Build/source/libs/poppler/poppler-0.24.4/fofi/Makefile.am +++ b/Build/source/libs/poppler/poppler-0.25.0/fofi/Makefile.am diff --git a/Build/source/libs/poppler/poppler-0.24.4/goo/FixedPoint.cc b/Build/source/libs/poppler/poppler-0.25.0/goo/FixedPoint.cc index 26b2f0fe890..26b2f0fe890 100644 --- a/Build/source/libs/poppler/poppler-0.24.4/goo/FixedPoint.cc +++ b/Build/source/libs/poppler/poppler-0.25.0/goo/FixedPoint.cc diff --git a/Build/source/libs/poppler/poppler-0.24.4/goo/FixedPoint.h b/Build/source/libs/poppler/poppler-0.25.0/goo/FixedPoint.h index 99749802db7..99749802db7 100644 --- a/Build/source/libs/poppler/poppler-0.24.4/goo/FixedPoint.h +++ b/Build/source/libs/poppler/poppler-0.25.0/goo/FixedPoint.h diff --git a/Build/source/libs/poppler/poppler-0.24.4/goo/GooHash.cc b/Build/source/libs/poppler/poppler-0.25.0/goo/GooHash.cc index f4a92f17506..f4a92f17506 100644 --- a/Build/source/libs/poppler/poppler-0.24.4/goo/GooHash.cc +++ b/Build/source/libs/poppler/poppler-0.25.0/goo/GooHash.cc diff --git a/Build/source/libs/poppler/poppler-0.24.4/goo/GooHash.h b/Build/source/libs/poppler/poppler-0.25.0/goo/GooHash.h index eda19e31409..eda19e31409 100644 --- a/Build/source/libs/poppler/poppler-0.24.4/goo/GooHash.h +++ b/Build/source/libs/poppler/poppler-0.25.0/goo/GooHash.h diff --git a/Build/source/libs/poppler/poppler-0.24.4/goo/GooLikely.h b/Build/source/libs/poppler/poppler-0.25.0/goo/GooLikely.h index 724ccf00870..724ccf00870 100644 --- a/Build/source/libs/poppler/poppler-0.24.4/goo/GooLikely.h +++ b/Build/source/libs/poppler/poppler-0.25.0/goo/GooLikely.h diff --git a/Build/source/libs/poppler/poppler-0.24.4/goo/GooList.cc b/Build/source/libs/poppler/poppler-0.25.0/goo/GooList.cc index 6ce4952dc6a..6ce4952dc6a 100644 --- a/Build/source/libs/poppler/poppler-0.24.4/goo/GooList.cc +++ b/Build/source/libs/poppler/poppler-0.25.0/goo/GooList.cc diff --git a/Build/source/libs/poppler/poppler-0.24.4/goo/GooList.h b/Build/source/libs/poppler/poppler-0.25.0/goo/GooList.h index c83a0e36a8a..c83a0e36a8a 100644 --- a/Build/source/libs/poppler/poppler-0.24.4/goo/GooList.h +++ b/Build/source/libs/poppler/poppler-0.25.0/goo/GooList.h diff --git a/Build/source/libs/poppler/poppler-0.24.4/goo/GooMutex.h b/Build/source/libs/poppler/poppler-0.25.0/goo/GooMutex.h index e9d5a543ff7..e9d5a543ff7 100644 --- a/Build/source/libs/poppler/poppler-0.24.4/goo/GooMutex.h +++ b/Build/source/libs/poppler/poppler-0.25.0/goo/GooMutex.h diff --git a/Build/source/libs/poppler/poppler-0.24.4/goo/GooString.cc b/Build/source/libs/poppler/poppler-0.25.0/goo/GooString.cc index d35161d87ad..e27f1588f1f 100644 --- a/Build/source/libs/poppler/poppler-0.24.4/goo/GooString.cc +++ b/Build/source/libs/poppler/poppler-0.25.0/goo/GooString.cc @@ -23,6 +23,7 @@ // Copyright (C) 2012 Fabio D'Urso <fabiodurso@hotmail.it> // Copyright (C) 2012 Adrian Johnson <ajohnson@redneon.com> // Copyright (C) 2012 Pino Toscano <pino@kde.org> +// Copyright (C) 2013 Jason Crain <jason@aquaticape.us> // // To see a description of the changes please see the Changelog file that // came with your tarball or type make ChangeLog if you are building from git @@ -893,6 +894,15 @@ int GooString::cmpN(const char *sA, int n) const { return 0; } +GBool GooString::endsWith(const char *suffix) const { + int suffixLen = strlen(suffix); + + if (length < suffixLen) + return gFalse; + + return strcmp(s + length - suffixLen, suffix) == 0; +} + GBool GooString::hasUnicodeMarker(void) { return length > 1 && (s[0] & 0xff) == 0xfe && (s[1] & 0xff) == 0xff; diff --git a/Build/source/libs/poppler/poppler-0.24.4/goo/GooString.h b/Build/source/libs/poppler/poppler-0.25.0/goo/GooString.h index b811c5ce5d8..0776fc1f798 100644 --- a/Build/source/libs/poppler/poppler-0.24.4/goo/GooString.h +++ b/Build/source/libs/poppler/poppler-0.25.0/goo/GooString.h @@ -19,6 +19,7 @@ // Copyright (C) 2006 Krzysztof Kowalczyk <kkowalczyk@gmail.com> // Copyright (C) 2008-2010, 2012 Albert Astals Cid <aacid@kde.org> // Copyright (C) 2012 Fabio D'Urso <fabiodurso@hotmail.it> +// Copyright (C) 2013 Jason Crain <jason@aquaticape.us> // // To see a description of the changes please see the Changelog file that // came with your tarball or type make ChangeLog if you are building from git @@ -155,6 +156,9 @@ public: int cmp(const char *sA) const; int cmpN(const char *sA, int n) const; + // Return true if string ends with suffix + GBool endsWith(const char *suffix) const; + GBool hasUnicodeMarker(void); // Sanitizes the string so that it does diff --git a/Build/source/libs/poppler/poppler-0.24.4/goo/GooTimer.cc b/Build/source/libs/poppler/poppler-0.25.0/goo/GooTimer.cc index c766c6bf2e4..c766c6bf2e4 100644 --- a/Build/source/libs/poppler/poppler-0.24.4/goo/GooTimer.cc +++ b/Build/source/libs/poppler/poppler-0.25.0/goo/GooTimer.cc diff --git a/Build/source/libs/poppler/poppler-0.24.4/goo/GooTimer.h b/Build/source/libs/poppler/poppler-0.25.0/goo/GooTimer.h index d77373e90c1..d77373e90c1 100644 --- a/Build/source/libs/poppler/poppler-0.24.4/goo/GooTimer.h +++ b/Build/source/libs/poppler/poppler-0.25.0/goo/GooTimer.h diff --git a/Build/source/libs/poppler/poppler-0.24.4/goo/ImgWriter.cc b/Build/source/libs/poppler/poppler-0.25.0/goo/ImgWriter.cc index a30d26d89ad..a30d26d89ad 100644 --- a/Build/source/libs/poppler/poppler-0.24.4/goo/ImgWriter.cc +++ b/Build/source/libs/poppler/poppler-0.25.0/goo/ImgWriter.cc diff --git a/Build/source/libs/poppler/poppler-0.24.4/goo/ImgWriter.h b/Build/source/libs/poppler/poppler-0.25.0/goo/ImgWriter.h index 8feb3511e4d..8feb3511e4d 100644 --- a/Build/source/libs/poppler/poppler-0.24.4/goo/ImgWriter.h +++ b/Build/source/libs/poppler/poppler-0.25.0/goo/ImgWriter.h diff --git a/Build/source/libs/poppler/poppler-0.24.4/goo/JpegWriter.cc b/Build/source/libs/poppler/poppler-0.25.0/goo/JpegWriter.cc index 9b7c5051838..9b7c5051838 100644 --- a/Build/source/libs/poppler/poppler-0.24.4/goo/JpegWriter.cc +++ b/Build/source/libs/poppler/poppler-0.25.0/goo/JpegWriter.cc diff --git a/Build/source/libs/poppler/poppler-0.24.4/goo/JpegWriter.h b/Build/source/libs/poppler/poppler-0.25.0/goo/JpegWriter.h index d69bbbb8dda..d69bbbb8dda 100644 --- a/Build/source/libs/poppler/poppler-0.24.4/goo/JpegWriter.h +++ b/Build/source/libs/poppler/poppler-0.25.0/goo/JpegWriter.h diff --git a/Build/source/libs/poppler/poppler-0.24.4/goo/Makefile.am b/Build/source/libs/poppler/poppler-0.25.0/goo/Makefile.am index 0764e79ca18..a48b20ec493 100644 --- a/Build/source/libs/poppler/poppler-0.24.4/goo/Makefile.am +++ b/Build/source/libs/poppler/poppler-0.25.0/goo/Makefile.am @@ -13,6 +13,7 @@ poppler_goo_include_HEADERS = \ gmem.h \ gfile.h \ FixedPoint.h \ + NetPBMWriter.h \ PNGWriter.h \ JpegWriter.h \ TiffWriter.h \ @@ -55,6 +56,7 @@ libgoo_la_SOURCES = \ GooString.cc \ gmem.cc \ FixedPoint.cc \ + NetPBMWriter.cc \ PNGWriter.cc \ JpegWriter.cc \ TiffWriter.cc \ diff --git a/Build/source/libs/poppler/poppler-0.25.0/goo/NetPBMWriter.cc b/Build/source/libs/poppler/poppler-0.25.0/goo/NetPBMWriter.cc new file mode 100644 index 00000000000..fca00b26b1a --- /dev/null +++ b/Build/source/libs/poppler/poppler-0.25.0/goo/NetPBMWriter.cc @@ -0,0 +1,84 @@ +//======================================================================== +// +// NetPBMWriter.h +// +// Copyright 1998-2003 Glyph & Cog, LLC +// +//======================================================================== +// +//======================================================================== +// +// Modified under the Poppler project - http://poppler.freedesktop.org +// +// All changes made under the Poppler project to this file are licensed +// under GPL version 2 or later +// +// Copyright (C) 2005, 2007, 2011 Albert Astals Cid <aacid@kde.org> +// Copyright (C) 2006 Rainer Keller <class321@gmx.de> +// Copyright (C) 2008 Timothy Lee <timothy.lee@siriushk.com> +// Copyright (C) 2008 Vasile Gaburici <gaburici@cs.umd.edu> +// Copyright (C) 2009 Carlos Garcia Campos <carlosgc@gnome.org> +// Copyright (C) 2009 William Bader <williambader@hotmail.com> +// Copyright (C) 2010 Jakob Voss <jakob.voss@gbv.de> +// Copyright (C) 2012, 2013 Adrian Johnson <ajohnson@redneon.com> +// Copyright (C) 2013 Thomas Fischer <fischer@unix-ag.uni-kl.de> +// +// To see a description of the changes please see the Changelog file that +// came with your tarball or type make ChangeLog if you are building from git +// +//======================================================================== + +#include "poppler-config.h" + +#include "NetPBMWriter.h" + +// Writer for the NetPBM formats (PBM and PPM) +// This format is documented at: +// http://netpbm.sourceforge.net/doc/pbm.html +// http://netpbm.sourceforge.net/doc/ppm.html + +NetPBMWriter::NetPBMWriter(Format formatA) : format(formatA) +{ +} + +bool NetPBMWriter::init(FILE *f, int widthA, int heightA, int hDPI, int vDPI) +{ + file = f; + width = widthA; + if (format == MONOCHROME) { + fprintf(file, "P4\n"); + fprintf(file, "%d %d\n", widthA, heightA); + } else { + fprintf(file, "P6\n"); + fprintf(file, "%d %d\n", widthA, heightA); + fprintf(file, "255\n"); + } + return true; +} + +bool NetPBMWriter::writePointers(unsigned char **rowPointers, int rowCount) +{ + for (int i = 0; i < rowCount; i++) + writeRow(&rowPointers[i]); + return true; +} + +bool NetPBMWriter::writeRow(unsigned char **row) +{ + if (format == MONOCHROME) { + // PBM uses 0 = white, 1 = black so we need to invert the colors + int size = (width + 7)/8; + for (int i = 0; i < size; i++) + fputc((*row)[i] ^ 0xff, file); + } else { + fwrite(*row, 1, width*3, file); + } + return true; +} + + +bool NetPBMWriter::close() +{ + return true; +} + diff --git a/Build/source/libs/poppler/poppler-0.25.0/goo/NetPBMWriter.h b/Build/source/libs/poppler/poppler-0.25.0/goo/NetPBMWriter.h new file mode 100644 index 00000000000..21a19ee7508 --- /dev/null +++ b/Build/source/libs/poppler/poppler-0.25.0/goo/NetPBMWriter.h @@ -0,0 +1,52 @@ +//======================================================================== +// +// NetPBMWriter.h +// +// This file is licensed under the GPLv2 or later +// +// Copyright (C) 2009 Stefan Thomas <thomas@eload24.com> +// Copyright (C) 2009, 2011 Albert Astals Cid <aacid@kde.org> +// Copyright (C) 2010, 2013 Adrian Johnson <ajohnson@redneon.com> +// Copyright (C) 2010 Brian Cameron <brian.cameron@oracle.com> +// Copyright (C) 2011 Thomas Freitag <Thomas.Freitag@alfa.de> +// +//======================================================================== + +#ifndef NETPBMWRITER_H +#define NETPBMWRITER_H + +#include "poppler-config.h" + +#include "ImgWriter.h" + +// Writer for the NetPBM formats (PBM and PPM) +// This format is documented at: +// http://netpbm.sourceforge.net/doc/pbm.html +// http://netpbm.sourceforge.net/doc/ppm.html + +class NetPBMWriter : public ImgWriter +{ +public: + + /* RGB - 3 bytes/pixel + * MONOCHROME - 8 pixels/byte + */ + enum Format { RGB, MONOCHROME }; + + NetPBMWriter(Format formatA = RGB); + ~NetPBMWriter() {}; + + bool init(FILE *f, int width, int height, int hDPI, int vDPI); + + bool writePointers(unsigned char **rowPointers, int rowCount); + bool writeRow(unsigned char **row); + + bool close(); + +private: + FILE *file; + Format format; + int width; +}; + +#endif diff --git a/Build/source/libs/poppler/poppler-0.24.4/goo/PNGWriter.cc b/Build/source/libs/poppler/poppler-0.25.0/goo/PNGWriter.cc index b775600c0a3..c9d5199d040 100644 --- a/Build/source/libs/poppler/poppler-0.24.4/goo/PNGWriter.cc +++ b/Build/source/libs/poppler/poppler-0.25.0/goo/PNGWriter.cc @@ -8,7 +8,7 @@ // Copyright (C) 2009 Shen Liang <shenzhuxi@gmail.com> // Copyright (C) 2009, 2011 Albert Astals Cid <aacid@kde.org> // Copyright (C) 2009 Stefan Thomas <thomas@eload24.com> -// Copyright (C) 2010, 2011 Adrian Johnson <ajohnson@redneon.com> +// Copyright (C) 2010, 2011, 2013 Adrian Johnson <ajohnson@redneon.com> // Copyright (C) 2011 Thomas Klausner <wiz@danbala.tuwien.ac.at> // Copyright (C) 2012 Pino Toscano <pino@kde.org> // @@ -147,10 +147,6 @@ bool PNGWriter::init(FILE *f, int width, int height, int hDPI, int vDPI) return false; } - // pack 1 pixel/byte rows into 8 pixels/byte - if (priv->format == MONOCHROME) - png_set_packing(priv->png_ptr); - return true; } diff --git a/Build/source/libs/poppler/poppler-0.24.4/goo/PNGWriter.h b/Build/source/libs/poppler/poppler-0.25.0/goo/PNGWriter.h index c73c96426b8..90a298e7ef3 100644 --- a/Build/source/libs/poppler/poppler-0.24.4/goo/PNGWriter.h +++ b/Build/source/libs/poppler/poppler-0.25.0/goo/PNGWriter.h @@ -6,9 +6,9 @@ // // Copyright (C) 2009 Warren Toomey <wkt@tuhs.org> // Copyright (C) 2009 Shen Liang <shenzhuxi@gmail.com> -// Copyright (C) 2009, 2011, 2012 Albert Astals Cid <aacid@kde.org> +// Copyright (C) 2009, 2011-2013 Albert Astals Cid <aacid@kde.org> // Copyright (C) 2009 Stefan Thomas <thomas@eload24.com> -// Copyright (C) 2010, 2011 Adrian Johnson <ajohnson@redneon.com> +// Copyright (C) 2010, 2011, 2013 Adrian Johnson <ajohnson@redneon.com> // Copyright (C) 2012 Pino Toscano <pino@kde.org> // //======================================================================== @@ -22,7 +22,7 @@ #include "ImgWriter.h" -class PNGWriterPrivate; +struct PNGWriterPrivate; class PNGWriter : public ImgWriter { @@ -31,7 +31,7 @@ public: /* RGB - 3 bytes/pixel * RGBA - 4 bytes/pixel * GRAY - 1 byte/pixel - * MONOCHROME - 1 byte/pixel. PNGWriter will bitpack to 8 pixels/byte + * MONOCHROME - 8 pixels/byte */ enum Format { RGB, RGBA, GRAY, MONOCHROME }; diff --git a/Build/source/libs/poppler/poppler-0.24.4/goo/TiffWriter.cc b/Build/source/libs/poppler/poppler-0.25.0/goo/TiffWriter.cc index d372a5bdfce..d372a5bdfce 100644 --- a/Build/source/libs/poppler/poppler-0.24.4/goo/TiffWriter.cc +++ b/Build/source/libs/poppler/poppler-0.25.0/goo/TiffWriter.cc diff --git a/Build/source/libs/poppler/poppler-0.24.4/goo/TiffWriter.h b/Build/source/libs/poppler/poppler-0.25.0/goo/TiffWriter.h index 52fdd53efa5..52fdd53efa5 100644 --- a/Build/source/libs/poppler/poppler-0.24.4/goo/TiffWriter.h +++ b/Build/source/libs/poppler/poppler-0.25.0/goo/TiffWriter.h diff --git a/Build/source/libs/poppler/poppler-0.24.4/goo/gfile.cc b/Build/source/libs/poppler/poppler-0.25.0/goo/gfile.cc index 44beddd5a13..44beddd5a13 100644 --- a/Build/source/libs/poppler/poppler-0.24.4/goo/gfile.cc +++ b/Build/source/libs/poppler/poppler-0.25.0/goo/gfile.cc diff --git a/Build/source/libs/poppler/poppler-0.24.4/goo/gfile.h b/Build/source/libs/poppler/poppler-0.25.0/goo/gfile.h index 5f546f11156..5f546f11156 100644 --- a/Build/source/libs/poppler/poppler-0.24.4/goo/gfile.h +++ b/Build/source/libs/poppler/poppler-0.25.0/goo/gfile.h diff --git a/Build/source/libs/poppler/poppler-0.24.4/goo/gmem.cc b/Build/source/libs/poppler/poppler-0.25.0/goo/gmem.cc index c1c607ac3f3..c1c607ac3f3 100644 --- a/Build/source/libs/poppler/poppler-0.24.4/goo/gmem.cc +++ b/Build/source/libs/poppler/poppler-0.25.0/goo/gmem.cc diff --git a/Build/source/libs/poppler/poppler-0.24.4/goo/gmem.h b/Build/source/libs/poppler/poppler-0.25.0/goo/gmem.h index 898f33933f9..898f33933f9 100644 --- a/Build/source/libs/poppler/poppler-0.24.4/goo/gmem.h +++ b/Build/source/libs/poppler/poppler-0.25.0/goo/gmem.h diff --git a/Build/source/libs/poppler/poppler-0.24.4/goo/gmempp.cc b/Build/source/libs/poppler/poppler-0.25.0/goo/gmempp.cc index a70338ca3ce..a70338ca3ce 100644 --- a/Build/source/libs/poppler/poppler-0.24.4/goo/gmempp.cc +++ b/Build/source/libs/poppler/poppler-0.25.0/goo/gmempp.cc diff --git a/Build/source/libs/poppler/poppler-0.24.4/goo/grandom.cc b/Build/source/libs/poppler/poppler-0.25.0/goo/grandom.cc index 1237175420b..1237175420b 100644 --- a/Build/source/libs/poppler/poppler-0.24.4/goo/grandom.cc +++ b/Build/source/libs/poppler/poppler-0.25.0/goo/grandom.cc diff --git a/Build/source/libs/poppler/poppler-0.24.4/goo/grandom.h b/Build/source/libs/poppler/poppler-0.25.0/goo/grandom.h index 45fa791aba8..45fa791aba8 100644 --- a/Build/source/libs/poppler/poppler-0.24.4/goo/grandom.h +++ b/Build/source/libs/poppler/poppler-0.25.0/goo/grandom.h diff --git a/Build/source/libs/poppler/poppler-0.24.4/goo/gstrtod.cc b/Build/source/libs/poppler/poppler-0.25.0/goo/gstrtod.cc index cd1d5b554f7..cd1d5b554f7 100644 --- a/Build/source/libs/poppler/poppler-0.24.4/goo/gstrtod.cc +++ b/Build/source/libs/poppler/poppler-0.25.0/goo/gstrtod.cc diff --git a/Build/source/libs/poppler/poppler-0.24.4/goo/gstrtod.h b/Build/source/libs/poppler/poppler-0.25.0/goo/gstrtod.h index e8abdadf53e..e8abdadf53e 100644 --- a/Build/source/libs/poppler/poppler-0.24.4/goo/gstrtod.h +++ b/Build/source/libs/poppler/poppler-0.25.0/goo/gstrtod.h diff --git a/Build/source/libs/poppler/poppler-0.24.4/goo/gtypes.h b/Build/source/libs/poppler/poppler-0.25.0/goo/gtypes.h index a8d4519497e..a8d4519497e 100644 --- a/Build/source/libs/poppler/poppler-0.24.4/goo/gtypes.h +++ b/Build/source/libs/poppler/poppler-0.25.0/goo/gtypes.h diff --git a/Build/source/libs/poppler/poppler-0.24.4/goo/gtypes_p.h b/Build/source/libs/poppler/poppler-0.25.0/goo/gtypes_p.h index cc4866e1389..cc4866e1389 100644 --- a/Build/source/libs/poppler/poppler-0.24.4/goo/gtypes_p.h +++ b/Build/source/libs/poppler/poppler-0.25.0/goo/gtypes_p.h diff --git a/Build/source/libs/poppler/poppler-0.24.4/gtk-doc.make b/Build/source/libs/poppler/poppler-0.25.0/gtk-doc.make index 104c3993f3e..104c3993f3e 100644 --- a/Build/source/libs/poppler/poppler-0.24.4/gtk-doc.make +++ b/Build/source/libs/poppler/poppler-0.25.0/gtk-doc.make diff --git a/Build/source/libs/poppler/poppler-0.24.4/poppler-cairo-uninstalled.pc.in b/Build/source/libs/poppler/poppler-0.25.0/poppler-cairo-uninstalled.pc.in index 2458eb20df8..2458eb20df8 100644 --- a/Build/source/libs/poppler/poppler-0.24.4/poppler-cairo-uninstalled.pc.in +++ b/Build/source/libs/poppler/poppler-0.25.0/poppler-cairo-uninstalled.pc.in diff --git a/Build/source/libs/poppler/poppler-0.24.4/poppler-cairo.pc.cmake b/Build/source/libs/poppler/poppler-0.25.0/poppler-cairo.pc.cmake index b32f118314b..b32f118314b 100644 --- a/Build/source/libs/poppler/poppler-0.24.4/poppler-cairo.pc.cmake +++ b/Build/source/libs/poppler/poppler-0.25.0/poppler-cairo.pc.cmake diff --git a/Build/source/libs/poppler/poppler-0.24.4/poppler-cairo.pc.in b/Build/source/libs/poppler/poppler-0.25.0/poppler-cairo.pc.in index 367a5b690bf..367a5b690bf 100644 --- a/Build/source/libs/poppler/poppler-0.24.4/poppler-cairo.pc.in +++ b/Build/source/libs/poppler/poppler-0.25.0/poppler-cairo.pc.in diff --git a/Build/source/libs/poppler/poppler-0.24.4/poppler-cpp-uninstalled.pc.in b/Build/source/libs/poppler/poppler-0.25.0/poppler-cpp-uninstalled.pc.in index af3640eb2c1..af3640eb2c1 100644 --- a/Build/source/libs/poppler/poppler-0.24.4/poppler-cpp-uninstalled.pc.in +++ b/Build/source/libs/poppler/poppler-0.25.0/poppler-cpp-uninstalled.pc.in diff --git a/Build/source/libs/poppler/poppler-0.24.4/poppler-cpp.pc.cmake b/Build/source/libs/poppler/poppler-0.25.0/poppler-cpp.pc.cmake index 3f56b3d9d90..3f56b3d9d90 100644 --- a/Build/source/libs/poppler/poppler-0.24.4/poppler-cpp.pc.cmake +++ b/Build/source/libs/poppler/poppler-0.25.0/poppler-cpp.pc.cmake diff --git a/Build/source/libs/poppler/poppler-0.24.4/poppler-cpp.pc.in b/Build/source/libs/poppler/poppler-0.25.0/poppler-cpp.pc.in index a7e97c25dfe..a7e97c25dfe 100644 --- a/Build/source/libs/poppler/poppler-0.24.4/poppler-cpp.pc.in +++ b/Build/source/libs/poppler/poppler-0.25.0/poppler-cpp.pc.in diff --git a/Build/source/libs/poppler/poppler-0.24.4/poppler-glib-uninstalled.pc.in b/Build/source/libs/poppler/poppler-0.25.0/poppler-glib-uninstalled.pc.in index 5506c4e53ac..5506c4e53ac 100644 --- a/Build/source/libs/poppler/poppler-0.24.4/poppler-glib-uninstalled.pc.in +++ b/Build/source/libs/poppler/poppler-0.25.0/poppler-glib-uninstalled.pc.in diff --git a/Build/source/libs/poppler/poppler-0.24.4/poppler-glib.pc.cmake b/Build/source/libs/poppler/poppler-0.25.0/poppler-glib.pc.cmake index e15e6699a43..e15e6699a43 100644 --- a/Build/source/libs/poppler/poppler-0.24.4/poppler-glib.pc.cmake +++ b/Build/source/libs/poppler/poppler-0.25.0/poppler-glib.pc.cmake diff --git a/Build/source/libs/poppler/poppler-0.24.4/poppler-glib.pc.in b/Build/source/libs/poppler/poppler-0.25.0/poppler-glib.pc.in index cd30feb728f..cd30feb728f 100644 --- a/Build/source/libs/poppler/poppler-0.24.4/poppler-glib.pc.in +++ b/Build/source/libs/poppler/poppler-0.25.0/poppler-glib.pc.in diff --git a/Build/source/libs/poppler/poppler-0.24.4/poppler-qt4-uninstalled.pc.in b/Build/source/libs/poppler/poppler-0.25.0/poppler-qt4-uninstalled.pc.in index 3a336c6c294..3a336c6c294 100644 --- a/Build/source/libs/poppler/poppler-0.24.4/poppler-qt4-uninstalled.pc.in +++ b/Build/source/libs/poppler/poppler-0.25.0/poppler-qt4-uninstalled.pc.in diff --git a/Build/source/libs/poppler/poppler-0.24.4/poppler-qt4.pc.cmake b/Build/source/libs/poppler/poppler-0.25.0/poppler-qt4.pc.cmake index b17fd5d8453..b17fd5d8453 100644 --- a/Build/source/libs/poppler/poppler-0.24.4/poppler-qt4.pc.cmake +++ b/Build/source/libs/poppler/poppler-0.25.0/poppler-qt4.pc.cmake diff --git a/Build/source/libs/poppler/poppler-0.24.4/poppler-qt4.pc.in b/Build/source/libs/poppler/poppler-0.25.0/poppler-qt4.pc.in index 306ae46e0b0..306ae46e0b0 100644 --- a/Build/source/libs/poppler/poppler-0.24.4/poppler-qt4.pc.in +++ b/Build/source/libs/poppler/poppler-0.25.0/poppler-qt4.pc.in diff --git a/Build/source/libs/poppler/poppler-0.24.4/poppler-qt5-uninstalled.pc.in b/Build/source/libs/poppler/poppler-0.25.0/poppler-qt5-uninstalled.pc.in index a91e1d5a3bd..a91e1d5a3bd 100644 --- a/Build/source/libs/poppler/poppler-0.24.4/poppler-qt5-uninstalled.pc.in +++ b/Build/source/libs/poppler/poppler-0.25.0/poppler-qt5-uninstalled.pc.in diff --git a/Build/source/libs/poppler/poppler-0.24.4/poppler-qt5.pc.cmake b/Build/source/libs/poppler/poppler-0.25.0/poppler-qt5.pc.cmake index b4d87b76675..b4d87b76675 100644 --- a/Build/source/libs/poppler/poppler-0.24.4/poppler-qt5.pc.cmake +++ b/Build/source/libs/poppler/poppler-0.25.0/poppler-qt5.pc.cmake diff --git a/Build/source/libs/poppler/poppler-0.24.4/poppler-qt5.pc.in b/Build/source/libs/poppler/poppler-0.25.0/poppler-qt5.pc.in index cda4c6f80fe..cda4c6f80fe 100644 --- a/Build/source/libs/poppler/poppler-0.24.4/poppler-qt5.pc.in +++ b/Build/source/libs/poppler/poppler-0.25.0/poppler-qt5.pc.in diff --git a/Build/source/libs/poppler/poppler-0.24.4/poppler-splash-uninstalled.pc.in b/Build/source/libs/poppler/poppler-0.25.0/poppler-splash-uninstalled.pc.in index 436ecdb8f1b..436ecdb8f1b 100644 --- a/Build/source/libs/poppler/poppler-0.24.4/poppler-splash-uninstalled.pc.in +++ b/Build/source/libs/poppler/poppler-0.25.0/poppler-splash-uninstalled.pc.in diff --git a/Build/source/libs/poppler/poppler-0.24.4/poppler-splash.pc.cmake b/Build/source/libs/poppler/poppler-0.25.0/poppler-splash.pc.cmake index cb95b3d2d27..cb95b3d2d27 100644 --- a/Build/source/libs/poppler/poppler-0.24.4/poppler-splash.pc.cmake +++ b/Build/source/libs/poppler/poppler-0.25.0/poppler-splash.pc.cmake diff --git a/Build/source/libs/poppler/poppler-0.24.4/poppler-splash.pc.in b/Build/source/libs/poppler/poppler-0.25.0/poppler-splash.pc.in index cf3491fc7cf..cf3491fc7cf 100644 --- a/Build/source/libs/poppler/poppler-0.24.4/poppler-splash.pc.in +++ b/Build/source/libs/poppler/poppler-0.25.0/poppler-splash.pc.in diff --git a/Build/source/libs/poppler/poppler-0.24.4/poppler-uninstalled.pc.in b/Build/source/libs/poppler/poppler-0.25.0/poppler-uninstalled.pc.in index 6076e80c5b3..6076e80c5b3 100644 --- a/Build/source/libs/poppler/poppler-0.24.4/poppler-uninstalled.pc.in +++ b/Build/source/libs/poppler/poppler-0.25.0/poppler-uninstalled.pc.in diff --git a/Build/source/libs/poppler/poppler-0.24.4/poppler.pc.cmake b/Build/source/libs/poppler/poppler-0.25.0/poppler.pc.cmake index f1aebedbefd..f1aebedbefd 100644 --- a/Build/source/libs/poppler/poppler-0.24.4/poppler.pc.cmake +++ b/Build/source/libs/poppler/poppler-0.25.0/poppler.pc.cmake diff --git a/Build/source/libs/poppler/poppler-0.24.4/poppler.pc.in b/Build/source/libs/poppler/poppler-0.25.0/poppler.pc.in index 8605b28673b..8605b28673b 100644 --- a/Build/source/libs/poppler/poppler-0.24.4/poppler.pc.in +++ b/Build/source/libs/poppler/poppler-0.25.0/poppler.pc.in diff --git a/Build/source/libs/poppler/poppler-0.24.4/poppler/Annot.cc b/Build/source/libs/poppler/poppler-0.25.0/poppler/Annot.cc index 00291f8c29b..90a6e5d09d3 100644 --- a/Build/source/libs/poppler/poppler-0.24.4/poppler/Annot.cc +++ b/Build/source/libs/poppler/poppler-0.25.0/poppler/Annot.cc @@ -28,6 +28,7 @@ // Copyright (C) 2012, 2013 Thomas Freitag <Thomas.Freitag@alfa.de> // Copyright (C) 2012 Tobias Koenig <tokoe@kdab.com> // Copyright (C) 2013 Peter Breitenlohner <peb@mppmu.mpg.de> +// Copyright (C) 2013 Adrian Johnson <ajohnson@redneon.com> // // To see a description of the changes please see the Changelog file that // came with your tarball or type make ChangeLog if you are building from git @@ -234,6 +235,28 @@ static LinkAction* getAdditionalAction(Annot::AdditionalActionsType type, Object return linkAction; } +static LinkAction* getFormAdditionalAction(Annot::FormAdditionalActionsType type, Object *additionalActions, PDFDoc *doc) { + Object additionalActionsObject; + LinkAction *linkAction = NULL; + + if (additionalActions->fetch(doc->getXRef(), &additionalActionsObject)->isDict()) { + const char *key = (type == Annot::actionFieldModified ? "K" : + type == Annot::actionFormatField ? "F" : + type == Annot::actionValidateField ? "V" : + type == Annot::actionCalculateField ? "C" : NULL); + + Object actionObject; + + if (additionalActionsObject.dictLookup(key, &actionObject)->isDict()) + linkAction = LinkAction::parseAction(&actionObject, doc->getCatalog()->getBaseURI()); + actionObject.free(); + } + + additionalActionsObject.free(); + + return linkAction; +} + //------------------------------------------------------------------------ // AnnotBorderEffect //------------------------------------------------------------------------ @@ -497,7 +520,6 @@ AnnotQuadrilaterals::AnnotQuadrilateral::AnnotQuadrilateral(double x1, double y1 // AnnotBorder //------------------------------------------------------------------------ AnnotBorder::AnnotBorder() { - type = typeUnknown; width = 1; dashLength = 0; dash = NULL; @@ -542,7 +564,6 @@ AnnotBorder::~AnnotBorder() { //------------------------------------------------------------------------ AnnotBorderArray::AnnotBorderArray() { - type = typeArray; horizontalCorner = 0; verticalCorner = 0; } @@ -593,10 +614,17 @@ void AnnotBorderArray::writeToObject(XRef *xref, Object *obj1) const { Object obj2; obj1->initArray(xref); - obj1->arrayAdd(obj2.initReal( horizontalCorner )); - obj1->arrayAdd(obj2.initReal( verticalCorner )); - obj1->arrayAdd(obj2.initReal( width )); - // TODO: Dash array + obj1->arrayAdd(obj2.initReal(horizontalCorner)); + obj1->arrayAdd(obj2.initReal(verticalCorner)); + obj1->arrayAdd(obj2.initReal(width)); + + if (dashLength > 0) { + Object obj3; + + obj1->arrayAdd(obj3.initArray(xref)); + for (int i = 0; i < dashLength; i++) + obj3.arrayAdd(obj2.initReal(dash[i])); + } } //------------------------------------------------------------------------ @@ -604,7 +632,6 @@ void AnnotBorderArray::writeToObject(XRef *xref, Object *obj1) const { //------------------------------------------------------------------------ AnnotBorderBS::AnnotBorderBS() { - type = typeBS; } AnnotBorderBS::AnnotBorderBS(Dict *dict) { @@ -655,6 +682,38 @@ AnnotBorderBS::AnnotBorderBS(Dict *dict) { } } +const char *AnnotBorderBS::getStyleName() const { + switch (style) { + case borderSolid: + return "S"; + case borderDashed: + return "D"; + case borderBeveled: + return "B"; + case borderInset: + return "I"; + case borderUnderlined: + return "U"; + } + + return "S"; +} + +void AnnotBorderBS::writeToObject(XRef *xref, Object *obj1) const { + Object obj2; + + obj1->initDict(xref); + obj1->dictSet("W", obj2.initReal(width)); + obj1->dictSet("S", obj2.initName(getStyleName())); + if (style == borderDashed && dashLength > 0) { + Object obj3; + + obj1->dictSet("D", obj3.initArray(xref)); + for (int i = 0; i < dashLength; i++) + obj3.arrayAdd(obj2.initReal(dash[i])); + } +} + //------------------------------------------------------------------------ // AnnotColor //------------------------------------------------------------------------ @@ -1272,18 +1331,14 @@ void Annot::initialize(PDFDoc *docA, Dict *dict) { } //----- parse the border style - if (dict->lookup("BS", &obj1)->isDict()) { - border = new AnnotBorderBS(obj1.getDict()); - } else { - obj1.free(); - - if (dict->lookup("Border", &obj1)->isArray()) - border = new AnnotBorderArray(obj1.getArray()); - else - // Adobe draws no border at all if the last element is of - // the wrong type. - border = NULL; - } + // According to the spec if neither the Border nor the BS entry is present, + // the border shall be drawn as a solid line with a width of 1 point. But acroread + // seems to ignore the Border entry for annots that can't have a BS entry. So, we only + // follow this rule for annots tha can have a BS entry. + if (dict->lookup("Border", &obj1)->isArray()) + border = new AnnotBorderArray(obj1.getArray()); + else + border = NULL; obj1.free(); if (dict->lookup("C", &obj1)->isArray()) { @@ -1425,14 +1480,14 @@ void Annot::setFlags(Guint new_flags) { update ("F", &obj1); } -void Annot::setBorder(AnnotBorderArray *new_border) { +void Annot::setBorder(AnnotBorder *new_border) { annotLocker(); delete border; if (new_border) { Object obj1; new_border->writeToObject(xref, &obj1); - update ("Border", &obj1); + update(new_border->getType() == AnnotBorder::typeArray ? "Border" : "BS", &obj1); border = new_border; } else { border = NULL; @@ -1640,6 +1695,26 @@ void Annot::setColor(AnnotColor *color, GBool fill) { } } +void Annot::setLineStyleForBorder(AnnotBorder *border) { + int i, dashLength; + double *dash; + + switch (border->getStyle()) { + case AnnotBorder::borderDashed: + appearBuf->append("["); + dashLength = border->getDashLength(); + dash = border->getDash(); + for (i = 0; i < dashLength; ++i) + appearBuf->appendf(" {0:.2f}", dash[i]); + appearBuf->append(" ] 0 d\n"); + break; + default: + appearBuf->append("[] 0 d\n"); + break; + } + appearBuf->appendf("{0:.2f} w\n", border->getWidth()); +} + // Draw an (approximate) circle of radius <r> centered at (<cx>, <cy>). // If <fill> is true, the circle is filled; otherwise it is stroked. void Annot::drawCircle(double cx, double cy, double r, GBool fill) { @@ -2580,6 +2655,14 @@ void AnnotLink::initialize(PDFDoc *docA, Dict *dict) { quadrilaterals = NULL; } obj1.free(); + + if (dict->lookup("BS", &obj1)->isDict()) { + delete border; + border = new AnnotBorderBS(obj1.getDict()); + } else if (!border) { + border = new AnnotBorderBS(); + } + obj1.free(); } void AnnotLink::draw(Gfx *gfx, GBool printing) { @@ -2707,6 +2790,14 @@ void AnnotFreeText::initialize(PDFDoc *docA, Dict *dict) { } obj1.free(); + if (dict->lookup("BS", &obj1)->isDict()) { + delete border; + border = new AnnotBorderBS(obj1.getDict()); + } else if (!border) { + border = new AnnotBorderBS(); + } + obj1.free(); + if (dict->lookup("BE", &obj1)->isDict()) { borderEffect = new AnnotBorderEffect(obj1.getDict()); } else { @@ -2905,29 +2996,10 @@ void AnnotFreeText::generateFreeTextAppearance() appearBuf = new GooString (); appearBuf->append ("q\n"); - - if (border) { - int i, dashLength; - double *dash; - borderWidth = border->getWidth(); - switch (border->getStyle()) { - case AnnotBorder::borderDashed: - appearBuf->append("["); - dashLength = border->getDashLength(); - dash = border->getDash(); - for (i = 0; i < dashLength; ++i) - appearBuf->appendf(" {0:.2f}", dash[i]); - appearBuf->append(" ] 0 d\n"); - break; - default: - appearBuf->append("[] 0 d\n"); - break; - } - appearBuf->appendf("{0:.2f} w\n", borderWidth); - } else { - borderWidth = 0; // No border - } + borderWidth = border->getWidth(); + if (borderWidth > 0) + setLineStyleForBorder(border); // Box size const double width = rect->x2 - rect->x1; @@ -3213,6 +3285,14 @@ void AnnotLine::initialize(PDFDoc *docA, Dict *dict) { captionTextHorizontal = captionTextVertical = 0; } obj1.free(); + + if (dict->lookup("BS", &obj1)->isDict()) { + delete border; + border = new AnnotBorderBS(obj1.getDict()); + } else if (!border) { + border = new AnnotBorderBS(); + } + obj1.free(); } void AnnotLine::setContents(GooString *new_content) { @@ -3320,29 +3400,9 @@ void AnnotLine::generateLineAppearance() setColor(color, gFalse); } - if (border) { - int i, dashLength; - double *dash; - - switch (border->getStyle()) { - case AnnotBorder::borderDashed: - appearBuf->append("["); - dashLength = border->getDashLength(); - dash = border->getDash(); - for (i = 0; i < dashLength; ++i) - appearBuf->appendf(" {0:.2f}", dash[i]); - appearBuf->append(" ] 0 d\n"); - break; - default: - appearBuf->append("[] 0 d\n"); - break; - } - borderWidth = border->getWidth(); - appearBuf->appendf("{0:.2f} w\n", borderWidth); - appearBBox->setBorderWidth(borderWidth); - } else { - borderWidth = 0; - } + setLineStyleForBorder(border); + borderWidth = border->getWidth(); + appearBBox->setBorderWidth(std::max(1., borderWidth)); const double x1 = coord1->getX(); const double y1 = coord1->getY(); @@ -3903,6 +3963,12 @@ void AnnotWidget::initialize(PDFDoc *docA, Dict *dict) { } obj1.free(); + if (dict->lookup("BS", &obj1)->isDict()) { + delete border; + border = new AnnotBorderBS(obj1.getDict()); + } + obj1.free(); + updatedAppearanceStream.num = updatedAppearanceStream.gen = -1; } @@ -3911,6 +3977,11 @@ LinkAction* AnnotWidget::getAdditionalAction(AdditionalActionsType type) return ::getAdditionalAction(type, &additionalActions, doc); } +LinkAction* AnnotWidget::getFormAdditionalAction(FormAdditionalActionsType type) +{ + return ::getFormAdditionalAction(type, &additionalActions, doc); +} + // Grand unified handler for preparing text strings to be drawn into form // fields. Takes as input a text string (in PDFDocEncoding or UTF-16). // Converts some or all of this string to the appropriate encoding for the @@ -5418,6 +5489,14 @@ void AnnotGeometry::initialize(PDFDoc *docA, Dict* dict) { } obj1.free(); + if (dict->lookup("BS", &obj1)->isDict()) { + delete border; + border = new AnnotBorderBS(obj1.getDict()); + } else if (!border) { + border = new AnnotBorderBS(); + } + obj1.free(); + if (dict->lookup("BE", &obj1)->isDict()) { borderEffect = new AnnotBorderEffect(obj1.getDict()); } else { @@ -5482,88 +5561,70 @@ void AnnotGeometry::draw(Gfx *gfx, GBool printing) { if (color) setColor(color, gFalse); - if (border) { - int i, dashLength; - double *dash; - double borderWidth = border->getWidth(); - - switch (border->getStyle()) { - case AnnotBorder::borderDashed: - appearBuf->append("["); - dashLength = border->getDashLength(); - dash = border->getDash(); - for (i = 0; i < dashLength; ++i) - appearBuf->appendf(" {0:.2f}", dash[i]); - appearBuf->append(" ] 0 d\n"); - break; - default: - appearBuf->append("[] 0 d\n"); - break; - } - appearBuf->appendf("{0:.2f} w\n", borderWidth); + double borderWidth = border->getWidth(); + setLineStyleForBorder(border); - if (interiorColor) - setColor(interiorColor, gTrue); + if (interiorColor) + setColor(interiorColor, gTrue); - if (type == typeSquare) { - appearBuf->appendf ("{0:.2f} {1:.2f} {2:.2f} {3:.2f} re\n", - borderWidth / 2.0, borderWidth / 2.0, - (rect->x2 - rect->x1) - borderWidth, - (rect->y2 - rect->y1) - borderWidth); - } else { - double width, height; - double b; - double x1, y1, x2, y2, x3, y3; - - width = rect->x2 - rect->x1; - height = rect->y2 - rect->y1; - b = borderWidth / 2.0; - - x1 = b; - y1 = height / 2.0; - appearBuf->appendf ("{0:.2f} {1:.2f} m\n", x1, y1); - - y1 += height / 4.0; - x2 = width / 4.0; - y2 = height - b; - x3 = width / 2.0; - y3 = y2; - appearBuf->appendf ("{0:.2f} {1:.2f} {2:.2f} {3:.2f} {4:.2f} {5:.2f} c\n", - x1, y1, x2, y2, x3, y3); - x2 = width - b; - y2 = y1; - x1 = x3 + (width / 4.0); - y1 = y3; - x3 = x2; - y3 = height / 2.0; - appearBuf->appendf ("{0:.2f} {1:.2f} {2:.2f} {3:.2f} {4:.2f} {5:.2f} c\n", - x1, y1, x2, y2, x3, y3); - - x2 = x1; - y2 = b; - x1 = x3; - y1 = height / 4.0; - x3 = width / 2.0; - y3 = b; - appearBuf->appendf ("{0:.2f} {1:.2f} {2:.2f} {3:.2f} {4:.2f} {5:.2f} c\n", - x1, y1, x2, y2, x3, y3); - - x2 = b; - y2 = y1; - x1 = width / 4.0; - y1 = b; - x3 = b; - y3 = height / 2.0; - appearBuf->appendf ("{0:.2f} {1:.2f} {2:.2f} {3:.2f} {4:.2f} {5:.2f} c\n", - x1, y1, x2, y2, x3, y3); + if (type == typeSquare) { + appearBuf->appendf ("{0:.2f} {1:.2f} {2:.2f} {3:.2f} re\n", + borderWidth / 2.0, borderWidth / 2.0, + (rect->x2 - rect->x1) - borderWidth, + (rect->y2 - rect->y1) - borderWidth); + } else { + double width, height; + double b; + double x1, y1, x2, y2, x3, y3; + + width = rect->x2 - rect->x1; + height = rect->y2 - rect->y1; + b = borderWidth / 2.0; + + x1 = b; + y1 = height / 2.0; + appearBuf->appendf ("{0:.2f} {1:.2f} m\n", x1, y1); + + y1 += height / 4.0; + x2 = width / 4.0; + y2 = height - b; + x3 = width / 2.0; + y3 = y2; + appearBuf->appendf ("{0:.2f} {1:.2f} {2:.2f} {3:.2f} {4:.2f} {5:.2f} c\n", + x1, y1, x2, y2, x3, y3); + x2 = width - b; + y2 = y1; + x1 = x3 + (width / 4.0); + y1 = y3; + x3 = x2; + y3 = height / 2.0; + appearBuf->appendf ("{0:.2f} {1:.2f} {2:.2f} {3:.2f} {4:.2f} {5:.2f} c\n", + x1, y1, x2, y2, x3, y3); + + x2 = x1; + y2 = b; + x1 = x3; + y1 = height / 4.0; + x3 = width / 2.0; + y3 = b; + appearBuf->appendf ("{0:.2f} {1:.2f} {2:.2f} {3:.2f} {4:.2f} {5:.2f} c\n", + x1, y1, x2, y2, x3, y3); + + x2 = b; + y2 = y1; + x1 = width / 4.0; + y1 = b; + x3 = b; + y3 = height / 2.0; + appearBuf->appendf ("{0:.2f} {1:.2f} {2:.2f} {3:.2f} {4:.2f} {5:.2f} c\n", + x1, y1, x2, y2, x3, y3); + } - } + if (interiorColor && interiorColor->getSpace() != AnnotColor::colorTransparent) + appearBuf->append ("b\n"); + else + appearBuf->append ("S\n"); - if (interiorColor && interiorColor->getSpace() != AnnotColor::colorTransparent) - appearBuf->append ("b\n"); - else - appearBuf->append ("S\n"); - } appearBuf->append ("Q\n"); double bbox[4]; @@ -5687,6 +5748,14 @@ void AnnotPolygon::initialize(PDFDoc *docA, Dict* dict) { } obj1.free(); + if (dict->lookup("BS", &obj1)->isDict()) { + delete border; + border = new AnnotBorderBS(obj1.getDict()); + } else if (!border) { + border = new AnnotBorderBS(); + } + obj1.free(); + if (dict->lookup("BE", &obj1)->isDict()) { borderEffect = new AnnotBorderEffect(obj1.getDict()); } else { @@ -5806,26 +5875,8 @@ void AnnotPolygon::draw(Gfx *gfx, GBool printing) { setColor(color, gFalse); } - if (border) { - int i, dashLength; - double *dash; - - switch (border->getStyle()) { - case AnnotBorder::borderDashed: - appearBuf->append("["); - dashLength = border->getDashLength(); - dash = border->getDash(); - for (i = 0; i < dashLength; ++i) - appearBuf->appendf(" {0:.2f}", dash[i]); - appearBuf->append(" ] 0 d\n"); - break; - default: - appearBuf->append("[] 0 d\n"); - break; - } - appearBuf->appendf("{0:.2f} w\n", border->getWidth()); - appearBBox->setBorderWidth(border->getWidth()); - } + setLineStyleForBorder(border); + appearBBox->setBorderWidth(std::max(1., border->getWidth())); if (interiorColor) { setColor(interiorColor, gTrue); @@ -5982,6 +6033,14 @@ void AnnotInk::initialize(PDFDoc *docA, Dict* dict) { ok = gFalse; } obj1.free(); + + if (dict->lookup("BS", &obj1)->isDict()) { + delete border; + border = new AnnotBorderBS(obj1.getDict()); + } else if (!border) { + border = new AnnotBorderBS(); + } + obj1.free(); } void AnnotInk::writeInkList(AnnotPath **paths, int n_paths, Array *dest_array) { @@ -6049,10 +6108,8 @@ void AnnotInk::draw(Gfx *gfx, GBool printing) { setColor(color, gFalse); } - if (border) { - appearBuf->appendf("{0:.2f} w\n", border->getWidth()); - appearBBox->setBorderWidth(border->getWidth()); - } + setLineStyleForBorder(border); + appearBBox->setBorderWidth(std::max(1., border->getWidth())); for (int i = 0; i < inkListLength; ++i) { const AnnotPath * path = inkList[i]; @@ -6313,7 +6370,7 @@ void AnnotFileAttachment::draw(Gfx *gfx, GBool printing) { // draw the appearance stream appearance.fetch(gfx->getXRef(), &obj); - gfx->drawAnnot(&obj, border, color, + gfx->drawAnnot(&obj, (AnnotBorder *)NULL, color, rect->x1, rect->y1, rect->x2, rect->y2, getRotation()); obj.free(); } @@ -6475,7 +6532,7 @@ void AnnotSound::draw(Gfx *gfx, GBool printing) { // draw the appearance stream appearance.fetch(gfx->getXRef(), &obj); - gfx->drawAnnot(&obj, border, color, + gfx->drawAnnot(&obj, (AnnotBorder *)NULL, color, rect->x1, rect->y1, rect->x2, rect->y2, getRotation()); obj.free(); } diff --git a/Build/source/libs/poppler/poppler-0.24.4/poppler/Annot.h b/Build/source/libs/poppler/poppler-0.25.0/poppler/Annot.h index 2865d23f7af..8fde6a6736b 100644 --- a/Build/source/libs/poppler/poppler-0.24.4/poppler/Annot.h +++ b/Build/source/libs/poppler/poppler-0.25.0/poppler/Annot.h @@ -25,6 +25,7 @@ // Copyright (C) 2012, 2013 Fabio D'Urso <fabiodurso@hotmail.it> // Copyright (C) 2012 Tobias Koenig <tokoe@kdab.com> // Copyright (C) 2013 Thomas Freitag <Thomas.Freitag@alfa.de> +// Copyright (C) 2013 Adrian Johnson <ajohnson@redneon.com> // // To see a description of the changes please see the Changelog file that // came with your tarball or type make ChangeLog if you are building from git @@ -215,7 +216,6 @@ protected: class AnnotBorder { public: enum AnnotBorderType { - typeUnknown, typeArray, typeBS }; @@ -228,18 +228,21 @@ public: borderUnderlined // Underlined }; - AnnotBorder(); virtual ~AnnotBorder(); virtual void setWidth(double new_width) { width = new_width; } - virtual AnnotBorderType getType() const { return type; } + virtual AnnotBorderType getType() const = 0; virtual double getWidth() const { return width; } virtual int getDashLength() const { return dashLength; } virtual double *getDash() const { return dash; } virtual AnnotBorderStyle getStyle() const { return style; } + virtual void writeToObject(XRef *xref, Object *obj1) const = 0; + protected: + AnnotBorder(); + GBool parseDashArray(Object *dashObj); AnnotBorderType type; @@ -259,15 +262,16 @@ public: AnnotBorderArray(); AnnotBorderArray(Array *array); - void writeToObject(XRef *xref, Object *dest) const; - void setHorizontalCorner(double hc) { horizontalCorner = hc; } void setVerticalCorner(double vc) { verticalCorner = vc; } double getHorizontalCorner() const { return horizontalCorner; } double getVerticalCorner() const { return verticalCorner; } -protected: +private: + virtual AnnotBorderType getType() const { return typeArray; } + virtual void writeToObject(XRef *xref, Object *obj1) const; + double horizontalCorner; // (Default 0) double verticalCorner; // (Default 0) // double width; // (Default 1) (inherited from AnnotBorder) @@ -284,6 +288,11 @@ public: AnnotBorderBS(Dict *dict); private: + virtual AnnotBorderType getType() const { return typeBS; } + virtual void writeToObject(XRef *xref, Object *obj1) const; + + const char *getStyleName() const; + // double width; // W (Default 1) (inherited from AnnotBorder) // AnnotBorderStyle style; // S (Default S) (inherited from AnnotBorder) // double *dash; // D (Default [3]) (inherited from AnnotBorder) @@ -536,6 +545,13 @@ public: actionPageInvisible ///< Performed when the page containing the annotation becomes invisible }; + enum FormAdditionalActionsType { + actionFieldModified, ///< Performed when the when the user modifies the field + actionFormatField, ///< Performed before the field is formatted to display its value + actionValidateField, ///< Performed when the field value changes + actionCalculateField, ///< Performed when the field needs to be recalculated + }; + Annot(PDFDoc *docA, PDFRectangle *rectA); Annot(PDFDoc *docA, Dict *dict); Annot(PDFDoc *docA, Dict *dict, Object *obj); @@ -568,7 +584,7 @@ public: void setModified(GooString *new_date); void setFlags(Guint new_flags); - void setBorder(AnnotBorderArray *new_border); // Takes ownership + void setBorder(AnnotBorder *new_border); // Takes ownership // The annotation takes the ownership of // new_color. @@ -612,6 +628,7 @@ protected: virtual ~Annot(); virtual void removeReferencedObjects(); // Called by Page::removeAnnot void setColor(AnnotColor *color, GBool fill); + void setLineStyleForBorder(AnnotBorder *border); void drawCircle(double cx, double cy, double r, GBool fill); void drawCircleTopLeft(double cx, double cy, double r); void drawCircleBottomRight(double cx, double cy, double r); @@ -1305,6 +1322,7 @@ public: AnnotAppearanceCharacs *getAppearCharacs() { return appearCharacs; } LinkAction *getAction() { return action; } LinkAction *getAdditionalAction(AdditionalActionsType type); + LinkAction *getFormAdditionalAction(FormAdditionalActionsType type); Dict *getParent() { return parent; } private: diff --git a/Build/source/libs/poppler/poppler-0.24.4/poppler/Array.cc b/Build/source/libs/poppler/poppler-0.25.0/poppler/Array.cc index 230c3287683..230c3287683 100644 --- a/Build/source/libs/poppler/poppler-0.24.4/poppler/Array.cc +++ b/Build/source/libs/poppler/poppler-0.25.0/poppler/Array.cc diff --git a/Build/source/libs/poppler/poppler-0.24.4/poppler/Array.h b/Build/source/libs/poppler/poppler-0.25.0/poppler/Array.h index e78e399baf2..e78e399baf2 100644 --- a/Build/source/libs/poppler/poppler-0.24.4/poppler/Array.h +++ b/Build/source/libs/poppler/poppler-0.25.0/poppler/Array.h diff --git a/Build/source/libs/poppler/poppler-0.24.4/poppler/BuiltinFont.cc b/Build/source/libs/poppler/poppler-0.25.0/poppler/BuiltinFont.cc index 20a297d6135..20a297d6135 100644 --- a/Build/source/libs/poppler/poppler-0.24.4/poppler/BuiltinFont.cc +++ b/Build/source/libs/poppler/poppler-0.25.0/poppler/BuiltinFont.cc diff --git a/Build/source/libs/poppler/poppler-0.24.4/poppler/BuiltinFont.h b/Build/source/libs/poppler/poppler-0.25.0/poppler/BuiltinFont.h index bbdd0558e9f..bbdd0558e9f 100644 --- a/Build/source/libs/poppler/poppler-0.24.4/poppler/BuiltinFont.h +++ b/Build/source/libs/poppler/poppler-0.25.0/poppler/BuiltinFont.h diff --git a/Build/source/libs/poppler/poppler-0.24.4/poppler/BuiltinFontTables.cc b/Build/source/libs/poppler/poppler-0.25.0/poppler/BuiltinFontTables.cc index 5115b7bcf13..5115b7bcf13 100644 --- a/Build/source/libs/poppler/poppler-0.24.4/poppler/BuiltinFontTables.cc +++ b/Build/source/libs/poppler/poppler-0.25.0/poppler/BuiltinFontTables.cc diff --git a/Build/source/libs/poppler/poppler-0.24.4/poppler/BuiltinFontTables.h b/Build/source/libs/poppler/poppler-0.25.0/poppler/BuiltinFontTables.h index eb45549efd2..eb45549efd2 100644 --- a/Build/source/libs/poppler/poppler-0.24.4/poppler/BuiltinFontTables.h +++ b/Build/source/libs/poppler/poppler-0.25.0/poppler/BuiltinFontTables.h diff --git a/Build/source/libs/poppler/poppler-0.24.4/poppler/CMap.cc b/Build/source/libs/poppler/poppler-0.25.0/poppler/CMap.cc index 13f293a4aea..13f293a4aea 100644 --- a/Build/source/libs/poppler/poppler-0.24.4/poppler/CMap.cc +++ b/Build/source/libs/poppler/poppler-0.25.0/poppler/CMap.cc diff --git a/Build/source/libs/poppler/poppler-0.24.4/poppler/CMap.h b/Build/source/libs/poppler/poppler-0.25.0/poppler/CMap.h index f4f5a9141c8..f4f5a9141c8 100644 --- a/Build/source/libs/poppler/poppler-0.24.4/poppler/CMap.h +++ b/Build/source/libs/poppler/poppler-0.25.0/poppler/CMap.h diff --git a/Build/source/libs/poppler/poppler-0.24.4/poppler/CachedFile.cc b/Build/source/libs/poppler/poppler-0.25.0/poppler/CachedFile.cc index b0ae8388113..b0ae8388113 100644 --- a/Build/source/libs/poppler/poppler-0.24.4/poppler/CachedFile.cc +++ b/Build/source/libs/poppler/poppler-0.25.0/poppler/CachedFile.cc diff --git a/Build/source/libs/poppler/poppler-0.24.4/poppler/CachedFile.h b/Build/source/libs/poppler/poppler-0.25.0/poppler/CachedFile.h index b99ea1ecad4..b99ea1ecad4 100644 --- a/Build/source/libs/poppler/poppler-0.24.4/poppler/CachedFile.h +++ b/Build/source/libs/poppler/poppler-0.25.0/poppler/CachedFile.h diff --git a/Build/source/libs/poppler/poppler-0.24.4/poppler/CairoFontEngine.cc b/Build/source/libs/poppler/poppler-0.25.0/poppler/CairoFontEngine.cc index 1546594f9ea..1546594f9ea 100644 --- a/Build/source/libs/poppler/poppler-0.24.4/poppler/CairoFontEngine.cc +++ b/Build/source/libs/poppler/poppler-0.25.0/poppler/CairoFontEngine.cc diff --git a/Build/source/libs/poppler/poppler-0.24.4/poppler/CairoFontEngine.h b/Build/source/libs/poppler/poppler-0.25.0/poppler/CairoFontEngine.h index 8c0dba116d5..8c0dba116d5 100644 --- a/Build/source/libs/poppler/poppler-0.24.4/poppler/CairoFontEngine.h +++ b/Build/source/libs/poppler/poppler-0.25.0/poppler/CairoFontEngine.h diff --git a/Build/source/libs/poppler/poppler-0.24.4/poppler/CairoOutputDev.cc b/Build/source/libs/poppler/poppler-0.25.0/poppler/CairoOutputDev.cc index 77bd2458714..77bd2458714 100644 --- a/Build/source/libs/poppler/poppler-0.24.4/poppler/CairoOutputDev.cc +++ b/Build/source/libs/poppler/poppler-0.25.0/poppler/CairoOutputDev.cc diff --git a/Build/source/libs/poppler/poppler-0.24.4/poppler/CairoOutputDev.h b/Build/source/libs/poppler/poppler-0.25.0/poppler/CairoOutputDev.h index c9ae33d4c65..c9ae33d4c65 100644 --- a/Build/source/libs/poppler/poppler-0.24.4/poppler/CairoOutputDev.h +++ b/Build/source/libs/poppler/poppler-0.25.0/poppler/CairoOutputDev.h diff --git a/Build/source/libs/poppler/poppler-0.24.4/poppler/CairoRescaleBox.cc b/Build/source/libs/poppler/poppler-0.25.0/poppler/CairoRescaleBox.cc index 3c96f45e5d3..3c96f45e5d3 100644 --- a/Build/source/libs/poppler/poppler-0.24.4/poppler/CairoRescaleBox.cc +++ b/Build/source/libs/poppler/poppler-0.25.0/poppler/CairoRescaleBox.cc diff --git a/Build/source/libs/poppler/poppler-0.24.4/poppler/CairoRescaleBox.h b/Build/source/libs/poppler/poppler-0.25.0/poppler/CairoRescaleBox.h index 072e8a9c80c..072e8a9c80c 100644 --- a/Build/source/libs/poppler/poppler-0.24.4/poppler/CairoRescaleBox.h +++ b/Build/source/libs/poppler/poppler-0.25.0/poppler/CairoRescaleBox.h diff --git a/Build/source/libs/poppler/poppler-0.24.4/poppler/Catalog.cc b/Build/source/libs/poppler/poppler-0.25.0/poppler/Catalog.cc index f17f2c0cd07..446434687ba 100644 --- a/Build/source/libs/poppler/poppler-0.24.4/poppler/Catalog.cc +++ b/Build/source/libs/poppler/poppler-0.25.0/poppler/Catalog.cc @@ -27,6 +27,8 @@ // Copyright (C) 2012 Fabio D'Urso <fabiodurso@hotmail.it> // Copyright (C) 2013 Thomas Freitag <Thomas.Freitag@alfa.de> // Copyright (C) 2013 Julien Nabet <serval2412@yahoo.fr> +// Copyright (C) 2013 Adrian Perez de Castro <aperez@igalia.com> +// Copyright (C) 2013 Adrian Johnson <ajohnson@redneon.com> // Copyright (C) 2013 José Aliste <jaliste@src.gnome.org> // // To see a description of the changes please see the Changelog file that @@ -57,6 +59,7 @@ #include "OptionalContent.h" #include "ViewerPreferences.h" #include "FileSpec.h" +#include "StructTreeRoot.h" #if MULTITHREADED # define catalogLocker() MutexLocker locker(&mutex) @@ -92,12 +95,14 @@ Catalog::Catalog(PDFDoc *docA) { embeddedFileNameTree = NULL; jsNameTree = NULL; viewerPrefs = NULL; + structTreeRoot = NULL; pagesList = NULL; pagesRefList = NULL; attrsList = NULL; kidsIdxList = NULL; lastCachedPage = 0; + markInfo = markInfoNull; xref->getCatalog(&catDict); if (!catDict.isDict()) { @@ -126,6 +131,9 @@ Catalog::Catalog(PDFDoc *docA) { } optContentProps.free(); + // actions + catDict.dictLookupNF("AA", &additionalActions); + // get the ViewerPreferences dictionary catDict.dictLookup("ViewerPreferences", &viewerPreferences); catDict.free(); @@ -176,11 +184,12 @@ Catalog::~Catalog() { delete form; delete optContent; delete viewerPrefs; + delete structTreeRoot; metadata.free(); - structTreeRoot.free(); outline.free(); acroForm.free(); viewerPreferences.free(); + additionalActions.free(); #if MULTITHREADED gDestroyMutex(&mutex); #endif @@ -849,24 +858,72 @@ PageLabelInfo *Catalog::getPageLabelInfo() return pageLabelInfo; } -Object *Catalog::getStructTreeRoot() +StructTreeRoot *Catalog::getStructTreeRoot() { catalogLocker(); - if (structTreeRoot.isNone()) - { - Object catDict; + if (!structTreeRoot) { + Object catalog; + Object root; + + xref->getCatalog(&catalog); + if (!catalog.isDict()) { + error(errSyntaxError, -1, "Catalog object is wrong type ({0:s})", catalog.getTypeName()); + catalog.free(); + return NULL; + } - xref->getCatalog(&catDict); - if (catDict.isDict()) { - catDict.dictLookup("StructTreeRoot", &structTreeRoot); - } else { - error(errSyntaxError, -1, "Catalog object is wrong type ({0:s})", catDict.getTypeName()); - structTreeRoot.initNull(); - } - catDict.free(); + if (catalog.dictLookup("StructTreeRoot", &root)->isDict("StructTreeRoot")) { + structTreeRoot = new StructTreeRoot(doc, root.getDict()); + } + + root.free(); + catalog.free(); } + return structTreeRoot; +} + +Guint Catalog::getMarkInfo() +{ + if (markInfo == markInfoNull) { + markInfo = 0; + + Object catDict; + catalogLocker(); + xref->getCatalog(&catDict); - return &structTreeRoot; + if (catDict.isDict()) { + Object markInfoDict; + catDict.dictLookup("MarkInfo", &markInfoDict); + if (markInfoDict.isDict()) { + Object value; + + if (markInfoDict.dictLookup("Marked", &value)->isBool() && value.getBool()) + markInfo |= markInfoMarked; + else if (!value.isNull()) + error(errSyntaxError, -1, "Marked object is wrong type ({0:s})", value.getTypeName()); + value.free(); + + if (markInfoDict.dictLookup("Suspects", &value)->isBool() && value.getBool()) + markInfo |= markInfoSuspects; + else if (!value.isNull()) + error(errSyntaxError, -1, "Suspects object is wrong type ({0:s})", value.getTypeName()); + value.free(); + + if (markInfoDict.dictLookup("UserProperties", &value)->isBool() && value.getBool()) + markInfo |= markInfoUserProperties; + else if (!value.isNull()) + error(errSyntaxError, -1, "UserProperties object is wrong type ({0:s})", value.getTypeName()); + value.free(); + } else if (!markInfoDict.isNull()) { + error(errSyntaxError, -1, "MarkInfo object is wrong type ({0:s})", markInfoDict.getTypeName()); + } + markInfoDict.free(); + } else { + error(errSyntaxError, -1, "Catalog object is wrong type ({0:s})", catDict.getTypeName()); + } + catDict.free(); + } + return markInfo; } Object *Catalog::getOutline() @@ -1029,3 +1086,25 @@ NameTree *Catalog::getJSNameTree() return jsNameTree; } +LinkAction* Catalog::getAdditionalAction(DocumentAdditionalActionsType type) { + Object additionalActionsObject; + LinkAction *linkAction = NULL; + + if (additionalActions.fetch(doc->getXRef(), &additionalActionsObject)->isDict()) { + const char *key = (type == actionCloseDocument ? "WC" : + type == actionSaveDocumentStart ? "WS" : + type == actionSaveDocumentFinish ? "DS" : + type == actionPrintDocumentStart ? "WP" : + type == actionPrintDocumentFinish ? "DP" : NULL); + + Object actionObject; + + if (additionalActionsObject.dictLookup(key, &actionObject)->isDict()) + linkAction = LinkAction::parseAction(&actionObject, doc->getCatalog()->getBaseURI()); + actionObject.free(); + } + + additionalActionsObject.free(); + + return linkAction; +} diff --git a/Build/source/libs/poppler/poppler-0.24.4/poppler/Catalog.h b/Build/source/libs/poppler/poppler-0.25.0/poppler/Catalog.h index 384f6342d6d..bc9ce20b098 100644 --- a/Build/source/libs/poppler/poppler-0.24.4/poppler/Catalog.h +++ b/Build/source/libs/poppler/poppler-0.25.0/poppler/Catalog.h @@ -22,6 +22,8 @@ // Copyright (C) 2010 Hib Eris <hib@hiberis.nl> // Copyright (C) 2012 Fabio D'Urso <fabiodurso@hotmail.it> // Copyright (C) 2013 Thomas Freitag <Thomas.Freitag@alfa.de> +// Copyright (C) 2013 Adrian Perez de Castro <aperez@igalia.com> +// Copyright (C) 2013 Adrian Johnson <ajohnson@redneon.com> // Copyright (C) 2013 José Aliste <jaliste@src.gnome.org> // // To see a description of the changes please see the Changelog file that @@ -49,11 +51,13 @@ class Page; class PageAttrs; struct Ref; class LinkDest; +class LinkAction; class PageLabelInfo; class Form; class OCGs; class ViewerPreferences; class FileSpec; +class StructTreeRoot; //------------------------------------------------------------------------ // NameTree @@ -125,7 +129,16 @@ public: GooString *readMetadata(); // Return the structure tree root object. - Object *getStructTreeRoot(); + StructTreeRoot *getStructTreeRoot(); + + // Return values from the MarkInfo dictionary as flags in a bitfield. + enum MarkInfoFlags { + markInfoNull = 1 << 0, + markInfoMarked = 1 << 1, + markInfoUserProperties = 1 << 2, + markInfoSuspects = 1 << 3, + }; + Guint getMarkInfo(); // Find a page, given its object ID. Returns page number, or 0 if // not found. @@ -145,6 +158,7 @@ public: // Get the number of javascript scripts int numJS() { return getJSNameTree()->numEntries(); } + GooString *getJSName(int i) { return getJSNameTree()->getName(i); } // Get the i'th JavaScript script (at the Document level) in the document GooString *getJS(int i); @@ -195,6 +209,16 @@ public: PageMode getPageMode(); PageLayout getPageLayout(); + enum DocumentAdditionalActionsType { + actionCloseDocument, ///< Performed before closing the document + actionSaveDocumentStart, ///< Performed before saving the document + actionSaveDocumentFinish, ///< Performed after saving the document + actionPrintDocumentStart, ///< Performed before printing the document + actionPrintDocumentFinish, ///< Performed after printing the document + }; + + LinkAction *getAdditionalAction(DocumentAdditionalActionsType type); + private: // Get page label info. @@ -220,7 +244,8 @@ private: NameTree *jsNameTree; // Java Script name-tree GooString *baseURI; // base URI for URI-type links Object metadata; // metadata stream - Object structTreeRoot; // structure tree root dictionary + StructTreeRoot *structTreeRoot; // structure tree root + Guint markInfo; // Flags from MarkInfo dictionary Object outline; // outline dictionary Object acroForm; // AcroForm dictionary Object viewerPreferences; // ViewerPreference dictionary @@ -229,6 +254,7 @@ private: PageLabelInfo *pageLabelInfo; // info about page labels PageMode pageMode; // page mode PageLayout pageLayout; // page layout + Object additionalActions; // page additional actions GBool cachePageTree(int page); // Cache first <page> pages. Object *findDestInTree(Object *tree, GooString *name, Object *obj); diff --git a/Build/source/libs/poppler/poppler-0.24.4/poppler/CharCodeToUnicode.cc b/Build/source/libs/poppler/poppler-0.25.0/poppler/CharCodeToUnicode.cc index 16ba6d48649..16ba6d48649 100644 --- a/Build/source/libs/poppler/poppler-0.24.4/poppler/CharCodeToUnicode.cc +++ b/Build/source/libs/poppler/poppler-0.25.0/poppler/CharCodeToUnicode.cc diff --git a/Build/source/libs/poppler/poppler-0.24.4/poppler/CharCodeToUnicode.h b/Build/source/libs/poppler/poppler-0.25.0/poppler/CharCodeToUnicode.h index 1672105a8f4..1672105a8f4 100644 --- a/Build/source/libs/poppler/poppler-0.24.4/poppler/CharCodeToUnicode.h +++ b/Build/source/libs/poppler/poppler-0.25.0/poppler/CharCodeToUnicode.h diff --git a/Build/source/libs/poppler/poppler-0.24.4/poppler/CharTypes.h b/Build/source/libs/poppler/poppler-0.25.0/poppler/CharTypes.h index d0df630d0c9..d0df630d0c9 100644 --- a/Build/source/libs/poppler/poppler-0.24.4/poppler/CharTypes.h +++ b/Build/source/libs/poppler/poppler-0.25.0/poppler/CharTypes.h diff --git a/Build/source/libs/poppler/poppler-0.24.4/poppler/CompactFontTables.h b/Build/source/libs/poppler/poppler-0.25.0/poppler/CompactFontTables.h index cfbfdaf5752..cfbfdaf5752 100644 --- a/Build/source/libs/poppler/poppler-0.24.4/poppler/CompactFontTables.h +++ b/Build/source/libs/poppler/poppler-0.25.0/poppler/CompactFontTables.h diff --git a/Build/source/libs/poppler/poppler-0.24.4/poppler/CurlCachedFile.cc b/Build/source/libs/poppler/poppler-0.25.0/poppler/CurlCachedFile.cc index af4c2b60322..af4c2b60322 100644 --- a/Build/source/libs/poppler/poppler-0.24.4/poppler/CurlCachedFile.cc +++ b/Build/source/libs/poppler/poppler-0.25.0/poppler/CurlCachedFile.cc diff --git a/Build/source/libs/poppler/poppler-0.24.4/poppler/CurlCachedFile.h b/Build/source/libs/poppler/poppler-0.25.0/poppler/CurlCachedFile.h index 49882aba8ac..49882aba8ac 100644 --- a/Build/source/libs/poppler/poppler-0.24.4/poppler/CurlCachedFile.h +++ b/Build/source/libs/poppler/poppler-0.25.0/poppler/CurlCachedFile.h diff --git a/Build/source/libs/poppler/poppler-0.24.4/poppler/CurlPDFDocBuilder.cc b/Build/source/libs/poppler/poppler-0.25.0/poppler/CurlPDFDocBuilder.cc index 5b02b14a784..5b02b14a784 100644 --- a/Build/source/libs/poppler/poppler-0.24.4/poppler/CurlPDFDocBuilder.cc +++ b/Build/source/libs/poppler/poppler-0.25.0/poppler/CurlPDFDocBuilder.cc diff --git a/Build/source/libs/poppler/poppler-0.24.4/poppler/CurlPDFDocBuilder.h b/Build/source/libs/poppler/poppler-0.25.0/poppler/CurlPDFDocBuilder.h index fb34862057c..fb34862057c 100644 --- a/Build/source/libs/poppler/poppler-0.24.4/poppler/CurlPDFDocBuilder.h +++ b/Build/source/libs/poppler/poppler-0.25.0/poppler/CurlPDFDocBuilder.h diff --git a/Build/source/libs/poppler/poppler-0.24.4/poppler/DCTStream.cc b/Build/source/libs/poppler/poppler-0.25.0/poppler/DCTStream.cc index bfdb0eaf80a..bfdb0eaf80a 100644 --- a/Build/source/libs/poppler/poppler-0.24.4/poppler/DCTStream.cc +++ b/Build/source/libs/poppler/poppler-0.25.0/poppler/DCTStream.cc diff --git a/Build/source/libs/poppler/poppler-0.24.4/poppler/DCTStream.h b/Build/source/libs/poppler/poppler-0.25.0/poppler/DCTStream.h index bc20a7aaab6..bc20a7aaab6 100644 --- a/Build/source/libs/poppler/poppler-0.24.4/poppler/DCTStream.h +++ b/Build/source/libs/poppler/poppler-0.25.0/poppler/DCTStream.h diff --git a/Build/source/libs/poppler/poppler-0.24.4/poppler/DateInfo.cc b/Build/source/libs/poppler/poppler-0.25.0/poppler/DateInfo.cc index 563204a1743..563204a1743 100644 --- a/Build/source/libs/poppler/poppler-0.24.4/poppler/DateInfo.cc +++ b/Build/source/libs/poppler/poppler-0.25.0/poppler/DateInfo.cc diff --git a/Build/source/libs/poppler/poppler-0.24.4/poppler/DateInfo.h b/Build/source/libs/poppler/poppler-0.25.0/poppler/DateInfo.h index 116350f4134..116350f4134 100644 --- a/Build/source/libs/poppler/poppler-0.24.4/poppler/DateInfo.h +++ b/Build/source/libs/poppler/poppler-0.25.0/poppler/DateInfo.h diff --git a/Build/source/libs/poppler/poppler-0.24.4/poppler/Decrypt.cc b/Build/source/libs/poppler/poppler-0.25.0/poppler/Decrypt.cc index ba44f959c31..ba44f959c31 100644 --- a/Build/source/libs/poppler/poppler-0.24.4/poppler/Decrypt.cc +++ b/Build/source/libs/poppler/poppler-0.25.0/poppler/Decrypt.cc diff --git a/Build/source/libs/poppler/poppler-0.24.4/poppler/Decrypt.h b/Build/source/libs/poppler/poppler-0.25.0/poppler/Decrypt.h index 10a6386c6b5..10a6386c6b5 100644 --- a/Build/source/libs/poppler/poppler-0.24.4/poppler/Decrypt.h +++ b/Build/source/libs/poppler/poppler-0.25.0/poppler/Decrypt.h diff --git a/Build/source/libs/poppler/poppler-0.24.4/poppler/Dict.cc b/Build/source/libs/poppler/poppler-0.25.0/poppler/Dict.cc index 4cf42dcd2c1..4cf42dcd2c1 100644 --- a/Build/source/libs/poppler/poppler-0.24.4/poppler/Dict.cc +++ b/Build/source/libs/poppler/poppler-0.25.0/poppler/Dict.cc diff --git a/Build/source/libs/poppler/poppler-0.24.4/poppler/Dict.h b/Build/source/libs/poppler/poppler-0.25.0/poppler/Dict.h index fba99edc513..fba99edc513 100644 --- a/Build/source/libs/poppler/poppler-0.24.4/poppler/Dict.h +++ b/Build/source/libs/poppler/poppler-0.25.0/poppler/Dict.h diff --git a/Build/source/libs/poppler/poppler-0.24.4/poppler/Error.cc b/Build/source/libs/poppler/poppler-0.25.0/poppler/Error.cc index 99ca3ad3f53..99ca3ad3f53 100644 --- a/Build/source/libs/poppler/poppler-0.24.4/poppler/Error.cc +++ b/Build/source/libs/poppler/poppler-0.25.0/poppler/Error.cc diff --git a/Build/source/libs/poppler/poppler-0.24.4/poppler/Error.h b/Build/source/libs/poppler/poppler-0.25.0/poppler/Error.h index 88fc3ea4353..88fc3ea4353 100644 --- a/Build/source/libs/poppler/poppler-0.24.4/poppler/Error.h +++ b/Build/source/libs/poppler/poppler-0.25.0/poppler/Error.h diff --git a/Build/source/libs/poppler/poppler-0.24.4/poppler/ErrorCodes.h b/Build/source/libs/poppler/poppler-0.25.0/poppler/ErrorCodes.h index b28528df564..b28528df564 100644 --- a/Build/source/libs/poppler/poppler-0.24.4/poppler/ErrorCodes.h +++ b/Build/source/libs/poppler/poppler-0.25.0/poppler/ErrorCodes.h diff --git a/Build/source/libs/poppler/poppler-0.24.4/poppler/FileSpec.cc b/Build/source/libs/poppler/poppler-0.25.0/poppler/FileSpec.cc index bac1eaea0d7..bac1eaea0d7 100644 --- a/Build/source/libs/poppler/poppler-0.24.4/poppler/FileSpec.cc +++ b/Build/source/libs/poppler/poppler-0.25.0/poppler/FileSpec.cc diff --git a/Build/source/libs/poppler/poppler-0.24.4/poppler/FileSpec.h b/Build/source/libs/poppler/poppler-0.25.0/poppler/FileSpec.h index 9f2f6fcd131..9f2f6fcd131 100644 --- a/Build/source/libs/poppler/poppler-0.24.4/poppler/FileSpec.h +++ b/Build/source/libs/poppler/poppler-0.25.0/poppler/FileSpec.h diff --git a/Build/source/libs/poppler/poppler-0.24.4/poppler/FlateStream.cc b/Build/source/libs/poppler/poppler-0.25.0/poppler/FlateStream.cc index 7990dadd821..7990dadd821 100644 --- a/Build/source/libs/poppler/poppler-0.24.4/poppler/FlateStream.cc +++ b/Build/source/libs/poppler/poppler-0.25.0/poppler/FlateStream.cc diff --git a/Build/source/libs/poppler/poppler-0.24.4/poppler/FlateStream.h b/Build/source/libs/poppler/poppler-0.25.0/poppler/FlateStream.h index 9e3835f042a..9e3835f042a 100644 --- a/Build/source/libs/poppler/poppler-0.24.4/poppler/FlateStream.h +++ b/Build/source/libs/poppler/poppler-0.25.0/poppler/FlateStream.h diff --git a/Build/source/libs/poppler/poppler-0.24.4/poppler/FontEncodingTables.cc b/Build/source/libs/poppler/poppler-0.25.0/poppler/FontEncodingTables.cc index 6ebef787421..6ebef787421 100644 --- a/Build/source/libs/poppler/poppler-0.24.4/poppler/FontEncodingTables.cc +++ b/Build/source/libs/poppler/poppler-0.25.0/poppler/FontEncodingTables.cc diff --git a/Build/source/libs/poppler/poppler-0.24.4/poppler/FontEncodingTables.h b/Build/source/libs/poppler/poppler-0.25.0/poppler/FontEncodingTables.h index a417b324e48..a417b324e48 100644 --- a/Build/source/libs/poppler/poppler-0.24.4/poppler/FontEncodingTables.h +++ b/Build/source/libs/poppler/poppler-0.25.0/poppler/FontEncodingTables.h diff --git a/Build/source/libs/poppler/poppler-0.24.4/poppler/FontInfo.cc b/Build/source/libs/poppler/poppler-0.25.0/poppler/FontInfo.cc index 8fc89e9d827..8fc89e9d827 100644 --- a/Build/source/libs/poppler/poppler-0.24.4/poppler/FontInfo.cc +++ b/Build/source/libs/poppler/poppler-0.25.0/poppler/FontInfo.cc diff --git a/Build/source/libs/poppler/poppler-0.24.4/poppler/FontInfo.h b/Build/source/libs/poppler/poppler-0.25.0/poppler/FontInfo.h index 615b6793de3..615b6793de3 100644 --- a/Build/source/libs/poppler/poppler-0.24.4/poppler/FontInfo.h +++ b/Build/source/libs/poppler/poppler-0.25.0/poppler/FontInfo.h diff --git a/Build/source/libs/poppler/poppler-0.24.4/poppler/Form.cc b/Build/source/libs/poppler/poppler-0.25.0/poppler/Form.cc index 78c25e3aa93..661ed8972df 100644 --- a/Build/source/libs/poppler/poppler-0.24.4/poppler/Form.cc +++ b/Build/source/libs/poppler/poppler-0.25.0/poppler/Form.cc @@ -7,7 +7,7 @@ // Copyright 2006-2008 Julien Rebetez <julienr@svn.gnome.org> // Copyright 2007-2012 Albert Astals Cid <aacid@kde.org> // Copyright 2007-2008, 2011 Carlos Garcia Campos <carlosgc@gnome.org> -// Copyright 2007 Adrian Johnson <ajohnson@redneon.com> +// Copyright 2007, 2013 Adrian Johnson <ajohnson@redneon.com> // Copyright 2007 Iñigo MartÃnez <inigomartinez@gmail.com> // Copyright 2008, 2011 Pino Toscano <pino@kde.org> // Copyright 2008 Michael Vrable <mvrable@cs.ucsd.edu> @@ -156,6 +156,10 @@ LinkAction *FormWidget::getActivationAction() { return widget ? widget->getAction() : NULL; } +LinkAction *FormWidget::getAdditionalAction(Annot::FormAdditionalActionsType type) { + return widget ? widget->getFormAdditionalAction(type) : NULL; +} + FormWidgetButton::FormWidgetButton (PDFDoc *docA, Object *aobj, unsigned num, Ref ref, FormField *p) : FormWidget(docA, aobj, num, ref, p) { diff --git a/Build/source/libs/poppler/poppler-0.24.4/poppler/Form.h b/Build/source/libs/poppler/poppler-0.25.0/poppler/Form.h index ef67748aa69..3778ff6f2ef 100644 --- a/Build/source/libs/poppler/poppler-0.24.4/poppler/Form.h +++ b/Build/source/libs/poppler/poppler-0.25.0/poppler/Form.h @@ -10,6 +10,7 @@ // Copyright 2010 Mark Riedesel <mark@klowner.com> // Copyright 2011 Pino Toscano <pino@kde.org> // Copyright 2012 Fabio D'Urso <fabiodurso@hotmail.it> +// Copyright 2013 Adrian Johnson <ajohnson@redneon.com> // //======================================================================== @@ -21,6 +22,7 @@ #endif #include "Object.h" +#include "Annot.h" #include <set> @@ -101,6 +103,7 @@ public: bool isReadOnly() const; LinkAction *getActivationAction(); + LinkAction *getAdditionalAction(Annot::FormAdditionalActionsType type); // return the unique ID corresponding to pageNum/fieldNum static int encodeID (unsigned pageNum, unsigned fieldNum); diff --git a/Build/source/libs/poppler/poppler-0.24.4/poppler/Function.cc b/Build/source/libs/poppler/poppler-0.25.0/poppler/Function.cc index 2f94a54a307..2f94a54a307 100644 --- a/Build/source/libs/poppler/poppler-0.24.4/poppler/Function.cc +++ b/Build/source/libs/poppler/poppler-0.25.0/poppler/Function.cc diff --git a/Build/source/libs/poppler/poppler-0.24.4/poppler/Function.h b/Build/source/libs/poppler/poppler-0.25.0/poppler/Function.h index 90e2a768ad0..90e2a768ad0 100644 --- a/Build/source/libs/poppler/poppler-0.24.4/poppler/Function.h +++ b/Build/source/libs/poppler/poppler-0.25.0/poppler/Function.h diff --git a/Build/source/libs/poppler/poppler-0.24.4/poppler/Gfx.cc b/Build/source/libs/poppler/poppler-0.25.0/poppler/Gfx.cc index f2971d666c9..90bf41e4965 100644 --- a/Build/source/libs/poppler/poppler-0.24.4/poppler/Gfx.cc +++ b/Build/source/libs/poppler/poppler-0.25.0/poppler/Gfx.cc @@ -460,7 +460,7 @@ void GfxResources::lookupColorSpace(const char *name, Object *obj) { obj->initNull(); } -GfxPattern *GfxResources::lookupPattern(char *name, OutputDev *out) { +GfxPattern *GfxResources::lookupPattern(char *name, OutputDev *out, GfxState *state) { GfxResources *resPtr; GfxPattern *pattern; Object obj; @@ -468,7 +468,7 @@ GfxPattern *GfxResources::lookupPattern(char *name, OutputDev *out) { for (resPtr = this; resPtr; resPtr = resPtr->next) { if (resPtr->patternDict.isDict()) { if (!resPtr->patternDict.dictLookup(name, &obj)->isNull()) { - pattern = GfxPattern::parse(&obj, out); + pattern = GfxPattern::parse(&obj, out, state); obj.free(); return pattern; } @@ -479,7 +479,7 @@ GfxPattern *GfxResources::lookupPattern(char *name, OutputDev *out) { return NULL; } -GfxShading *GfxResources::lookupShading(char *name, OutputDev *out) { +GfxShading *GfxResources::lookupShading(char *name, OutputDev *out, GfxState *state) { GfxResources *resPtr; GfxShading *shading; Object obj; @@ -487,7 +487,7 @@ GfxShading *GfxResources::lookupShading(char *name, OutputDev *out) { for (resPtr = this; resPtr; resPtr = resPtr->next) { if (resPtr->shadingDict.isDict()) { if (!resPtr->shadingDict.dictLookup(name, &obj)->isNull()) { - shading = GfxShading::parse(&obj, out); + shading = GfxShading::parse(&obj, out, state); obj.free(); return shading; } @@ -584,6 +584,9 @@ Gfx::Gfx(PDFDoc *docA, OutputDev *outA, int pageNum, Dict *resDict, out->clip(state); state->clearPath(); } +#ifdef USE_CMS + initDisplayProfile(); +#endif } Gfx::Gfx(PDFDoc *docA, OutputDev *outA, Dict *resDict, @@ -633,8 +636,55 @@ Gfx::Gfx(PDFDoc *docA, OutputDev *outA, Dict *resDict, out->clip(state); state->clearPath(); } +#ifdef USE_CMS + initDisplayProfile(); +#endif } +#ifdef USE_CMS + +#ifdef USE_LCMS1 +#include <lcms.h> +#else +#include <lcms2.h> +#define LCMS_FLAGS cmsFLAGS_NOOPTIMIZE +#endif + +void Gfx::initDisplayProfile() { + Object catDict; + xref->getCatalog(&catDict); + if (catDict.isDict()) { + Object outputIntents; + catDict.dictLookup("OutputIntents", &outputIntents); + if (outputIntents.isArray() && outputIntents.arrayGetLength() == 1) { + Object firstElement; + outputIntents.arrayGet(0, &firstElement); + if (firstElement.isDict()) { + Object profile; + firstElement.dictLookup("DestOutputProfile", &profile); + if (profile.isStream()) { + Stream *iccStream = profile.getStream(); + int length = 0; + Guchar *profBuf = iccStream->toUnsignedChars(&length, 65536, 65536); + cmsHPROFILE hp = cmsOpenProfileFromMem(profBuf,length); + if (hp == 0) { + error(errSyntaxWarning, -1, "read ICCBased color space profile error"); + } else { + state->setDisplayProfile(hp); + } + gfree(profBuf); + } + profile.free(); + } + firstElement.free(); + } + outputIntents.free(); + } + catDict.free(); +} + +#endif + Gfx::~Gfx() { while (stateGuards.size()) { popStateGuard(); @@ -1183,7 +1233,7 @@ void Gfx::opSetExtGState(Object args[], int numArgs) { blendingColorSpace = NULL; isolated = knockout = gFalse; if (!obj4.dictLookup("CS", &obj5)->isNull()) { - blendingColorSpace = GfxColorSpace::parse(&obj5, out); + blendingColorSpace = GfxColorSpace::parse(&obj5, out, state); } obj5.free(); if (obj4.dictLookup("I", &obj5)->isBool()) { @@ -1371,6 +1421,7 @@ void Gfx::doSoftMask(Object *str, GBool alpha, } void Gfx::opSetRenderingIntent(Object args[], int numArgs) { + state->setRenderingIntent(args[0].getName()); } //------------------------------------------------------------------------ @@ -1385,7 +1436,7 @@ void Gfx::opSetFillGray(Object args[], int numArgs) { state->setFillPattern(NULL); res->lookupColorSpace("DefaultGray", &obj); if (!obj.isNull()) { - colorSpace = GfxColorSpace::parse(&obj, out); + colorSpace = GfxColorSpace::parse(&obj, out, state); } if (colorSpace == NULL) { colorSpace = new GfxDeviceGrayColorSpace(); @@ -1406,7 +1457,7 @@ void Gfx::opSetStrokeGray(Object args[], int numArgs) { state->setStrokePattern(NULL); res->lookupColorSpace("DefaultGray", &obj); if (!obj.isNull()) { - colorSpace = GfxColorSpace::parse(&obj, out); + colorSpace = GfxColorSpace::parse(&obj, out, state); } if (colorSpace == NULL) { colorSpace = new GfxDeviceGrayColorSpace(); @@ -1427,7 +1478,7 @@ void Gfx::opSetFillCMYKColor(Object args[], int numArgs) { res->lookupColorSpace("DefaultCMYK", &obj); if (!obj.isNull()) { - colorSpace = GfxColorSpace::parse(&obj, out); + colorSpace = GfxColorSpace::parse(&obj, out, state); } if (colorSpace == NULL) { colorSpace = new GfxDeviceCMYKColorSpace(); @@ -1452,7 +1503,7 @@ void Gfx::opSetStrokeCMYKColor(Object args[], int numArgs) { state->setStrokePattern(NULL); res->lookupColorSpace("DefaultCMYK", &obj); if (!obj.isNull()) { - colorSpace = GfxColorSpace::parse(&obj, out); + colorSpace = GfxColorSpace::parse(&obj, out, state); } if (colorSpace == NULL) { colorSpace = new GfxDeviceCMYKColorSpace(); @@ -1476,7 +1527,7 @@ void Gfx::opSetFillRGBColor(Object args[], int numArgs) { state->setFillPattern(NULL); res->lookupColorSpace("DefaultRGB", &obj); if (!obj.isNull()) { - colorSpace = GfxColorSpace::parse(&obj, out); + colorSpace = GfxColorSpace::parse(&obj, out, state); } if (colorSpace == NULL) { colorSpace = new GfxDeviceRGBColorSpace(); @@ -1500,7 +1551,7 @@ void Gfx::opSetStrokeRGBColor(Object args[], int numArgs) { state->setStrokePattern(NULL); res->lookupColorSpace("DefaultRGB", &obj); if (!obj.isNull()) { - colorSpace = GfxColorSpace::parse(&obj, out); + colorSpace = GfxColorSpace::parse(&obj, out, state); } if (colorSpace == NULL) { colorSpace = new GfxDeviceRGBColorSpace(); @@ -1522,9 +1573,9 @@ void Gfx::opSetFillColorSpace(Object args[], int numArgs) { res->lookupColorSpace(args[0].getName(), &obj); if (obj.isNull()) { - colorSpace = GfxColorSpace::parse(&args[0], out); + colorSpace = GfxColorSpace::parse(&args[0], out, state); } else { - colorSpace = GfxColorSpace::parse(&obj, out); + colorSpace = GfxColorSpace::parse(&obj, out, state); } obj.free(); if (colorSpace) { @@ -1547,9 +1598,9 @@ void Gfx::opSetStrokeColorSpace(Object args[], int numArgs) { state->setStrokePattern(NULL); res->lookupColorSpace(args[0].getName(), &obj); if (obj.isNull()) { - colorSpace = GfxColorSpace::parse(&args[0], out); + colorSpace = GfxColorSpace::parse(&args[0], out, state); } else { - colorSpace = GfxColorSpace::parse(&obj, out); + colorSpace = GfxColorSpace::parse(&obj, out, state); } obj.free(); if (colorSpace) { @@ -1620,7 +1671,7 @@ void Gfx::opSetFillColorN(Object args[], int numArgs) { } if (numArgs > 0) { if (args[numArgs-1].isName() && - (pattern = res->lookupPattern(args[numArgs-1].getName(), out))) { + (pattern = res->lookupPattern(args[numArgs-1].getName(), out, state))) { state->setFillPattern(pattern); } } @@ -1672,7 +1723,7 @@ void Gfx::opSetStrokeColorN(Object args[], int numArgs) { return; } if (args[numArgs-1].isName() && - (pattern = res->lookupPattern(args[numArgs-1].getName(), out))) { + (pattern = res->lookupPattern(args[numArgs-1].getName(), out, state))) { state->setStrokePattern(pattern); } @@ -2382,7 +2433,7 @@ void Gfx::opShFill(Object args[], int numArgs) { return; } - if (!(shading = res->lookupShading(args[0].getName(), out))) { + if (!(shading = res->lookupShading(args[0].getName(), out, state))) { return; } @@ -4339,14 +4390,29 @@ void Gfx::doImage(Object *ref, Stream *str, GBool inlineImg) { } } if (!obj1.isNull()) { - colorSpace = GfxColorSpace::parse(&obj1, out); + Object objIntent; + char *tempIntent = NULL; + dict->lookup("Intent", &objIntent); + if (objIntent.isName()) { + tempIntent = state->getRenderingIntent(); + if (tempIntent != NULL) { + tempIntent = strdup(tempIntent); + } + state->setRenderingIntent(objIntent.getName()); + } + colorSpace = GfxColorSpace::parse(&obj1, out, state); + if (objIntent.isName()) { + state->setRenderingIntent(tempIntent); + free(tempIntent); + } + objIntent.free(); } else if (csMode == streamCSDeviceGray) { Object objCS; res->lookupColorSpace("DefaultGray", &objCS); if (objCS.isNull()) { colorSpace = new GfxDeviceGrayColorSpace(); } else { - colorSpace = GfxColorSpace::parse(&objCS, out); + colorSpace = GfxColorSpace::parse(&objCS, out, state); } objCS.free(); } else if (csMode == streamCSDeviceRGB) { @@ -4355,7 +4421,7 @@ void Gfx::doImage(Object *ref, Stream *str, GBool inlineImg) { if (objCS.isNull()) { colorSpace = new GfxDeviceRGBColorSpace(); } else { - colorSpace = GfxColorSpace::parse(&objCS, out); + colorSpace = GfxColorSpace::parse(&objCS, out, state); } objCS.free(); } else if (csMode == streamCSDeviceCMYK) { @@ -4364,7 +4430,7 @@ void Gfx::doImage(Object *ref, Stream *str, GBool inlineImg) { if (objCS.isNull()) { colorSpace = new GfxDeviceCMYKColorSpace(); } else { - colorSpace = GfxColorSpace::parse(&objCS, out); + colorSpace = GfxColorSpace::parse(&objCS, out, state); } objCS.free(); } else { @@ -4459,7 +4525,7 @@ void Gfx::doImage(Object *ref, Stream *str, GBool inlineImg) { obj2.free(); } } - maskColorSpace = GfxColorSpace::parse(&obj1, out); + maskColorSpace = GfxColorSpace::parse(&obj1, out, state); obj1.free(); if (!maskColorSpace || maskColorSpace->getMode() != csDeviceGray) { goto err1; @@ -4755,7 +4821,7 @@ void Gfx::doForm(Object *str) { if (dict->lookup("Group", &obj1)->isDict()) { if (obj1.dictLookup("S", &obj2)->isName("Transparency")) { if (!obj1.dictLookup("CS", &obj3)->isNull()) { - blendingColorSpace = GfxColorSpace::parse(&obj3, out); + blendingColorSpace = GfxColorSpace::parse(&obj3, out, state); } obj3.free(); if (obj1.dictLookup("I", &obj3)->isBool()) { diff --git a/Build/source/libs/poppler/poppler-0.24.4/poppler/Gfx.h b/Build/source/libs/poppler/poppler-0.25.0/poppler/Gfx.h index aba3b7e5bfe..a82f9f4af24 100644 --- a/Build/source/libs/poppler/poppler-0.24.4/poppler/Gfx.h +++ b/Build/source/libs/poppler/poppler-0.25.0/poppler/Gfx.h @@ -117,8 +117,8 @@ public: GBool lookupXObjectNF(char *name, Object *obj); GBool lookupMarkedContentNF(char *name, Object *obj); void lookupColorSpace(const char *name, Object *obj); - GfxPattern *lookupPattern(char *name, OutputDev *out); - GfxShading *lookupShading(char *name, OutputDev *out); + GfxPattern *lookupPattern(char *name, OutputDev *out, GfxState *state); + GfxShading *lookupShading(char *name, OutputDev *out, GfxState *state); GBool lookupGState(char *name, Object *obj); GBool lookupGStateNF(char *name, Object *obj); @@ -156,7 +156,9 @@ public: PDFRectangle *box, PDFRectangle *cropBox, GBool (*abortCheckCbkA)(void *data) = NULL, void *abortCheckCbkDataA = NULL, XRef *xrefA = NULL); - +#ifdef USE_CMS + void initDisplayProfile(); +#endif ~Gfx(); XRef *getXRef() { return xref; } diff --git a/Build/source/libs/poppler/poppler-0.24.4/poppler/GfxFont.cc b/Build/source/libs/poppler/poppler-0.25.0/poppler/GfxFont.cc index ea22af8272c..c54181b4150 100644 --- a/Build/source/libs/poppler/poppler-0.24.4/poppler/GfxFont.cc +++ b/Build/source/libs/poppler/poppler-0.25.0/poppler/GfxFont.cc @@ -30,6 +30,7 @@ // Copyright (C) 2012 Yi Yang <ahyangyi@gmail.com> // Copyright (C) 2012 Suzuki Toshiya <mpsuzuki@hiroshima-u.ac.jp> // Copyright (C) 2012 Thomas Freitag <Thomas.Freitag@alfa.de> +// Copyright (C) 2013 Jason Crain <jason@aquaticape.us> // // To see a description of the changes please see the Changelog file that // came with your tarball or type make ChangeLog if you are building from git @@ -1221,10 +1222,16 @@ Gfx8BitFont::Gfx8BitFont(XRef *xref, const char *tagA, Ref idA, GooString *nameA // pass 1: use the name-to-Unicode mapping table missing = hex = gFalse; + GBool isZapfDingbats = name && name->endsWith("ZapfDingbats"); for (code = 0; code < 256; ++code) { if ((charName = enc[code])) { - if (!(toUnicode[code] = globalParams->mapNameToUnicode(charName)) && - strcmp(charName, ".notdef")) { + if (isZapfDingbats) { + // include ZapfDingbats names + toUnicode[code] = globalParams->mapNameToUnicodeAll(charName); + } else { + toUnicode[code] = globalParams->mapNameToUnicodeText(charName); + } + if (!toUnicode[code] && strcmp(charName, ".notdef")) { // if it wasn't in the name-to-Unicode table, check for a // name that looks like 'Axx' or 'xx', where 'A' is any letter // and 'xx' is two hex digits @@ -1485,7 +1492,7 @@ static int parseCharName(char *charName, Unicode *uBuf, int uLen, // corresponding character in that list. // 3.2. otherwise, if the component is in the Adobe Glyph List, then map it // to the corresponding character in that list. - if (names && (uBuf[0] = globalParams->mapNameToUnicode(charName))) { + if (names && (uBuf[0] = globalParams->mapNameToUnicodeText(charName))) { return 1; } if (numeric) { @@ -1674,7 +1681,7 @@ int *Gfx8BitFont::getCodeToGIDMap(FoFiTrueType *ff) { } else if (useUnicode) { Unicode *uAux; for (i = 0; i < 256; ++i) { - if (((charName = enc[i]) && (u = globalParams->mapNameToUnicode(charName)))) + if (((charName = enc[i]) && (u = globalParams->mapNameToUnicodeAll(charName)))) map[i] = ff->mapCodeToGID(cmap, u); else { diff --git a/Build/source/libs/poppler/poppler-0.24.4/poppler/GfxFont.h b/Build/source/libs/poppler/poppler-0.25.0/poppler/GfxFont.h index f9806681102..f9806681102 100644 --- a/Build/source/libs/poppler/poppler-0.24.4/poppler/GfxFont.h +++ b/Build/source/libs/poppler/poppler-0.25.0/poppler/GfxFont.h diff --git a/Build/source/libs/poppler/poppler-0.24.4/poppler/GfxState.cc b/Build/source/libs/poppler/poppler-0.25.0/poppler/GfxState.cc index 0bafb6d3f72..7c7928a915d 100644 --- a/Build/source/libs/poppler/poppler-0.24.4/poppler/GfxState.cc +++ b/Build/source/libs/poppler/poppler-0.25.0/poppler/GfxState.cc @@ -18,13 +18,14 @@ // Copyright (C) 2006, 2010 Carlos Garcia Campos <carlosgc@gnome.org> // Copyright (C) 2006-2013 Albert Astals Cid <aacid@kde.org> // Copyright (C) 2009, 2012 Koji Otani <sho@bbr.jp> -// Copyright (C) 2009, 2011, 2012 Thomas Freitag <Thomas.Freitag@alfa.de> +// Copyright (C) 2009, 2011-2013 Thomas Freitag <Thomas.Freitag@alfa.de> // Copyright (C) 2009 Christian Persch <chpe@gnome.org> // Copyright (C) 2010 PaweÅ‚ Wiejacha <pawel.wiejacha@gmail.com> // Copyright (C) 2010 Christian Feuersänger <cfeuersaenger@googlemail.com> // Copyright (C) 2011 Andrea Canciani <ranma42@gmail.com> // Copyright (C) 2012 William Bader <williambader@hotmail.com> // Copyright (C) 2013 Lu Wang <coolwanglu@gmail.com> +// Copyright (C) 2013 Hib Eris <hib@hiberis.nl> // // To see a description of the changes please see the Changelog file that // came with your tarball or type make ChangeLog if you are building from git @@ -53,6 +54,7 @@ #include "GlobalParams.h" #include "PopplerCache.h" #include "OutputDev.h" +#include "splash/SplashTypes.h" //------------------------------------------------------------------------ @@ -155,6 +157,8 @@ static const char *gfxColorSpaceModeNames[] = { #ifdef USE_CMS +static const std::map<unsigned int, unsigned int>::size_type CMSCACHE_LIMIT = 2048; + #ifdef USE_LCMS1 #include <lcms.h> #define cmsColorSpaceSignature icColorSpaceSignature @@ -198,9 +202,11 @@ void GfxColorTransform::doTransform(void *in, void *out, unsigned int size) { } // transformA should be a cmsHTRANSFORM -GfxColorTransform::GfxColorTransform(void *transformA) { +GfxColorTransform::GfxColorTransform(void *transformA, int cmsIntentA, unsigned int transformPixelTypeA) { transform = transformA; refCount = 1; + cmsIntent = cmsIntentA; + transformPixelType = transformPixelTypeA; } GfxColorTransform::~GfxColorTransform() { @@ -228,6 +234,25 @@ static cmsHPROFILE loadColorProfile(const char *fileName); void GfxColorSpace::setDisplayProfile(void *displayProfileA) { displayProfile = displayProfileA; + if (displayProfile != NULL) { + cmsHTRANSFORM transform; + unsigned int nChannels; + + displayPixelType = getCMSColorSpaceType(cmsGetColorSpace(displayProfile)); + nChannels = getCMSNChannels(cmsGetColorSpace(displayProfile)); + // create transform from XYZ + cmsHPROFILE XYZProfile = cmsCreateXYZProfile(); + if ((transform = cmsCreateTransform(XYZProfile, TYPE_XYZ_DBL, + displayProfile, + COLORSPACE_SH(displayPixelType) | + CHANNELS_SH(nChannels) | BYTES_SH(1), + INTENT_RELATIVE_COLORIMETRIC,LCMS_FLAGS)) == 0) { + error(errSyntaxWarning, -1, "Can't create Lab transform"); + } else { + XYZ2DisplayTransform = new GfxColorTransform(transform, INTENT_RELATIVE_COLORIMETRIC, displayPixelType); + } + cmsCloseProfile(XYZProfile); + } } void GfxColorSpace::setDisplayProfileName(GooString *name) { @@ -256,7 +281,7 @@ GfxColorSpace::GfxColorSpace() { GfxColorSpace::~GfxColorSpace() { } -GfxColorSpace *GfxColorSpace::parse(Object *csObj, OutputDev *out, int recursion) { +GfxColorSpace *GfxColorSpace::parse(Object *csObj, OutputDev *out, GfxState *state, int recursion) { GfxColorSpace *cs; Object obj1; @@ -287,21 +312,21 @@ GfxColorSpace *GfxColorSpace::parse(Object *csObj, OutputDev *out, int recursion } else if (obj1.isName("DeviceCMYK") || obj1.isName("CMYK")) { cs = new GfxDeviceCMYKColorSpace(); } else if (obj1.isName("CalGray")) { - cs = GfxCalGrayColorSpace::parse(csObj->getArray()); + cs = GfxCalGrayColorSpace::parse(csObj->getArray(), state); } else if (obj1.isName("CalRGB")) { - cs = GfxCalRGBColorSpace::parse(csObj->getArray()); + cs = GfxCalRGBColorSpace::parse(csObj->getArray(), state); } else if (obj1.isName("Lab")) { - cs = GfxLabColorSpace::parse(csObj->getArray()); + cs = GfxLabColorSpace::parse(csObj->getArray(), state); } else if (obj1.isName("ICCBased")) { - cs = GfxICCBasedColorSpace::parse(csObj->getArray(), out, recursion); + cs = GfxICCBasedColorSpace::parse(csObj->getArray(), out, state, recursion); } else if (obj1.isName("Indexed") || obj1.isName("I")) { - cs = GfxIndexedColorSpace::parse(csObj->getArray(), out, recursion); + cs = GfxIndexedColorSpace::parse(csObj->getArray(), out, state, recursion); } else if (obj1.isName("Separation")) { - cs = GfxSeparationColorSpace::parse(csObj->getArray(), out, recursion); + cs = GfxSeparationColorSpace::parse(csObj->getArray(), out, state, recursion); } else if (obj1.isName("DeviceN")) { - cs = GfxDeviceNColorSpace::parse(csObj->getArray(), out, recursion); + cs = GfxDeviceNColorSpace::parse(csObj->getArray(), out, state, recursion); } else if (obj1.isName("Pattern")) { - cs = GfxPatternColorSpace::parse(csObj->getArray(), out, recursion); + cs = GfxPatternColorSpace::parse(csObj->getArray(), out, state, recursion); } else { error(errSyntaxWarning, -1, "Bad color space"); } @@ -420,13 +445,13 @@ int GfxColorSpace::setupColorProfiles() // create transform from XYZ cmsHPROFILE XYZProfile = cmsCreateXYZProfile(); if ((transform = cmsCreateTransform(XYZProfile, TYPE_XYZ_DBL, - displayProfile, + displayProfile, COLORSPACE_SH(displayPixelType) | CHANNELS_SH(nChannels) | BYTES_SH(1), INTENT_RELATIVE_COLORIMETRIC,LCMS_FLAGS)) == 0) { error(errSyntaxWarning, -1, "Can't create Lab transform"); } else { - XYZ2DisplayTransform = new GfxColorTransform(transform); + XYZ2DisplayTransform = new GfxColorTransform(transform, INTENT_RELATIVE_COLORIMETRIC, displayPixelType); } cmsCloseProfile(XYZProfile); } @@ -604,6 +629,24 @@ void GfxDeviceGrayColorSpace::getRGBXLine(Guchar *in, Guchar *out, int length) { } } +void GfxDeviceGrayColorSpace::getCMYKLine(Guchar *in, Guchar *out, int length) { + for (int i = 0; i < length; i++) { + *out++ = 0; + *out++ = 0; + *out++ = 0; + *out++ = in[i]; + } +} + +void GfxDeviceGrayColorSpace::getDeviceNLine(Guchar *in, Guchar *out, int length) { + for (int i = 0; i < length; i++) { + for (int j = 0; j < SPOT_NCOMPS+4; j++) + out[j] = 0; + out[4] = in[i]; + out += (SPOT_NCOMPS+4); + } +} + void GfxDeviceGrayColorSpace::getCMYK(GfxColor *color, GfxCMYK *cmyk) { cmyk->c = cmyk->m = cmyk->y = 0; cmyk->k = clip01(gfxColorComp1 - color->c[0]); @@ -630,6 +673,11 @@ GfxCalGrayColorSpace::GfxCalGrayColorSpace() { } GfxCalGrayColorSpace::~GfxCalGrayColorSpace() { +#ifdef USE_CMS + if (transform != NULL) { + if (transform->unref() == 0) delete transform; + } +#endif } GfxColorSpace *GfxCalGrayColorSpace::copy() { @@ -643,6 +691,10 @@ GfxColorSpace *GfxCalGrayColorSpace::copy() { cs->blackY = blackY; cs->blackZ = blackZ; cs->gamma = gamma; +#ifdef USE_CMS + cs->transform = transform; + if (transform != NULL) transform->ref(); +#endif return cs; } @@ -654,7 +706,7 @@ static const double xyzrgb[3][3] = { { 0.055643, -0.204026, 1.057229 } }; -GfxColorSpace *GfxCalGrayColorSpace::parse(Array *arr) { +GfxColorSpace *GfxCalGrayColorSpace::parse(Array *arr, GfxState *state) { GfxCalGrayColorSpace *cs; Object obj1, obj2, obj3; @@ -712,7 +764,10 @@ GfxColorSpace *GfxCalGrayColorSpace::parse(Array *arr) { cs->kb = 1 / (xyzrgb[2][0] * cs->whiteX + xyzrgb[2][1] * cs->whiteY + xyzrgb[2][2] * cs->whiteZ); - +#ifdef USE_CMS + cs->transform = (state != NULL) ? state->getXYZ2DisplayTransform() : XYZ2DisplayTransform; + if (cs->transform != NULL) cs->transform->ref(); +#endif return cs; } @@ -731,7 +786,7 @@ void GfxCalGrayColorSpace::getGray(GfxColor *color, GfxGray *gray) { GfxRGB rgb; #ifdef USE_CMS - if (XYZ2DisplayTransform != NULL && displayPixelType == PT_GRAY) { + if (transform != NULL && transform->getTransformPixelType() == PT_GRAY) { Guchar out[gfxColorMaxComps]; double in[gfxColorMaxComps]; double X, Y, Z; @@ -740,7 +795,7 @@ void GfxCalGrayColorSpace::getGray(GfxColor *color, GfxGray *gray) { in[0] = clip01(X); in[1] = clip01(Y); in[2] = clip01(Z); - XYZ2DisplayTransform->doTransform(in,out,1); + transform->doTransform(in,out,1); *gray = byteToCol(out[0]); return; } @@ -757,14 +812,14 @@ void GfxCalGrayColorSpace::getRGB(GfxColor *color, GfxRGB *rgb) { getXYZ(color,&X,&Y,&Z); #ifdef USE_CMS - if (XYZ2DisplayTransform != NULL && displayPixelType == PT_RGB) { + if (transform != NULL && transform->getTransformPixelType() == PT_RGB) { Guchar out[gfxColorMaxComps]; double in[gfxColorMaxComps]; in[0] = clip01(X); in[1] = clip01(Y); in[2] = clip01(Z); - XYZ2DisplayTransform->doTransform(in,out,1); + transform->doTransform(in,out,1); rgb->r = byteToCol(out[0]); rgb->g = byteToCol(out[1]); rgb->b = byteToCol(out[2]); @@ -788,7 +843,7 @@ void GfxCalGrayColorSpace::getCMYK(GfxColor *color, GfxCMYK *cmyk) { GfxColorComp c, m, y, k; #ifdef USE_CMS - if (XYZ2DisplayTransform != NULL && displayPixelType == PT_CMYK) { + if (transform != NULL && transform->getTransformPixelType() == PT_CMYK) { double in[gfxColorMaxComps]; Guchar out[gfxColorMaxComps]; double X, Y, Z; @@ -798,7 +853,7 @@ void GfxCalGrayColorSpace::getCMYK(GfxColor *color, GfxCMYK *cmyk) { in[1] = clip01(Y); in[2] = clip01(Z); - XYZ2DisplayTransform->doTransform(in,out,1); + transform->doTransform(in,out,1); cmyk->c = byteToCol(out[0]); cmyk->m = byteToCol(out[1]); cmyk->y = byteToCol(out[2]); @@ -900,6 +955,52 @@ void GfxDeviceRGBColorSpace::getRGBXLine(Guchar *in, Guchar *out, int length) { *out++ = 255; } } + +void GfxDeviceRGBColorSpace::getCMYKLine(Guchar *in, Guchar *out, int length) { + GfxColorComp c, m, y, k; + + for (int i = 0; i < length; i++) { + c = byteToCol(255 - *in++); + m = byteToCol(255 - *in++); + y = byteToCol(255 - *in++); + k = c; + if (m < k) { + k = m; + } + if (y < k) { + k = y; + } + *out++ = colToByte(c - k); + *out++ = colToByte(m - k); + *out++ = colToByte(y - k); + *out++ = colToByte(k); + } +} + +void GfxDeviceRGBColorSpace::getDeviceNLine(Guchar *in, Guchar *out, int length) { + GfxColorComp c, m, y, k; + + for (int i = 0; i < length; i++) { + for (int j = 0; j < SPOT_NCOMPS+4; j++) + out[j] = 0; + c = byteToCol(255 - *in++); + m = byteToCol(255 - *in++); + y = byteToCol(255 - *in++); + k = c; + if (m < k) { + k = m; + } + if (y < k) { + k = y; + } + out[0] = colToByte(c - k); + out[1] = colToByte(m - k); + out[2] = colToByte(y - k); + out[3] = colToByte(k); + out += (SPOT_NCOMPS+4); + } +} + void GfxDeviceRGBColorSpace::getCMYK(GfxColor *color, GfxCMYK *cmyk) { GfxColorComp c, m, y, k; @@ -950,6 +1051,11 @@ GfxCalRGBColorSpace::GfxCalRGBColorSpace() { } GfxCalRGBColorSpace::~GfxCalRGBColorSpace() { +#ifdef USE_CMS + if (transform != NULL) { + if (transform->unref() == 0) delete transform; + } +#endif } GfxColorSpace *GfxCalRGBColorSpace::copy() { @@ -969,10 +1075,14 @@ GfxColorSpace *GfxCalRGBColorSpace::copy() { for (i = 0; i < 9; ++i) { cs->mat[i] = mat[i]; } +#ifdef USE_CMS + cs->transform = transform; + if (transform != NULL) transform->ref(); +#endif return cs; } -GfxColorSpace *GfxCalRGBColorSpace::parse(Array *arr) { +GfxColorSpace *GfxCalRGBColorSpace::parse(Array *arr, GfxState *state) { GfxCalRGBColorSpace *cs; Object obj1, obj2, obj3; int i; @@ -1054,6 +1164,10 @@ GfxColorSpace *GfxCalRGBColorSpace::parse(Array *arr) { xyzrgb[2][1] * cs->whiteY + xyzrgb[2][2] * cs->whiteZ); +#ifdef USE_CMS + cs->transform = (state != NULL) ? state->getXYZ2DisplayTransform() : XYZ2DisplayTransform; + if (cs->transform != NULL) cs->transform->ref(); +#endif return cs; } @@ -1074,7 +1188,7 @@ void GfxCalRGBColorSpace::getGray(GfxColor *color, GfxGray *gray) { GfxRGB rgb; #ifdef USE_CMS - if (XYZ2DisplayTransform != NULL && displayPixelType == PT_GRAY) { + if (transform != NULL && transform->getTransformPixelType() == PT_GRAY) { Guchar out[gfxColorMaxComps]; double in[gfxColorMaxComps]; double X, Y, Z; @@ -1083,7 +1197,7 @@ void GfxCalRGBColorSpace::getGray(GfxColor *color, GfxGray *gray) { in[0] = clip01(X); in[1] = clip01(Y); in[2] = clip01(Z); - XYZ2DisplayTransform->doTransform(in,out,1); + transform->doTransform(in,out,1); *gray = byteToCol(out[0]); return; } @@ -1100,14 +1214,14 @@ void GfxCalRGBColorSpace::getRGB(GfxColor *color, GfxRGB *rgb) { getXYZ(color,&X,&Y,&Z); #ifdef USE_CMS - if (XYZ2DisplayTransform != NULL && displayPixelType == PT_RGB) { + if (transform != NULL && transform->getTransformPixelType() == PT_RGB) { Guchar out[gfxColorMaxComps]; double in[gfxColorMaxComps]; in[0] = clip01(X/whiteX); in[1] = clip01(Y/whiteY); in[2] = clip01(Z/whiteZ); - XYZ2DisplayTransform->doTransform(in,out,1); + transform->doTransform(in,out,1); rgb->r = byteToCol(out[0]); rgb->g = byteToCol(out[1]); rgb->b = byteToCol(out[2]); @@ -1128,7 +1242,7 @@ void GfxCalRGBColorSpace::getCMYK(GfxColor *color, GfxCMYK *cmyk) { GfxColorComp c, m, y, k; #ifdef USE_CMS - if (XYZ2DisplayTransform != NULL && displayPixelType == PT_CMYK) { + if (transform != NULL && transform->getTransformPixelType() == PT_CMYK) { double in[gfxColorMaxComps]; Guchar out[gfxColorMaxComps]; double X, Y, Z; @@ -1137,7 +1251,7 @@ void GfxCalRGBColorSpace::getCMYK(GfxColor *color, GfxCMYK *cmyk) { in[0] = clip01(X); in[1] = clip01(Y); in[2] = clip01(Z); - XYZ2DisplayTransform->doTransform(in,out,1); + transform->doTransform(in,out,1); cmyk->c = byteToCol(out[0]); cmyk->m = byteToCol(out[1]); cmyk->y = byteToCol(out[2]); @@ -1266,6 +1380,29 @@ void GfxDeviceCMYKColorSpace::getRGBXLine(Guchar *in, Guchar *out, int length) } } +void GfxDeviceCMYKColorSpace::getCMYKLine(Guchar *in, Guchar *out, int length) +{ + for (int i = 0; i < length; i++) { + *out++ = *in++; + *out++ = *in++; + *out++ = *in++; + *out++ = *in++; + } +} + +void GfxDeviceCMYKColorSpace::getDeviceNLine(Guchar *in, Guchar *out, int length) +{ + for (int i = 0; i < length; i++) { + for (int j = 0; j < SPOT_NCOMPS+4; j++) + out[j] = 0; + out[0] = *in++; + out[1] = *in++; + out[2] = *in++; + out[3] = *in++; + out += (SPOT_NCOMPS+4); + } +} + void GfxDeviceCMYKColorSpace::getCMYK(GfxColor *color, GfxCMYK *cmyk) { cmyk->c = clip01(color->c[0]); cmyk->m = clip01(color->c[1]); @@ -1301,6 +1438,11 @@ GfxLabColorSpace::GfxLabColorSpace() { } GfxLabColorSpace::~GfxLabColorSpace() { +#ifdef USE_CMS + if (transform != NULL) { + if (transform->unref() == 0) delete transform; + } +#endif } GfxColorSpace *GfxLabColorSpace::copy() { @@ -1320,10 +1462,14 @@ GfxColorSpace *GfxLabColorSpace::copy() { cs->kr = kr; cs->kg = kg; cs->kb = kb; +#ifdef USE_CMS + cs->transform = transform; + if (transform != NULL) transform->ref(); +#endif return cs; } -GfxColorSpace *GfxLabColorSpace::parse(Array *arr) { +GfxColorSpace *GfxLabColorSpace::parse(Array *arr, GfxState *state) { GfxLabColorSpace *cs; Object obj1, obj2, obj3; @@ -1388,6 +1534,10 @@ GfxColorSpace *GfxLabColorSpace::parse(Array *arr) { xyzrgb[2][1] * cs->whiteY + xyzrgb[2][2] * cs->whiteZ); +#ifdef USE_CMS + cs->transform = (state != NULL) ? state->getXYZ2DisplayTransform() : XYZ2DisplayTransform; + if (cs->transform != NULL) cs->transform->ref(); +#endif return cs; } @@ -1395,12 +1545,12 @@ void GfxLabColorSpace::getGray(GfxColor *color, GfxGray *gray) { GfxRGB rgb; #ifdef USE_CMS - if (XYZ2DisplayTransform != NULL && displayPixelType == PT_GRAY) { + if (transform != NULL && transform->getTransformPixelType() == PT_GRAY) { Guchar out[gfxColorMaxComps]; double in[gfxColorMaxComps]; getXYZ(color, &in[0], &in[1], &in[2]); - XYZ2DisplayTransform->doTransform(in,out,1); + transform->doTransform(in,out,1); *gray = byteToCol(out[0]); return; } @@ -1447,18 +1597,40 @@ void GfxLabColorSpace::getRGB(GfxColor *color, GfxRGB *rgb) { getXYZ(color, &X, &Y, &Z); #ifdef USE_CMS - if (XYZ2DisplayTransform != NULL && displayPixelType == PT_RGB) { + if (transform != NULL && transform->getTransformPixelType() == PT_RGB) { Guchar out[gfxColorMaxComps]; double in[gfxColorMaxComps]; in[0] = clip01(X); in[1] = clip01(Y); in[2] = clip01(Z); - XYZ2DisplayTransform->doTransform(in,out,1); + transform->doTransform(in,out,1); rgb->r = byteToCol(out[0]); rgb->g = byteToCol(out[1]); rgb->b = byteToCol(out[2]); return; + } else if (transform != NULL && transform->getTransformPixelType() == PT_CMYK) { + Guchar out[gfxColorMaxComps]; + double in[gfxColorMaxComps]; + double c, m, y, k, c1, m1, y1, k1, r, g, b; + + in[0] = clip01(X); + in[1] = clip01(Y); + in[2] = clip01(Z); + transform->doTransform(in,out,1); + c = byteToDbl(out[0]); + m = byteToDbl(out[1]); + y = byteToDbl(out[2]); + k = byteToDbl(out[3]); + c1 = 1 - c; + m1 = 1 - m; + y1 = 1 - y; + k1 = 1 - k; + cmykToRGBMatrixMultiplication(c, m, y, k, c1, m1, y1, k1, r, g, b); + rgb->r = clip01(dblToCol(r)); + rgb->g = clip01(dblToCol(g)); + rgb->b = clip01(dblToCol(b)); + return; } #endif X *= whiteX; @@ -1478,12 +1650,12 @@ void GfxLabColorSpace::getCMYK(GfxColor *color, GfxCMYK *cmyk) { GfxColorComp c, m, y, k; #ifdef USE_CMS - if (XYZ2DisplayTransform != NULL && displayPixelType == PT_CMYK) { + if (transform != NULL && transform->getTransformPixelType() == PT_CMYK) { double in[gfxColorMaxComps]; Guchar out[gfxColorMaxComps]; getXYZ(color, &in[0], &in[1], &in[2]); - XYZ2DisplayTransform->doTransform(in,out,1); + transform->doTransform(in,out,1); cmyk->c = byteToCol(out[0]); cmyk->m = byteToCol(out[1]); cmyk->y = byteToCol(out[2]); @@ -1626,7 +1798,7 @@ GfxColorSpace *GfxICCBasedColorSpace::copy() { return cs; } -GfxColorSpace *GfxICCBasedColorSpace::parse(Array *arr, OutputDev *out, int recursion) { +GfxColorSpace *GfxICCBasedColorSpace::parse(Array *arr, OutputDev *out, GfxState *state, int recursion) { GfxICCBasedColorSpace *cs; Ref iccProfileStreamA; int nCompsA; @@ -1655,7 +1827,24 @@ GfxColorSpace *GfxICCBasedColorSpace::parse(Array *arr, OutputDev *out, int recu if (item != NULL) { cs = static_cast<GfxICCBasedColorSpace*>(item->cs->copy()); - return cs; + int transformIntent = cs->getIntent(); + int cmsIntent = INTENT_RELATIVE_COLORIMETRIC; + if (state != NULL) { + const char *intent = state->getRenderingIntent(); + if (intent != NULL) { + if (strcmp(intent, "AbsoluteColorimetric") == 0) { + cmsIntent = INTENT_ABSOLUTE_COLORIMETRIC; + } else if (strcmp(intent, "Saturation") == 0) { + cmsIntent = INTENT_SATURATION; + } else if (strcmp(intent, "Perceptual") == 0) { + cmsIntent = INTENT_PERCEPTUAL; + } + } + } + if (transformIntent == cmsIntent) { + return cs; + } + delete cs; } } #endif @@ -1681,7 +1870,7 @@ GfxColorSpace *GfxICCBasedColorSpace::parse(Array *arr, OutputDev *out, int recu nCompsA = 4; } if (dict->lookup("Alternate", &obj2)->isNull() || - !(altA = GfxColorSpace::parse(&obj2, out, recursion + 1))) { + !(altA = GfxColorSpace::parse(&obj2, out, state, recursion + 1))) { switch (nCompsA) { case 1: altA = new GfxDeviceGrayColorSpace(); @@ -1731,32 +1920,46 @@ GfxColorSpace *GfxICCBasedColorSpace::parse(Array *arr, OutputDev *out, int recu if (hp == 0) { error(errSyntaxWarning, -1, "read ICCBased color space profile error"); } else { - cmsHPROFILE dhp = displayProfile; + cmsHPROFILE dhp = (state != NULL && state->getDisplayProfile() != NULL) ? state->getDisplayProfile() : displayProfile; if (dhp == NULL) dhp = RGBProfile; unsigned int cst = getCMSColorSpaceType(cmsGetColorSpace(hp)); unsigned int dNChannels = getCMSNChannels(cmsGetColorSpace(dhp)); unsigned int dcst = getCMSColorSpaceType(cmsGetColorSpace(dhp)); cmsHTRANSFORM transform; + + int cmsIntent = INTENT_RELATIVE_COLORIMETRIC; + if (state != NULL) { + const char *intent = state->getRenderingIntent(); + if (intent != NULL) { + if (strcmp(intent, "AbsoluteColorimetric") == 0) { + cmsIntent = INTENT_ABSOLUTE_COLORIMETRIC; + } else if (strcmp(intent, "Saturation") == 0) { + cmsIntent = INTENT_SATURATION; + } else if (strcmp(intent, "Perceptual") == 0) { + cmsIntent = INTENT_PERCEPTUAL; + } + } + } if ((transform = cmsCreateTransform(hp, COLORSPACE_SH(cst) |CHANNELS_SH(nCompsA) | BYTES_SH(1), dhp, COLORSPACE_SH(dcst) | CHANNELS_SH(dNChannels) | BYTES_SH(1), - INTENT_RELATIVE_COLORIMETRIC,LCMS_FLAGS)) == 0) { + cmsIntent, LCMS_FLAGS)) == 0) { error(errSyntaxWarning, -1, "Can't create transform"); cs->transform = NULL; } else { - cs->transform = new GfxColorTransform(transform); + cs->transform = new GfxColorTransform(transform, cmsIntent, dcst); } - if (dcst == PT_RGB) { + if (dcst == PT_RGB || dcst == PT_CMYK) { // create line transform only when the display is RGB type color space if ((transform = cmsCreateTransform(hp, CHANNELS_SH(nCompsA) | BYTES_SH(1),dhp, - TYPE_RGB_8,INTENT_RELATIVE_COLORIMETRIC,LCMS_FLAGS)) == 0) { + (dcst == PT_RGB) ? TYPE_RGB_8 : TYPE_CMYK_8, cmsIntent, LCMS_FLAGS)) == 0) { error(errSyntaxWarning, -1, "Can't create transform"); cs->lineTransform = NULL; } else { - cs->lineTransform = new GfxColorTransform(transform); + cs->lineTransform = new GfxColorTransform(transform, cmsIntent, dcst); } } cmsCloseProfile(hp); @@ -1774,15 +1977,35 @@ GfxColorSpace *GfxICCBasedColorSpace::parse(Array *arr, OutputDev *out, int recu void GfxICCBasedColorSpace::getGray(GfxColor *color, GfxGray *gray) { #ifdef USE_CMS - if (transform != 0 && displayPixelType == PT_GRAY) { + if (transform != 0 && transform->getTransformPixelType() == PT_GRAY) { Guchar in[gfxColorMaxComps]; Guchar out[gfxColorMaxComps]; for (int i = 0;i < nComps;i++) { in[i] = colToByte(color->c[i]); } + if (nComps <= 4) { + unsigned int key = 0; + for (int j = 0; j < nComps; j++) { + key = (key << 8) + in[j]; + } + std::map<unsigned int, unsigned int>::iterator it = cmsCache.find(key); + if (it != cmsCache.end()) { + unsigned int value = it->second; + *gray = byteToCol(value & 0xff); + return; + } + } transform->doTransform(in,out,1); *gray = byteToCol(out[0]); + if (nComps <= 4 && cmsCache.size() <= CMSCACHE_LIMIT) { + unsigned int key = 0; + for (int j = 0; j < nComps; j++) { + key = (key << 8) + in[j]; + } + unsigned int value = out[0]; + cmsCache.insert(std::pair<unsigned int, unsigned int>(key, value)); + } } else { GfxRGB rgb; getRGB(color,&rgb); @@ -1797,18 +2020,82 @@ void GfxICCBasedColorSpace::getGray(GfxColor *color, GfxGray *gray) { void GfxICCBasedColorSpace::getRGB(GfxColor *color, GfxRGB *rgb) { #ifdef USE_CMS - if (transform != 0 - && (displayProfile == NULL || displayPixelType == PT_RGB)) { + if (transform != 0 && transform->getTransformPixelType() == PT_RGB) { Guchar in[gfxColorMaxComps]; Guchar out[gfxColorMaxComps]; for (int i = 0;i < nComps;i++) { in[i] = colToByte(color->c[i]); } + if (nComps <= 4) { + unsigned int key = 0; + for (int j = 0; j < nComps; j++) { + key = (key << 8) + in[j]; + } + std::map<unsigned int, unsigned int>::iterator it = cmsCache.find(key); + if (it != cmsCache.end()) { + unsigned int value = it->second; + rgb->r = byteToCol(value >> 16); + rgb->g = byteToCol((value >> 8) & 0xff); + rgb->b = byteToCol(value & 0xff); + return; + } + } transform->doTransform(in,out,1); rgb->r = byteToCol(out[0]); rgb->g = byteToCol(out[1]); rgb->b = byteToCol(out[2]); + if (nComps <= 4 && cmsCache.size() <= CMSCACHE_LIMIT) { + unsigned int key = 0; + for (int j = 0; j < nComps; j++) { + key = (key << 8) + in[j]; + } + unsigned int value = (out[0] << 16) + (out[1] << 8) + out[2]; + cmsCache.insert(std::pair<unsigned int, unsigned int>(key, value)); + } + } else if (transform != NULL && transform->getTransformPixelType() == PT_CMYK) { + Guchar in[gfxColorMaxComps]; + Guchar out[gfxColorMaxComps]; + double c, m, y, k, c1, m1, y1, k1, r, g, b; + + for (int i = 0;i < nComps;i++) { + in[i] = colToByte(color->c[i]); + } + if (nComps <= 4) { + unsigned int key = 0; + for (int j = 0; j < nComps; j++) { + key = (key << 8) + in[j]; + } + std::map<unsigned int, unsigned int>::iterator it = cmsCache.find(key); + if (it != cmsCache.end()) { + unsigned int value = it->second; + rgb->r = byteToCol(value >> 16); + rgb->g = byteToCol((value >> 8) & 0xff); + rgb->b = byteToCol(value & 0xff); + return; + } + } + transform->doTransform(in,out,1); + c = byteToDbl(out[0]); + m = byteToDbl(out[1]); + y = byteToDbl(out[2]); + k = byteToDbl(out[3]); + c1 = 1 - c; + m1 = 1 - m; + y1 = 1 - y; + k1 = 1 - k; + cmykToRGBMatrixMultiplication(c, m, y, k, c1, m1, y1, k1, r, g, b); + rgb->r = clip01(dblToCol(r)); + rgb->g = clip01(dblToCol(g)); + rgb->b = clip01(dblToCol(b)); + if (nComps <= 4 && cmsCache.size() <= CMSCACHE_LIMIT) { + unsigned int key = 0; + for (int j = 0; j < nComps; j++) { + key = (key << 8) + in[j]; + } + unsigned int value = (dblToByte(r) << 16) + (dblToByte(g) << 8) + dblToByte(b); + cmsCache.insert(std::pair<unsigned int, unsigned int>(key, value)); + } } else { alt->getRGB(color, rgb); } @@ -1820,7 +2107,7 @@ void GfxICCBasedColorSpace::getRGB(GfxColor *color, GfxRGB *rgb) { void GfxICCBasedColorSpace::getRGBLine(Guchar *in, unsigned int *out, int length) { #ifdef USE_CMS - if (lineTransform != 0) { + if (lineTransform != 0 && lineTransform->getTransformPixelType() == PT_RGB) { Guchar* tmp = (Guchar *)gmallocn(3 * length, sizeof(Guchar)); lineTransform->doTransform(in, tmp, length); for (int i = 0; i < length; ++i) { @@ -1838,7 +2125,7 @@ void GfxICCBasedColorSpace::getRGBLine(Guchar *in, unsigned int *out, void GfxICCBasedColorSpace::getRGBLine(Guchar *in, Guchar *out, int length) { #ifdef USE_CMS - if (lineTransform != 0) { + if (lineTransform != 0 && lineTransform->getTransformPixelType() == PT_RGB) { Guchar* tmp = (Guchar *)gmallocn(3 * length, sizeof(Guchar)); lineTransform->doTransform(in, tmp, length); Guchar *current = tmp; @@ -1848,6 +2135,26 @@ void GfxICCBasedColorSpace::getRGBLine(Guchar *in, Guchar *out, int length) { *out++ = *current++; } gfree(tmp); + } else if (lineTransform != NULL && lineTransform->getTransformPixelType() == PT_CMYK) { + Guchar* tmp = (Guchar *)gmallocn(4 * length, sizeof(Guchar)); + lineTransform->doTransform(in, tmp, length); + Guchar *current = tmp; + double c, m, y, k, c1, m1, y1, k1, r, g, b; + for (int i = 0; i < length; ++i) { + c = byteToDbl(*current++); + m = byteToDbl(*current++); + y = byteToDbl(*current++); + k = byteToDbl(*current++); + c1 = 1 - c; + m1 = 1 - m; + y1 = 1 - y; + k1 = 1 - k; + cmykToRGBMatrixMultiplication(c, m, y, k, c1, m1, y1, k1, r, g, b); + *out++ = dblToByte(r); + *out++ = dblToByte(g); + *out++ = dblToByte(b); + } + gfree(tmp); } else { alt->getRGBLine(in, out, length); } @@ -1858,7 +2165,7 @@ void GfxICCBasedColorSpace::getRGBLine(Guchar *in, Guchar *out, int length) { void GfxICCBasedColorSpace::getRGBXLine(Guchar *in, Guchar *out, int length) { #ifdef USE_CMS - if (lineTransform != 0) { + if (lineTransform != 0 && lineTransform->getTransformPixelType() == PT_RGB) { Guchar* tmp = (Guchar *)gmallocn(3 * length, sizeof(Guchar)); lineTransform->doTransform(in, tmp, length); Guchar *current = tmp; @@ -1877,20 +2184,123 @@ void GfxICCBasedColorSpace::getRGBXLine(Guchar *in, Guchar *out, int length) { #endif } +void GfxICCBasedColorSpace::getCMYKLine(Guchar *in, Guchar *out, int length) { +#ifdef USE_CMS + if (lineTransform != NULL && lineTransform->getTransformPixelType() == PT_CMYK) { + transform->doTransform(in,out,length); + } else if (lineTransform != NULL) { + GfxColorComp c, m, y, k; + Guchar* tmp = (Guchar *)gmallocn(3 * length, sizeof(Guchar)); + getRGBLine(in, tmp, length); + Guchar *p = tmp; + for (int i = 0; i < length; i++) { + c = byteToCol(255 - *p++); + m = byteToCol(255 - *p++); + y = byteToCol(255 - *p++); + k = c; + if (m < k) { + k = m; + } + if (y < k) { + k = y; + } + *out++ = colToByte(c - k); + *out++ = colToByte(m - k); + *out++ = colToByte(y - k); + *out++ = colToByte(k); + } + gfree(tmp); + } else { + alt->getCMYKLine(in, out, length); + } +#else + alt->getCMYKLine(in, out, length); +#endif +} + +void GfxICCBasedColorSpace::getDeviceNLine(Guchar *in, Guchar *out, int length) { +#ifdef USE_CMS + if (lineTransform != NULL && lineTransform->getTransformPixelType() == PT_CMYK) { + Guchar* tmp = (Guchar *)gmallocn(4 * length, sizeof(Guchar)); + transform->doTransform(in,tmp,length); + Guchar *p = tmp; + for (int i = 0; i < length; i++) { + for (int j = 0; j < 4; j++) + *out++ = *p++; + for (int j = 4; j < SPOT_NCOMPS+4; j++) + *out++ = 0; + } + gfree(tmp); + } else if (lineTransform != NULL) { + GfxColorComp c, m, y, k; + Guchar* tmp = (Guchar *)gmallocn(3 * length, sizeof(Guchar)); + getRGBLine(in, tmp, length); + Guchar *p = tmp; + for (int i = 0; i < length; i++) { + for (int j = 0; j < SPOT_NCOMPS+4; j++) + out[j] = 0; + c = byteToCol(255 - *p++); + m = byteToCol(255 - *p++); + y = byteToCol(255 - *p++); + k = c; + if (m < k) { + k = m; + } + if (y < k) { + k = y; + } + out[0] = colToByte(c - k); + out[1] = colToByte(m - k); + out[2] = colToByte(y - k); + out[3] = colToByte(k); + out += (SPOT_NCOMPS+4); + } + gfree(tmp); + } else { + alt->getDeviceNLine(in, out, length); + } +#else + alt->getDeviceNLine(in, out, length); +#endif +} + void GfxICCBasedColorSpace::getCMYK(GfxColor *color, GfxCMYK *cmyk) { #ifdef USE_CMS - if (transform != NULL && displayPixelType == PT_CMYK) { + if (transform != NULL && transform->getTransformPixelType() == PT_CMYK) { Guchar in[gfxColorMaxComps]; Guchar out[gfxColorMaxComps]; for (int i = 0;i < nComps;i++) { in[i] = colToByte(color->c[i]); } + if (nComps <= 4) { + unsigned int key = 0; + for (int j = 0; j < nComps; j++) { + key = (key << 8) + in[j]; + } + std::map<unsigned int, unsigned int>::iterator it = cmsCache.find(key); + if (it != cmsCache.end()) { + unsigned int value = it->second; + cmyk->c = byteToCol(value >> 24); + cmyk->m = byteToCol((value >> 16) & 0xff); + cmyk->y = byteToCol((value >> 8) & 0xff); + cmyk->k = byteToCol(value & 0xff); + return; + } + } transform->doTransform(in,out,1); cmyk->c = byteToCol(out[0]); cmyk->m = byteToCol(out[1]); cmyk->y = byteToCol(out[2]); cmyk->k = byteToCol(out[3]); + if (nComps <= 4 && cmsCache.size() <= CMSCACHE_LIMIT) { + unsigned int key = 0; + for (int j = 0; j < nComps; j++) { + key = (key << 8) + in[j]; + } + unsigned int value = (out[0] << 24) + (out[1] << 16) + (out[2] << 8) + out[3]; + cmsCache.insert(std::pair<unsigned int, unsigned int>(key, value)); + } } else { GfxRGB rgb; GfxColorComp c, m, y, k; @@ -1924,6 +2334,22 @@ GBool GfxICCBasedColorSpace::useGetRGBLine() { #endif } +GBool GfxICCBasedColorSpace::useGetCMYKLine() { +#ifdef USE_CMS + return lineTransform != NULL || alt->useGetCMYKLine(); +#else + return alt->useGetCMYKLine(); +#endif +} + +GBool GfxICCBasedColorSpace::useGetDeviceNLine() { +#ifdef USE_CMS + return lineTransform != NULL || alt->useGetDeviceNLine(); +#else + return alt->useGetDeviceNLine(); +#endif +} + void GfxICCBasedColorSpace::getDeviceN(GfxColor *color, GfxColor *deviceN) { GfxCMYK cmyk; for (int i = 0; i < gfxColorMaxComps; i++) @@ -1993,7 +2419,7 @@ GfxColorSpace *GfxIndexedColorSpace::copy() { return cs; } -GfxColorSpace *GfxIndexedColorSpace::parse(Array *arr, OutputDev *out, int recursion) { +GfxColorSpace *GfxIndexedColorSpace::parse(Array *arr, OutputDev *out, GfxState *state, int recursion) { GfxIndexedColorSpace *cs; GfxColorSpace *baseA; int indexHighA; @@ -2006,7 +2432,7 @@ GfxColorSpace *GfxIndexedColorSpace::parse(Array *arr, OutputDev *out, int recur goto err1; } arr->get(1, &obj1); - if (!(baseA = GfxColorSpace::parse(&obj1, out, recursion + 1))) { + if (!(baseA = GfxColorSpace::parse(&obj1, out, state, recursion + 1))) { error(errSyntaxWarning, -1, "Bad Indexed color space (base color space)"); goto err2; } @@ -2148,6 +2574,36 @@ void GfxIndexedColorSpace::getRGBXLine(Guchar *in, Guchar *out, int length) gfree (line); } +void GfxIndexedColorSpace::getCMYKLine(Guchar *in, Guchar *out, int length) { + Guchar *line; + int i, j, n; + + n = base->getNComps(); + line = (Guchar *) gmallocn (length, n); + for (i = 0; i < length; i++) + for (j = 0; j < n; j++) + line[i * n + j] = lookup[in[i] * n + j]; + + base->getCMYKLine(line, out, length); + + gfree (line); +} + +void GfxIndexedColorSpace::getDeviceNLine(Guchar *in, Guchar *out, int length) { + Guchar *line; + int i, j, n; + + n = base->getNComps(); + line = (Guchar *) gmallocn (length, n); + for (i = 0; i < length; i++) + for (j = 0; j < n; j++) + line[i * n + j] = lookup[in[i] * n + j]; + + base->getDeviceNLine(line, out, length); + + gfree (line); +} + void GfxIndexedColorSpace::getCMYK(GfxColor *color, GfxCMYK *cmyk) { GfxColor color2; @@ -2228,7 +2684,7 @@ GfxColorSpace *GfxSeparationColorSpace::copy() { } //~ handle the 'All' and 'None' colorants -GfxColorSpace *GfxSeparationColorSpace::parse(Array *arr, OutputDev *out, int recursion) { +GfxColorSpace *GfxSeparationColorSpace::parse(Array *arr, OutputDev *out, GfxState *state, int recursion) { GfxSeparationColorSpace *cs; GooString *nameA; GfxColorSpace *altA; @@ -2246,7 +2702,7 @@ GfxColorSpace *GfxSeparationColorSpace::parse(Array *arr, OutputDev *out, int re nameA = new GooString(obj1.getName()); obj1.free(); arr->get(2, &obj1); - if (!(altA = GfxColorSpace::parse(&obj1, out, recursion + 1))) { + if (!(altA = GfxColorSpace::parse(&obj1, out, state, recursion + 1))) { error(errSyntaxWarning, -1, "Bad Separation color space (alternate color space)"); goto err3; } @@ -2477,7 +2933,7 @@ GfxColorSpace *GfxDeviceNColorSpace::copy() { } //~ handle the 'None' colorant -GfxColorSpace *GfxDeviceNColorSpace::parse(Array *arr, OutputDev *out, int recursion) { +GfxColorSpace *GfxDeviceNColorSpace::parse(Array *arr, OutputDev *out, GfxState *state, int recursion) { GfxDeviceNColorSpace *cs; int nCompsA; GooString *namesA[gfxColorMaxComps]; @@ -2512,7 +2968,7 @@ GfxColorSpace *GfxDeviceNColorSpace::parse(Array *arr, OutputDev *out, int recur } obj1.free(); arr->get(2, &obj1); - if (!(altA = GfxColorSpace::parse(&obj1, out, recursion + 1))) { + if (!(altA = GfxColorSpace::parse(&obj1, out, state, recursion + 1))) { error(errSyntaxWarning, -1, "Bad DeviceN color space (alternate color space)"); goto err3; } @@ -2535,7 +2991,7 @@ GfxColorSpace *GfxDeviceNColorSpace::parse(Array *arr, OutputDev *out, int recur Object obj3; colorants->getVal(i, &obj3); if (obj3.isArray()) { - separationList->append(GfxSeparationColorSpace::parse(obj3.getArray(), out, recursion)); + separationList->append(GfxSeparationColorSpace::parse(obj3.getArray(), out, state, recursion)); } else { obj3.free(); obj2.free(); @@ -2743,7 +3199,7 @@ GfxColorSpace *GfxPatternColorSpace::copy() { (GfxColorSpace *)NULL); } -GfxColorSpace *GfxPatternColorSpace::parse(Array *arr, OutputDev *out, int recursion) { +GfxColorSpace *GfxPatternColorSpace::parse(Array *arr, OutputDev *out, GfxState *state, int recursion) { GfxPatternColorSpace *cs; GfxColorSpace *underA; Object obj1; @@ -2755,7 +3211,7 @@ GfxColorSpace *GfxPatternColorSpace::parse(Array *arr, OutputDev *out, int recur underA = NULL; if (arr->getLength() == 2) { arr->get(1, &obj1); - if (!(underA = GfxColorSpace::parse(&obj1, out, recursion + 1))) { + if (!(underA = GfxColorSpace::parse(&obj1, out, state, recursion + 1))) { error(errSyntaxWarning, -1, "Bad Pattern color space (underlying color space)"); obj1.free(); return NULL; @@ -2800,7 +3256,7 @@ GfxPattern::GfxPattern(int typeA) { GfxPattern::~GfxPattern() { } -GfxPattern *GfxPattern::parse(Object *obj, OutputDev *out) { +GfxPattern *GfxPattern::parse(Object *obj, OutputDev *out, GfxState *state) { GfxPattern *pattern; Object obj1; @@ -2815,7 +3271,7 @@ GfxPattern *GfxPattern::parse(Object *obj, OutputDev *out) { if (obj1.isInt() && obj1.getInt() == 1) { pattern = GfxTilingPattern::parse(obj); } else if (obj1.isInt() && obj1.getInt() == 2) { - pattern = GfxShadingPattern::parse(obj, out); + pattern = GfxShadingPattern::parse(obj, out, state); } obj1.free(); return pattern; @@ -2943,7 +3399,7 @@ GfxPattern *GfxTilingPattern::copy() { // GfxShadingPattern //------------------------------------------------------------------------ -GfxShadingPattern *GfxShadingPattern::parse(Object *patObj, OutputDev *out) { +GfxShadingPattern *GfxShadingPattern::parse(Object *patObj, OutputDev *out, GfxState *state) { Dict *dict; GfxShading *shadingA; double matrixA[6]; @@ -2956,7 +3412,7 @@ GfxShadingPattern *GfxShadingPattern::parse(Object *patObj, OutputDev *out) { dict = patObj->getDict(); dict->lookup("Shading", &obj1); - shadingA = GfxShading::parse(&obj1, out); + shadingA = GfxShading::parse(&obj1, out, state); obj1.free(); if (!shadingA) { return NULL; @@ -3029,7 +3485,7 @@ GfxShading::~GfxShading() { } } -GfxShading *GfxShading::parse(Object *obj, OutputDev *out) { +GfxShading *GfxShading::parse(Object *obj, OutputDev *out, GfxState *state) { GfxShading *shading; Dict *dict; int typeA; @@ -3053,17 +3509,17 @@ GfxShading *GfxShading::parse(Object *obj, OutputDev *out) { switch (typeA) { case 1: - shading = GfxFunctionShading::parse(dict, out); + shading = GfxFunctionShading::parse(dict, out, state); break; case 2: - shading = GfxAxialShading::parse(dict, out); + shading = GfxAxialShading::parse(dict, out, state); break; case 3: - shading = GfxRadialShading::parse(dict, out); + shading = GfxRadialShading::parse(dict, out, state); break; case 4: if (obj->isStream()) { - shading = GfxGouraudTriangleShading::parse(4, dict, obj->getStream(), out); + shading = GfxGouraudTriangleShading::parse(4, dict, obj->getStream(), out, state); } else { error(errSyntaxWarning, -1, "Invalid Type 4 shading object"); goto err1; @@ -3071,7 +3527,7 @@ GfxShading *GfxShading::parse(Object *obj, OutputDev *out) { break; case 5: if (obj->isStream()) { - shading = GfxGouraudTriangleShading::parse(5, dict, obj->getStream(), out); + shading = GfxGouraudTriangleShading::parse(5, dict, obj->getStream(), out, state); } else { error(errSyntaxWarning, -1, "Invalid Type 5 shading object"); goto err1; @@ -3079,7 +3535,7 @@ GfxShading *GfxShading::parse(Object *obj, OutputDev *out) { break; case 6: if (obj->isStream()) { - shading = GfxPatchMeshShading::parse(6, dict, obj->getStream(), out); + shading = GfxPatchMeshShading::parse(6, dict, obj->getStream(), out, state); } else { error(errSyntaxWarning, -1, "Invalid Type 6 shading object"); goto err1; @@ -3087,7 +3543,7 @@ GfxShading *GfxShading::parse(Object *obj, OutputDev *out) { break; case 7: if (obj->isStream()) { - shading = GfxPatchMeshShading::parse(7, dict, obj->getStream(), out); + shading = GfxPatchMeshShading::parse(7, dict, obj->getStream(), out, state); } else { error(errSyntaxWarning, -1, "Invalid Type 7 shading object"); goto err1; @@ -3104,12 +3560,12 @@ GfxShading *GfxShading::parse(Object *obj, OutputDev *out) { return NULL; } -GBool GfxShading::init(Dict *dict, OutputDev *out) { +GBool GfxShading::init(Dict *dict, OutputDev *out, GfxState *state) { Object obj1, obj2; int i; dict->lookup("ColorSpace", &obj1); - if (!(colorSpace = GfxColorSpace::parse(&obj1, out))) { + if (!(colorSpace = GfxColorSpace::parse(&obj1, out, state))) { error(errSyntaxWarning, -1, "Bad color space in shading dictionary"); obj1.free(); return gFalse; @@ -3216,7 +3672,7 @@ GfxFunctionShading::~GfxFunctionShading() { } } -GfxFunctionShading *GfxFunctionShading::parse(Dict *dict, OutputDev *out) { +GfxFunctionShading *GfxFunctionShading::parse(Dict *dict, OutputDev *out, GfxState *state) { GfxFunctionShading *shading; double x0A, y0A, x1A, y1A; double matrixA[6]; @@ -3284,7 +3740,7 @@ GfxFunctionShading *GfxFunctionShading::parse(Dict *dict, OutputDev *out) { shading = new GfxFunctionShading(x0A, y0A, x1A, y1A, matrixA, funcsA, nFuncsA); - if (!shading->init(dict, out)) { + if (!shading->init(dict, out, state)) { delete shading; return NULL; } @@ -3535,7 +3991,7 @@ GfxAxialShading::GfxAxialShading(GfxAxialShading *shading): GfxAxialShading::~GfxAxialShading() { } -GfxAxialShading *GfxAxialShading::parse(Dict *dict, OutputDev *out) { +GfxAxialShading *GfxAxialShading::parse(Dict *dict, OutputDev *out, GfxState *state) { GfxAxialShading *shading; double x0A, y0A, x1A, y1A; double t0A, t1A; @@ -3632,7 +4088,7 @@ GfxAxialShading *GfxAxialShading::parse(Dict *dict, OutputDev *out) { shading = new GfxAxialShading(x0A, y0A, x1A, y1A, t0A, t1A, funcsA, nFuncsA, extend0A, extend1A); - if (!shading->init(dict, out)) { + if (!shading->init(dict, out, state)) { delete shading; return NULL; } @@ -3743,7 +4199,7 @@ GfxRadialShading::GfxRadialShading(GfxRadialShading *shading): GfxRadialShading::~GfxRadialShading() { } -GfxRadialShading *GfxRadialShading::parse(Dict *dict, OutputDev *out) { +GfxRadialShading *GfxRadialShading::parse(Dict *dict, OutputDev *out, GfxState *state) { GfxRadialShading *shading; double x0A, y0A, r0A, x1A, y1A, r1A; double t0A, t1A; @@ -3822,7 +4278,7 @@ GfxRadialShading *GfxRadialShading::parse(Dict *dict, OutputDev *out) { shading = new GfxRadialShading(x0A, y0A, r0A, x1A, y1A, r1A, t0A, t1A, funcsA, nFuncsA, extend0A, extend1A); - if (!shading->init(dict, out)) { + if (!shading->init(dict, out, state)) { delete shading; return NULL; } @@ -4266,7 +4722,7 @@ GfxGouraudTriangleShading::~GfxGouraudTriangleShading() { GfxGouraudTriangleShading *GfxGouraudTriangleShading::parse(int typeA, Dict *dict, Stream *str, - OutputDev *out) { + OutputDev *out, GfxState *gfxState) { GfxGouraudTriangleShading *shading; Function *funcsA[gfxColorMaxComps]; int nFuncsA; @@ -4462,7 +4918,7 @@ GfxGouraudTriangleShading *GfxGouraudTriangleShading::parse(int typeA, shading = new GfxGouraudTriangleShading(typeA, verticesA, nVerticesA, trianglesA, nTrianglesA, funcsA, nFuncsA); - if (!shading->init(dict, out)) { + if (!shading->init(dict, out, gfxState)) { delete shading; return NULL; } @@ -4609,7 +5065,7 @@ GfxPatchMeshShading::~GfxPatchMeshShading() { } GfxPatchMeshShading *GfxPatchMeshShading::parse(int typeA, Dict *dict, - Stream *str, OutputDev *out) { + Stream *str, OutputDev *out, GfxState *state) { GfxPatchMeshShading *shading; Function *funcsA[gfxColorMaxComps]; int nFuncsA; @@ -5133,7 +5589,7 @@ GfxPatchMeshShading *GfxPatchMeshShading::parse(int typeA, Dict *dict, shading = new GfxPatchMeshShading(typeA, patchesA, nPatchesA, funcsA, nFuncsA); - if (!shading->init(dict, out)) { + if (!shading->init(dict, out, state)) { delete shading; return NULL; } @@ -5258,7 +5714,7 @@ GfxImageColorMap::GfxImageColorMap(int bitsA, Object *decode, nComps2 = colorSpace2->getNComps(); indexedLookup = indexedCS->getLookup(); colorSpace2->getDefaultRanges(x, y, indexHigh); - if (colorSpace2->useGetGrayLine() || colorSpace2->useGetRGBLine()) { + if (colorSpace2->useGetGrayLine() || colorSpace2->useGetRGBLine() || colorSpace2->useGetCMYKLine() || colorSpace2->useGetDeviceNLine()) { byte_lookup = (Guchar *)gmallocn ((maxPixel + 1), nComps2); useByteLookup = gTrue; } @@ -5285,7 +5741,7 @@ GfxImageColorMap::GfxImageColorMap(int bitsA, Object *decode, colorSpace2 = sepCS->getAlt(); nComps2 = colorSpace2->getNComps(); sepFunc = sepCS->getFunc(); - if (colorSpace2->useGetGrayLine() || colorSpace2->useGetRGBLine()) { + if (colorSpace2->useGetGrayLine() || colorSpace2->useGetRGBLine() || colorSpace2->useGetCMYKLine() || colorSpace2->useGetDeviceNLine()) { byte_lookup = (Guchar *)gmallocn ((maxPixel + 1), nComps2); useByteLookup = gTrue; } @@ -5302,7 +5758,7 @@ GfxImageColorMap::GfxImageColorMap(int bitsA, Object *decode, } break; default: - if (colorSpace->useGetGrayLine() || colorSpace->useGetRGBLine()) { + if (colorSpace->useGetGrayLine() || colorSpace->useGetRGBLine() || colorSpace->useGetCMYKLine() || colorSpace->useGetDeviceNLine()) { byte_lookup = (Guchar *)gmallocn ((maxPixel + 1), nComps); useByteLookup = gTrue; } @@ -5599,6 +6055,94 @@ void GfxImageColorMap::getRGBXLine(Guchar *in, Guchar *out, int length) { } +void GfxImageColorMap::getCMYKLine(Guchar *in, Guchar *out, int length) { + int i, j; + Guchar *inp, *tmp_line; + + if (!useCMYKLine()) { + GfxCMYK cmyk; + + inp = in; + for (i = 0; i < length; i++) { + getCMYK (inp, &cmyk); + *out++ = colToByte(cmyk.c); + *out++ = colToByte(cmyk.m); + *out++ = colToByte(cmyk.y); + *out++ = colToByte(cmyk.k); + inp += nComps; + } + return; + } + + switch (colorSpace->getMode()) { + case csIndexed: + case csSeparation: + tmp_line = (Guchar *) gmallocn (length, nComps2); + for (i = 0; i < length; i++) { + for (j = 0; j < nComps2; j++) { + tmp_line[i * nComps2 + j] = byte_lookup[in[i] * nComps2 + j]; + } + } + colorSpace2->getCMYKLine(tmp_line, out, length); + gfree (tmp_line); + break; + + default: + inp = in; + for (j = 0; j < length; j++) + for (i = 0; i < nComps; i++) { + *inp = byte_lookup[*inp * nComps + i]; + inp++; + } + colorSpace->getCMYKLine(in, out, length); + break; + } + +} + +void GfxImageColorMap::getDeviceNLine(Guchar *in, Guchar *out, int length) { + int i, j; + Guchar *inp, *tmp_line; + + if (!useDeviceNLine()) { + GfxColor deviceN; + + inp = in; + for (i = 0; i < length; i++) { + getDeviceN (inp, &deviceN); + for (int j = 0; j < SPOT_NCOMPS+4; j++) + *out++ = deviceN.c[j]; + inp += nComps; + } + return; + } + + switch (colorSpace->getMode()) { + case csIndexed: + case csSeparation: + tmp_line = (Guchar *) gmallocn (length, nComps2); + for (i = 0; i < length; i++) { + for (j = 0; j < nComps2; j++) { + tmp_line[i * nComps2 + j] = byte_lookup[in[i] * nComps2 + j]; + } + } + colorSpace2->getDeviceNLine(tmp_line, out, length); + gfree (tmp_line); + break; + + default: + inp = in; + for (j = 0; j < length; j++) + for (i = 0; i < nComps; i++) { + *inp = byte_lookup[*inp * nComps + i]; + inp++; + } + colorSpace->getDeviceNLine(in, out, length); + break; + } + +} + void GfxImageColorMap::getCMYK(Guchar *x, GfxCMYK *cmyk) { GfxColor color; int i; @@ -5981,9 +6525,17 @@ GfxState::GfxState(double hDPIA, double vDPIA, PDFRectangle *pageBox, clipXMax = pageWidth; clipYMax = pageHeight; + renderingIntent[0] = 0; + saved = NULL; #ifdef USE_CMS GfxColorSpace::setupColorProfiles(); + XYZ2DisplayTransformRelCol = NULL; + XYZ2DisplayTransformAbsCol = NULL; + XYZ2DisplayTransformSat = NULL; + XYZ2DisplayTransformPerc = NULL; + localDisplayProfile = NULL; + displayProfileRef = 0; #endif } @@ -6015,6 +6567,27 @@ GfxState::~GfxState() { if (font) { font->decRefCnt(); } +#ifdef USE_CMS + if (XYZ2DisplayTransformRelCol) { + if (XYZ2DisplayTransformRelCol->unref() == 0) + delete XYZ2DisplayTransformRelCol; + } + if (XYZ2DisplayTransformAbsCol) { + if (XYZ2DisplayTransformAbsCol->unref() == 0) + delete XYZ2DisplayTransformAbsCol; + } + if (XYZ2DisplayTransformSat) { + if (XYZ2DisplayTransformSat->unref() == 0) + delete XYZ2DisplayTransformSat; + } + if (XYZ2DisplayTransformPerc) { + if (XYZ2DisplayTransformPerc->unref() == 0) + delete XYZ2DisplayTransformPerc; + } + if (--displayProfileRef == 0 && localDisplayProfile != NULL) { + cmsCloseProfile(localDisplayProfile); + } +#endif } // Used for copy(); @@ -6050,8 +6623,102 @@ GfxState::GfxState(GfxState *state, GBool copyPath) { path = state->path->copy(); } saved = NULL; +#ifdef USE_CMS + if (XYZ2DisplayTransformRelCol) { + XYZ2DisplayTransformRelCol->ref(); + } + if (XYZ2DisplayTransformAbsCol) { + XYZ2DisplayTransformAbsCol->ref(); + } + if (XYZ2DisplayTransformSat) { + XYZ2DisplayTransformSat->ref(); + } + if (XYZ2DisplayTransformPerc) { + XYZ2DisplayTransformPerc->ref(); + } + if (localDisplayProfile) { + displayProfileRef++; + } +#endif } +#ifdef USE_CMS +void GfxState::setDisplayProfile(cmsHPROFILE localDisplayProfileA) { + if (localDisplayProfile != NULL) { + cmsCloseProfile(localDisplayProfile); + } + localDisplayProfile = localDisplayProfileA; + if (localDisplayProfileA != NULL) { + cmsHTRANSFORM transform; + unsigned int nChannels; + unsigned int localDisplayPixelType; + + localDisplayPixelType = getCMSColorSpaceType(cmsGetColorSpace(localDisplayProfile)); + nChannels = getCMSNChannels(cmsGetColorSpace(localDisplayProfile)); + displayProfileRef = 1; + // create transform from XYZ + cmsHPROFILE XYZProfile = cmsCreateXYZProfile(); + if ((transform = cmsCreateTransform(XYZProfile, TYPE_XYZ_DBL, + localDisplayProfile, + COLORSPACE_SH(localDisplayPixelType) | + CHANNELS_SH(nChannels) | BYTES_SH(1), + INTENT_RELATIVE_COLORIMETRIC,LCMS_FLAGS)) == 0) { + error(errSyntaxWarning, -1, "Can't create Lab transform"); + } else { + XYZ2DisplayTransformRelCol = new GfxColorTransform(transform, INTENT_RELATIVE_COLORIMETRIC, localDisplayPixelType); + } + if ((transform = cmsCreateTransform(XYZProfile, TYPE_XYZ_DBL, + localDisplayProfile, + COLORSPACE_SH(localDisplayPixelType) | + CHANNELS_SH(nChannels) | BYTES_SH(1), + INTENT_ABSOLUTE_COLORIMETRIC,LCMS_FLAGS)) == 0) { + error(errSyntaxWarning, -1, "Can't create Lab transform"); + } else { + XYZ2DisplayTransformAbsCol = new GfxColorTransform(transform, INTENT_ABSOLUTE_COLORIMETRIC, localDisplayPixelType); + } + if ((transform = cmsCreateTransform(XYZProfile, TYPE_XYZ_DBL, + localDisplayProfile, + COLORSPACE_SH(localDisplayPixelType) | + CHANNELS_SH(nChannels) | BYTES_SH(1), + INTENT_SATURATION,LCMS_FLAGS)) == 0) { + error(errSyntaxWarning, -1, "Can't create Lab transform"); + } else { + XYZ2DisplayTransformSat = new GfxColorTransform(transform, INTENT_SATURATION, localDisplayPixelType); + } + if ((transform = cmsCreateTransform(XYZProfile, TYPE_XYZ_DBL, + localDisplayProfile, + COLORSPACE_SH(localDisplayPixelType) | + CHANNELS_SH(nChannels) | BYTES_SH(1), + INTENT_PERCEPTUAL,LCMS_FLAGS)) == 0) { + error(errSyntaxWarning, -1, "Can't create Lab transform"); + } else { + XYZ2DisplayTransformPerc = new GfxColorTransform(transform, INTENT_PERCEPTUAL, localDisplayPixelType); + } + cmsCloseProfile(XYZProfile); + } +} + +GfxColorTransform *GfxState::getXYZ2DisplayTransform() { + GfxColorTransform *transform; + + transform = XYZ2DisplayTransformRelCol; + if (renderingIntent != NULL) { + if (strcmp(renderingIntent, "AbsoluteColorimetric") == 0) { + transform = XYZ2DisplayTransformAbsCol; + } else if (strcmp(renderingIntent, "Saturation") == 0) { + transform = XYZ2DisplayTransformSat; + } else if (strcmp(renderingIntent, "Perceptual") == 0) { + transform = XYZ2DisplayTransformPerc; + } + } + if (transform == NULL) { + transform = XYZ2DisplayTransform; + } + return transform; +} + +#endif + void GfxState::setPath(GfxPath *pathA) { delete path; path = pathA; diff --git a/Build/source/libs/poppler/poppler-0.24.4/poppler/GfxState.h b/Build/source/libs/poppler/poppler-0.25.0/poppler/GfxState.h index 2f3efcfb2ef..106b2c0bf00 100644 --- a/Build/source/libs/poppler/poppler-0.24.4/poppler/GfxState.h +++ b/Build/source/libs/poppler/poppler-0.25.0/poppler/GfxState.h @@ -20,7 +20,7 @@ // Copyright (C) 2009-2011, 2013 Albert Astals Cid <aacid@kde.org> // Copyright (C) 2010 Christian Feuersänger <cfeuersaenger@googlemail.com> // Copyright (C) 2011 Andrea Canciani <ranma42@gmail.com> -// Copyright (C) 2011, 2012 Thomas Freitag <Thomas.Freitag@alfa.de> +// Copyright (C) 2011-2013 Thomas Freitag <Thomas.Freitag@alfa.de> // Copyright (C) 2013 Lu Wang <coolwanglu@gmail.com> // // To see a description of the changes please see the Changelog file that @@ -42,6 +42,7 @@ #include "Function.h" #include <assert.h> +#include <map> class Array; class Gfx; @@ -51,6 +52,7 @@ class GfxShading; class PopplerCache; class GooList; class OutputDev; +class GfxState; class Matrix { public: @@ -180,14 +182,18 @@ class GfxColorTransform { public: void doTransform(void *in, void *out, unsigned int size); // transformA should be a cmsHTRANSFORM - GfxColorTransform(void *transformA); + GfxColorTransform(void *transformA, int cmsIntent, unsigned int transformPixelType); ~GfxColorTransform(); + int getIntent() { return cmsIntent; } + int getTransformPixelType() { return transformPixelType; } void ref(); unsigned int unref(); private: GfxColorTransform() {} void *transform; unsigned int refCount; + int cmsIntent; + unsigned int transformPixelType; }; class GfxColorSpace { @@ -199,7 +205,7 @@ public: virtual GfxColorSpaceMode getMode() = 0; // Construct a color space. Returns NULL if unsuccessful. - static GfxColorSpace *parse(Object *csObj, OutputDev *out, int recursion = 0); + static GfxColorSpace *parse(Object *csObj, OutputDev *out, GfxState *state, int recursion = 0); // Convert to gray, RGB, or CMYK. virtual void getGray(GfxColor *color, GfxGray *gray) = 0; @@ -210,6 +216,8 @@ public: virtual void getRGBLine(Guchar * /*in*/, unsigned int * /*out*/, int /*length*/) { error(errInternal, -1, "GfxColorSpace::getRGBLine (first variant) this should not happen"); } virtual void getRGBLine(Guchar * /*in*/, Guchar * /*out*/, int /*length*/) { error(errInternal, -1, "GfxColorSpace::getRGBLine (second variant) this should not happen"); } virtual void getRGBXLine(Guchar * /*in*/, Guchar * /*out*/, int /*length*/) { error(errInternal, -1, "GfxColorSpace::getRGBXLine this should not happen"); } + virtual void getCMYKLine(Guchar * /*in*/, Guchar * /*out*/, int /*length*/) { error(errInternal, -1, "GfxColorSpace::getCMYKLine this should not happen"); } + virtual void getDeviceNLine(Guchar * /*in*/, Guchar * /*out*/, int /*length*/) { error(errInternal, -1, "GfxColorSpace::getDeviceNLine this should not happen"); } // create mapping for spot colorants virtual void createMapping(GooList *separationList, int maxSepComps); @@ -218,6 +226,10 @@ public: virtual GBool useGetRGBLine() { return gFalse; } // Does this ColorSpace support getGrayLine? virtual GBool useGetGrayLine() { return gFalse; } + // Does this ColorSpace support getCMYKLine? + virtual GBool useGetCMYKLine() { return gFalse; } + // Does this ColorSpace support getDeviceNLine? + virtual GBool useGetDeviceNLine() { return gFalse; } // Return the number of color components. virtual int getNComps() = 0; @@ -279,9 +291,13 @@ public: virtual void getRGBLine(Guchar *in, unsigned int *out, int length); virtual void getRGBLine(Guchar *in, Guchar *out, int length); virtual void getRGBXLine(Guchar *in, Guchar *out, int length); + virtual void getCMYKLine(Guchar *in, Guchar *out, int length); + virtual void getDeviceNLine(Guchar *in, Guchar *out, int length); virtual GBool useGetRGBLine() { return gTrue; } virtual GBool useGetGrayLine() { return gTrue; } + virtual GBool useGetCMYKLine() { return gTrue; } + virtual GBool useGetDeviceNLine() { return gTrue; } virtual int getNComps() { return 1; } virtual void getDefaultColor(GfxColor *color); @@ -302,7 +318,7 @@ public: virtual GfxColorSpaceMode getMode() { return csCalGray; } // Construct a CalGray color space. Returns NULL if unsuccessful. - static GfxColorSpace *parse(Array *arr); + static GfxColorSpace *parse(Array *arr, GfxState *state); virtual void getGray(GfxColor *color, GfxGray *gray); virtual void getRGB(GfxColor *color, GfxRGB *rgb); @@ -328,6 +344,9 @@ private: double gamma; // gamma value double kr, kg, kb; // gamut mapping mulitpliers void getXYZ(GfxColor *color, double *pX, double *pY, double *pZ); +#ifdef USE_CMS + GfxColorTransform *transform; +#endif }; //------------------------------------------------------------------------ @@ -350,9 +369,13 @@ public: virtual void getRGBLine(Guchar *in, unsigned int *out, int length); virtual void getRGBLine(Guchar *in, Guchar *out, int length); virtual void getRGBXLine(Guchar *in, Guchar *out, int length); + virtual void getCMYKLine(Guchar *in, Guchar *out, int length); + virtual void getDeviceNLine(Guchar *in, Guchar *out, int length); virtual GBool useGetRGBLine() { return gTrue; } virtual GBool useGetGrayLine() { return gTrue; } + virtual GBool useGetCMYKLine() { return gTrue; } + virtual GBool useGetDeviceNLine() { return gTrue; } virtual int getNComps() { return 3; } virtual void getDefaultColor(GfxColor *color); @@ -373,7 +396,7 @@ public: virtual GfxColorSpaceMode getMode() { return csCalRGB; } // Construct a CalRGB color space. Returns NULL if unsuccessful. - static GfxColorSpace *parse(Array *arr); + static GfxColorSpace *parse(Array *arr, GfxState *state); virtual void getGray(GfxColor *color, GfxGray *gray); virtual void getRGB(GfxColor *color, GfxRGB *rgb); @@ -403,6 +426,9 @@ private: double mat[9]; // ABC -> XYZ transform matrix double kr, kg, kb; // gamut mapping mulitpliers void getXYZ(GfxColor *color, double *pX, double *pY, double *pZ); +#ifdef USE_CMS + GfxColorTransform *transform; +#endif }; //------------------------------------------------------------------------ @@ -424,7 +450,11 @@ public: virtual void getRGBLine(Guchar *in, unsigned int *out, int length); virtual void getRGBLine(Guchar *, Guchar *out, int length); virtual void getRGBXLine(Guchar *in, Guchar *out, int length); + virtual void getCMYKLine(Guchar *in, Guchar *out, int length); + virtual void getDeviceNLine(Guchar *in, Guchar *out, int length); virtual GBool useGetRGBLine() { return gTrue; } + virtual GBool useGetCMYKLine() { return gTrue; } + virtual GBool useGetDeviceNLine() { return gTrue; } virtual int getNComps() { return 4; } virtual void getDefaultColor(GfxColor *color); @@ -445,7 +475,7 @@ public: virtual GfxColorSpaceMode getMode() { return csLab; } // Construct a Lab color space. Returns NULL if unsuccessful. - static GfxColorSpace *parse(Array *arr); + static GfxColorSpace *parse(Array *arr, GfxState *state); virtual void getGray(GfxColor *color, GfxGray *gray); virtual void getRGB(GfxColor *color, GfxRGB *rgb); @@ -477,6 +507,9 @@ private: double aMin, aMax, bMin, bMax; // range for the a and b components double kr, kg, kb; // gamut mapping mulitpliers void getXYZ(GfxColor *color, double *pX, double *pY, double *pZ); +#ifdef USE_CMS + GfxColorTransform *transform; +#endif }; //------------------------------------------------------------------------ @@ -493,7 +526,7 @@ public: virtual GfxColorSpaceMode getMode() { return csICCBased; } // Construct an ICCBased color space. Returns NULL if unsuccessful. - static GfxColorSpace *parse(Array *arr, OutputDev *out, int recursion); + static GfxColorSpace *parse(Array *arr, OutputDev *out, GfxState *state, int recursion); virtual void getGray(GfxColor *color, GfxGray *gray); virtual void getRGB(GfxColor *color, GfxRGB *rgb); @@ -502,8 +535,12 @@ public: virtual void getRGBLine(Guchar *in, unsigned int *out, int length); virtual void getRGBLine(Guchar *in, Guchar *out, int length); virtual void getRGBXLine(Guchar *in, Guchar *out, int length); + virtual void getCMYKLine(Guchar *in, Guchar *out, int length); + virtual void getDeviceNLine(Guchar *in, Guchar *out, int length); virtual GBool useGetRGBLine(); + virtual GBool useGetCMYKLine(); + virtual GBool useGetDeviceNLine(); virtual int getNComps() { return nComps; } virtual void getDefaultColor(GfxColor *color); @@ -522,8 +559,10 @@ private: double rangeMax[4]; // max values for each component Ref iccProfileStream; // the ICC profile #ifdef USE_CMS + int getIntent() { return (transform != NULL) ? transform->getIntent() : 0; } GfxColorTransform *transform; GfxColorTransform *lineTransform; // color transform for line + std::map<unsigned int, unsigned int> cmsCache; #endif }; //------------------------------------------------------------------------ @@ -539,7 +578,7 @@ public: virtual GfxColorSpaceMode getMode() { return csIndexed; } // Construct an Indexed color space. Returns NULL if unsuccessful. - static GfxColorSpace *parse(Array *arr, OutputDev *out, int recursion); + static GfxColorSpace *parse(Array *arr, OutputDev *out, GfxState *state, int recursion); virtual void getGray(GfxColor *color, GfxGray *gray); virtual void getRGB(GfxColor *color, GfxRGB *rgb); @@ -548,8 +587,12 @@ public: virtual void getRGBLine(Guchar *in, unsigned int *out, int length); virtual void getRGBLine(Guchar *in, Guchar *out, int length); virtual void getRGBXLine(Guchar *in, Guchar *out, int length); + virtual void getCMYKLine(Guchar *in, Guchar *out, int length); + virtual void getDeviceNLine(Guchar *in, Guchar *out, int length); virtual GBool useGetRGBLine() { return gTrue; } + virtual GBool useGetCMYKLine() { return gTrue; } + virtual GBool useGetDeviceNLine() { return gTrue; } virtual int getNComps() { return 1; } virtual void getDefaultColor(GfxColor *color); @@ -588,7 +631,7 @@ public: virtual GfxColorSpaceMode getMode() { return csSeparation; } // Construct a Separation color space. Returns NULL if unsuccessful. - static GfxColorSpace *parse(Array *arr, OutputDev *out, int recursion); + static GfxColorSpace *parse(Array *arr, OutputDev *out, GfxState *state, int recursion); virtual void getGray(GfxColor *color, GfxGray *gray); virtual void getRGB(GfxColor *color, GfxRGB *rgb); @@ -633,7 +676,7 @@ public: virtual GfxColorSpaceMode getMode() { return csDeviceN; } // Construct a DeviceN color space. Returns NULL if unsuccessful. - static GfxColorSpace *parse(Array *arr, OutputDev *out, int recursion); + static GfxColorSpace *parse(Array *arr, OutputDev *out, GfxState *state, int recursion); virtual void getGray(GfxColor *color, GfxGray *gray); virtual void getRGB(GfxColor *color, GfxRGB *rgb); @@ -680,7 +723,7 @@ public: virtual GfxColorSpaceMode getMode() { return csPattern; } // Construct a Pattern color space. Returns NULL if unsuccessful. - static GfxColorSpace *parse(Array *arr, OutputDev *out, int recursion); + static GfxColorSpace *parse(Array *arr, OutputDev *out, GfxState *state, int recursion); virtual void getGray(GfxColor *color, GfxGray *gray); virtual void getRGB(GfxColor *color, GfxRGB *rgb); @@ -709,7 +752,7 @@ public: GfxPattern(int typeA); virtual ~GfxPattern(); - static GfxPattern *parse(Object *obj, OutputDev *out); + static GfxPattern *parse(Object *obj, OutputDev *out, GfxState *state); virtual GfxPattern *copy() = 0; @@ -765,7 +808,7 @@ private: class GfxShadingPattern: public GfxPattern { public: - static GfxShadingPattern *parse(Object *patObj, OutputDev *out); + static GfxShadingPattern *parse(Object *patObj, OutputDev *out, GfxState *state); virtual ~GfxShadingPattern(); virtual GfxPattern *copy(); @@ -792,7 +835,7 @@ public: GfxShading(GfxShading *shading); virtual ~GfxShading(); - static GfxShading *parse(Object *obj, OutputDev *out); + static GfxShading *parse(Object *obj, OutputDev *out, GfxState *state); virtual GfxShading *copy() = 0; @@ -806,7 +849,7 @@ public: protected: - GBool init(Dict *dict, OutputDev *out); + GBool init(Dict *dict, OutputDev *out, GfxState *state); int type; GfxColorSpace *colorSpace; @@ -875,7 +918,7 @@ public: GfxFunctionShading(GfxFunctionShading *shading); virtual ~GfxFunctionShading(); - static GfxFunctionShading *parse(Dict *dict, OutputDev *out); + static GfxFunctionShading *parse(Dict *dict, OutputDev *out, GfxState *state); virtual GfxShading *copy(); @@ -909,7 +952,7 @@ public: GfxAxialShading(GfxAxialShading *shading); virtual ~GfxAxialShading(); - static GfxAxialShading *parse(Dict *dict, OutputDev *out); + static GfxAxialShading *parse(Dict *dict, OutputDev *out, GfxState *state); virtual GfxShading *copy(); @@ -942,7 +985,7 @@ public: GfxRadialShading(GfxRadialShading *shading); virtual ~GfxRadialShading(); - static GfxRadialShading *parse(Dict *dict, OutputDev *out); + static GfxRadialShading *parse(Dict *dict, OutputDev *out, GfxState *state); virtual GfxShading *copy(); @@ -980,7 +1023,7 @@ public: GfxGouraudTriangleShading(GfxGouraudTriangleShading *shading); virtual ~GfxGouraudTriangleShading(); - static GfxGouraudTriangleShading *parse(int typeA, Dict *dict, Stream *str, OutputDev *out); + static GfxGouraudTriangleShading *parse(int typeA, Dict *dict, Stream *str, OutputDev *out, GfxState *state); virtual GfxShading *copy(); @@ -1066,7 +1109,7 @@ public: GfxPatchMeshShading(GfxPatchMeshShading *shading); virtual ~GfxPatchMeshShading(); - static GfxPatchMeshShading *parse(int typeA, Dict *dict, Stream *str, OutputDev *out); + static GfxPatchMeshShading *parse(int typeA, Dict *dict, Stream *str, OutputDev *out, GfxState *state); virtual GfxShading *copy(); @@ -1126,6 +1169,8 @@ public: double getDecodeHigh(int i) { return decodeLow[i] + decodeRange[i]; } bool useRGBLine() { return (colorSpace2 && colorSpace2->useGetRGBLine ()) || (!colorSpace2 && colorSpace->useGetRGBLine ()); } + bool useCMYKLine() { return (colorSpace2 && colorSpace2->useGetCMYKLine ()) || (!colorSpace2 && colorSpace->useGetCMYKLine ()); } + bool useDeviceNLine() { return (colorSpace2 && colorSpace2->useGetDeviceNLine ()) || (!colorSpace2 && colorSpace->useGetDeviceNLine ()); } // Convert an image pixel to a color. void getGray(Guchar *x, GfxGray *gray); @@ -1134,6 +1179,8 @@ public: void getRGBLine(Guchar *in, Guchar *out, int length); void getRGBXLine(Guchar *in, Guchar *out, int length); void getGrayLine(Guchar *in, Guchar *out, int length); + void getCMYKLine(Guchar *in, Guchar *out, int length); + void getDeviceNLine(Guchar *in, Guchar *out, int length); void getCMYK(Guchar *x, GfxCMYK *cmyk); void getDeviceN(Guchar *x, GfxColor *deviceN); void getColor(Guchar *x, GfxColor *color); @@ -1407,6 +1454,7 @@ public: double getLeading() { return leading; } double getRise() { return rise; } int getRender() { return render; } + char *getRenderingIntent() { return renderingIntent; } GfxPath *getPath() { return path; } void setPath(GfxPath *pathA); double getCurX() { return curX; } @@ -1485,6 +1533,14 @@ public: { rise = riseA; } void setRender(int renderA) { render = renderA; } + void setRenderingIntent(const char *intent) + { strncpy(renderingIntent, intent, 31); } + +#ifdef USE_CMS + void setDisplayProfile(void *localDisplayProfileA); + void *getDisplayProfile() { return localDisplayProfile; } + GfxColorTransform *getXYZ2DisplayTransform(); +#endif // Add to path. void moveTo(double x, double y) @@ -1573,10 +1629,20 @@ private: double clipXMin, clipYMin, // bounding box for clip region clipXMax, clipYMax; + char renderingIntent[32]; GfxState *saved; // next GfxState on stack GfxState(GfxState *state, GBool copyPath); + +#ifdef USE_CMS + void *localDisplayProfile; + int displayProfileRef; + GfxColorTransform *XYZ2DisplayTransformRelCol; + GfxColorTransform *XYZ2DisplayTransformAbsCol; + GfxColorTransform *XYZ2DisplayTransformSat; + GfxColorTransform *XYZ2DisplayTransformPerc; +#endif }; #endif diff --git a/Build/source/libs/poppler/poppler-0.24.4/poppler/GfxState_helpers.h b/Build/source/libs/poppler/poppler-0.25.0/poppler/GfxState_helpers.h index bc0024edd79..bc0024edd79 100644 --- a/Build/source/libs/poppler/poppler-0.24.4/poppler/GfxState_helpers.h +++ b/Build/source/libs/poppler/poppler-0.25.0/poppler/GfxState_helpers.h diff --git a/Build/source/libs/poppler/poppler-0.24.4/poppler/GlobalParams.cc b/Build/source/libs/poppler/poppler-0.25.0/poppler/GlobalParams.cc index 6efdd0c0b9c..01a31573d01 100644 --- a/Build/source/libs/poppler/poppler-0.24.4/poppler/GlobalParams.cc +++ b/Build/source/libs/poppler/poppler-0.25.0/poppler/GlobalParams.cc @@ -34,6 +34,7 @@ // Copyright (C) 2012 Adrian Johnson <ajohnson@redneon.com> // Copyright (C) 2012 Thomas Freitag <Thomas.Freitag@alfa.de> // Copyright (C) 2012 Peter Breitenlohner <peb@mppmu.mpg.de> +// Copyright (C) 2013 Jason Crain <jason@aquaticape.us> // // To see a description of the changes please see the Changelog file that // came with your tarball or type make ChangeLog if you are building from git @@ -576,7 +577,8 @@ GlobalParams::GlobalParams(const char *customPopplerDataDir) #ifdef _WIN32 substFiles = new GooHash(gTrue); #endif - nameToUnicode = new NameToCharCode(); + nameToUnicodeZapfDingbats = new NameToCharCode(); + nameToUnicodeText = new NameToCharCode(); cidToUnicodes = new GooHash(gTrue); unicodeToUnicodes = new GooHash(gTrue); residentUnicodeMaps = new GooHash(); @@ -648,9 +650,13 @@ GlobalParams::GlobalParams(const char *customPopplerDataDir) securityHandlers = new GooList(); #endif - // set up the initial nameToUnicode table - for (i = 0; nameToUnicodeTab[i].name; ++i) { - nameToUnicode->add(nameToUnicodeTab[i].name, nameToUnicodeTab[i].u); + // set up the initial nameToUnicode tables + for (i = 0; nameToUnicodeZapfDingbatsTab[i].name; ++i) { + nameToUnicodeZapfDingbats->add(nameToUnicodeZapfDingbatsTab[i].name, nameToUnicodeZapfDingbatsTab[i].u); + } + + for (i = 0; nameToUnicodeTextTab[i].name; ++i) { + nameToUnicodeText->add(nameToUnicodeTextTab[i].name, nameToUnicodeTextTab[i].u); } // set up the residentUnicodeMaps table @@ -740,7 +746,7 @@ void GlobalParams::parseNameToUnicode(GooString *name) { tok2 = strtok_r(NULL, " \t\r\n", &tokptr); if (tok1 && tok2) { sscanf(tok1, "%x", &u); - nameToUnicode->add(tok2, u); + nameToUnicodeText->add(tok2, u); } else { error(errConfig, -1, "Bad line in 'nameToUnicode' file ({0:t}:{1:d})", name, line); @@ -796,7 +802,8 @@ GlobalParams::~GlobalParams() { delete macRomanReverseMap; - delete nameToUnicode; + delete nameToUnicodeZapfDingbats; + delete nameToUnicodeText; deleteGooHash(cidToUnicodes, GooString); deleteGooHash(unicodeToUnicodes, GooString); deleteGooHash(residentUnicodeMaps, UnicodeMap); @@ -853,9 +860,17 @@ CharCode GlobalParams::getMacRomanCharCode(char *charName) { return macRomanReverseMap->lookup(charName); } -Unicode GlobalParams::mapNameToUnicode(const char *charName) { - // no need to lock - nameToUnicode is constant - return nameToUnicode->lookup(charName); +Unicode GlobalParams::mapNameToUnicodeAll(const char *charName) { + // no need to lock - nameToUnicodeZapfDingbats and nameToUnicodeText are constant + Unicode u = nameToUnicodeZapfDingbats->lookup(charName); + if (!u) + u = nameToUnicodeText->lookup(charName); + return u; +} + +Unicode GlobalParams::mapNameToUnicodeText(const char *charName) { + // no need to lock - nameToUnicodeText is constant + return nameToUnicodeText->lookup(charName); } UnicodeMap *GlobalParams::getResidentUnicodeMap(GooString *encodingName) { diff --git a/Build/source/libs/poppler/poppler-0.24.4/poppler/GlobalParams.h b/Build/source/libs/poppler/poppler-0.25.0/poppler/GlobalParams.h index bc11684f268..c33a8024c04 100644 --- a/Build/source/libs/poppler/poppler-0.24.4/poppler/GlobalParams.h +++ b/Build/source/libs/poppler/poppler-0.25.0/poppler/GlobalParams.h @@ -25,6 +25,7 @@ // Copyright (C) 2011 Pino Toscano <pino@kde.org> // Copyright (C) 2012 Adrian Johnson <ajohnson@redneon.com> // Copyright (C) 2012 Thomas Freitag <Thomas.Freitag@alfa.de> +// Copyright (C) 2013 Jason Crain <jason@aquaticape.us> // // To see a description of the changes please see the Changelog file that // came with your tarball or type make ChangeLog if you are building from git @@ -139,7 +140,14 @@ public: CharCode getMacRomanCharCode(char *charName); - Unicode mapNameToUnicode(const char *charName); + // Return Unicode values for character names. Used for general text + // extraction. + Unicode mapNameToUnicodeText(const char *charName); + + // Return Unicode values for character names. Used for glyph + // lookups or text extraction with ZapfDingbats fonts. + Unicode mapNameToUnicodeAll(const char *charName); + UnicodeMap *getResidentUnicodeMap(GooString *encodingName); FILE *getUnicodeMapFile(GooString *encodingName); FILE *findCMapFile(GooString *collection, GooString *cMapName); @@ -271,8 +279,10 @@ private: //----- user-modifiable settings - NameToCharCode * // mapping from char name to Unicode - nameToUnicode; + NameToCharCode * // mapping from char name to Unicode for ZapfDingbats + nameToUnicodeZapfDingbats; + NameToCharCode * // mapping from char name to Unicode for text + nameToUnicodeText; // extraction GooHash *cidToUnicodes; // files for mappings from char collections // to Unicode, indexed by collection name // [GooString] diff --git a/Build/source/libs/poppler/poppler-0.24.4/poppler/GlobalParamsWin.cc b/Build/source/libs/poppler/poppler-0.25.0/poppler/GlobalParamsWin.cc index 084b49bf639..084b49bf639 100644 --- a/Build/source/libs/poppler/poppler-0.24.4/poppler/GlobalParamsWin.cc +++ b/Build/source/libs/poppler/poppler-0.25.0/poppler/GlobalParamsWin.cc diff --git a/Build/source/libs/poppler/poppler-0.24.4/poppler/Hints.cc b/Build/source/libs/poppler/poppler-0.25.0/poppler/Hints.cc index 49e201daa93..49e201daa93 100644 --- a/Build/source/libs/poppler/poppler-0.24.4/poppler/Hints.cc +++ b/Build/source/libs/poppler/poppler-0.25.0/poppler/Hints.cc diff --git a/Build/source/libs/poppler/poppler-0.24.4/poppler/Hints.h b/Build/source/libs/poppler/poppler-0.25.0/poppler/Hints.h index f5225f9fa9b..f46c07f673b 100644 --- a/Build/source/libs/poppler/poppler-0.24.4/poppler/Hints.h +++ b/Build/source/libs/poppler/poppler-0.25.0/poppler/Hints.h @@ -5,7 +5,7 @@ // This file is licensed under the GPLv2 or later // // Copyright 2010 Hib Eris <hib@hiberis.nl> -// Copyright 2010 Albert Astals Cid <aacid@kde.org> +// Copyright 2010, 2013 Albert Astals Cid <aacid@kde.org> // Copyright 2013 Adrian Johnson <ajohnson@redneon.com> // //======================================================================== @@ -57,7 +57,6 @@ private: int pageObjectFirst; Goffset pageOffsetFirst; Guint pageEndFirst; - int objectNumberFirst; Guint nObjectLeast; Guint objectOffsetFirst; diff --git a/Build/source/libs/poppler/poppler-0.24.4/poppler/JArithmeticDecoder.cc b/Build/source/libs/poppler/poppler-0.25.0/poppler/JArithmeticDecoder.cc index d23f7ea3887..d23f7ea3887 100644 --- a/Build/source/libs/poppler/poppler-0.24.4/poppler/JArithmeticDecoder.cc +++ b/Build/source/libs/poppler/poppler-0.25.0/poppler/JArithmeticDecoder.cc diff --git a/Build/source/libs/poppler/poppler-0.24.4/poppler/JArithmeticDecoder.h b/Build/source/libs/poppler/poppler-0.25.0/poppler/JArithmeticDecoder.h index 3c3e6fed0e5..3c3e6fed0e5 100644 --- a/Build/source/libs/poppler/poppler-0.24.4/poppler/JArithmeticDecoder.h +++ b/Build/source/libs/poppler/poppler-0.25.0/poppler/JArithmeticDecoder.h diff --git a/Build/source/libs/poppler/poppler-0.24.4/poppler/JBIG2Stream.cc b/Build/source/libs/poppler/poppler-0.25.0/poppler/JBIG2Stream.cc index 12de50e18c5..dbc7bdca260 100644 --- a/Build/source/libs/poppler/poppler-0.24.4/poppler/JBIG2Stream.cc +++ b/Build/source/libs/poppler/poppler-0.25.0/poppler/JBIG2Stream.cc @@ -1495,7 +1495,7 @@ void JBIG2Stream::readSegments() { // arithmetic-coded symbol dictionary segments when numNewSyms // == 0. Segments like this often occur for blank pages. - error(errSyntaxError, curStr->getPos(), "{0:d} extraneous byte{1:s} after segment", + error(errSyntaxError, curStr->getPos(), "{0:lld} extraneous byte{1:s} after segment", segExtraBytes, (segExtraBytes > 1) ? "s" : ""); // Burn through the remaining bytes -- inefficient, but diff --git a/Build/source/libs/poppler/poppler-0.24.4/poppler/JBIG2Stream.h b/Build/source/libs/poppler/poppler-0.25.0/poppler/JBIG2Stream.h index be1b3bd7897..0ee2518575c 100644 --- a/Build/source/libs/poppler/poppler-0.24.4/poppler/JBIG2Stream.h +++ b/Build/source/libs/poppler/poppler-0.25.0/poppler/JBIG2Stream.h @@ -56,6 +56,7 @@ public: virtual int lookChar(); virtual GooString *getPSFilter(int psLevel, const char *indent); virtual GBool isBinary(GBool last = gTrue); + virtual Object *getGlobalsStream() { return &globalsStream; } private: virtual GBool hasGetChars() { return true; } diff --git a/Build/source/libs/poppler/poppler-0.24.4/poppler/JPEG2000Stream.cc b/Build/source/libs/poppler/poppler-0.25.0/poppler/JPEG2000Stream.cc index 703d471c99a..703d471c99a 100644 --- a/Build/source/libs/poppler/poppler-0.24.4/poppler/JPEG2000Stream.cc +++ b/Build/source/libs/poppler/poppler-0.25.0/poppler/JPEG2000Stream.cc diff --git a/Build/source/libs/poppler/poppler-0.24.4/poppler/JPEG2000Stream.h b/Build/source/libs/poppler/poppler-0.25.0/poppler/JPEG2000Stream.h index 3feccbef06d..3feccbef06d 100644 --- a/Build/source/libs/poppler/poppler-0.24.4/poppler/JPEG2000Stream.h +++ b/Build/source/libs/poppler/poppler-0.25.0/poppler/JPEG2000Stream.h diff --git a/Build/source/libs/poppler/poppler-0.24.4/poppler/JPXStream.cc b/Build/source/libs/poppler/poppler-0.25.0/poppler/JPXStream.cc index 1476e6a0cfe..1476e6a0cfe 100644 --- a/Build/source/libs/poppler/poppler-0.24.4/poppler/JPXStream.cc +++ b/Build/source/libs/poppler/poppler-0.25.0/poppler/JPXStream.cc diff --git a/Build/source/libs/poppler/poppler-0.24.4/poppler/JPXStream.h b/Build/source/libs/poppler/poppler-0.25.0/poppler/JPXStream.h index 30855431fb4..30855431fb4 100644 --- a/Build/source/libs/poppler/poppler-0.24.4/poppler/JPXStream.h +++ b/Build/source/libs/poppler/poppler-0.25.0/poppler/JPXStream.h diff --git a/Build/source/libs/poppler/poppler-0.24.4/poppler/Lexer.cc b/Build/source/libs/poppler/poppler-0.25.0/poppler/Lexer.cc index c62052998b8..c62052998b8 100644 --- a/Build/source/libs/poppler/poppler-0.24.4/poppler/Lexer.cc +++ b/Build/source/libs/poppler/poppler-0.25.0/poppler/Lexer.cc diff --git a/Build/source/libs/poppler/poppler-0.24.4/poppler/Lexer.h b/Build/source/libs/poppler/poppler-0.25.0/poppler/Lexer.h index 02b6cdc6923..02b6cdc6923 100644 --- a/Build/source/libs/poppler/poppler-0.24.4/poppler/Lexer.h +++ b/Build/source/libs/poppler/poppler-0.25.0/poppler/Lexer.h diff --git a/Build/source/libs/poppler/poppler-0.24.4/poppler/Linearization.cc b/Build/source/libs/poppler/poppler-0.25.0/poppler/Linearization.cc index 33331d1af37..33331d1af37 100644 --- a/Build/source/libs/poppler/poppler-0.24.4/poppler/Linearization.cc +++ b/Build/source/libs/poppler/poppler-0.25.0/poppler/Linearization.cc diff --git a/Build/source/libs/poppler/poppler-0.24.4/poppler/Linearization.h b/Build/source/libs/poppler/poppler-0.25.0/poppler/Linearization.h index 6728a750aba..6728a750aba 100644 --- a/Build/source/libs/poppler/poppler-0.24.4/poppler/Linearization.h +++ b/Build/source/libs/poppler/poppler-0.25.0/poppler/Linearization.h diff --git a/Build/source/libs/poppler/poppler-0.24.4/poppler/Link.cc b/Build/source/libs/poppler/poppler-0.25.0/poppler/Link.cc index 20184d1376c..20184d1376c 100644 --- a/Build/source/libs/poppler/poppler-0.24.4/poppler/Link.cc +++ b/Build/source/libs/poppler/poppler-0.25.0/poppler/Link.cc diff --git a/Build/source/libs/poppler/poppler-0.24.4/poppler/Link.h b/Build/source/libs/poppler/poppler-0.25.0/poppler/Link.h index fc2abe60052..fc2abe60052 100644 --- a/Build/source/libs/poppler/poppler-0.24.4/poppler/Link.h +++ b/Build/source/libs/poppler/poppler-0.25.0/poppler/Link.h diff --git a/Build/source/libs/poppler/poppler-0.24.4/poppler/LocalPDFDocBuilder.cc b/Build/source/libs/poppler/poppler-0.25.0/poppler/LocalPDFDocBuilder.cc index 6f6f1fca9f7..6f6f1fca9f7 100644 --- a/Build/source/libs/poppler/poppler-0.24.4/poppler/LocalPDFDocBuilder.cc +++ b/Build/source/libs/poppler/poppler-0.25.0/poppler/LocalPDFDocBuilder.cc diff --git a/Build/source/libs/poppler/poppler-0.24.4/poppler/LocalPDFDocBuilder.h b/Build/source/libs/poppler/poppler-0.25.0/poppler/LocalPDFDocBuilder.h index c2b1d903885..c2b1d903885 100644 --- a/Build/source/libs/poppler/poppler-0.24.4/poppler/LocalPDFDocBuilder.h +++ b/Build/source/libs/poppler/poppler-0.25.0/poppler/LocalPDFDocBuilder.h diff --git a/Build/source/libs/poppler/poppler-0.24.4/poppler/Makefile.am b/Build/source/libs/poppler/poppler-0.25.0/poppler/Makefile.am index 6e21c17eb04..07cfb3b0090 100644 --- a/Build/source/libs/poppler/poppler-0.24.4/poppler/Makefile.am +++ b/Build/source/libs/poppler/poppler-0.25.0/poppler/Makefile.am @@ -157,7 +157,7 @@ libpoppler_la_LIBADD = \ $(PTHREAD_LIBS) \ $(win32_libs) -libpoppler_la_LDFLAGS = -version-info 44:0:0 @create_shared_lib@ @auto_import_flags@ +libpoppler_la_LDFLAGS = -version-info 45:0:0 @create_shared_lib@ @auto_import_flags@ if ENABLE_XPDF_HEADERS @@ -216,6 +216,8 @@ poppler_include_HEADERS = \ StdinPDFDocBuilder.h \ Stream-CCITT.h \ Stream.h \ + StructElement.h \ + StructTreeRoot.h \ UnicodeMap.h \ UnicodeMapTables.h \ UnicodeTypeTable.h \ @@ -230,6 +232,7 @@ poppler_include_HEADERS = \ NameToUnicodeTable.h \ PSOutputDev.h \ TextOutputDev.h \ + MarkedContentOutputDev.h \ SecurityHandler.h \ UTF.h \ UTF8.h \ @@ -294,6 +297,8 @@ libpoppler_la_SOURCES = \ StdinCachedFile.cc \ StdinPDFDocBuilder.cc \ Stream.cc \ + StructTreeRoot.cc \ + StructElement.cc \ strtok_r.cpp \ UnicodeMap.cc \ UnicodeTypeTable.cc \ @@ -302,6 +307,7 @@ libpoppler_la_SOURCES = \ XRef.cc \ PSOutputDev.cc \ TextOutputDev.cc \ + MarkedContentOutputDev.cc \ PageLabelInfo.h \ PageLabelInfo.cc \ SecurityHandler.cc \ diff --git a/Build/source/libs/poppler/poppler-0.25.0/poppler/MarkedContentOutputDev.cc b/Build/source/libs/poppler/poppler-0.25.0/poppler/MarkedContentOutputDev.cc new file mode 100644 index 00000000000..7fdd8f54c53 --- /dev/null +++ b/Build/source/libs/poppler/poppler-0.25.0/poppler/MarkedContentOutputDev.cc @@ -0,0 +1,212 @@ +//======================================================================== +// +// MarkedContentOutputDev.cc +// +// This file is licensed under the GPLv2 or later +// +// Copyright 2013 Igalia S.L. +// +//======================================================================== + +#include "MarkedContentOutputDev.h" +#include "GlobalParams.h" +#include "UnicodeMap.h" +#include "GfxState.h" +#include "GfxFont.h" +#include "Annot.h" +#include <vector> + + +MarkedContentOutputDev::MarkedContentOutputDev(int mcidA): + currentFont(NULL), + currentText(NULL), + mcid(mcidA), + pageWidth(0.0), + pageHeight(0.0), + unicodeMap(NULL) +{ + currentColor.r = currentColor.g = currentColor.b = 0; +} + + +MarkedContentOutputDev::~MarkedContentOutputDev() +{ + if (unicodeMap) + unicodeMap->decRefCnt(); + if (currentFont) + currentFont->decRefCnt(); + delete currentText; +} + + +void MarkedContentOutputDev::endSpan() +{ + if (currentText && currentText->getLength()) { + // The TextSpan takes ownership of currentText and + // increases the reference count for currentFont. + textSpans.push_back(TextSpan(currentText, + currentFont, + currentColor)); + } + currentText = NULL; +} + + +void MarkedContentOutputDev::startPage(int pageNum, GfxState *state, XRef *xref) +{ + if (state) { + pageWidth = state->getPageWidth(); + pageHeight = state->getPageHeight(); + } else { + pageWidth = pageHeight = 0.0; + } +} + + +void MarkedContentOutputDev::endPage() +{ + pageWidth = pageHeight = 0.0; +} + + +void MarkedContentOutputDev::beginMarkedContent(char *name, Dict *properties) +{ + int id = -1; + if (properties) + properties->lookupInt("MCID", NULL, &id); + + if (id == -1) + return; + + // The stack keep track of MCIDs of nested marked content. + if (inMarkedContent() || id == mcid) + mcidStack.push_back(id); +} + + +void MarkedContentOutputDev::endMarkedContent(GfxState *state) +{ + if (inMarkedContent()) { + mcidStack.pop_back(); + // The outer marked content sequence MCID was popped, ensure + // that the last piece of text collected ends up in a TextSpan. + if (!inMarkedContent()) + endSpan(); + } +} + + +bool MarkedContentOutputDev::needFontChange(GfxFont* font) const +{ + if (currentFont == font) + return gFalse; + + if (!currentFont) + return font != NULL && font->isOk(); + + if (font == NULL) + return gTrue; + + // Two non-null valid fonts are the same if they point to the same Ref + if (currentFont->getID()->num == font->getID()->num && + currentFont->getID()->gen == font->getID()->gen) + return gFalse; + + return gTrue; +} + + +void MarkedContentOutputDev::drawChar(GfxState *state, + double xx, double yy, + double dx, double dy, + double ox, double oy, + CharCode c, int nBytes, + Unicode *u, int uLen) +{ + if (!inMarkedContent() || !uLen) + return; + + + // Color changes are tracked here so the color can be chosen depending on + // the render mode (for mode 1 stroke color is used), so there is no need + // to implement both updateFillColor() and updateStrokeColor(). + GBool colorChange = gFalse; + GfxRGB color; + if ((state->getRender() & 3) == 1) + state->getStrokeRGB(&color); + else + state->getFillRGB(&color); + + colorChange = (color.r != currentColor.r || + color.g != currentColor.g || + color.b != currentColor.b); + + // Check also for font changes. + GBool fontChange = needFontChange(state->getFont()); + + // Save a span with the current changes. + if (colorChange || fontChange) { + endSpan(); + } + + // Perform the color/font changes. + if (colorChange) + currentColor = color; + + if (fontChange) { + if (currentFont != NULL) { + currentFont->decRefCnt(); + currentFont = NULL; + } + if (state->getFont() != NULL) { + currentFont = state->getFont(); + currentFont->incRefCnt(); + } + } + + + double sp, dx2, dy2, w1, h1, x1, y1; + + // Subtract char and word spacing from the (dx,dy) values + sp = state->getCharSpace(); + if (c == (CharCode) 0x20) + sp += state->getWordSpace(); + state->textTransformDelta(sp * state->getHorizScaling(), 0, &dx2, &dy2); + dx -= dx2; + dy -= dy2; + state->transformDelta(dx, dy, &w1, &h1); + state->transform(xx, yy, &x1, &y1); + + // Throw away characters that are not inside the page boundaries. + if (x1 + w1 < 0 || x1 > pageWidth || y1 + h1 < 0 || y1 > pageHeight) + return; + + // Make a sanity check on character size. Note: (x != x) <-> isnan(x) + if (x1 != x1 || y1 != y1 || w1 != w1 || h1 != h1) + return; + + for (int i = 0; i < uLen; i++) { + // Soft hyphen markers are skipped, as they are invisible unless + // rendering is done to an actual device and the hyphenation hint + // used. MarkedContentOutputDev extracts the *visible* text content. + if (u[i] != 0x00AD) { + // Add the UTF-8 sequence to the current text span. + if (!unicodeMap) + unicodeMap = globalParams->getTextEncoding(); + + char buf[8]; + int n = unicodeMap->mapUnicode(u[i], buf, sizeof(buf)); + if (n > 0) { + if (currentText == NULL) + currentText = new GooString(); + currentText->append(buf, n); + } + } + } +} + + +const TextSpanArray& MarkedContentOutputDev::getTextSpans() const +{ + return textSpans; +} diff --git a/Build/source/libs/poppler/poppler-0.25.0/poppler/MarkedContentOutputDev.h b/Build/source/libs/poppler/poppler-0.25.0/poppler/MarkedContentOutputDev.h new file mode 100644 index 00000000000..4ea60c255a1 --- /dev/null +++ b/Build/source/libs/poppler/poppler-0.25.0/poppler/MarkedContentOutputDev.h @@ -0,0 +1,130 @@ +//======================================================================== +// +// MarkedContentOutputDev.h +// +// This file is licensed under the GPLv2 or later +// +// Copyright 2013 Igalia S.L. +// +//======================================================================== + +#ifndef MARKEDCONTENTOUTPUTDEV_H +#define MARKEDCONTENTOUTPUTDEV_H + +#include "goo/gtypes.h" +#include "goo/gmem.h" +#include "OutputDev.h" +#include "GfxState.h" +#include "GfxFont.h" +#include <vector> + +class Dict; +class UnicodeMap; + + +class TextSpan { +public: + TextSpan(const TextSpan& other): data(other.data) { + data->refcount++; + } + + TextSpan& operator=(const TextSpan& other) { + if (this != &other) { + data = other.data; + data->refcount++; + } + return *this; + } + + ~TextSpan() { + if (data && --data->refcount == 0) + delete data; + } + + GfxFont* getFont() const { return data->font; } + GooString* getText() const { return data->text; } + GfxRGB& getColor() const { return data->color; } + +private: + // Note: Takes ownership of strings, increases refcount for font. + TextSpan(GooString *text, + GfxFont *font, + const GfxRGB& color) + : data(new Data) { + data->text = text; + data->font = font; + data->color = color; + if (data->font) + data->font->incRefCnt(); + } + + struct Data { + GfxFont *font; + GooString *text; + GfxRGB color; + unsigned refcount; + + Data(): refcount(1) {} + + ~Data() { + assert(refcount == 0); + if (font) + font->decRefCnt(); + delete text; + } + }; + + Data *data; + + friend class MarkedContentOutputDev; +}; + + +typedef std::vector<TextSpan> TextSpanArray; + + +class MarkedContentOutputDev: public OutputDev { +public: + MarkedContentOutputDev(int mcidA); + virtual ~MarkedContentOutputDev(); + + virtual GBool isOk() { return gTrue; } + virtual GBool upsideDown() { return gTrue; } + virtual GBool useDrawChar() { return gTrue; } + virtual GBool interpretType3Chars() { return gFalse; } + virtual GBool needNonText() { return gFalse; } + virtual GBool needCharCount() { return gFalse; } + + virtual void startPage(int pageNum, GfxState *state, XRef *xref); + virtual void endPage(); + + virtual void drawChar(GfxState *state, + double xx, double yy, + double dx, double dy, + double ox, double oy, + CharCode c, int nBytes, + Unicode *u, int uLen); + + virtual void beginMarkedContent(char *name, Dict *properties); + virtual void endMarkedContent(GfxState *state); + + const TextSpanArray& getTextSpans() const; + +private: + + void endSpan(); + bool inMarkedContent() const { return mcidStack.size() > 0; } + bool needFontChange(GfxFont* font) const; + + GfxFont *currentFont; + GooString *currentText; + GfxRGB currentColor; + TextSpanArray textSpans; + int mcid; + std::vector<int> mcidStack; + double pageWidth; + double pageHeight; + UnicodeMap *unicodeMap; +}; + +#endif /* !MARKEDCONTENTOUTPUTDEV_H */ diff --git a/Build/source/libs/poppler/poppler-0.24.4/poppler/Movie.cc b/Build/source/libs/poppler/poppler-0.25.0/poppler/Movie.cc index f68b6adcd4d..f68b6adcd4d 100644 --- a/Build/source/libs/poppler/poppler-0.24.4/poppler/Movie.cc +++ b/Build/source/libs/poppler/poppler-0.25.0/poppler/Movie.cc diff --git a/Build/source/libs/poppler/poppler-0.24.4/poppler/Movie.h b/Build/source/libs/poppler/poppler-0.25.0/poppler/Movie.h index 1a162659179..1a162659179 100644 --- a/Build/source/libs/poppler/poppler-0.24.4/poppler/Movie.h +++ b/Build/source/libs/poppler/poppler-0.25.0/poppler/Movie.h diff --git a/Build/source/libs/poppler/poppler-0.24.4/poppler/NameToCharCode.cc b/Build/source/libs/poppler/poppler-0.25.0/poppler/NameToCharCode.cc index 5448dc4ce10..5448dc4ce10 100644 --- a/Build/source/libs/poppler/poppler-0.24.4/poppler/NameToCharCode.cc +++ b/Build/source/libs/poppler/poppler-0.25.0/poppler/NameToCharCode.cc diff --git a/Build/source/libs/poppler/poppler-0.24.4/poppler/NameToCharCode.h b/Build/source/libs/poppler/poppler-0.25.0/poppler/NameToCharCode.h index 5b1092bb96b..5b1092bb96b 100644 --- a/Build/source/libs/poppler/poppler-0.24.4/poppler/NameToCharCode.h +++ b/Build/source/libs/poppler/poppler-0.25.0/poppler/NameToCharCode.h diff --git a/Build/source/libs/poppler/poppler-0.24.4/poppler/NameToUnicodeTable.h b/Build/source/libs/poppler/poppler-0.25.0/poppler/NameToUnicodeTable.h index 74645ab2878..827edbaee60 100644 --- a/Build/source/libs/poppler/poppler-0.24.4/poppler/NameToUnicodeTable.h +++ b/Build/source/libs/poppler/poppler-0.25.0/poppler/NameToUnicodeTable.h @@ -14,6 +14,7 @@ // under GPL version 2 or later // // Copyright (C) 2011, 2012 Albert Astals Cid <aacid@kde.org> +// Copyright (C) 2013 Jason Crain <jason@aquaticape.us> // // To see a description of the changes please see the Changelog file that // came with your tarball or type make ChangeLog if you are building from git @@ -24,10 +25,13 @@ #include <stddef.h> -static struct { +struct NameToUnicodeTab { Unicode u; const char *name; -} nameToUnicodeTab[] = { +}; + +// map character names to Unicode +static struct NameToUnicodeTab nameToUnicodeTextTab[] = { {0x0021, "!"}, {0x0023, "#"}, {0x0024, "$"}, @@ -800,207 +804,6 @@ static struct { {0x005f, "_"}, {0x0060, "`"}, {0x0061, "a"}, - {0x275e, "a100"}, - {0x2761, "a101"}, - {0x2762, "a102"}, - {0x2763, "a103"}, - {0x2764, "a104"}, - {0x2710, "a105"}, - {0x2765, "a106"}, - {0x2766, "a107"}, - {0x2767, "a108"}, - {0x2660, "a109"}, - {0x2721, "a10"}, - {0x2665, "a110"}, - {0x2666, "a111"}, - {0x2663, "a112"}, - {0x2709, "a117"}, - {0x2708, "a118"}, - {0x2707, "a119"}, - {0x261b, "a11"}, - {0x2460, "a120"}, - {0x2461, "a121"}, - {0x2462, "a122"}, - {0x2463, "a123"}, - {0x2464, "a124"}, - {0x2465, "a125"}, - {0x2466, "a126"}, - {0x2467, "a127"}, - {0x2468, "a128"}, - {0x2469, "a129"}, - {0x261e, "a12"}, - {0x2776, "a130"}, - {0x2777, "a131"}, - {0x2778, "a132"}, - {0x2779, "a133"}, - {0x277a, "a134"}, - {0x277b, "a135"}, - {0x277c, "a136"}, - {0x277d, "a137"}, - {0x277e, "a138"}, - {0x277f, "a139"}, - {0x270c, "a13"}, - {0x2780, "a140"}, - {0x2781, "a141"}, - {0x2782, "a142"}, - {0x2783, "a143"}, - {0x2784, "a144"}, - {0x2785, "a145"}, - {0x2786, "a146"}, - {0x2787, "a147"}, - {0x2788, "a148"}, - {0x2789, "a149"}, - {0x270d, "a14"}, - {0x278a, "a150"}, - {0x278b, "a151"}, - {0x278c, "a152"}, - {0x278d, "a153"}, - {0x278e, "a154"}, - {0x278f, "a155"}, - {0x2790, "a156"}, - {0x2791, "a157"}, - {0x2792, "a158"}, - {0x2793, "a159"}, - {0x270e, "a15"}, - {0x2794, "a160"}, - {0x2192, "a161"}, - {0x27a3, "a162"}, - {0x2194, "a163"}, - {0x2195, "a164"}, - {0x2799, "a165"}, - {0x279b, "a166"}, - {0x279c, "a167"}, - {0x279d, "a168"}, - {0x279e, "a169"}, - {0x270f, "a16"}, - {0x279f, "a170"}, - {0x27a0, "a171"}, - {0x27a1, "a172"}, - {0x27a2, "a173"}, - {0x27a4, "a174"}, - {0x27a5, "a175"}, - {0x27a6, "a176"}, - {0x27a7, "a177"}, - {0x27a8, "a178"}, - {0x27a9, "a179"}, - {0x2711, "a17"}, - {0x27ab, "a180"}, - {0x27ad, "a181"}, - {0x27af, "a182"}, - {0x27b2, "a183"}, - {0x27b3, "a184"}, - {0x27b5, "a185"}, - {0x27b8, "a186"}, - {0x27ba, "a187"}, - {0x27bb, "a188"}, - {0x27bc, "a189"}, - {0x2712, "a18"}, - {0x27bd, "a190"}, - {0x27be, "a191"}, - {0x279a, "a192"}, - {0x27aa, "a193"}, - {0x27b6, "a194"}, - {0x27b9, "a195"}, - {0x2798, "a196"}, - {0x27b4, "a197"}, - {0x27b7, "a198"}, - {0x27ac, "a199"}, - {0x2713, "a19"}, - {0x2701, "a1"}, - {0x27ae, "a200"}, - {0x27b1, "a201"}, - {0x2703, "a202"}, - {0x2750, "a203"}, - {0x2752, "a204"}, - {0x276e, "a205"}, - {0x2770, "a206"}, - {0x2714, "a20"}, - {0x2715, "a21"}, - {0x2716, "a22"}, - {0x2717, "a23"}, - {0x2718, "a24"}, - {0x2719, "a25"}, - {0x271a, "a26"}, - {0x271b, "a27"}, - {0x271c, "a28"}, - {0x2722, "a29"}, - {0x2702, "a2"}, - {0x2723, "a30"}, - {0x2724, "a31"}, - {0x2725, "a32"}, - {0x2726, "a33"}, - {0x2727, "a34"}, - {0x2605, "a35"}, - {0x2729, "a36"}, - {0x272a, "a37"}, - {0x272b, "a38"}, - {0x272c, "a39"}, - {0x2704, "a3"}, - {0x272d, "a40"}, - {0x272e, "a41"}, - {0x272f, "a42"}, - {0x2730, "a43"}, - {0x2731, "a44"}, - {0x2732, "a45"}, - {0x2733, "a46"}, - {0x2734, "a47"}, - {0x2735, "a48"}, - {0x2736, "a49"}, - {0x260e, "a4"}, - {0x2737, "a50"}, - {0x2738, "a51"}, - {0x2739, "a52"}, - {0x273a, "a53"}, - {0x273b, "a54"}, - {0x273c, "a55"}, - {0x273d, "a56"}, - {0x273e, "a57"}, - {0x273f, "a58"}, - {0x2740, "a59"}, - {0x2706, "a5"}, - {0x2741, "a60"}, - {0x2742, "a61"}, - {0x2743, "a62"}, - {0x2744, "a63"}, - {0x2745, "a64"}, - {0x2746, "a65"}, - {0x2747, "a66"}, - {0x2748, "a67"}, - {0x2749, "a68"}, - {0x274a, "a69"}, - {0x271d, "a6"}, - {0x274b, "a70"}, - {0x25cf, "a71"}, - {0x274d, "a72"}, - {0x25a0, "a73"}, - {0x274f, "a74"}, - {0x2751, "a75"}, - {0x25b2, "a76"}, - {0x25bc, "a77"}, - {0x25c6, "a78"}, - {0x2756, "a79"}, - {0x271e, "a7"}, - {0x25d7, "a81"}, - {0x2758, "a82"}, - {0x2759, "a83"}, - {0x275a, "a84"}, - {0x276f, "a85"}, - {0x2771, "a86"}, - {0x2772, "a87"}, - {0x2773, "a88"}, - {0x2768, "a89"}, - {0x271f, "a8"}, - {0x2769, "a90"}, - {0x276c, "a91"}, - {0x276d, "a92"}, - {0x276a, "a93"}, - {0x276b, "a94"}, - {0x2774, "a95"}, - {0x2775, "a96"}, - {0x275b, "a97"}, - {0x275c, "a98"}, - {0x275d, "a99"}, - {0x2720, "a9"}, {0x0986, "aabengali"}, {0x00e1, "aacute"}, {0x0906, "aadeva"}, @@ -4473,3 +4276,209 @@ static struct { {0x007e, "~"}, { 0, NULL } }; + +// map ZapfDingbats names to Unicode +static struct NameToUnicodeTab nameToUnicodeZapfDingbatsTab[] = { + {0x275e, "a100"}, + {0x2761, "a101"}, + {0x2762, "a102"}, + {0x2763, "a103"}, + {0x2764, "a104"}, + {0x2710, "a105"}, + {0x2765, "a106"}, + {0x2766, "a107"}, + {0x2767, "a108"}, + {0x2660, "a109"}, + {0x2721, "a10"}, + {0x2665, "a110"}, + {0x2666, "a111"}, + {0x2663, "a112"}, + {0x2709, "a117"}, + {0x2708, "a118"}, + {0x2707, "a119"}, + {0x261b, "a11"}, + {0x2460, "a120"}, + {0x2461, "a121"}, + {0x2462, "a122"}, + {0x2463, "a123"}, + {0x2464, "a124"}, + {0x2465, "a125"}, + {0x2466, "a126"}, + {0x2467, "a127"}, + {0x2468, "a128"}, + {0x2469, "a129"}, + {0x261e, "a12"}, + {0x2776, "a130"}, + {0x2777, "a131"}, + {0x2778, "a132"}, + {0x2779, "a133"}, + {0x277a, "a134"}, + {0x277b, "a135"}, + {0x277c, "a136"}, + {0x277d, "a137"}, + {0x277e, "a138"}, + {0x277f, "a139"}, + {0x270c, "a13"}, + {0x2780, "a140"}, + {0x2781, "a141"}, + {0x2782, "a142"}, + {0x2783, "a143"}, + {0x2784, "a144"}, + {0x2785, "a145"}, + {0x2786, "a146"}, + {0x2787, "a147"}, + {0x2788, "a148"}, + {0x2789, "a149"}, + {0x270d, "a14"}, + {0x278a, "a150"}, + {0x278b, "a151"}, + {0x278c, "a152"}, + {0x278d, "a153"}, + {0x278e, "a154"}, + {0x278f, "a155"}, + {0x2790, "a156"}, + {0x2791, "a157"}, + {0x2792, "a158"}, + {0x2793, "a159"}, + {0x270e, "a15"}, + {0x2794, "a160"}, + {0x2192, "a161"}, + {0x27a3, "a162"}, + {0x2194, "a163"}, + {0x2195, "a164"}, + {0x2799, "a165"}, + {0x279b, "a166"}, + {0x279c, "a167"}, + {0x279d, "a168"}, + {0x279e, "a169"}, + {0x270f, "a16"}, + {0x279f, "a170"}, + {0x27a0, "a171"}, + {0x27a1, "a172"}, + {0x27a2, "a173"}, + {0x27a4, "a174"}, + {0x27a5, "a175"}, + {0x27a6, "a176"}, + {0x27a7, "a177"}, + {0x27a8, "a178"}, + {0x27a9, "a179"}, + {0x2711, "a17"}, + {0x27ab, "a180"}, + {0x27ad, "a181"}, + {0x27af, "a182"}, + {0x27b2, "a183"}, + {0x27b3, "a184"}, + {0x27b5, "a185"}, + {0x27b8, "a186"}, + {0x27ba, "a187"}, + {0x27bb, "a188"}, + {0x27bc, "a189"}, + {0x2712, "a18"}, + {0x27bd, "a190"}, + {0x27be, "a191"}, + {0x279a, "a192"}, + {0x27aa, "a193"}, + {0x27b6, "a194"}, + {0x27b9, "a195"}, + {0x2798, "a196"}, + {0x27b4, "a197"}, + {0x27b7, "a198"}, + {0x27ac, "a199"}, + {0x2713, "a19"}, + {0x2701, "a1"}, + {0x27ae, "a200"}, + {0x27b1, "a201"}, + {0x2703, "a202"}, + {0x2750, "a203"}, + {0x2752, "a204"}, + {0x276e, "a205"}, + {0x2770, "a206"}, + {0x2714, "a20"}, + {0x2715, "a21"}, + {0x2716, "a22"}, + {0x2717, "a23"}, + {0x2718, "a24"}, + {0x2719, "a25"}, + {0x271a, "a26"}, + {0x271b, "a27"}, + {0x271c, "a28"}, + {0x2722, "a29"}, + {0x2702, "a2"}, + {0x2723, "a30"}, + {0x2724, "a31"}, + {0x2725, "a32"}, + {0x2726, "a33"}, + {0x2727, "a34"}, + {0x2605, "a35"}, + {0x2729, "a36"}, + {0x272a, "a37"}, + {0x272b, "a38"}, + {0x272c, "a39"}, + {0x2704, "a3"}, + {0x272d, "a40"}, + {0x272e, "a41"}, + {0x272f, "a42"}, + {0x2730, "a43"}, + {0x2731, "a44"}, + {0x2732, "a45"}, + {0x2733, "a46"}, + {0x2734, "a47"}, + {0x2735, "a48"}, + {0x2736, "a49"}, + {0x260e, "a4"}, + {0x2737, "a50"}, + {0x2738, "a51"}, + {0x2739, "a52"}, + {0x273a, "a53"}, + {0x273b, "a54"}, + {0x273c, "a55"}, + {0x273d, "a56"}, + {0x273e, "a57"}, + {0x273f, "a58"}, + {0x2740, "a59"}, + {0x2706, "a5"}, + {0x2741, "a60"}, + {0x2742, "a61"}, + {0x2743, "a62"}, + {0x2744, "a63"}, + {0x2745, "a64"}, + {0x2746, "a65"}, + {0x2747, "a66"}, + {0x2748, "a67"}, + {0x2749, "a68"}, + {0x274a, "a69"}, + {0x271d, "a6"}, + {0x274b, "a70"}, + {0x25cf, "a71"}, + {0x274d, "a72"}, + {0x25a0, "a73"}, + {0x274f, "a74"}, + {0x2751, "a75"}, + {0x25b2, "a76"}, + {0x25bc, "a77"}, + {0x25c6, "a78"}, + {0x2756, "a79"}, + {0x271e, "a7"}, + {0x25d7, "a81"}, + {0x2758, "a82"}, + {0x2759, "a83"}, + {0x275a, "a84"}, + {0x276f, "a85"}, + {0x2771, "a86"}, + {0x2772, "a87"}, + {0x2773, "a88"}, + {0x2768, "a89"}, + {0x271f, "a8"}, + {0x2769, "a90"}, + {0x276c, "a91"}, + {0x276d, "a92"}, + {0x276a, "a93"}, + {0x276b, "a94"}, + {0x2774, "a95"}, + {0x2775, "a96"}, + {0x275b, "a97"}, + {0x275c, "a98"}, + {0x275d, "a99"}, + {0x2720, "a9"}, + { 0, NULL } +}; diff --git a/Build/source/libs/poppler/poppler-0.24.4/poppler/Object.cc b/Build/source/libs/poppler/poppler-0.25.0/poppler/Object.cc index d06bb39fb6d..d06bb39fb6d 100644 --- a/Build/source/libs/poppler/poppler-0.24.4/poppler/Object.cc +++ b/Build/source/libs/poppler/poppler-0.25.0/poppler/Object.cc diff --git a/Build/source/libs/poppler/poppler-0.24.4/poppler/Object.h b/Build/source/libs/poppler/poppler-0.25.0/poppler/Object.h index 1b123549a72..a2996248b94 100644 --- a/Build/source/libs/poppler/poppler-0.24.4/poppler/Object.h +++ b/Build/source/libs/poppler/poppler-0.25.0/poppler/Object.h @@ -20,6 +20,7 @@ // Copyright (C) 2012 Fabio D'Urso <fabiodurso@hotmail.it> // Copyright (C) 2013 Thomas Freitag <Thomas.Freitag@alfa.de> // Copyright (C) 2013 Adrian Johnson <ajohnson@redneon.com> +// Copyright (C) 2013 Adrian Perez de Castro <aperez@igalia.com> // // To see a description of the changes please see the Changelog file that // came with your tarball or type make ChangeLog if you are building from git @@ -199,6 +200,10 @@ public: double getNum() { OBJECT_3TYPES_CHECK(objInt, objInt64, objReal); return type == objInt ? (double)intg : type == objInt64 ? (double)int64g : real; } GooString *getString() { OBJECT_TYPE_CHECK(objString); return string; } + // After takeString() the only method that should be called for the object is free() + // because the object it's not expected to have a NULL string. + GooString *takeString() { + OBJECT_TYPE_CHECK(objString); GooString *s = string; string = NULL; return s; } char *getName() { OBJECT_TYPE_CHECK(objName); return name; } Array *getArray() { OBJECT_TYPE_CHECK(objArray); return array; } Dict *getDict() { OBJECT_TYPE_CHECK(objDict); return dict; } diff --git a/Build/source/libs/poppler/poppler-0.24.4/poppler/OptionalContent.cc b/Build/source/libs/poppler/poppler-0.25.0/poppler/OptionalContent.cc index e0d49bc9a5f..e0d49bc9a5f 100644 --- a/Build/source/libs/poppler/poppler-0.24.4/poppler/OptionalContent.cc +++ b/Build/source/libs/poppler/poppler-0.25.0/poppler/OptionalContent.cc diff --git a/Build/source/libs/poppler/poppler-0.24.4/poppler/OptionalContent.h b/Build/source/libs/poppler/poppler-0.25.0/poppler/OptionalContent.h index 02c9a471e33..2e416462003 100644 --- a/Build/source/libs/poppler/poppler-0.24.4/poppler/OptionalContent.h +++ b/Build/source/libs/poppler/poppler-0.25.0/poppler/OptionalContent.h @@ -4,6 +4,7 @@ // // Copyright 2007 Brad Hards <bradh@kde.org> // Copyright 2008 Carlos Garcia Campos <carlosgc@gnome.org> +// Copyright 2013 Albert Astals Cid <aacid@kde.org> // // Released under the GPL (version 2, or later, at your option) // @@ -101,7 +102,6 @@ public: UsageState getPrintState() { return printState; } private: - XRef *xref; GooString *m_name; Ref m_ref; State m_state; diff --git a/Build/source/libs/poppler/poppler-0.24.4/poppler/Outline.cc b/Build/source/libs/poppler/poppler-0.25.0/poppler/Outline.cc index bd4e6d01b6d..bd4e6d01b6d 100644 --- a/Build/source/libs/poppler/poppler-0.24.4/poppler/Outline.cc +++ b/Build/source/libs/poppler/poppler-0.25.0/poppler/Outline.cc diff --git a/Build/source/libs/poppler/poppler-0.24.4/poppler/Outline.h b/Build/source/libs/poppler/poppler-0.25.0/poppler/Outline.h index 90190e69280..90190e69280 100644 --- a/Build/source/libs/poppler/poppler-0.24.4/poppler/Outline.h +++ b/Build/source/libs/poppler/poppler-0.25.0/poppler/Outline.h diff --git a/Build/source/libs/poppler/poppler-0.24.4/poppler/OutputDev.cc b/Build/source/libs/poppler/poppler-0.25.0/poppler/OutputDev.cc index ee3cf5a30ff..ee3cf5a30ff 100644 --- a/Build/source/libs/poppler/poppler-0.24.4/poppler/OutputDev.cc +++ b/Build/source/libs/poppler/poppler-0.25.0/poppler/OutputDev.cc diff --git a/Build/source/libs/poppler/poppler-0.24.4/poppler/OutputDev.h b/Build/source/libs/poppler/poppler-0.25.0/poppler/OutputDev.h index e8a7a4794ce..e8a7a4794ce 100644 --- a/Build/source/libs/poppler/poppler-0.24.4/poppler/OutputDev.h +++ b/Build/source/libs/poppler/poppler-0.25.0/poppler/OutputDev.h diff --git a/Build/source/libs/poppler/poppler-0.24.4/poppler/PDFDoc.cc b/Build/source/libs/poppler/poppler-0.25.0/poppler/PDFDoc.cc index c78d5ca5323..c78d5ca5323 100644 --- a/Build/source/libs/poppler/poppler-0.24.4/poppler/PDFDoc.cc +++ b/Build/source/libs/poppler/poppler-0.25.0/poppler/PDFDoc.cc diff --git a/Build/source/libs/poppler/poppler-0.24.4/poppler/PDFDoc.h b/Build/source/libs/poppler/poppler-0.25.0/poppler/PDFDoc.h index da9bf5b3c8a..42c7cba772b 100644 --- a/Build/source/libs/poppler/poppler-0.24.4/poppler/PDFDoc.h +++ b/Build/source/libs/poppler/poppler-0.25.0/poppler/PDFDoc.h @@ -26,6 +26,7 @@ // Copyright (C) 2012 Fabio D'Urso <fabiodurso@hotmail.it> // Copyright (C) 2013 Adrian Johnson <ajohnson@redneon.com> // Copyright (C) 2013 Adam Reichold <adamreichold@myopera.com> +// Copyright (C) 2013 Adrian Perez de Castro <aperez@igalia.com> // // To see a description of the changes please see the Changelog file that // came with your tarball or type make ChangeLog if you are building from git @@ -60,6 +61,7 @@ class Outline; class Linearization; class SecurityHandler; class Hints; +class StructTreeRoot; enum PDFWriteMode { writeStandard, @@ -139,7 +141,7 @@ public: GooString *readMetadata() { return catalog->readMetadata(); } // Return the structure tree root object. - Object *getStructTreeRoot() { return catalog->getStructTreeRoot(); } + StructTreeRoot *getStructTreeRoot() { return catalog->getStructTreeRoot(); } // Get page. Page *getPage(int page); diff --git a/Build/source/libs/poppler/poppler-0.24.4/poppler/PDFDocBuilder.h b/Build/source/libs/poppler/poppler-0.25.0/poppler/PDFDocBuilder.h index d6eccf5487a..d6eccf5487a 100644 --- a/Build/source/libs/poppler/poppler-0.24.4/poppler/PDFDocBuilder.h +++ b/Build/source/libs/poppler/poppler-0.25.0/poppler/PDFDocBuilder.h diff --git a/Build/source/libs/poppler/poppler-0.24.4/poppler/PDFDocEncoding.cc b/Build/source/libs/poppler/poppler-0.25.0/poppler/PDFDocEncoding.cc index 79408346419..79408346419 100644 --- a/Build/source/libs/poppler/poppler-0.24.4/poppler/PDFDocEncoding.cc +++ b/Build/source/libs/poppler/poppler-0.25.0/poppler/PDFDocEncoding.cc diff --git a/Build/source/libs/poppler/poppler-0.24.4/poppler/PDFDocEncoding.h b/Build/source/libs/poppler/poppler-0.25.0/poppler/PDFDocEncoding.h index 4f0840bb28a..4f0840bb28a 100644 --- a/Build/source/libs/poppler/poppler-0.24.4/poppler/PDFDocEncoding.h +++ b/Build/source/libs/poppler/poppler-0.25.0/poppler/PDFDocEncoding.h diff --git a/Build/source/libs/poppler/poppler-0.24.4/poppler/PDFDocFactory.cc b/Build/source/libs/poppler/poppler-0.25.0/poppler/PDFDocFactory.cc index 1ec46477237..1ec46477237 100644 --- a/Build/source/libs/poppler/poppler-0.24.4/poppler/PDFDocFactory.cc +++ b/Build/source/libs/poppler/poppler-0.25.0/poppler/PDFDocFactory.cc diff --git a/Build/source/libs/poppler/poppler-0.24.4/poppler/PDFDocFactory.h b/Build/source/libs/poppler/poppler-0.25.0/poppler/PDFDocFactory.h index dbceaa567ee..dbceaa567ee 100644 --- a/Build/source/libs/poppler/poppler-0.24.4/poppler/PDFDocFactory.h +++ b/Build/source/libs/poppler/poppler-0.25.0/poppler/PDFDocFactory.h diff --git a/Build/source/libs/poppler/poppler-0.24.4/poppler/PSOutputDev.cc b/Build/source/libs/poppler/poppler-0.25.0/poppler/PSOutputDev.cc index 623251f65f8..623251f65f8 100644 --- a/Build/source/libs/poppler/poppler-0.24.4/poppler/PSOutputDev.cc +++ b/Build/source/libs/poppler/poppler-0.25.0/poppler/PSOutputDev.cc diff --git a/Build/source/libs/poppler/poppler-0.24.4/poppler/PSOutputDev.h b/Build/source/libs/poppler/poppler-0.25.0/poppler/PSOutputDev.h index 92b007eafaf..92b007eafaf 100644 --- a/Build/source/libs/poppler/poppler-0.24.4/poppler/PSOutputDev.h +++ b/Build/source/libs/poppler/poppler-0.25.0/poppler/PSOutputDev.h diff --git a/Build/source/libs/poppler/poppler-0.24.4/poppler/PSTokenizer.cc b/Build/source/libs/poppler/poppler-0.25.0/poppler/PSTokenizer.cc index 05127f0d03c..05127f0d03c 100644 --- a/Build/source/libs/poppler/poppler-0.24.4/poppler/PSTokenizer.cc +++ b/Build/source/libs/poppler/poppler-0.25.0/poppler/PSTokenizer.cc diff --git a/Build/source/libs/poppler/poppler-0.24.4/poppler/PSTokenizer.h b/Build/source/libs/poppler/poppler-0.25.0/poppler/PSTokenizer.h index fc2f053d3f2..fc2f053d3f2 100644 --- a/Build/source/libs/poppler/poppler-0.24.4/poppler/PSTokenizer.h +++ b/Build/source/libs/poppler/poppler-0.25.0/poppler/PSTokenizer.h diff --git a/Build/source/libs/poppler/poppler-0.24.4/poppler/Page.cc b/Build/source/libs/poppler/poppler-0.25.0/poppler/Page.cc index e0a3b298afc..ecdff32f693 100644 --- a/Build/source/libs/poppler/poppler-0.24.4/poppler/Page.cc +++ b/Build/source/libs/poppler/poppler-0.25.0/poppler/Page.cc @@ -27,6 +27,7 @@ // Copyright (C) 2012, 2013 Fabio D'Urso <fabiodurso@hotmail.it> // Copyright (C) 2013 Thomas Freitag <Thomas.Freitag@alfa.de> // Copyright (C) 2013 Jason Crain <jason@aquaticape.us> +// Copyright (C) 2013 Adrian Johnson <ajohnson@redneon.com> // // To see a description of the changes please see the Changelog file that // came with your tarball or type make ChangeLog if you are building from git @@ -671,7 +672,7 @@ GBool Page::loadThumb(unsigned char **data_out, obj1.free (); dict->lookup ("CS", &obj1); } - colorSpace = GfxColorSpace::parse(&obj1, NULL); + colorSpace = GfxColorSpace::parse(&obj1, NULL, NULL); obj1.free(); if (!colorSpace) { fprintf (stderr, "Error: Cannot parse color space\n"); @@ -823,3 +824,23 @@ void Page::getDefaultCTM(double *ctm, double hDPI, double vDPI, } delete state; } + +LinkAction* Page::getAdditionalAction(PageAdditionalActionsType type) { + Object additionalActionsObject; + LinkAction *linkAction = NULL; + + if (actions.fetch(doc->getXRef(), &additionalActionsObject)->isDict()) { + const char *key = (type == actionOpenPage ? "O" : + type == actionClosePage ? "C" : NULL); + + Object actionObject; + + if (additionalActionsObject.dictLookup(key, &actionObject)->isDict()) + linkAction = LinkAction::parseAction(&actionObject, doc->getCatalog()->getBaseURI()); + actionObject.free(); + } + + additionalActionsObject.free(); + + return linkAction; +} diff --git a/Build/source/libs/poppler/poppler-0.24.4/poppler/Page.h b/Build/source/libs/poppler/poppler-0.25.0/poppler/Page.h index 1c9d0a9cbc7..2aaabae9b16 100644 --- a/Build/source/libs/poppler/poppler-0.24.4/poppler/Page.h +++ b/Build/source/libs/poppler/poppler-0.25.0/poppler/Page.h @@ -22,6 +22,7 @@ // Copyright (C) 2012 Fabio D'Urso <fabiodurso@hotmail.it> // Copyright (C) 2012 Albert Astals Cid <aacid@kde.org> // Copyright (C) 2013 Thomas Freitag <Thomas.Freitag@alfa.de> +// Copyright (C) 2013 Adrian Johnson <ajohnson@redneon.com> // // To see a description of the changes please see the Changelog file that // came with your tarball or type make ChangeLog if you are building from git @@ -44,6 +45,7 @@ class PDFDoc; class XRef; class OutputDev; class Links; +class LinkAction; class Annots; class Annot; class Gfx; @@ -211,6 +213,13 @@ public: // Get actions Object *getActions(Object *obj) { return actions.fetch(xref, obj); } + enum PageAdditionalActionsType { + actionOpenPage, ///< Performed when opening the page + actionClosePage, ///< Performed when closing the page + }; + + LinkAction *getAdditionalAction(PageAdditionalActionsType type); + Gfx *createGfx(OutputDev *out, double hDPI, double vDPI, int rotate, GBool useMediaBox, GBool crop, int sliceX, int sliceY, int sliceW, int sliceH, @@ -267,7 +276,7 @@ private: Object contents; // page contents Object thumb; // page thumbnail Object trans; // page transition - Object actions; // page addiction actions + Object actions; // page additional actions double duration; // page duration GBool ok; // true if page is valid #if MULTITHREADED diff --git a/Build/source/libs/poppler/poppler-0.24.4/poppler/PageLabelInfo.cc b/Build/source/libs/poppler/poppler-0.25.0/poppler/PageLabelInfo.cc index 3153377f6d3..3153377f6d3 100644 --- a/Build/source/libs/poppler/poppler-0.24.4/poppler/PageLabelInfo.cc +++ b/Build/source/libs/poppler/poppler-0.25.0/poppler/PageLabelInfo.cc diff --git a/Build/source/libs/poppler/poppler-0.24.4/poppler/PageLabelInfo.h b/Build/source/libs/poppler/poppler-0.25.0/poppler/PageLabelInfo.h index 960e710069d..960e710069d 100644 --- a/Build/source/libs/poppler/poppler-0.24.4/poppler/PageLabelInfo.h +++ b/Build/source/libs/poppler/poppler-0.25.0/poppler/PageLabelInfo.h diff --git a/Build/source/libs/poppler/poppler-0.24.4/poppler/PageLabelInfo_p.h b/Build/source/libs/poppler/poppler-0.25.0/poppler/PageLabelInfo_p.h index d3cd89f9bcd..d3cd89f9bcd 100644 --- a/Build/source/libs/poppler/poppler-0.24.4/poppler/PageLabelInfo_p.h +++ b/Build/source/libs/poppler/poppler-0.25.0/poppler/PageLabelInfo_p.h diff --git a/Build/source/libs/poppler/poppler-0.24.4/poppler/PageTransition.cc b/Build/source/libs/poppler/poppler-0.25.0/poppler/PageTransition.cc index 441634c039f..441634c039f 100644 --- a/Build/source/libs/poppler/poppler-0.24.4/poppler/PageTransition.cc +++ b/Build/source/libs/poppler/poppler-0.25.0/poppler/PageTransition.cc diff --git a/Build/source/libs/poppler/poppler-0.24.4/poppler/PageTransition.h b/Build/source/libs/poppler/poppler-0.25.0/poppler/PageTransition.h index e892c6c5051..e892c6c5051 100644 --- a/Build/source/libs/poppler/poppler-0.24.4/poppler/PageTransition.h +++ b/Build/source/libs/poppler/poppler-0.25.0/poppler/PageTransition.h diff --git a/Build/source/libs/poppler/poppler-0.24.4/poppler/Parser.cc b/Build/source/libs/poppler/poppler-0.25.0/poppler/Parser.cc index a0219945bd9..a0219945bd9 100644 --- a/Build/source/libs/poppler/poppler-0.24.4/poppler/Parser.cc +++ b/Build/source/libs/poppler/poppler-0.25.0/poppler/Parser.cc diff --git a/Build/source/libs/poppler/poppler-0.24.4/poppler/Parser.h b/Build/source/libs/poppler/poppler-0.25.0/poppler/Parser.h index 1ce9445e19d..1ce9445e19d 100644 --- a/Build/source/libs/poppler/poppler-0.24.4/poppler/Parser.h +++ b/Build/source/libs/poppler/poppler-0.25.0/poppler/Parser.h diff --git a/Build/source/libs/poppler/poppler-0.24.4/poppler/PopplerCache.cc b/Build/source/libs/poppler/poppler-0.25.0/poppler/PopplerCache.cc index 6018a77b70f..6018a77b70f 100644 --- a/Build/source/libs/poppler/poppler-0.24.4/poppler/PopplerCache.cc +++ b/Build/source/libs/poppler/poppler-0.25.0/poppler/PopplerCache.cc diff --git a/Build/source/libs/poppler/poppler-0.24.4/poppler/PopplerCache.h b/Build/source/libs/poppler/poppler-0.25.0/poppler/PopplerCache.h index 74010a2fa6b..74010a2fa6b 100644 --- a/Build/source/libs/poppler/poppler-0.24.4/poppler/PopplerCache.h +++ b/Build/source/libs/poppler/poppler-0.25.0/poppler/PopplerCache.h diff --git a/Build/source/libs/poppler/poppler-0.24.4/poppler/PreScanOutputDev.cc b/Build/source/libs/poppler/poppler-0.25.0/poppler/PreScanOutputDev.cc index 6a011266013..6a011266013 100644 --- a/Build/source/libs/poppler/poppler-0.24.4/poppler/PreScanOutputDev.cc +++ b/Build/source/libs/poppler/poppler-0.25.0/poppler/PreScanOutputDev.cc diff --git a/Build/source/libs/poppler/poppler-0.24.4/poppler/PreScanOutputDev.h b/Build/source/libs/poppler/poppler-0.25.0/poppler/PreScanOutputDev.h index 0fc9d3e3446..0fc9d3e3446 100644 --- a/Build/source/libs/poppler/poppler-0.24.4/poppler/PreScanOutputDev.h +++ b/Build/source/libs/poppler/poppler-0.25.0/poppler/PreScanOutputDev.h diff --git a/Build/source/libs/poppler/poppler-0.24.4/poppler/ProfileData.cc b/Build/source/libs/poppler/poppler-0.25.0/poppler/ProfileData.cc index a0c44747a56..a0c44747a56 100644 --- a/Build/source/libs/poppler/poppler-0.24.4/poppler/ProfileData.cc +++ b/Build/source/libs/poppler/poppler-0.25.0/poppler/ProfileData.cc diff --git a/Build/source/libs/poppler/poppler-0.24.4/poppler/ProfileData.h b/Build/source/libs/poppler/poppler-0.25.0/poppler/ProfileData.h index 418ee010755..418ee010755 100644 --- a/Build/source/libs/poppler/poppler-0.24.4/poppler/ProfileData.h +++ b/Build/source/libs/poppler/poppler-0.25.0/poppler/ProfileData.h diff --git a/Build/source/libs/poppler/poppler-0.24.4/poppler/Rendition.cc b/Build/source/libs/poppler/poppler-0.25.0/poppler/Rendition.cc index c040bf2b4a8..c040bf2b4a8 100644 --- a/Build/source/libs/poppler/poppler-0.24.4/poppler/Rendition.cc +++ b/Build/source/libs/poppler/poppler-0.25.0/poppler/Rendition.cc diff --git a/Build/source/libs/poppler/poppler-0.24.4/poppler/Rendition.h b/Build/source/libs/poppler/poppler-0.25.0/poppler/Rendition.h index 75bfeff32c9..75bfeff32c9 100644 --- a/Build/source/libs/poppler/poppler-0.24.4/poppler/Rendition.h +++ b/Build/source/libs/poppler/poppler-0.25.0/poppler/Rendition.h diff --git a/Build/source/libs/poppler/poppler-0.24.4/poppler/SecurityHandler.cc b/Build/source/libs/poppler/poppler-0.25.0/poppler/SecurityHandler.cc index 8b85e60db0a..8b85e60db0a 100644 --- a/Build/source/libs/poppler/poppler-0.24.4/poppler/SecurityHandler.cc +++ b/Build/source/libs/poppler/poppler-0.25.0/poppler/SecurityHandler.cc diff --git a/Build/source/libs/poppler/poppler-0.24.4/poppler/SecurityHandler.h b/Build/source/libs/poppler/poppler-0.25.0/poppler/SecurityHandler.h index c2991c8f375..c2991c8f375 100644 --- a/Build/source/libs/poppler/poppler-0.24.4/poppler/SecurityHandler.h +++ b/Build/source/libs/poppler/poppler-0.25.0/poppler/SecurityHandler.h diff --git a/Build/source/libs/poppler/poppler-0.24.4/poppler/Sound.cc b/Build/source/libs/poppler/poppler-0.25.0/poppler/Sound.cc index 6129fdcb47d..6129fdcb47d 100644 --- a/Build/source/libs/poppler/poppler-0.24.4/poppler/Sound.cc +++ b/Build/source/libs/poppler/poppler-0.25.0/poppler/Sound.cc diff --git a/Build/source/libs/poppler/poppler-0.24.4/poppler/Sound.h b/Build/source/libs/poppler/poppler-0.25.0/poppler/Sound.h index acb0f8d9acd..acb0f8d9acd 100644 --- a/Build/source/libs/poppler/poppler-0.24.4/poppler/Sound.h +++ b/Build/source/libs/poppler/poppler-0.25.0/poppler/Sound.h diff --git a/Build/source/libs/poppler/poppler-0.24.4/poppler/SplashOutputDev.cc b/Build/source/libs/poppler/poppler-0.25.0/poppler/SplashOutputDev.cc index 8c6950253b7..d0a945468a1 100644 --- a/Build/source/libs/poppler/poppler-0.24.4/poppler/SplashOutputDev.cc +++ b/Build/source/libs/poppler/poppler-0.25.0/poppler/SplashOutputDev.cc @@ -1195,6 +1195,7 @@ struct SplashTransparencyGroup { SplashBitmap *shape; GBool knockout; SplashCoord knockoutOpacity; + GBool fontAA; //----- saved state SplashBitmap *origBitmap; @@ -2888,19 +2889,27 @@ GBool SplashOutputDev::imageSrc(void *data, SplashColorPtr colorLine, break; #if SPLASH_CMYK case splashModeCMYK8: - for (x = 0, q = colorLine; x < imgData->width; ++x, p += nComps) { - imgData->colorMap->getCMYK(p, &cmyk); - *q++ = colToByte(cmyk.c); - *q++ = colToByte(cmyk.m); - *q++ = colToByte(cmyk.y); - *q++ = colToByte(cmyk.k); + if (imgData->colorMap->useCMYKLine()) { + imgData->colorMap->getCMYKLine(p, (Guchar *) colorLine, imgData->width); + } else { + for (x = 0, q = colorLine; x < imgData->width; ++x, p += nComps) { + imgData->colorMap->getCMYK(p, &cmyk); + *q++ = colToByte(cmyk.c); + *q++ = colToByte(cmyk.m); + *q++ = colToByte(cmyk.y); + *q++ = colToByte(cmyk.k); + } } break; case splashModeDeviceN8: - for (x = 0, q = colorLine; x < imgData->width; ++x, p += nComps) { - imgData->colorMap->getDeviceN(p, &deviceN); - for (int cp = 0; cp < SPOT_NCOMPS+4; cp++) - *q++ = colToByte(deviceN.c[cp]); + if (imgData->colorMap->useDeviceNLine()) { + imgData->colorMap->getDeviceNLine(p, (Guchar *) colorLine, imgData->width); + } else { + for (x = 0, q = colorLine; x < imgData->width; ++x, p += nComps) { + imgData->colorMap->getDeviceN(p, &deviceN); + for (int cp = 0; cp < SPOT_NCOMPS+4; cp++) + *q++ = colToByte(deviceN.c[cp]); + } } break; #endif @@ -3803,7 +3812,7 @@ void SplashOutputDev::beginTransparencyGroup(GfxState *state, double *bbox, transpGroup->blendingColorSpace = blendingColorSpace; transpGroup->isolated = isolated; transpGroup->shape = (knockout && !isolated) ? SplashBitmap::copy(bitmap) : NULL; - transpGroup->knockout = gFalse; + transpGroup->knockout = (knockout && isolated); transpGroup->knockoutOpacity = 1.0; transpGroup->next = transpGroupStack; transpGroupStack = transpGroup; @@ -3811,6 +3820,7 @@ void SplashOutputDev::beginTransparencyGroup(GfxState *state, double *bbox, // save state transpGroup->origBitmap = bitmap; transpGroup->origSplash = splash; + transpGroup->fontAA = fontEngine->getAA(); //~ this handles the blendingColorSpace arg for soft masks, but //~ not yet for transparency groups @@ -3842,6 +3852,9 @@ void SplashOutputDev::beginTransparencyGroup(GfxState *state, double *bbox, bitmapTopDown, bitmap->getSeparationList()); splash = new Splash(bitmap, vectorAntialias, transpGroup->origSplash->getScreen()); + if (transpGroup->next != NULL && transpGroup->next->knockout) { + fontEngine->setAA(gFalse); + } splash->setThinLineMode(transpGroup->origSplash->getThinLineMode()); splash->setMinLineWidth(globalParams->getMinLineWidth()); //~ Acrobat apparently copies at least the fill and stroke colors, and @@ -3860,8 +3873,12 @@ void SplashOutputDev::beginTransparencyGroup(GfxState *state, double *bbox, } else { SplashBitmap *shape = (knockout) ? transpGroup->shape : (transpGroup->next != NULL && transpGroup->next->shape != NULL) ? transpGroup->next->shape : transpGroup->origBitmap; + int shapeTx = (knockout) ? tx : + (transpGroup->next != NULL && transpGroup->next->shape != NULL) ? transpGroup->next->tx + tx : tx; + int shapeTy = (knockout) ? ty : + (transpGroup->next != NULL && transpGroup->next->shape != NULL) ? transpGroup->next->ty + ty : ty; splash->blitTransparent(transpGroup->origBitmap, tx, ty, 0, 0, w, h); - splash->setInNonIsolatedGroup(shape, tx, ty); + splash->setInNonIsolatedGroup(shape, shapeTx, shapeTy); } transpGroup->tBitmap = bitmap; state->shiftCTMAndClip(-tx, -ty); @@ -3898,8 +3915,9 @@ void SplashOutputDev::paintTransparencyGroup(GfxState *state, double *bbox) { : transpGroupStack->knockoutOpacity; splash->setOverprintMask(0xffffffff, gFalse); splash->composite(tBitmap, 0, 0, tx, ty, - tBitmap->getWidth(), tBitmap->getHeight(), - gFalse, !isolated, transpGroupStack->next != NULL && transpGroupStack->next->knockout, knockoutOpacity); + tBitmap->getWidth(), tBitmap->getHeight(), + gFalse, !isolated, transpGroupStack->next != NULL && transpGroupStack->next->knockout, knockoutOpacity); + fontEngine->setAA(transpGroupStack->fontAA); if (transpGroupStack->next != NULL && transpGroupStack->next->shape != NULL) { transpGroupStack->next->knockout = gTrue; } diff --git a/Build/source/libs/poppler/poppler-0.24.4/poppler/SplashOutputDev.h b/Build/source/libs/poppler/poppler-0.25.0/poppler/SplashOutputDev.h index ce1d50d0fdd..ce1d50d0fdd 100644 --- a/Build/source/libs/poppler/poppler-0.24.4/poppler/SplashOutputDev.h +++ b/Build/source/libs/poppler/poppler-0.25.0/poppler/SplashOutputDev.h diff --git a/Build/source/libs/poppler/poppler-0.24.4/poppler/StdinCachedFile.cc b/Build/source/libs/poppler/poppler-0.25.0/poppler/StdinCachedFile.cc index db966377bb0..db966377bb0 100644 --- a/Build/source/libs/poppler/poppler-0.24.4/poppler/StdinCachedFile.cc +++ b/Build/source/libs/poppler/poppler-0.25.0/poppler/StdinCachedFile.cc diff --git a/Build/source/libs/poppler/poppler-0.24.4/poppler/StdinCachedFile.h b/Build/source/libs/poppler/poppler-0.25.0/poppler/StdinCachedFile.h index 5be6fa841a3..5be6fa841a3 100644 --- a/Build/source/libs/poppler/poppler-0.24.4/poppler/StdinCachedFile.h +++ b/Build/source/libs/poppler/poppler-0.25.0/poppler/StdinCachedFile.h diff --git a/Build/source/libs/poppler/poppler-0.24.4/poppler/StdinPDFDocBuilder.cc b/Build/source/libs/poppler/poppler-0.25.0/poppler/StdinPDFDocBuilder.cc index 571ee46d7f6..571ee46d7f6 100644 --- a/Build/source/libs/poppler/poppler-0.24.4/poppler/StdinPDFDocBuilder.cc +++ b/Build/source/libs/poppler/poppler-0.25.0/poppler/StdinPDFDocBuilder.cc diff --git a/Build/source/libs/poppler/poppler-0.24.4/poppler/StdinPDFDocBuilder.h b/Build/source/libs/poppler/poppler-0.25.0/poppler/StdinPDFDocBuilder.h index e9b2f47f636..e9b2f47f636 100644 --- a/Build/source/libs/poppler/poppler-0.24.4/poppler/StdinPDFDocBuilder.h +++ b/Build/source/libs/poppler/poppler-0.25.0/poppler/StdinPDFDocBuilder.h diff --git a/Build/source/libs/poppler/poppler-0.24.4/poppler/Stream-CCITT.h b/Build/source/libs/poppler/poppler-0.25.0/poppler/Stream-CCITT.h index 7207729a4d1..7207729a4d1 100644 --- a/Build/source/libs/poppler/poppler-0.24.4/poppler/Stream-CCITT.h +++ b/Build/source/libs/poppler/poppler-0.25.0/poppler/Stream-CCITT.h diff --git a/Build/source/libs/poppler/poppler-0.24.4/poppler/Stream.cc b/Build/source/libs/poppler/poppler-0.25.0/poppler/Stream.cc index 8ef061ab90d..8ef061ab90d 100644 --- a/Build/source/libs/poppler/poppler-0.24.4/poppler/Stream.cc +++ b/Build/source/libs/poppler/poppler-0.25.0/poppler/Stream.cc diff --git a/Build/source/libs/poppler/poppler-0.24.4/poppler/Stream.h b/Build/source/libs/poppler/poppler-0.25.0/poppler/Stream.h index 9b40fd1623a..00b2925b3d5 100644 --- a/Build/source/libs/poppler/poppler-0.24.4/poppler/Stream.h +++ b/Build/source/libs/poppler/poppler-0.25.0/poppler/Stream.h @@ -797,6 +797,11 @@ public: virtual void unfilteredReset (); + int getEncoding() { return encoding; } + GBool getEndOfLine() { return endOfLine; } + int getColumns() { return columns; } + GBool getBlackIs1() { return black; } + private: void ccittReset(GBool unfiltered); diff --git a/Build/source/libs/poppler/poppler-0.25.0/poppler/StructElement.cc b/Build/source/libs/poppler/poppler-0.25.0/poppler/StructElement.cc new file mode 100644 index 00000000000..3a98658437b --- /dev/null +++ b/Build/source/libs/poppler/poppler-0.25.0/poppler/StructElement.cc @@ -0,0 +1,1382 @@ +//======================================================================== +// +// StructElement.cc +// +// This file is licensed under the GPLv2 or later +// +// Copyright 2013 Igalia S.L. +// +//======================================================================== + +#ifdef USE_GCC_PRAGMAS +#pragma interface +#endif + +#include "StructElement.h" +#include "StructTreeRoot.h" +#include "GlobalParams.h" +#include "UnicodeMap.h" +#include "PDFDoc.h" +#include "Dict.h" + +#include <assert.h> + +class GfxState; + + +static GBool isPlacementName(Object *value) +{ + return value->isName("Block") + || value->isName("Inline") + || value->isName("Before") + || value->isName("Start") + || value->isName("End"); +} + +static GBool isWritingModeName(Object *value) +{ + return value->isName("LrTb") + || value->isName("RlTb") + || value->isName("TbRl"); +} + +static GBool isBorderStyleName(Object *value) +{ + return value->isName("None") + || value->isName("Hidden") + || value->isName("Dotted") + || value->isName("Dashed") + || value->isName("Solid") + || value->isName("Double") + || value->isName("Groove") + || value->isName("Ridge") + || value->isName("Inset") + || value->isName("Outset"); +} + +static GBool isTextAlignName(Object *value) +{ + return value->isName("Start") + || value->isName("End") + || value->isName("Center") + || value->isName("Justify"); +} + +static GBool isBlockAlignName(Object *value) +{ + return value->isName("Before") + || value->isName("Middle") + || value->isName("After") + || value->isName("Justify"); +} + +static GBool isInlineAlignName(Object *value) +{ + return value->isName("Start") + || value->isName("End") + || value->isName("Center"); +} + +static GBool isNumber(Object *value) +{ + return value->isNum(); +} + +static GBool isLineHeight(Object *value) +{ + return value->isName("Normal") + || value->isName("Auto") + || isNumber(value); +} + +static GBool isTextDecorationName(Object *value) +{ + return value->isName("None") + || value->isName("Underline") + || value->isName("Overline") + || value->isName("LineThrough"); +} + +static GBool isRubyAlignName(Object *value) +{ + return value->isName("Start") + || value->isName("End") + || value->isName("Center") + || value->isName("Justify") + || value->isName("Distribute"); +} + +static GBool isRubyPositionName(Object *value) +{ + return value->isName("Before") + || value->isName("After") + || value->isName("Warichu") + || value->isName("Inline"); +} + +static GBool isGlyphOrientationName(Object *value) +{ + return value->isName("Auto") + || value->isName("90") + || value->isName("180") + || value->isName("270") + || value->isName("360") + || value->isName("-90") + || value->isName("-180"); +} + +static GBool isListNumberingName(Object *value) +{ + return value->isName("None") + || value->isName("Disc") + || value->isName("Circle") + || value->isName("Square") + || value->isName("Decimal") + || value->isName("UpperRoman") + || value->isName("LowerRoman") + || value->isName("UpperAlpha") + || value->isName("LowerAlpha"); +} + +static GBool isFieldRoleName(Object *value) +{ + return value->isName("rb") + || value->isName("cb") + || value->isName("pb") + || value->isName("tv"); +} + +static GBool isFieldCheckedName(Object *value) +{ + return value->isName("on") + || value->isName("off") + || value->isName("neutral"); +} + +static GBool isTableScopeName(Object *value) +{ + return value->isName("Row") + || value->isName("Column") + || value->isName("Both"); +} + +static GBool isRGBColor(Object *value) +{ + if (!(value->isArray() && value->arrayGetLength() == 3)) + return gFalse; + + GBool okay = gTrue; + for (int i = 0; i < 3; i++) { + Object obj; + if (!value->arrayGet(i, &obj)->isNum()) { + okay = gFalse; + obj.free(); + break; + } + if (obj.getNum() < 0.0 || obj.getNum() > 1.0) { + okay = gFalse; + obj.free(); + break; + } + obj.free(); + } + + return okay; +} + +static GBool isNatural(Object *value) +{ + return (value->isInt() && value->getInt() > 0) + || (value->isInt64() && value->getInt64() > 0); +} + +static GBool isPositive(Object *value) +{ + return value->isNum() && value->getNum() >= 0.0; +} + +static GBool isNumberOrAuto(Object *value) +{ + return isNumber(value) || value->isName("Auto"); +} + +static GBool isTextString(Object *value) +{ + // XXX: Shall isName() also be checked? + return value->isString(); +} + + +#define ARRAY_CHECKER(name, checkItem, length, allowSingle, allowNulls) \ + static GBool name(Object *value) { \ + if (!value->isArray()) \ + return allowSingle ? checkItem(value) : gFalse; \ + \ + if (length && value->arrayGetLength() != length) \ + return gFalse; \ + \ + GBool okay = gTrue; \ + for (int i = 0; i < value->arrayGetLength(); i++) { \ + Object obj; \ + value->arrayGet(i, &obj); \ + if ((!allowNulls && obj.isNull()) || !checkItem(&obj)) { \ + okay = gFalse; \ + obj.free(); \ + break; \ + } \ + obj.free(); \ + } \ + return okay; \ + } + +ARRAY_CHECKER(isRGBColorOrOptionalArray4, isRGBColor, 4, gTrue, gTrue ); +ARRAY_CHECKER(isPositiveOrOptionalArray4, isPositive, 4, gTrue, gTrue ); +ARRAY_CHECKER(isPositiveOrArray4, isPositive, 4, gTrue, gFalse); +ARRAY_CHECKER(isBorderStyle, isBorderStyleName, 4, gTrue, gTrue ); +ARRAY_CHECKER(isNumberArray4, isNumber, 4, gFalse, gFalse); +ARRAY_CHECKER(isNumberOrArrayN, isNumber, 0, gTrue, gFalse); +ARRAY_CHECKER(isTableHeaders, isTextString, 0, gFalse, gFalse); + + +// Type of functions used to do type-checking on attribute values +typedef GBool (*AttributeCheckFunc)(Object*); + +// Maps attributes to their names and whether the attribute can be inherited. +struct AttributeMapEntry { + Attribute::Type type; + const char *name; + const Object *defval; + GBool inherit; + AttributeCheckFunc check; +}; + +struct AttributeDefaults { + Object Inline; + Object LrTb; + Object Normal; + Object Distribute; + Object off; + Object Zero; + Object Auto; + Object Start; + Object None; + Object Before; + Object Nat1; + + AttributeDefaults() { + Inline.initName("Inline"); + LrTb.initName("LrTb"); + Normal.initName("Normal"); + Distribute.initName("Distribute"); + off.initName("off"); + + Zero.initReal(0.0); + Auto.initName("Auto"); + Start.initName("Start"); + None.initName("None"); + Before.initName("Before"); + Nat1.initInt(1); + } +}; + +static const AttributeDefaults attributeDefaults; + + +#define ATTR_LIST_END \ + { Attribute::Unknown, NULL, NULL, gFalse, NULL } + +#define ATTR_WITH_DEFAULT(name, inherit, check, defval) \ + { Attribute::name, \ + #name, \ + &attributeDefaults.defval, \ + inherit, \ + check } + +#define ATTR(name, inherit, check) \ + { Attribute::name, \ + #name, \ + NULL, \ + inherit, \ + check } + +static const AttributeMapEntry attributeMapCommonShared[] = +{ + ATTR_WITH_DEFAULT(Placement, gFalse, isPlacementName, Inline), + ATTR_WITH_DEFAULT(WritingMode, gTrue, isWritingModeName, LrTb), + ATTR (BackgroundColor, gFalse, isRGBColor), + ATTR (BorderColor, gTrue, isRGBColorOrOptionalArray4), + ATTR_WITH_DEFAULT(BorderStyle, gFalse, isBorderStyle, None), + ATTR (BorderThickness, gTrue, isPositiveOrOptionalArray4), + ATTR_WITH_DEFAULT(Padding, gFalse, isPositiveOrArray4, Zero), + ATTR (Color, gTrue, isRGBColor), + ATTR_LIST_END +}; + +static const AttributeMapEntry attributeMapCommonBlock[] = +{ + ATTR_WITH_DEFAULT(SpaceBefore, gFalse, isPositive, Zero), + ATTR_WITH_DEFAULT(SpaceAfter, gFalse, isPositive, Zero), + ATTR_WITH_DEFAULT(StartIndent, gTrue, isNumber, Zero), + ATTR_WITH_DEFAULT(EndIndent, gTrue, isNumber, Zero), + ATTR_WITH_DEFAULT(TextIndent, gTrue, isNumber, Zero), + ATTR_WITH_DEFAULT(TextAlign, gTrue, isTextAlignName, Start), + ATTR (BBox, gFalse, isNumberArray4), + ATTR_WITH_DEFAULT(Width, gFalse, isNumberOrAuto, Auto), + ATTR_WITH_DEFAULT(Height, gFalse, isNumberOrAuto, Auto), + ATTR_WITH_DEFAULT(BlockAlign, gTrue, isBlockAlignName, Before), + ATTR_WITH_DEFAULT(InlineAlign, gTrue, isInlineAlignName, Start), + ATTR_LIST_END +}; + +static const AttributeMapEntry attributeMapCommonInline[] = +{ + ATTR_WITH_DEFAULT(BaselineShift, gFalse, isNumber, Zero), + ATTR_WITH_DEFAULT(LineHeight, gTrue, isLineHeight, Normal), + ATTR (TextDecorationColor, gTrue, isRGBColor), + ATTR (TextDecorationThickness, gTrue, isPositive), + ATTR_WITH_DEFAULT(TextDecorationType, gFalse, isTextDecorationName, None), + ATTR_WITH_DEFAULT(GlyphOrientationVertical, gTrue, isGlyphOrientationName, Auto), + ATTR_LIST_END +}; + +static const AttributeMapEntry attributeMapCommonRubyText[] = +{ + ATTR_WITH_DEFAULT(RubyPosition, gTrue, isRubyPositionName, Before), + ATTR_WITH_DEFAULT(RubyAlign, gTrue, isRubyAlignName, Distribute), + ATTR_LIST_END +}; + +static const AttributeMapEntry attributeMapCommonColumns[] = +{ + ATTR_WITH_DEFAULT(ColumnCount, gFalse, isNatural, Nat1), + ATTR (ColumnGap, gFalse, isNumberOrArrayN), + ATTR (ColumnWidths, gFalse, isNumberOrArrayN), + ATTR_LIST_END +}; + +static const AttributeMapEntry attributeMapCommonList[] = { + ATTR_WITH_DEFAULT(ListNumbering, gTrue, isListNumberingName, None), + ATTR_LIST_END +}; + +static const AttributeMapEntry attributeMapCommonPrintField[] = +{ + ATTR (Role, gFalse, isFieldRoleName), + ATTR_WITH_DEFAULT(checked, gFalse, isFieldCheckedName, off), + ATTR (Desc, gFalse, isTextString), + ATTR_LIST_END +}; + +static const AttributeMapEntry attributeMapCommonTable[] = +{ + ATTR(Headers, gFalse, isTableHeaders), + ATTR(Scope, gFalse, isTableScopeName), + ATTR(Summary, gFalse, isTextString), + ATTR_LIST_END +}; + +static const AttributeMapEntry attributeMapCommonTableCell[] = +{ + ATTR_WITH_DEFAULT(RowSpan, gFalse, isNatural, Nat1), + ATTR_WITH_DEFAULT(ColSpan, gFalse, isNatural, Nat1), + ATTR_WITH_DEFAULT(TBorderStyle, gTrue, isBorderStyle, None), + ATTR_WITH_DEFAULT(TPadding, gTrue, isPositiveOrArray4, Zero), + ATTR_LIST_END +}; + +#undef ATTR_WITH_DEFAULT +#undef ATTR + + +static const AttributeMapEntry *attributeMapAll[] = { + attributeMapCommonShared, + attributeMapCommonBlock, + attributeMapCommonInline, + attributeMapCommonRubyText, + attributeMapCommonColumns, + attributeMapCommonList, + attributeMapCommonPrintField, + attributeMapCommonTable, + attributeMapCommonTableCell, + NULL, +}; + +static const AttributeMapEntry *attributeMapShared[] = { + attributeMapCommonShared, + NULL, +}; + +static const AttributeMapEntry *attributeMapBlock[] = { + attributeMapCommonShared, + attributeMapCommonBlock, + NULL, +}; + +static const AttributeMapEntry *attributeMapInline[] = { + attributeMapCommonShared, + attributeMapCommonInline, + NULL, +}; + +static const AttributeMapEntry *attributeMapTableCell[] = { + attributeMapCommonShared, + attributeMapCommonBlock, + attributeMapCommonTable, + attributeMapCommonTableCell, + NULL, +}; + +static const AttributeMapEntry *attributeMapRubyText[] = { + attributeMapCommonShared, + attributeMapCommonInline, + attributeMapCommonRubyText, + NULL, +}; + +static const AttributeMapEntry *attributeMapColumns[] = { + attributeMapCommonShared, + attributeMapCommonInline, + attributeMapCommonColumns, + NULL, +}; + +static const AttributeMapEntry *attributeMapList[] = { + attributeMapCommonShared, + attributeMapCommonList, + NULL, +}; + +static const AttributeMapEntry *attributeMapTable[] = { + attributeMapCommonShared, + attributeMapCommonBlock, + attributeMapCommonTable, + NULL, +}; + +static const AttributeMapEntry *attributeMapIllustration[] = { + // XXX: Illustrations may have some attributes from the "shared", "inline", + // the "block" sets. This is a loose specification; making it better + // means duplicating entries from the sets. This seems good enough... + attributeMapCommonShared, + attributeMapCommonBlock, + attributeMapCommonInline, + NULL, +}; + +// Table mapping owners of attributes to their names. +static const struct OwnerMapEntry { + Attribute::Owner owner; + const char *name; +} ownerMap[] = { + // XXX: Those are sorted in the owner priority resolution order. If the + // same attribute is defined with two owners, the order in the table + // can be used to know which one has more priority. + { Attribute::XML_1_00, "XML-1.00" }, + { Attribute::HTML_3_20, "HTML-3.20" }, + { Attribute::HTML_4_01, "HTML-4.01" }, + { Attribute::OEB_1_00, "OEB-1.00" }, + { Attribute::RTF_1_05, "RTF-1.05" }, + { Attribute::CSS_1_00, "CSS-1.00" }, + { Attribute::CSS_2_00, "CSS-2.00" }, + { Attribute::Layout, "Layout" }, + { Attribute::PrintField, "PrintField" }, + { Attribute::Table, "Table" }, + { Attribute::List, "List" }, + { Attribute::UserProperties, "UserProperties" }, +}; + + +static GBool ownerHasMorePriority(Attribute::Owner a, Attribute::Owner b) +{ + unsigned aIndex, bIndex; + + for (unsigned i = aIndex = bIndex = 0; i < sizeof(ownerMap) / sizeof(ownerMap[0]); i++) { + if (ownerMap[i].owner == a) + aIndex = i; + if (ownerMap[i].owner == b) + bIndex = i; + } + + return aIndex < bIndex; +} + + +// Maps element types to their names and also serves as lookup table +// for additional element type attributes. + +enum ElementType { + elementTypeUndefined, + elementTypeInline, + elementTypeBlock, +}; + +static const struct TypeMapEntry { + StructElement::Type type; + const char *name; + ElementType elementType; + const AttributeMapEntry **attributes; +} typeMap[] = { + { StructElement::Document, "Document", elementTypeInline, attributeMapShared }, + { StructElement::Part, "Part", elementTypeInline, attributeMapShared }, + { StructElement::Art, "Art", elementTypeInline, attributeMapColumns }, + { StructElement::Sect, "Sect", elementTypeInline, attributeMapColumns }, + { StructElement::Div, "Div", elementTypeInline, attributeMapColumns }, + { StructElement::BlockQuote, "BlockQuote", elementTypeInline, attributeMapInline }, + { StructElement::Caption, "Caption", elementTypeInline, attributeMapInline }, + { StructElement::NonStruct, "NonStruct", elementTypeInline, attributeMapInline }, + { StructElement::Index, "Index", elementTypeInline, attributeMapInline }, + { StructElement::Private, "Private", elementTypeInline, attributeMapInline }, + { StructElement::Span, "Span", elementTypeInline, attributeMapInline }, + { StructElement::Quote, "Quote", elementTypeInline, attributeMapInline }, + { StructElement::Note, "Note", elementTypeInline, attributeMapInline }, + { StructElement::Reference, "Reference", elementTypeInline, attributeMapInline }, + { StructElement::BibEntry, "BibEntry", elementTypeInline, attributeMapInline }, + { StructElement::Code, "Code", elementTypeInline, attributeMapInline }, + { StructElement::Link, "Link", elementTypeInline, attributeMapInline }, + { StructElement::Annot, "Annot", elementTypeInline, attributeMapInline }, + { StructElement::Ruby, "Ruby", elementTypeInline, attributeMapRubyText }, + { StructElement::RB, "RB", elementTypeUndefined, attributeMapRubyText }, + { StructElement::RT, "RT", elementTypeUndefined, attributeMapRubyText }, + { StructElement::RP, "RP", elementTypeUndefined, attributeMapShared }, + { StructElement::Warichu, "Warichu", elementTypeInline, attributeMapRubyText }, + { StructElement::WT, "WT", elementTypeUndefined, attributeMapShared }, + { StructElement::WP, "WP", elementTypeUndefined, attributeMapShared }, + { StructElement::P, "P", elementTypeBlock, attributeMapBlock }, + { StructElement::H, "H", elementTypeBlock, attributeMapBlock }, + { StructElement::H1, "H1", elementTypeBlock, attributeMapBlock }, + { StructElement::H2, "H2", elementTypeBlock, attributeMapBlock }, + { StructElement::H3, "H3", elementTypeBlock, attributeMapBlock }, + { StructElement::H4, "H4", elementTypeBlock, attributeMapBlock }, + { StructElement::H5, "H5", elementTypeBlock, attributeMapBlock }, + { StructElement::H6, "H6", elementTypeBlock, attributeMapBlock }, + { StructElement::L, "L", elementTypeBlock, attributeMapList }, + { StructElement::LI, "LI", elementTypeBlock, attributeMapBlock }, + { StructElement::Lbl, "Lbl", elementTypeBlock, attributeMapBlock }, + { StructElement::LBody, "LBody", elementTypeUndefined, attributeMapBlock }, + { StructElement::Table, "Table", elementTypeBlock, attributeMapTable }, + { StructElement::TR, "TR", elementTypeUndefined, attributeMapShared }, + { StructElement::TH, "TH", elementTypeUndefined, attributeMapTableCell }, + { StructElement::TD, "TD", elementTypeUndefined, attributeMapTableCell }, + { StructElement::THead, "THead", elementTypeUndefined, attributeMapShared }, + { StructElement::TFoot, "TFoot", elementTypeUndefined, attributeMapShared }, + { StructElement::TBody, "TBody", elementTypeUndefined, attributeMapShared }, + { StructElement::Figure, "Figure", elementTypeUndefined, attributeMapIllustration }, + { StructElement::Formula, "Formula", elementTypeUndefined, attributeMapIllustration }, + { StructElement::Form, "Form", elementTypeUndefined, attributeMapIllustration }, + { StructElement::TOC, "TOC", elementTypeUndefined, attributeMapShared }, + { StructElement::TOCI, "TOCI", elementTypeUndefined, attributeMapShared }, +}; + + +//------------------------------------------------------------------------ +// Helpers for the attribute and structure type tables +//------------------------------------------------------------------------ + +static inline const AttributeMapEntry * +getAttributeMapEntry(const AttributeMapEntry **entryList, Attribute::Type type) +{ + assert(entryList); + while (*entryList) { + const AttributeMapEntry *entry = *entryList; + while (entry->type != Attribute::Unknown) { + assert(entry->name); + if (type == entry->type) + return entry; + entry++; + } + entryList++; + } + return NULL; +} + +static inline const AttributeMapEntry * +getAttributeMapEntry(const AttributeMapEntry **entryList, const char *name) +{ + assert(entryList); + while (*entryList) { + const AttributeMapEntry *entry = *entryList; + while (entry->type != Attribute::Unknown) { + assert(entry->name); + if (strcmp(name, entry->name) == 0) + return entry; + entry++; + } + entryList++; + } + return NULL; +} + +static inline const OwnerMapEntry *getOwnerMapEntry(Attribute::Owner owner) +{ + for (unsigned i = 0; i < sizeof(ownerMap) / sizeof(ownerMap[0]); i++) { + if (owner == ownerMap[i].owner) + return &ownerMap[i]; + } + return NULL; +} + +static inline const OwnerMapEntry *getOwnerMapEntry(const char *name) +{ + for (unsigned i = 0; i < sizeof(ownerMap) / sizeof(ownerMap[0]); i++) { + if (strcmp(name, ownerMap[i].name) == 0) + return &ownerMap[i]; + } + return NULL; +} + +static const char *ownerToName(Attribute::Owner owner) +{ + const OwnerMapEntry *entry = getOwnerMapEntry(owner); + return entry ? entry->name : "UnknownOwner"; +} + +static Attribute::Owner nameToOwner(const char *name) +{ + const OwnerMapEntry *entry = getOwnerMapEntry(name); + return entry ? entry->owner : Attribute::UnknownOwner; +} + +static inline const TypeMapEntry *getTypeMapEntry(StructElement::Type type) +{ + for (unsigned i = 0; i < sizeof(typeMap) / sizeof(typeMap[0]); i++) { + if (type == typeMap[i].type) + return &typeMap[i]; + } + return NULL; +} + +static inline const TypeMapEntry *getTypeMapEntry(const char *name) +{ + for (unsigned i = 0; i < sizeof(typeMap) / sizeof(typeMap[0]); i++) { + if (strcmp(name, typeMap[i].name) == 0) + return &typeMap[i]; + } + return NULL; +} + +static const char *typeToName(StructElement::Type type) +{ + if (type == StructElement::MCID) + return "MarkedContent"; + if (type == StructElement::OBJR) + return "ObjectReference"; + + const TypeMapEntry *entry = getTypeMapEntry(type); + return entry ? entry->name : "Unknown"; +} + +static StructElement::Type nameToType(const char *name) +{ + const TypeMapEntry *entry = getTypeMapEntry(name); + return entry ? entry->type : StructElement::Unknown; +} + + +//------------------------------------------------------------------------ +// Attribute +//------------------------------------------------------------------------ + +Attribute::Attribute(const char *nameA, Object *valueA): + type(UserProperty), + owner(UserProperties), + revision(0), + name(nameA), + value(), + hidden(gFalse), + formatted(NULL) +{ + assert(valueA); + valueA->copy(&value); +} + +Attribute::Attribute(Type type, Object *valueA): + type(type), + owner(UserProperties), // TODO: Determine corresponding owner from Type + revision(0), + name(), + value(), + hidden(gFalse), + formatted(NULL) +{ + assert(valueA); + + valueA->copy(&value); + + if (!checkType()) + type = Unknown; +} + +Attribute::~Attribute() +{ + delete formatted; + value.free(); +} + +const char *Attribute::getTypeName() const +{ + if (type == UserProperty) + return name.getCString(); + + const AttributeMapEntry *entry = getAttributeMapEntry(attributeMapAll, type); + if (entry) + return entry->name; + + return "Unknown"; +} + +const char *Attribute::getOwnerName() const +{ + return ownerToName(owner); +} + +Object *Attribute::getDefaultValue(Attribute::Type type) +{ + const AttributeMapEntry *entry = getAttributeMapEntry(attributeMapAll, type); + return entry ? const_cast<Object*>(entry->defval) : NULL; +} + +void Attribute::setFormattedValue(const char *formattedA) +{ + if (formattedA) { + if (formatted) + formatted->Set(formattedA); + else + formatted = new GooString(formattedA); + } else { + delete formatted; + formatted = NULL; + } +} + +GBool Attribute::checkType(StructElement *element) +{ + // If an element is passed, tighther type-checking can be done. + if (!element) + return gTrue; + + const TypeMapEntry *elementTypeEntry = getTypeMapEntry(element->getType()); + if (elementTypeEntry && elementTypeEntry->attributes) { + const AttributeMapEntry *entry = getAttributeMapEntry(elementTypeEntry->attributes, type); + if (entry) { + if (entry->check && !((*entry->check)(&value))) { + return gFalse; + } + } else { + // No entry: the attribute is not valid for the containing element. + return gFalse; + } + } + + return gTrue; +} + +Attribute::Type Attribute::getTypeForName(const char *name, StructElement *element) +{ + const AttributeMapEntry **attributes = attributeMapAll; + if (element) { + const TypeMapEntry *elementTypeEntry = getTypeMapEntry(element->getType()); + if (elementTypeEntry && elementTypeEntry->attributes) { + attributes = elementTypeEntry->attributes; + } + } + + const AttributeMapEntry *entry = getAttributeMapEntry(attributes, name); + return entry ? entry->type : Unknown; +} + +Attribute *Attribute::parseUserProperty(Dict *property) +{ + Object obj, value; + const char *name = NULL; + + if (property->lookup("N", &obj)->isString()) + name = obj.getString()->getCString(); + else if (obj.isName()) + name = obj.getName(); + else { + error(errSyntaxError, -1, "N object is wrong type ({0:s})", obj.getTypeName()); + obj.free(); + return NULL; + } + + if (property->lookup("V", &value)->isNull()) { + error(errSyntaxError, -1, "V object is wrong type ({0:s})", value.getTypeName()); + value.free(); + obj.free(); + return NULL; + } + + Attribute *attribute = new Attribute(name, &value); + value.free(); + obj.free(); + + if (property->lookup("F", &obj)->isString()) { + attribute->setFormattedValue(obj.getString()->getCString()); + } else if (!obj.isNull()) { + error(errSyntaxWarning, -1, "F object is wrong type ({0:s})", obj.getTypeName()); + } + obj.free(); + + if (property->lookup("H", &obj)->isBool()) { + attribute->setHidden(obj.getBool()); + } else if (!obj.isNull()) { + error(errSyntaxWarning, -1, "H object is wrong type ({0:s})", obj.getTypeName()); + } + obj.free(); + + return attribute; +} + + +//------------------------------------------------------------------------ +// StructElement +//------------------------------------------------------------------------ + +StructElement::StructData::StructData(): + altText(0), + actualText(0), + id(0), + title(0), + expandedAbbr(0), + language(0), + revision(0) +{ +} + +StructElement::StructData::~StructData() +{ + delete altText; + delete actualText; + delete id; + delete title; + delete language; + parentRef.free(); + for (ElemPtrArray::iterator i = elements.begin(); i != elements.end(); ++i) delete *i; + for (AttrPtrArray::iterator i = attributes.begin(); i != attributes.end(); ++i) delete *i; +} + + +StructElement::StructElement(Dict *element, + StructTreeRoot *treeRootA, + StructElement *parentA, + std::set<int> &seen): + type(Unknown), + treeRoot(treeRootA), + parent(parentA), + s(new StructData()) +{ + assert(treeRoot); + assert(element); + + parse(element); + parseChildren(element, seen); +} + +StructElement::StructElement(int mcid, StructTreeRoot *treeRootA, StructElement *parentA): + type(MCID), + treeRoot(treeRootA), + parent(parentA), + c(new ContentData(mcid)) +{ + assert(treeRoot); + assert(parent); +} + +StructElement::StructElement(const Ref& ref, StructTreeRoot *treeRootA, StructElement *parentA): + type(OBJR), + treeRoot(treeRootA), + parent(parentA), + c(new ContentData(ref)) +{ + assert(treeRoot); + assert(parent); +} + +StructElement::~StructElement() +{ + if (isContent()) + delete c; + else + delete s; + pageRef.free(); +} + +GBool StructElement::isBlock() const +{ + const TypeMapEntry *entry = getTypeMapEntry(type); + return entry ? (entry->elementType == elementTypeBlock) : gFalse; +} + +GBool StructElement::isInline() const +{ + const TypeMapEntry *entry = getTypeMapEntry(type); + return entry ? (entry->elementType == elementTypeInline) : gFalse; +} + +GBool StructElement::hasPageRef() const +{ + return pageRef.isRef() || (parent && parent->hasPageRef()); +} + +bool StructElement::getPageRef(Ref& ref) const +{ + if (pageRef.isRef()) { + ref = pageRef.getRef(); + return gTrue; + } + + if (parent) + return parent->getPageRef(ref); + + return gFalse; +} + +const char *StructElement::getTypeName() const +{ + return typeToName(type); +} + +const Attribute *StructElement::findAttribute(Attribute::Type attributeType, GBool inherit, + Attribute::Owner attributeOwner) const +{ + if (isContent()) + return parent->findAttribute(attributeType, inherit, attributeOwner); + + if (attributeType == Attribute::Unknown || attributeType == Attribute::UserProperty) + return NULL; + + const Attribute *result = NULL; + + if (attributeOwner == Attribute::UnknownOwner) { + // Search for the attribute, no matter who the owner is + for (unsigned i = 0; i < getNumAttributes(); i++) { + const Attribute *attr = getAttribute(i); + if (attributeType == attr->getType()) { + if (!result || ownerHasMorePriority(attr->getOwner(), result->getOwner())) + result = attr; + } + } + } else { + // Search for the attribute, with a specific owner + for (unsigned i = 0; i < getNumAttributes(); i++) { + const Attribute *attr = getAttribute(i); + if (attributeType == attr->getType() && attributeOwner == attr->getOwner()) { + result = attr; + break; + } + } + } + + if (result) + return result; + + if (inherit && parent) { + const AttributeMapEntry *entry = getAttributeMapEntry(attributeMapAll, attributeType); + assert(entry); + // TODO: Take into account special inheritance cases, for example: + // inline elements which have been changed to be block using + // "/Placement/Block" have slightly different rules. + if (entry->inherit) + return parent->findAttribute(attributeType, inherit, attributeOwner); + } + + return NULL; +} + +GooString* StructElement::appendSubTreeText(GooString *string, GBool recursive) const +{ + if (isContent() && !isObjectRef()) { + MarkedContentOutputDev mcdev(getMCID()); + const TextSpanArray& spans(getTextSpansInternal(mcdev)); + + if (!string) + string = new GooString(); + + for (TextSpanArray::const_iterator i = spans.begin(); i != spans.end(); ++i) + string->append(i->getText()); + + return string; + } + + if (!recursive) + return NULL; + + // Do a depth-first traversal, to get elements in logical order + if (!string) + string = new GooString(); + + for (unsigned i = 0; i < getNumElements(); i++) + getElement(i)->appendSubTreeText(string, recursive); + + return string; +} + +const TextSpanArray& StructElement::getTextSpansInternal(MarkedContentOutputDev& mcdev) const +{ + assert(isContent()); + + int startPage = 0, endPage = 0; + + Ref ref; + if (getPageRef(ref)) { + startPage = endPage = treeRoot->getDoc()->findPage(ref.num, ref.gen); + } + + if (!(startPage && endPage)) { + startPage = 1; + endPage = treeRoot->getDoc()->getNumPages(); + } + + treeRoot->getDoc()->displayPages(&mcdev, startPage, endPage, 72.0, 72.0, 0, gTrue, gFalse, gFalse); + return mcdev.getTextSpans(); +} + +static StructElement::Type roleMapResolve(Dict *roleMap, const char *name, const char *curName, Object *resolved) +{ + // Circular reference + if (curName && !strcmp(name, curName)) + return StructElement::Unknown; + + if (roleMap->lookup(curName ? curName : name, resolved)->isName()) { + StructElement::Type type = nameToType(resolved->getName()); + return type == StructElement::Unknown + ? roleMapResolve(roleMap, name, resolved->getName(), resolved) + : type; + } + + if (!resolved->isNull()) + error(errSyntaxWarning, -1, "RoleMap entry is wrong type ({0:s})", resolved->getTypeName()); + return StructElement::Unknown; +} + +void StructElement::parse(Dict *element) +{ + Object obj; + + // Type is optional, but if present must be StructElem + if (!element->lookup("Type", &obj)->isNull() && !obj.isName("StructElem")) { + error(errSyntaxError, -1, "Type of StructElem object is wrong"); + obj.free(); + return; + } + obj.free(); + + // Parent object reference (required). + if (!element->lookupNF("P", &s->parentRef)->isRef()) { + error(errSyntaxError, -1, "P object is wrong type ({0:s})", obj.getTypeName()); + return; + } + + // Check whether the S-type is valid for the top level + // element and create a node of the appropriate type. + if (!element->lookup("S", &obj)->isName()) { + error(errSyntaxError, -1, "S object is wrong type ({0:s})", obj.getTypeName()); + obj.free(); + return; + } + + // Type name may not be standard, resolve through RoleMap first. + if (treeRoot->getRoleMap()) { + Object resolvedName; + type = roleMapResolve(treeRoot->getRoleMap(), obj.getName(), NULL, &resolvedName); + } + + // Resolving through RoleMap may leave type as Unknown, e.g. for types + // which are not present in it, yet they are standard element types. + if (type == Unknown) + type = nameToType(obj.getName()); + + // At this point either the type name must have been resolved. + if (type == Unknown) { + error(errSyntaxError, -1, "StructElem object is wrong type ({0:s})", obj.getName()); + obj.free(); + return; + } + obj.free(); + + // Object ID (optional), to be looked at the IDTree in the tree root. + if (element->lookup("ID", &obj)->isString()) { + s->id = obj.takeString(); + } + obj.free(); + + // Page reference (optional) in which at least one of the child items + // is to be rendered in. Note: each element stores only the /Pg value + // contained by it, and StructElement::getPageRef() may look in parent + // elements to find the page where an element belongs. + element->lookupNF("Pg", &pageRef); + + // Revision number (optional). + if (element->lookup("R", &obj)->isInt()) { + s->revision = obj.getInt(); + } + obj.free(); + + // Element title (optional). + if (element->lookup("T", &obj)->isString()) { + s->title = obj.takeString(); + } + obj.free(); + + // Language (optional). + if (element->lookup("Lang", &obj)->isString()) { + s->language = obj.takeString(); + } + obj.free(); + + // Alternative text (optional). + if (element->lookup("Alt", &obj)->isString()) { + s->altText = obj.takeString(); + } + obj.free(); + + // Expanded form of an abbreviation (optional). + if (element->lookup("E", &obj)->isString()) { + s->expandedAbbr = obj.takeString(); + } + obj.free(); + + // Actual text (optional). + if (element->lookup("ActualText", &obj)->isString()) { + s->actualText = obj.takeString(); + } + obj.free(); + + // Attributes directly attached to the element (optional). + if (element->lookup("A", &obj)->isDict()) { + parseAttributes(obj.getDict()); + } else if (obj.isArray()) { + Object iobj; + unsigned attrIndex = getNumAttributes(); + for (int i = 0; i < obj.arrayGetLength(); i++) { + if (obj.arrayGet(i, &iobj)->isDict()) { + attrIndex = getNumAttributes(); + parseAttributes(obj.getDict()); + } else if (iobj.isInt()) { + const int revision = iobj.getInt(); + // Set revision numbers for the elements previously created. + for (unsigned j = attrIndex; j < getNumAttributes(); j++) + getAttribute(j)->setRevision(revision); + } else { + error(errSyntaxWarning, -1, "A item is wrong type ({0:s})", iobj.getTypeName()); + } + iobj.free(); + } + } else if (!obj.isNull()) { + error(errSyntaxWarning, -1, "A is wrong type ({0:s})", obj.getTypeName()); + } + obj.free(); + + // Attributes referenced indirectly through the ClassMap (optional). + if (treeRoot->getClassMap()) { + Object classes; + if (element->lookup("C", &classes)->isName()) { + Object attr; + if (treeRoot->getClassMap()->lookup(classes.getName(), &attr)->isDict()) { + parseAttributes(attr.getDict(), gTrue); + } else if (attr.isArray()) { + for (int i = 0; i < attr.arrayGetLength(); i++) { + Object iobj; + unsigned attrIndex = getNumAttributes(); + if (attr.arrayGet(i, &iobj)->isDict()) { + attrIndex = getNumAttributes(); + parseAttributes(iobj.getDict(), gTrue); + } else if (iobj.isInt()) { + // Set revision numbers for the elements previously created. + const int revision = iobj.getInt(); + for (unsigned j = attrIndex; j < getNumAttributes(); j++) + getAttribute(j)->setRevision(revision); + } else { + error(errSyntaxWarning, -1, "C item is wrong type ({0:s})", iobj.getTypeName()); + } + iobj.free(); + } + } else if (!attr.isNull()) { + error(errSyntaxWarning, -1, "C object is wrong type ({0:s})", classes.getTypeName()); + } + classes.free(); + attr.free(); + } + } +} + +StructElement *StructElement::parseChild(Object *ref, + Object *childObj, + std::set<int> &seen) +{ + assert(childObj); + assert(ref); + + StructElement *child = NULL; + + if (childObj->isInt()) { + child = new StructElement(childObj->getInt(), treeRoot, this); + } else if (childObj->isDict("MCR")) { + /* + * TODO: The optional Stm/StwOwn attributes are not handled, so all the + * page will be always scanned when calling StructElement::getText(). + */ + Object mcidObj; + Object pageRefObj; + + if (!childObj->dictLookup("MCID", &mcidObj)->isInt()) { + error(errSyntaxError, -1, "MCID object is wrong type ({0:s})", mcidObj.getTypeName()); + mcidObj.free(); + return NULL; + } + + child = new StructElement(mcidObj.getInt(), treeRoot, this); + mcidObj.free(); + + if (childObj->dictLookupNF("Pg", &pageRefObj)->isRef()) { + child->pageRef = pageRefObj; + } else { + pageRefObj.free(); + } + } else if (childObj->isDict("OBJR")) { + Object refObj; + + if (childObj->dictLookupNF("Obj", &refObj)->isRef()) { + Object pageRefObj; + + child = new StructElement(refObj.getRef(), treeRoot, this); + + if (childObj->dictLookupNF("Pg", &pageRefObj)->isRef()) { + child->pageRef = pageRefObj; + } else { + pageRefObj.free(); + } + } else { + error(errSyntaxError, -1, "Obj object is wrong type ({0:s})", refObj.getTypeName()); + } + refObj.free(); + } else if (childObj->isDict()) { + if (!ref->isRef()) { + error(errSyntaxError, -1, + "Structure element dictionary is not an indirect reference ({0:s})", + ref->getTypeName()); + } else if (seen.find(ref->getRefNum()) == seen.end()) { + seen.insert(ref->getRefNum()); + child = new StructElement(childObj->getDict(), treeRoot, this, seen); + } else { + error(errSyntaxWarning, -1, + "Loop detected in structure tree, skipping subtree at object {0:i}:{0:i}", + ref->getRefNum(), ref->getRefGen()); + } + } else { + error(errSyntaxWarning, -1, "K has a child of wrong type ({0:s})", childObj->getTypeName()); + } + + if (child) { + if (child->isOk()) { + appendElement(child); + if (ref->isRef()) + treeRoot->parentTreeAdd(ref->getRef(), child); + } else { + delete child; + child = NULL; + } + } + + return child; +} + +void StructElement::parseChildren(Dict *element, std::set<int> &seen) +{ + Object kids; + + if (element->lookup("K", &kids)->isArray()) { + for (int i = 0; i < kids.arrayGetLength(); i++) { + Object obj, ref; + parseChild(kids.arrayGetNF(i, &ref), kids.arrayGet(i, &obj), seen); + obj.free(); + ref.free(); + } + } else if (kids.isDict() || kids.isInt()) { + Object ref; + parseChild(element->lookupNF("K", &ref), &kids, seen); + ref.free(); + } + + kids.free(); +} + +void StructElement::parseAttributes(Dict *attributes, GBool keepExisting) +{ + Object owner; + if (attributes->lookup("O", &owner)->isName("UserProperties")) { + // In this case /P is an array of UserProperty dictionaries + Object userProperties; + if (attributes->lookup("P", &userProperties)->isArray()) { + for (int i = 0; i < userProperties.arrayGetLength(); i++) { + Object property; + if (userProperties.arrayGet(i, &property)->isDict()) { + Attribute *attribute = Attribute::parseUserProperty(property.getDict()); + if (attribute && attribute->isOk()) { + appendAttribute(attribute); + } else { + error(errSyntaxWarning, -1, "Item in P is invalid"); + delete attribute; + } + } else { + error(errSyntaxWarning, -1, "Item in P is wrong type ({0:s})", property.getTypeName()); + } + property.free(); + } + } + userProperties.free(); + } else if (owner.isName()) { + // In this case /P contains standard attributes. + // Check first if the owner is a valid standard one. + Attribute::Owner ownerValue = nameToOwner(owner.getName()); + if (ownerValue != Attribute::UnknownOwner) { + // Iterate over the entries of the "attributes" dictionary. + // The /O entry (owner) is skipped. + for (int i = 0; i < attributes->getLength(); i++) { + const char *key = attributes->getKey(i); + if (strcmp(key, "O") != 0) { + Attribute::Type type = Attribute::getTypeForName(key, this); + + // Check if the attribute is already defined. + if (keepExisting) { + GBool exists = gFalse; + for (unsigned j = 0; j < getNumAttributes(); j++) { + if (getAttribute(j)->getType() == type) { + exists = gTrue; + break; + } + } + if (exists) + continue; + } + + if (type != Attribute::Unknown) { + Object value; + GBool typeCheckOk = gTrue; + Attribute *attribute = new Attribute(type, attributes->getVal(i, &value)); + value.free(); + + if (attribute->isOk() && (typeCheckOk = attribute->checkType(this))) { + appendAttribute(attribute); + } else { + // It is not needed to free "value", the Attribute instance + // owns the contents, so deleting "attribute" is enough. + if (!typeCheckOk) { + error(errSyntaxWarning, -1, "Attribute {0:s} value is of wrong type ({1:s})", + attribute->getTypeName(), attribute->getValue()->getTypeName()); + } + delete attribute; + } + } else { + error(errSyntaxWarning, -1, "Wrong Attribute '{0:s}' in element {1:s}", key, getTypeName()); + } + } + } + } else { + error(errSyntaxWarning, -1, "O object is invalid value ({0:s})", owner.getName()); + } + } else if (!owner.isNull()) { + error(errSyntaxWarning, -1, "O is wrong type ({0:s})", owner.getTypeName()); + } + owner.free(); +} diff --git a/Build/source/libs/poppler/poppler-0.25.0/poppler/StructElement.h b/Build/source/libs/poppler/poppler-0.25.0/poppler/StructElement.h new file mode 100644 index 00000000000..b9eef8a6b60 --- /dev/null +++ b/Build/source/libs/poppler/poppler-0.25.0/poppler/StructElement.h @@ -0,0 +1,306 @@ +//======================================================================== +// +// StructElement.h +// +// This file is licensed under the GPLv2 or later +// +// Copyright 2013 Igalia S.L. +// +//======================================================================== + +#ifndef STRUCTELEMENT_H +#define STRUCTELEMENT_H + +#ifdef USE_GCC_PRAGMAS +#pragma interface +#endif + +#include "goo/gtypes.h" +#include "goo/GooString.h" +#include "MarkedContentOutputDev.h" +#include "Object.h" +#include <vector> +#include <set> + +class GooString; +class Dict; +class StructElement; +class StructTreeRoot; + + +class Attribute { +public: + enum Type { + Unknown = 0, // Uninitialized, parsing error, etc. + UserProperty, // User defined attribute (i.e. non-standard) + + // Common standard attributes + Placement, WritingMode, BackgroundColor, BorderColor, BorderStyle, + BorderThickness, Color, Padding, + + // Block element standard attributes + SpaceBefore, SpaceAfter, StartIndent, EndIndent, TextIndent, TextAlign, + BBox, Width, Height, BlockAlign, InlineAlign, TBorderStyle, TPadding, + + // Inline element standard attributes + BaselineShift, LineHeight, TextDecorationColor, TextDecorationThickness, + TextDecorationType, RubyAlign, RubyPosition, GlyphOrientationVertical, + + // Column-only standard attributes + ColumnCount, ColumnGap, ColumnWidths, + + // List-only standard attributes + ListNumbering, + + // PrintField-only standard attributes + Role, checked, Desc, + + // Table-only standard attributes + RowSpan, ColSpan, Headers, Scope, Summary, + }; + + enum Owner { + UnknownOwner = 0, + // User-defined attributes + UserProperties, + // Standard attributes + Layout, List, PrintField, Table, + // Translation to other formats + XML_1_00, HTML_3_20, HTML_4_01, OEB_1_00, RTF_1_05, CSS_1_00, CSS_2_00, + }; + + // Creates a standard attribute. The name is predefined, and the + // value is type-checked to conform to the PDF specification. + Attribute(Type type, Object *value); + + // Creates an UserProperty attribute, with an arbitrary name and value. + Attribute(const char *name, Object *value); + + GBool isOk() const { return type != Unknown; } + + // Name, type and value can be set only on construction. + Type getType() const { return type; } + Owner getOwner() const { return owner; } + const char *getTypeName() const; + const char *getOwnerName() const; + Object *getValue() const { return &value; } + static Object *getDefaultValue(Type type); + + const char *getName() const { return type == UserProperty ? name.getCString() : getTypeName(); } + + // The revision is optional, and defaults to zero. + Guint getRevision() const { return revision; } + void setRevision(Guint revisionA) { revision = revisionA; } + + // Hidden elements should not be displayed by the user agent + GBool isHidden() const { return hidden; } + void setHidden(GBool hiddenA) { hidden = hiddenA; } + + // The formatted value may be in the PDF, or be left undefined (NULL). + // In the later case the user agent should provide a default representation. + const char *getFormattedValue() const { return formatted ? formatted->getCString() : NULL; } + void setFormattedValue(const char *formattedA); + + ~Attribute(); + +private: + Type type; + Owner owner; + Guint revision; + mutable GooString name; + mutable Object value; + GBool hidden; + GooString *formatted; + + GBool checkType(StructElement *element = NULL); + static Type getTypeForName(const char *name, StructElement *element = NULL); + static Attribute *parseUserProperty(Dict *property); + + friend class StructElement; +}; + + +class StructElement { +public: + enum Type { + Unknown = 0, + MCID, // MCID reference, used internally + OBJR, // Object reference, used internally + + Document, Part, Art, Sect, Div, // Structural elements + + Span, Quote, Note, Reference, BibEntry, // Inline elements + Code, Link, Annot, + BlockQuote, Caption, NonStruct, + TOC, TOCI, Index, Private, + + P, H, H1, H2, H3, H4, H5, H6, // Paragraph-like + + L, LI, Lbl, LBody, // List elements + + Table, TR, TH, TD, THead, TFoot, TBody, // Table elements + + Ruby, RB, RT, RP, // Ruby text elements + Warichu, WT, WP, + + Figure, Formula, Form, // Illustration-like elements + }; + + static const Ref InvalidRef; + + const char *getTypeName() const; + Type getType() const { return type; } + GBool isOk() const { return type != Unknown; } + GBool isBlock() const; + GBool isInline() const; + + inline GBool isContent() const { return (type == MCID) || isObjectRef(); } + inline GBool isObjectRef() const { return (type == OBJR && c->ref.num != -1 && c->ref.gen != -1); } + + int getMCID() const { return c->mcid; } + Ref getObjectRef() const { return c->ref; } + Ref getParentRef() { return isContent() ? parent->getParentRef() : s->parentRef.getRef(); } + GBool hasPageRef() const; + GBool getPageRef(Ref& ref) const; + StructTreeRoot *getStructTreeRoot() { return treeRoot; } + + // Optional element identifier. + const GooString *getID() const { return isContent() ? NULL : s->id; } + GooString *getID() { return isContent() ? NULL : s->id; } + + // Optional ISO language name, e.g. en_US + GooString *getLanguage() { + if (!isContent() && s->language) return s->language; + return parent ? parent->getLanguage() : NULL; + } + const GooString *getLanguage() const { + if (!isContent() && s->language) return s->language; + return parent ? parent->getLanguage() : NULL; + } + + // Optional revision number, defaults to zero. + Guint getRevision() const { return isContent() ? 0 : s->revision; } + void setRevision(Guint revision) { if (isContent()) s->revision = revision; } + + // Optional element title, in human-readable form. + const GooString *getTitle() const { return isContent() ? NULL : s->title; } + GooString *getTitle() { return isContent() ? NULL : s->title; } + + // Optional element expanded abbreviation text. + const GooString *getExpandedAbbr() const { return isContent() ? NULL : s->expandedAbbr; } + GooString *getExpandedAbbr() { return isContent() ? NULL : s->expandedAbbr; } + + unsigned getNumElements() const { return isContent() ? 0 : s->elements.size(); } + const StructElement *getElement(int i) const { return isContent() ? NULL : s->elements.at(i); } + StructElement *getElement(int i) { return isContent() ? NULL : s->elements.at(i); } + + void appendElement(StructElement *element) { + if (!isContent() && element && element->isOk()) { + s->elements.push_back(element); + } + } + + unsigned getNumAttributes() const { return isContent() ? 0 : s->attributes.size(); } + const Attribute *getAttribute(int i) const { return isContent() ? NULL : s->attributes.at(i); } + Attribute *getAttribute(int i) { return isContent() ? NULL : s->attributes.at(i); } + + void appendAttribute(Attribute *attribute) { + if (!isContent() && attribute) { + s->attributes.push_back(attribute); + } + } + + const Attribute* findAttribute(Attribute::Type attributeType, GBool inherit = gFalse, + Attribute::Owner owner = Attribute::UnknownOwner) const; + + const GooString *getAltText() const { return isContent() ? NULL : s->altText; } + GooString *getAltText() { return isContent() ? NULL : s->altText; } + + const GooString *getActualText() const { return isContent() ? NULL : s->actualText; } + GooString *getActualText() { return isContent() ? NULL : s->actualText; } + + // Content text referenced by the element: + // + // - For MCID reference elements, this is just the text of the + // corresponding marked content object in the page stream, regardless + // of the setting of the "recursive" flag. + // - For other elements, if the "recursive" flag is set, the text + // enclosed by *all* the child MCID reference elements of the subtree + // is returned. The text is assembled by traversing the leaf MCID + // reference elements in logical order. + // - In any other case, the function returns NULL. + // + // A new string is returned, and the ownership passed to the caller. + // + GooString *getText(GBool recursive = gTrue) const { + return appendSubTreeText(NULL, recursive); + } + + const TextSpanArray getTextSpans() const { + if (!isContent()) + return TextSpanArray(); + MarkedContentOutputDev mcdev(getMCID()); + return getTextSpansInternal(mcdev); + } + + ~StructElement(); + +private: + GooString* appendSubTreeText(GooString *string, GBool recursive) const; + const TextSpanArray& getTextSpansInternal(MarkedContentOutputDev& mcdev) const; + + typedef std::vector<Attribute*> AttrPtrArray; + typedef std::vector<StructElement*> ElemPtrArray; + + struct StructData { + Object parentRef; + GooString *altText; + GooString *actualText; + GooString *id; + GooString *title; + GooString *expandedAbbr; + GooString *language; + Guint revision; + ElemPtrArray elements; + AttrPtrArray attributes; + + StructData(); + ~StructData(); + }; + + // Data in content elements (MCID, MCR) + struct ContentData { + union { + int mcid; + Ref ref; + }; + + ContentData(int mcidA): mcid(mcidA) {} + ContentData(const Ref& r) { ref.num = r.num; ref.gen = r.gen; } + }; + + // Common data + Type type; + StructTreeRoot *treeRoot; + StructElement *parent; + mutable Object pageRef; + + union { + StructData *s; + ContentData *c; + }; + + StructElement(Dict *elementDict, StructTreeRoot *treeRootA, StructElement *parentA, std::set<int> &seen); + StructElement(int mcid, StructTreeRoot *treeRootA, StructElement *parentA); + StructElement(const Ref &ref, StructTreeRoot *treeRootA, StructElement *parentA); + + void parse(Dict* elementDict); + StructElement* parseChild(Object *ref, Object* childObj, std::set<int> &seen); + void parseChildren(Dict* element, std::set<int> &seen); + void parseAttributes(Dict *element, GBool keepExisting = gFalse); + + friend class StructTreeRoot; +}; + +#endif + diff --git a/Build/source/libs/poppler/poppler-0.25.0/poppler/StructTreeRoot.cc b/Build/source/libs/poppler/poppler-0.25.0/poppler/StructTreeRoot.cc new file mode 100644 index 00000000000..59f017ee910 --- /dev/null +++ b/Build/source/libs/poppler/poppler-0.25.0/poppler/StructTreeRoot.cc @@ -0,0 +1,174 @@ +//======================================================================== +// +// StructTreeRoot.cc +// +// This file is licensed under the GPLv2 or later +// +// Copyright 2013 Igalia S.L. +// +//======================================================================== + +#ifdef USE_GCC_PRAGMAS +#pragma interface +#endif + +#include "goo/GooString.h" +#include "StructTreeRoot.h" +#include "StructElement.h" +#include "PDFDoc.h" +#include "Object.h" +#include "Dict.h" +#include <set> +#include <assert.h> + + +StructTreeRoot::StructTreeRoot(PDFDoc *docA, Dict *structTreeRootDict): + doc(docA) +{ + assert(doc); + assert(structTreeRootDict); + parse(structTreeRootDict); +} + +StructTreeRoot::~StructTreeRoot() +{ + for (ElemPtrArray::iterator i = elements.begin(); i != elements.end(); ++i) + delete *i; + classMap.free(); + roleMap.free(); +} + +void StructTreeRoot::parse(Dict *root) +{ + // The RoleMap/ClassMap dictionaries are needed by all the parsing + // functions, which will resolve the custom names to canonical + // standard names. + root->lookup("RoleMap", &roleMap); + root->lookup("ClassMap", &classMap); + + // ParentTree (optional). If present, it must be a number tree, + // otherwise it is not possible to map stream objects to their + // corresponsing structure element. Here only the references are + // loaded into the array, the pointers to the StructElements will + // be filled-in later when parsing them. + Object obj; + if (root->lookup("ParentTree", &obj)->isDict()) { + Object nums; + if (obj.dictLookup("Nums", &nums)->isArray()) { + if (nums.arrayGetLength() % 2 == 0) { + parentTree.resize(nums.arrayGetLength() / 2); + // Index numbers in even positions, references in odd ones + for (int i = 0; i < nums.arrayGetLength(); i += 2) { + Object index, value; + + if (!nums.arrayGet(i, &index)->isInt()) { + error(errSyntaxError, -1, "Nums item at position {0:d} is wrong type ({1:s})", i, index.getTypeName()); + index.free(); + continue; + } + if (index.getInt() < 0) { + error(errSyntaxError, -1, "Nums item at position {0:d} is invalid value ({1:d})", i, index.getInt()); + index.free(); + continue; + } + + const unsigned idx = index.getInt(); + if (nums.arrayGetNF(i + 1, &value)->isRef()) { + parentTree[idx].resize(1); + parentTree[idx][0].ref = value.getRef(); + } else if (nums.arrayGet(i + 1, &value)->isArray()) { + parentTree[idx].resize(value.arrayGetLength()); + for (int j = 0; j < value.arrayGetLength(); j++) { + Object itemvalue; + if (value.arrayGetNF(j, &itemvalue)->isRef()) + parentTree[idx][j].ref = itemvalue.getRef(); + else + error(errSyntaxError, -1, "Nums array item at position {0:d}/{1:d} is invalid type ({2:s})", i, j, itemvalue.getTypeName()); + itemvalue.free(); + } + } else { + error(errSyntaxError, -1, "Nums item at position {0:d} is wrong type ({1:s})", i + 1, value.getTypeName()); + } + + value.free(); + index.free(); + } + } else { + error(errSyntaxError, -1, "Nums array length is not a even ({0:i})", nums.arrayGetLength()); + } + } else { + error(errSyntaxError, -1, "Nums object is wrong type ({0:s})", nums.getTypeName()); + } + nums.free(); + } + obj.free(); + + std::set<int> seenElements; + + // Parse the children StructElements + const GBool marked = doc->getCatalog()->getMarkInfo() & Catalog::markInfoMarked; + Object kids; + if (root->lookup("K", &kids)->isArray()) { + if (marked && kids.arrayGetLength() > 1) { + error(errSyntaxWarning, -1, "K in StructTreeRoot has more than one children in a tagged PDF"); + } + for (int i = 0; i < kids.arrayGetLength(); i++) { + Object obj, ref; + kids.arrayGetNF(i, &ref); + if (ref.isRef()) { + seenElements.insert(ref.getRefNum()); + } + if (kids.arrayGet(i, &obj)->isDict()) { + StructElement *child = new StructElement(obj.getDict(), this, NULL, seenElements); + if (child->isOk()) { + if (marked && !(child->getType() == StructElement::Document || + child->getType() == StructElement::Part || + child->getType() == StructElement::Art || + child->getType() == StructElement::Div)) { + error(errSyntaxWarning, -1, "StructTreeRoot element of tagged PDF is wrong type ({0:s})", child->getTypeName()); + } + appendElement(child); + if (ref.isRef()) { + parentTreeAdd(ref.getRef(), child); + } + } else { + error(errSyntaxWarning, -1, "StructTreeRoot element could not be parsed"); + delete child; + } + } else { + error(errSyntaxWarning, -1, "K has a child of wrong type ({0:s})", obj.getTypeName()); + } + obj.free(); + ref.free(); + } + } else if (kids.isDict()) { + if (marked) { + error(errSyntaxWarning, -1, "K has a child of wrong type for a tagged PDF ({0:s})", kids.getTypeName()); + } + StructElement *child = new StructElement(kids.getDict(), this, NULL, seenElements); + if (child->isOk()) { + appendElement(child); + Object ref; + if (root->lookupNF("K", &ref)->isRef()) + parentTreeAdd(ref.getRef(), child); + ref.free(); + } else { + error(errSyntaxWarning, -1, "StructTreeRoot element could not be parsed"); + delete child; + } + } else if (!kids.isNull()) { + error(errSyntaxWarning, -1, "K in StructTreeRoot is wrong type ({0:s})", kids.getTypeName()); + } + + kids.free(); +} + +void StructTreeRoot::parentTreeAdd(const Ref &objectRef, StructElement *element) +{ + for (std::vector< std::vector<Parent> >::iterator i = parentTree.begin(); i != parentTree.end(); ++i) { + for (std::vector<Parent>::iterator j = i->begin(); j != i->end(); ++j) { + if (j->ref.num == objectRef.num && j->ref.gen == objectRef.gen) + j->element = element; + } + } +} diff --git a/Build/source/libs/poppler/poppler-0.25.0/poppler/StructTreeRoot.h b/Build/source/libs/poppler/poppler-0.25.0/poppler/StructTreeRoot.h new file mode 100644 index 00000000000..9928e2f6eba --- /dev/null +++ b/Build/source/libs/poppler/poppler-0.25.0/poppler/StructTreeRoot.h @@ -0,0 +1,83 @@ +//======================================================================== +// +// StructTreeRoot.h +// +// This file is licensed under the GPLv2 or later +// +// Copyright 2013 Igalia S.L. +// +//======================================================================== + +#ifndef STRUCTTREEROOT_H +#define STRUCTTREEROOT_H + +#ifdef USE_GCC_PRAGMAS +#pragma interface +#endif + +#include "goo/gtypes.h" +#include "Object.h" +#include "StructElement.h" +#include <vector> + +class Dict; +class PDFDoc; + + +class StructTreeRoot +{ +public: + StructTreeRoot(PDFDoc *docA, Dict *rootDict); + ~StructTreeRoot(); + + PDFDoc *getDoc() { return doc; } + Dict *getRoleMap() { return roleMap.isDict() ? roleMap.getDict() : NULL; } + Dict *getClassMap() { return classMap.isDict() ? classMap.getDict() : NULL; } + unsigned getNumElements() const { return elements.size(); } + const StructElement *getElement(int i) const { return elements.at(i); } + StructElement *getElement(int i) { return elements.at(i); } + + void appendElement(StructElement *element) { + if (element && element->isOk()) { + elements.push_back(element); + } + } + + const StructElement *findParentElement(unsigned index) const { + if (index < parentTree.size() && parentTree[index].size() == 1) { + return parentTree[index][0].element; + } + return NULL; + } + +private: + typedef std::vector<StructElement*> ElemPtrArray; + + // Structure for items in /ParentTree, it keeps a mapping of + // object references and pointers to StructElement objects. + struct Parent { + Ref ref; + StructElement *element; + + Parent(): element(NULL) { ref.num = ref.gen = -1; } + Parent(const Parent &p): element(p.element) { + ref.num = p.ref.num; + ref.gen = p.ref.gen; + } + ~Parent() {} + }; + + PDFDoc *doc; + Object roleMap; + Object classMap; + ElemPtrArray elements; + std::vector< std::vector<Parent> > parentTree; + + void parse(Dict *rootDict); + void parentTreeAdd(const Ref &objectRef, StructElement *element); + + friend class StructElement; +}; + +#endif + diff --git a/Build/source/libs/poppler/poppler-0.24.4/poppler/TextOutputDev.cc b/Build/source/libs/poppler/poppler-0.25.0/poppler/TextOutputDev.cc index 4adb3c2bb6c..7c2ca78895f 100644 --- a/Build/source/libs/poppler/poppler-0.24.4/poppler/TextOutputDev.cc +++ b/Build/source/libs/poppler/poppler-0.25.0/poppler/TextOutputDev.cc @@ -4000,21 +4000,6 @@ public: PDFRectangle *selection) = 0; protected: - - class TextWordSelection { - public: - TextWordSelection(TextWord *word, int begin, int end) - : word(word), - begin(begin), - end(end) - { - } - - TextWord *word; - int begin; - int end; - }; - TextPage *page; }; @@ -4044,7 +4029,7 @@ public: void endPage(); GooString *getText(void); - GooList **getWordList(int *nLines); + GooList **takeWordList(int *nLines); private: @@ -4179,27 +4164,18 @@ GooString *TextSelectionDumper::getText (void) return text; } -GooList **TextSelectionDumper::getWordList(int *nLinesOut) +GooList **TextSelectionDumper::takeWordList(int *nLinesOut) { - int i, j; + GooList **returnValue = lines; + *nLinesOut = nLines; if (nLines == 0) return NULL; - GooList **wordList = (GooList **)gmallocn(nLines, sizeof(GooList *)); - - for (i = 0; i < nLines; i++) { - GooList *lineWords = lines[i]; - wordList[i] = new GooList(); - for (j = 0; j < lineWords->getLength(); j++) { - TextWordSelection *sel = (TextWordSelection *)lineWords->get(j); - wordList[i]->append(sel->word); - } - } - - *nLinesOut = nLines; + nLines = 0; + lines = NULL; - return wordList; + return returnValue; } class TextSelectionSizer : public TextSelectionVisitor { @@ -4793,7 +4769,7 @@ GooList **TextPage::getSelectionWords(PDFRectangle *selection, visitSelection(&dumper, selection, style); dumper.endPage(); - return dumper.getWordList(nLines); + return dumper.takeWordList(nLines); } GBool TextPage::findCharRange(int pos, int length, diff --git a/Build/source/libs/poppler/poppler-0.24.4/poppler/TextOutputDev.h b/Build/source/libs/poppler/poppler-0.25.0/poppler/TextOutputDev.h index 56736b3f7ce..23fb3b726a9 100644 --- a/Build/source/libs/poppler/poppler-0.24.4/poppler/TextOutputDev.h +++ b/Build/source/libs/poppler/poppler-0.25.0/poppler/TextOutputDev.h @@ -478,6 +478,26 @@ private: #endif // TEXTOUT_WORD_LIST +class TextWordSelection { +public: + TextWordSelection(TextWord *word, int begin, int end) + : word(word), begin(begin), end(end) + { + } + + TextWord * getWord() const { return word; } + int getBegin() const { return begin; } + int getEnd() const { return end; } + +private: + TextWord *word; + int begin; + int end; + + friend class TextSelectionPainter; + friend class TextSelectionDumper; +}; + //------------------------------------------------------------------------ // TextPage //------------------------------------------------------------------------ diff --git a/Build/source/libs/poppler/poppler-0.24.4/poppler/UTF.cc b/Build/source/libs/poppler/poppler-0.25.0/poppler/UTF.cc index 46007b73006..46007b73006 100644 --- a/Build/source/libs/poppler/poppler-0.24.4/poppler/UTF.cc +++ b/Build/source/libs/poppler/poppler-0.25.0/poppler/UTF.cc diff --git a/Build/source/libs/poppler/poppler-0.24.4/poppler/UTF.h b/Build/source/libs/poppler/poppler-0.25.0/poppler/UTF.h index 248c168cca5..248c168cca5 100644 --- a/Build/source/libs/poppler/poppler-0.24.4/poppler/UTF.h +++ b/Build/source/libs/poppler/poppler-0.25.0/poppler/UTF.h diff --git a/Build/source/libs/poppler/poppler-0.24.4/poppler/UTF8.h b/Build/source/libs/poppler/poppler-0.25.0/poppler/UTF8.h index 34a07d4082f..34a07d4082f 100644 --- a/Build/source/libs/poppler/poppler-0.24.4/poppler/UTF8.h +++ b/Build/source/libs/poppler/poppler-0.25.0/poppler/UTF8.h diff --git a/Build/source/libs/poppler/poppler-0.24.4/poppler/UnicodeCClassTables.h b/Build/source/libs/poppler/poppler-0.25.0/poppler/UnicodeCClassTables.h index 62f9ecc3657..62f9ecc3657 100644 --- a/Build/source/libs/poppler/poppler-0.24.4/poppler/UnicodeCClassTables.h +++ b/Build/source/libs/poppler/poppler-0.25.0/poppler/UnicodeCClassTables.h diff --git a/Build/source/libs/poppler/poppler-0.24.4/poppler/UnicodeCompTables.h b/Build/source/libs/poppler/poppler-0.25.0/poppler/UnicodeCompTables.h index 68e2f86aee9..68e2f86aee9 100644 --- a/Build/source/libs/poppler/poppler-0.24.4/poppler/UnicodeCompTables.h +++ b/Build/source/libs/poppler/poppler-0.25.0/poppler/UnicodeCompTables.h diff --git a/Build/source/libs/poppler/poppler-0.24.4/poppler/UnicodeDecompTables.h b/Build/source/libs/poppler/poppler-0.25.0/poppler/UnicodeDecompTables.h index 4bc34b18d99..4bc34b18d99 100644 --- a/Build/source/libs/poppler/poppler-0.24.4/poppler/UnicodeDecompTables.h +++ b/Build/source/libs/poppler/poppler-0.25.0/poppler/UnicodeDecompTables.h diff --git a/Build/source/libs/poppler/poppler-0.24.4/poppler/UnicodeMap.cc b/Build/source/libs/poppler/poppler-0.25.0/poppler/UnicodeMap.cc index 0528cdfc686..0528cdfc686 100644 --- a/Build/source/libs/poppler/poppler-0.24.4/poppler/UnicodeMap.cc +++ b/Build/source/libs/poppler/poppler-0.25.0/poppler/UnicodeMap.cc diff --git a/Build/source/libs/poppler/poppler-0.24.4/poppler/UnicodeMap.h b/Build/source/libs/poppler/poppler-0.25.0/poppler/UnicodeMap.h index ba7df2cfb99..ba7df2cfb99 100644 --- a/Build/source/libs/poppler/poppler-0.24.4/poppler/UnicodeMap.h +++ b/Build/source/libs/poppler/poppler-0.25.0/poppler/UnicodeMap.h diff --git a/Build/source/libs/poppler/poppler-0.24.4/poppler/UnicodeMapTables.h b/Build/source/libs/poppler/poppler-0.25.0/poppler/UnicodeMapTables.h index 073e474e6be..073e474e6be 100644 --- a/Build/source/libs/poppler/poppler-0.24.4/poppler/UnicodeMapTables.h +++ b/Build/source/libs/poppler/poppler-0.25.0/poppler/UnicodeMapTables.h diff --git a/Build/source/libs/poppler/poppler-0.24.4/poppler/UnicodeTypeTable.cc b/Build/source/libs/poppler/poppler-0.25.0/poppler/UnicodeTypeTable.cc index 721af9db6e5..721af9db6e5 100644 --- a/Build/source/libs/poppler/poppler-0.24.4/poppler/UnicodeTypeTable.cc +++ b/Build/source/libs/poppler/poppler-0.25.0/poppler/UnicodeTypeTable.cc diff --git a/Build/source/libs/poppler/poppler-0.24.4/poppler/UnicodeTypeTable.h b/Build/source/libs/poppler/poppler-0.25.0/poppler/UnicodeTypeTable.h index 869aad9e6c6..869aad9e6c6 100644 --- a/Build/source/libs/poppler/poppler-0.24.4/poppler/UnicodeTypeTable.h +++ b/Build/source/libs/poppler/poppler-0.25.0/poppler/UnicodeTypeTable.h diff --git a/Build/source/libs/poppler/poppler-0.24.4/poppler/ViewerPreferences.cc b/Build/source/libs/poppler/poppler-0.25.0/poppler/ViewerPreferences.cc index cba8d0ac512..cba8d0ac512 100644 --- a/Build/source/libs/poppler/poppler-0.24.4/poppler/ViewerPreferences.cc +++ b/Build/source/libs/poppler/poppler-0.25.0/poppler/ViewerPreferences.cc diff --git a/Build/source/libs/poppler/poppler-0.24.4/poppler/ViewerPreferences.h b/Build/source/libs/poppler/poppler-0.25.0/poppler/ViewerPreferences.h index 8cdc4d40a73..8cdc4d40a73 100644 --- a/Build/source/libs/poppler/poppler-0.24.4/poppler/ViewerPreferences.h +++ b/Build/source/libs/poppler/poppler-0.25.0/poppler/ViewerPreferences.h diff --git a/Build/source/libs/poppler/poppler-0.24.4/poppler/XRef.cc b/Build/source/libs/poppler/poppler-0.25.0/poppler/XRef.cc index 5495b62f7ba..5495b62f7ba 100644 --- a/Build/source/libs/poppler/poppler-0.24.4/poppler/XRef.cc +++ b/Build/source/libs/poppler/poppler-0.25.0/poppler/XRef.cc diff --git a/Build/source/libs/poppler/poppler-0.24.4/poppler/XRef.h b/Build/source/libs/poppler/poppler-0.25.0/poppler/XRef.h index 70065d8963e..70065d8963e 100644 --- a/Build/source/libs/poppler/poppler-0.24.4/poppler/XRef.h +++ b/Build/source/libs/poppler/poppler-0.25.0/poppler/XRef.h diff --git a/Build/source/libs/poppler/poppler-0.24.4/poppler/XpdfPluginAPI.cc b/Build/source/libs/poppler/poppler-0.25.0/poppler/XpdfPluginAPI.cc index 834c681d991..834c681d991 100644 --- a/Build/source/libs/poppler/poppler-0.24.4/poppler/XpdfPluginAPI.cc +++ b/Build/source/libs/poppler/poppler-0.25.0/poppler/XpdfPluginAPI.cc diff --git a/Build/source/libs/poppler/poppler-0.24.4/poppler/XpdfPluginAPI.h b/Build/source/libs/poppler/poppler-0.25.0/poppler/XpdfPluginAPI.h index b0165c0a72a..b0165c0a72a 100644 --- a/Build/source/libs/poppler/poppler-0.24.4/poppler/XpdfPluginAPI.h +++ b/Build/source/libs/poppler/poppler-0.25.0/poppler/XpdfPluginAPI.h diff --git a/Build/source/libs/poppler/poppler-0.24.4/poppler/gen-unicode-tables.py b/Build/source/libs/poppler/poppler-0.25.0/poppler/gen-unicode-tables.py index 282f6e52518..282f6e52518 100644 --- a/Build/source/libs/poppler/poppler-0.24.4/poppler/gen-unicode-tables.py +++ b/Build/source/libs/poppler/poppler-0.25.0/poppler/gen-unicode-tables.py diff --git a/Build/source/libs/poppler/poppler-0.24.4/poppler/poppler-config.h.cmake b/Build/source/libs/poppler/poppler-0.25.0/poppler/poppler-config.h.cmake index 71a3278ff44..71a3278ff44 100644 --- a/Build/source/libs/poppler/poppler-0.24.4/poppler/poppler-config.h.cmake +++ b/Build/source/libs/poppler/poppler-0.25.0/poppler/poppler-config.h.cmake diff --git a/Build/source/libs/poppler/poppler-0.24.4/poppler/poppler-config.h.in b/Build/source/libs/poppler/poppler-0.25.0/poppler/poppler-config.h.in index c5e181c4337..c5e181c4337 100644 --- a/Build/source/libs/poppler/poppler-0.24.4/poppler/poppler-config.h.in +++ b/Build/source/libs/poppler/poppler-0.25.0/poppler/poppler-config.h.in diff --git a/Build/source/libs/poppler/poppler-0.24.4/poppler/strtok_r.cpp b/Build/source/libs/poppler/poppler-0.25.0/poppler/strtok_r.cpp index 6483e0f7be9..6483e0f7be9 100644 --- a/Build/source/libs/poppler/poppler-0.24.4/poppler/strtok_r.cpp +++ b/Build/source/libs/poppler/poppler-0.25.0/poppler/strtok_r.cpp diff --git a/Build/source/libs/poppler/poppler-0.25.0/splash/Makefile.am b/Build/source/libs/poppler/poppler-0.25.0/splash/Makefile.am new file mode 100644 index 00000000000..4330c53aabf --- /dev/null +++ b/Build/source/libs/poppler/poppler-0.25.0/splash/Makefile.am @@ -0,0 +1,73 @@ +INCLUDES = \ + -I$(top_srcdir) \ + -I$(top_srcdir)/goo \ + $(libjpeg_includes) \ + $(libtiff_includes) \ + $(libpng_includes) \ + $(FREETYPE_CFLAGS) + +# SplashBitmap includes JpegWriter.h, TiffWriter.h, PNGWriter.h +if BUILD_LIBJPEG +libjpeg_includes = $(LIBJPEG_CFLAGS) +endif + +if BUILD_LIBTIFF +libtiff_includes = $(LIBTIFF_CFLAGS) +endif + +if BUILD_LIBPNG +libpng_includes = $(LIBPNG_CFLAGS) +endif + +noinst_LTLIBRARIES = libsplash.la + +if ENABLE_XPDF_HEADERS + +poppler_splash_includedir = $(includedir)/poppler/splash +poppler_splash_include_HEADERS = \ + Splash.h \ + SplashBitmap.h \ + SplashClip.h \ + SplashErrorCodes.h \ + SplashFTFont.h \ + SplashFTFontEngine.h \ + SplashFTFontFile.h \ + SplashFont.h \ + SplashFontEngine.h \ + SplashFontFile.h \ + SplashFontFileID.h \ + SplashGlyphBitmap.h \ + SplashMath.h \ + SplashPath.h \ + SplashPattern.h \ + SplashScreen.h \ + SplashState.h \ + SplashT1Font.h \ + SplashT1FontEngine.h \ + SplashT1FontFile.h \ + SplashTypes.h \ + SplashXPath.h \ + SplashXPathScanner.h + +endif + +libsplash_la_SOURCES = \ + Splash.cc \ + SplashBitmap.cc \ + SplashClip.cc \ + SplashFTFont.cc \ + SplashFTFontEngine.cc \ + SplashFTFontFile.cc \ + SplashFont.cc \ + SplashFontEngine.cc \ + SplashFontFile.cc \ + SplashFontFileID.cc \ + SplashPath.cc \ + SplashPattern.cc \ + SplashScreen.cc \ + SplashState.cc \ + SplashT1Font.cc \ + SplashT1FontEngine.cc \ + SplashT1FontFile.cc \ + SplashXPath.cc \ + SplashXPathScanner.cc diff --git a/Build/source/libs/poppler/poppler-0.25.0/splash/Makefile.in b/Build/source/libs/poppler/poppler-0.25.0/splash/Makefile.in new file mode 100644 index 00000000000..3e550e6b466 --- /dev/null +++ b/Build/source/libs/poppler/poppler-0.25.0/splash/Makefile.in @@ -0,0 +1,816 @@ +# Makefile.in generated by automake 1.14 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994-2013 Free Software Foundation, Inc. + +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + + +VPATH = @srcdir@ +am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)' +am__make_running_with_option = \ + case $${target_option-} in \ + ?) ;; \ + *) echo "am__make_running_with_option: internal error: invalid" \ + "target option '$${target_option-}' specified" >&2; \ + exit 1;; \ + esac; \ + has_opt=no; \ + sane_makeflags=$$MAKEFLAGS; \ + if $(am__is_gnu_make); then \ + sane_makeflags=$$MFLAGS; \ + else \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + bs=\\; \ + sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ + | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ + esac; \ + fi; \ + skip_next=no; \ + strip_trailopt () \ + { \ + flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ + }; \ + for flg in $$sane_makeflags; do \ + test $$skip_next = yes && { skip_next=no; continue; }; \ + case $$flg in \ + *=*|--*) continue;; \ + -*I) strip_trailopt 'I'; skip_next=yes;; \ + -*I?*) strip_trailopt 'I';; \ + -*O) strip_trailopt 'O'; skip_next=yes;; \ + -*O?*) strip_trailopt 'O';; \ + -*l) strip_trailopt 'l'; skip_next=yes;; \ + -*l?*) strip_trailopt 'l';; \ + -[dEDm]) skip_next=yes;; \ + -[JT]) skip_next=yes;; \ + esac; \ + case $$flg in \ + *$$target_option*) has_opt=yes; break;; \ + esac; \ + done; \ + test $$has_opt = yes +am__make_dryrun = (target_option=n; $(am__make_running_with_option)) +am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +subdir = splash +DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \ + $(top_srcdir)/depcomp \ + $(am__poppler_splash_include_HEADERS_DIST) +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/ax_pthread.m4 \ + $(top_srcdir)/m4/define-dir.m4 $(top_srcdir)/m4/gtk-doc.m4 \ + $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/introspection.m4 \ + $(top_srcdir)/m4/libjpeg.m4 $(top_srcdir)/m4/libtool.m4 \ + $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ + $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ + $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/config.h \ + $(top_builddir)/poppler/poppler-config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +LTLIBRARIES = $(noinst_LTLIBRARIES) +libsplash_la_LIBADD = +am_libsplash_la_OBJECTS = Splash.lo SplashBitmap.lo SplashClip.lo \ + SplashFTFont.lo SplashFTFontEngine.lo SplashFTFontFile.lo \ + SplashFont.lo SplashFontEngine.lo SplashFontFile.lo \ + SplashFontFileID.lo SplashPath.lo SplashPattern.lo \ + SplashScreen.lo SplashState.lo SplashT1Font.lo \ + SplashT1FontEngine.lo SplashT1FontFile.lo SplashXPath.lo \ + SplashXPathScanner.lo +libsplash_la_OBJECTS = $(am_libsplash_la_OBJECTS) +AM_V_lt = $(am__v_lt_@AM_V@) +am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) +am__v_lt_0 = --silent +am__v_lt_1 = +AM_V_P = $(am__v_P_@AM_V@) +am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) +am__v_P_0 = false +am__v_P_1 = : +AM_V_GEN = $(am__v_GEN_@AM_V@) +am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) +am__v_GEN_0 = @echo " GEN " $@; +am__v_GEN_1 = +AM_V_at = $(am__v_at_@AM_V@) +am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) +am__v_at_0 = @ +am__v_at_1 = +DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) -I$(top_builddir)/poppler +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__depfiles_maybe = depfiles +am__mv = mv -f +CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ + $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) +LTCXXCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) \ + $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ + $(AM_CXXFLAGS) $(CXXFLAGS) +AM_V_CXX = $(am__v_CXX_@AM_V@) +am__v_CXX_ = $(am__v_CXX_@AM_DEFAULT_V@) +am__v_CXX_0 = @echo " CXX " $@; +am__v_CXX_1 = +CXXLD = $(CXX) +CXXLINK = $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CXXLD) $(AM_CXXFLAGS) \ + $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ +AM_V_CXXLD = $(am__v_CXXLD_@AM_V@) +am__v_CXXLD_ = $(am__v_CXXLD_@AM_DEFAULT_V@) +am__v_CXXLD_0 = @echo " CXXLD " $@; +am__v_CXXLD_1 = +SOURCES = $(libsplash_la_SOURCES) +DIST_SOURCES = $(libsplash_la_SOURCES) +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac +am__poppler_splash_include_HEADERS_DIST = Splash.h SplashBitmap.h \ + SplashClip.h SplashErrorCodes.h SplashFTFont.h \ + SplashFTFontEngine.h SplashFTFontFile.h SplashFont.h \ + SplashFontEngine.h SplashFontFile.h SplashFontFileID.h \ + SplashGlyphBitmap.h SplashMath.h SplashPath.h SplashPattern.h \ + SplashScreen.h SplashState.h SplashT1Font.h \ + SplashT1FontEngine.h SplashT1FontFile.h SplashTypes.h \ + SplashXPath.h SplashXPathScanner.h +am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; +am__vpath_adj = case $$p in \ + $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ + *) f=$$p;; \ + esac; +am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; +am__install_max = 40 +am__nobase_strip_setup = \ + srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` +am__nobase_strip = \ + for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" +am__nobase_list = $(am__nobase_strip_setup); \ + for p in $$list; do echo "$$p $$p"; done | \ + sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ + $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ + if (++n[$$2] == $(am__install_max)) \ + { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ + END { for (dir in files) print dir, files[dir] }' +am__base_list = \ + sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ + sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' +am__uninstall_files_from_dir = { \ + test -z "$$files" \ + || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ + || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ + $(am__cd) "$$dir" && rm -f $$files; }; \ + } +am__installdirs = "$(DESTDIR)$(poppler_splash_includedir)" +HEADERS = $(poppler_splash_include_HEADERS) +am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) +# Read a list of newline-separated strings from the standard input, +# and print each of them once, without duplicates. Input order is +# *not* preserved. +am__uniquify_input = $(AWK) '\ + BEGIN { nonempty = 0; } \ + { items[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in items) print i; }; } \ +' +# Make sure the list of sources is unique. This is necessary because, +# e.g., the same source file might be shared among _SOURCES variables +# for different programs/libraries. +am__define_uniq_tagged_files = \ + list='$(am__tagged_files)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | $(am__uniquify_input)` +ETAGS = etags +CTAGS = ctags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +AR = @AR@ +AS = @AS@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CAIRO_CFLAGS = @CAIRO_CFLAGS@ +CAIRO_FEATURE = @CAIRO_FEATURE@ +CAIRO_LIBS = @CAIRO_LIBS@ +CAIRO_REQ = @CAIRO_REQ@ +CAIRO_VERSION = @CAIRO_VERSION@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +FGREP = @FGREP@ +FONTCONFIG_CFLAGS = @FONTCONFIG_CFLAGS@ +FONTCONFIG_LIBS = @FONTCONFIG_LIBS@ +FREETYPE_CFLAGS = @FREETYPE_CFLAGS@ +FREETYPE_CONFIG = @FREETYPE_CONFIG@ +FREETYPE_LIBS = @FREETYPE_LIBS@ +GLIB_MKENUMS = @GLIB_MKENUMS@ +GLIB_REQ = @GLIB_REQ@ +GLIB_REQUIRED = @GLIB_REQUIRED@ +GREP = @GREP@ +GTKDOC_CHECK = @GTKDOC_CHECK@ +GTKDOC_DEPS_CFLAGS = @GTKDOC_DEPS_CFLAGS@ +GTKDOC_DEPS_LIBS = @GTKDOC_DEPS_LIBS@ +GTKDOC_MKPDF = @GTKDOC_MKPDF@ +GTKDOC_REBASE = @GTKDOC_REBASE@ +GTK_TEST_CFLAGS = @GTK_TEST_CFLAGS@ +GTK_TEST_LIBS = @GTK_TEST_LIBS@ +HTML_DIR = @HTML_DIR@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +INTROSPECTION_CFLAGS = @INTROSPECTION_CFLAGS@ +INTROSPECTION_COMPILER = @INTROSPECTION_COMPILER@ +INTROSPECTION_GENERATE = @INTROSPECTION_GENERATE@ +INTROSPECTION_GIRDIR = @INTROSPECTION_GIRDIR@ +INTROSPECTION_LIBS = @INTROSPECTION_LIBS@ +INTROSPECTION_MAKEFILE = @INTROSPECTION_MAKEFILE@ +INTROSPECTION_SCANNER = @INTROSPECTION_SCANNER@ +INTROSPECTION_TYPELIBDIR = @INTROSPECTION_TYPELIBDIR@ +LCMS_CFLAGS = @LCMS_CFLAGS@ +LCMS_LIBS = @LCMS_LIBS@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBCURL_CFLAGS = @LIBCURL_CFLAGS@ +LIBCURL_LIBS = @LIBCURL_LIBS@ +LIBICONV = @LIBICONV@ +LIBJPEG_CFLAGS = @LIBJPEG_CFLAGS@ +LIBJPEG_LIBS = @LIBJPEG_LIBS@ +LIBOBJS = @LIBOBJS@ +LIBOPENJPEG_CFLAGS = @LIBOPENJPEG_CFLAGS@ +LIBOPENJPEG_LIBS = @LIBOPENJPEG_LIBS@ +LIBPNG_CFLAGS = @LIBPNG_CFLAGS@ +LIBPNG_LIBS = @LIBPNG_LIBS@ +LIBS = @LIBS@ +LIBTIFF_CFLAGS = @LIBTIFF_CFLAGS@ +LIBTIFF_CFLAGSS = @LIBTIFF_CFLAGSS@ +LIBTIFF_LIBS = @LIBTIFF_LIBS@ +LIBTOOL = @LIBTOOL@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBICONV = @LTLIBICONV@ +LTLIBOBJS = @LTLIBOBJS@ +MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ +MKDIR_P = @MKDIR_P@ +MOCQT4 = @MOCQT4@ +MOCQT42 = @MOCQT42@ +MOCQT5 = @MOCQT5@ +MOCQT52 = @MOCQT52@ +NM = @NM@ +NMEDIT = @NMEDIT@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PC_REQUIRES = @PC_REQUIRES@ +PC_REQUIRES_PRIVATE = @PC_REQUIRES_PRIVATE@ +PDFTOCAIRO_CFLAGS = @PDFTOCAIRO_CFLAGS@ +PDFTOCAIRO_LIBS = @PDFTOCAIRO_LIBS@ +PKG_CONFIG = @PKG_CONFIG@ +PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ +POPPLER_DATADIR = @POPPLER_DATADIR@ +POPPLER_GLIB_CFLAGS = @POPPLER_GLIB_CFLAGS@ +POPPLER_GLIB_DISABLE_DEPRECATED = @POPPLER_GLIB_DISABLE_DEPRECATED@ +POPPLER_GLIB_DISABLE_SINGLE_INCLUDES = @POPPLER_GLIB_DISABLE_SINGLE_INCLUDES@ +POPPLER_GLIB_LIBS = @POPPLER_GLIB_LIBS@ +POPPLER_MAJOR_VERSION = @POPPLER_MAJOR_VERSION@ +POPPLER_MICRO_VERSION = @POPPLER_MICRO_VERSION@ +POPPLER_MINOR_VERSION = @POPPLER_MINOR_VERSION@ +POPPLER_QT4_CFLAGS = @POPPLER_QT4_CFLAGS@ +POPPLER_QT4_CXXFLAGS = @POPPLER_QT4_CXXFLAGS@ +POPPLER_QT4_LIBS = @POPPLER_QT4_LIBS@ +POPPLER_QT4_TEST_CFLAGS = @POPPLER_QT4_TEST_CFLAGS@ +POPPLER_QT4_TEST_LIBS = @POPPLER_QT4_TEST_LIBS@ +POPPLER_QT5_CFLAGS = @POPPLER_QT5_CFLAGS@ +POPPLER_QT5_CXXFLAGS = @POPPLER_QT5_CXXFLAGS@ +POPPLER_QT5_LIBS = @POPPLER_QT5_LIBS@ +POPPLER_QT5_TEST_CFLAGS = @POPPLER_QT5_TEST_CFLAGS@ +POPPLER_QT5_TEST_LIBS = @POPPLER_QT5_TEST_LIBS@ +POPPLER_VERSION = @POPPLER_VERSION@ +PTHREAD_CC = @PTHREAD_CC@ +PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ +PTHREAD_LIBS = @PTHREAD_LIBS@ +QTCHOOSER = @QTCHOOSER@ +RANLIB = @RANLIB@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +TESTDATADIR = @TESTDATADIR@ +VERSION = @VERSION@ +XMKMF = @XMKMF@ +X_CFLAGS = @X_CFLAGS@ +X_EXTRA_LIBS = @X_EXTRA_LIBS@ +X_LIBS = @X_LIBS@ +X_PRE_LIBS = @X_PRE_LIBS@ +ZLIB_LIBS = @ZLIB_LIBS@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_AR = @ac_ct_AR@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +auto_import_flags = @auto_import_flags@ +ax_pthread_config = @ax_pthread_config@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +create_shared_lib = @create_shared_lib@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +win32_libs = @win32_libs@ +INCLUDES = \ + -I$(top_srcdir) \ + -I$(top_srcdir)/goo \ + $(libjpeg_includes) \ + $(libtiff_includes) \ + $(libpng_includes) \ + $(FREETYPE_CFLAGS) + + +# SplashBitmap includes JpegWriter.h, TiffWriter.h, PNGWriter.h +@BUILD_LIBJPEG_TRUE@libjpeg_includes = $(LIBJPEG_CFLAGS) +@BUILD_LIBTIFF_TRUE@libtiff_includes = $(LIBTIFF_CFLAGS) +@BUILD_LIBPNG_TRUE@libpng_includes = $(LIBPNG_CFLAGS) +noinst_LTLIBRARIES = libsplash.la +@ENABLE_XPDF_HEADERS_TRUE@poppler_splash_includedir = $(includedir)/poppler/splash +@ENABLE_XPDF_HEADERS_TRUE@poppler_splash_include_HEADERS = \ +@ENABLE_XPDF_HEADERS_TRUE@ Splash.h \ +@ENABLE_XPDF_HEADERS_TRUE@ SplashBitmap.h \ +@ENABLE_XPDF_HEADERS_TRUE@ SplashClip.h \ +@ENABLE_XPDF_HEADERS_TRUE@ SplashErrorCodes.h \ +@ENABLE_XPDF_HEADERS_TRUE@ SplashFTFont.h \ +@ENABLE_XPDF_HEADERS_TRUE@ SplashFTFontEngine.h \ +@ENABLE_XPDF_HEADERS_TRUE@ SplashFTFontFile.h \ +@ENABLE_XPDF_HEADERS_TRUE@ SplashFont.h \ +@ENABLE_XPDF_HEADERS_TRUE@ SplashFontEngine.h \ +@ENABLE_XPDF_HEADERS_TRUE@ SplashFontFile.h \ +@ENABLE_XPDF_HEADERS_TRUE@ SplashFontFileID.h \ +@ENABLE_XPDF_HEADERS_TRUE@ SplashGlyphBitmap.h \ +@ENABLE_XPDF_HEADERS_TRUE@ SplashMath.h \ +@ENABLE_XPDF_HEADERS_TRUE@ SplashPath.h \ +@ENABLE_XPDF_HEADERS_TRUE@ SplashPattern.h \ +@ENABLE_XPDF_HEADERS_TRUE@ SplashScreen.h \ +@ENABLE_XPDF_HEADERS_TRUE@ SplashState.h \ +@ENABLE_XPDF_HEADERS_TRUE@ SplashT1Font.h \ +@ENABLE_XPDF_HEADERS_TRUE@ SplashT1FontEngine.h \ +@ENABLE_XPDF_HEADERS_TRUE@ SplashT1FontFile.h \ +@ENABLE_XPDF_HEADERS_TRUE@ SplashTypes.h \ +@ENABLE_XPDF_HEADERS_TRUE@ SplashXPath.h \ +@ENABLE_XPDF_HEADERS_TRUE@ SplashXPathScanner.h + +libsplash_la_SOURCES = \ + Splash.cc \ + SplashBitmap.cc \ + SplashClip.cc \ + SplashFTFont.cc \ + SplashFTFontEngine.cc \ + SplashFTFontFile.cc \ + SplashFont.cc \ + SplashFontEngine.cc \ + SplashFontFile.cc \ + SplashFontFileID.cc \ + SplashPath.cc \ + SplashPattern.cc \ + SplashScreen.cc \ + SplashState.cc \ + SplashT1Font.cc \ + SplashT1FontEngine.cc \ + SplashT1FontFile.cc \ + SplashXPath.cc \ + SplashXPathScanner.cc + +all: all-am + +.SUFFIXES: +.SUFFIXES: .cc .lo .o .obj +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign splash/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --foreign splash/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): + +clean-noinstLTLIBRARIES: + -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) + @list='$(noinst_LTLIBRARIES)'; \ + locs=`for p in $$list; do echo $$p; done | \ + sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \ + sort -u`; \ + test -z "$$locs" || { \ + echo rm -f $${locs}; \ + rm -f $${locs}; \ + } + +libsplash.la: $(libsplash_la_OBJECTS) $(libsplash_la_DEPENDENCIES) $(EXTRA_libsplash_la_DEPENDENCIES) + $(AM_V_CXXLD)$(CXXLINK) $(libsplash_la_OBJECTS) $(libsplash_la_LIBADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Splash.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/SplashBitmap.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/SplashClip.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/SplashFTFont.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/SplashFTFontEngine.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/SplashFTFontFile.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/SplashFont.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/SplashFontEngine.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/SplashFontFile.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/SplashFontFileID.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/SplashPath.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/SplashPattern.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/SplashScreen.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/SplashState.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/SplashT1Font.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/SplashT1FontEngine.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/SplashT1FontFile.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/SplashXPath.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/SplashXPathScanner.Plo@am__quote@ + +.cc.o: +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXXCOMPILE) -c -o $@ $< + +.cc.obj: +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'` + +.cc.lo: +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(LTCXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LTCXXCOMPILE) -c -o $@ $< + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs +install-poppler_splash_includeHEADERS: $(poppler_splash_include_HEADERS) + @$(NORMAL_INSTALL) + @list='$(poppler_splash_include_HEADERS)'; test -n "$(poppler_splash_includedir)" || list=; \ + if test -n "$$list"; then \ + echo " $(MKDIR_P) '$(DESTDIR)$(poppler_splash_includedir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(poppler_splash_includedir)" || exit 1; \ + fi; \ + for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + echo "$$d$$p"; \ + done | $(am__base_list) | \ + while read files; do \ + echo " $(INSTALL_HEADER) $$files '$(DESTDIR)$(poppler_splash_includedir)'"; \ + $(INSTALL_HEADER) $$files "$(DESTDIR)$(poppler_splash_includedir)" || exit $$?; \ + done + +uninstall-poppler_splash_includeHEADERS: + @$(NORMAL_UNINSTALL) + @list='$(poppler_splash_include_HEADERS)'; test -n "$(poppler_splash_includedir)" || list=; \ + files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ + dir='$(DESTDIR)$(poppler_splash_includedir)'; $(am__uninstall_files_from_dir) + +ID: $(am__tagged_files) + $(am__define_uniq_tagged_files); mkid -fID $$unique +tags: tags-am +TAGS: tags + +tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + set x; \ + here=`pwd`; \ + $(am__define_uniq_tagged_files); \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: ctags-am + +CTAGS: ctags +ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + $(am__define_uniq_tagged_files); \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" +cscopelist: cscopelist-am + +cscopelist-am: $(am__tagged_files) + list='$(am__tagged_files)'; \ + case "$(srcdir)" in \ + [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ + *) sdir=$(subdir)/$(srcdir) ;; \ + esac; \ + for i in $$list; do \ + if test -f "$$i"; then \ + echo "$(subdir)/$$i"; \ + else \ + echo "$$sdir/$$i"; \ + fi; \ + done >> $(top_builddir)/cscope.files + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(LTLIBRARIES) $(HEADERS) +installdirs: + for dir in "$(DESTDIR)$(poppler_splash_includedir)"; do \ + test -z "$$dir" || $(MKDIR_P) "$$dir"; \ + done +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \ + mostlyclean-am + +distclean: distclean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +html-am: + +info: info-am + +info-am: + +install-data-am: install-poppler_splash_includeHEADERS + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: + +install-html: install-html-am + +install-html-am: + +install-info: install-info-am + +install-info-am: + +install-man: + +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-poppler_splash_includeHEADERS + +.MAKE: install-am install-strip + +.PHONY: CTAGS GTAGS TAGS all all-am check check-am clean clean-generic \ + clean-libtool clean-noinstLTLIBRARIES cscopelist-am ctags \ + ctags-am distclean distclean-compile distclean-generic \ + distclean-libtool distclean-tags distdir dvi dvi-am html \ + html-am info info-am install install-am install-data \ + install-data-am install-dvi install-dvi-am install-exec \ + install-exec-am install-html install-html-am install-info \ + install-info-am install-man install-pdf install-pdf-am \ + install-poppler_splash_includeHEADERS install-ps install-ps-am \ + install-strip installcheck installcheck-am installdirs \ + maintainer-clean maintainer-clean-generic mostlyclean \ + mostlyclean-compile mostlyclean-generic mostlyclean-libtool \ + pdf pdf-am ps ps-am tags tags-am uninstall uninstall-am \ + uninstall-poppler_splash_includeHEADERS + + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/Build/source/libs/poppler/poppler-0.25.0/splash/Splash.cc b/Build/source/libs/poppler/poppler-0.25.0/splash/Splash.cc new file mode 100644 index 00000000000..4a7d814f623 --- /dev/null +++ b/Build/source/libs/poppler/poppler-0.25.0/splash/Splash.cc @@ -0,0 +1,6409 @@ +//======================================================================== +// +// Splash.cc +// +//======================================================================== + +//======================================================================== +// +// Modified under the Poppler project - http://poppler.freedesktop.org +// +// All changes made under the Poppler project to this file are licensed +// under GPL version 2 or later +// +// Copyright (C) 2005-2013 Albert Astals Cid <aacid@kde.org> +// Copyright (C) 2005 Marco Pesenti Gritti <mpg@redhat.com> +// Copyright (C) 2010-2013 Thomas Freitag <Thomas.Freitag@alfa.de> +// Copyright (C) 2010 Christian Feuersänger <cfeuersaenger@googlemail.com> +// Copyright (C) 2011-2013 William Bader <williambader@hotmail.com> +// Copyright (C) 2012 Markus Trippelsdorf <markus@trippelsdorf.de> +// Copyright (C) 2012 Adrian Johnson <ajohnson@redneon.com> +// Copyright (C) 2012 Matthias Kramm <kramm@quiss.org> +// +// To see a description of the changes please see the Changelog file that +// came with your tarball or type make ChangeLog if you are building from git +// +//======================================================================== + +#include <config.h> + +#ifdef USE_GCC_PRAGMAS +#pragma implementation +#endif + +#include <stdlib.h> +#include <string.h> +#include <limits.h> +#include <assert.h> +#include <math.h> +#include "goo/gmem.h" +#include "goo/GooLikely.h" +#include "goo/GooList.h" +#include "poppler/Error.h" +#include "SplashErrorCodes.h" +#include "SplashMath.h" +#include "SplashBitmap.h" +#include "SplashState.h" +#include "SplashPath.h" +#include "SplashXPath.h" +#include "SplashXPathScanner.h" +#include "SplashPattern.h" +#include "SplashScreen.h" +#include "SplashFont.h" +#include "SplashGlyphBitmap.h" +#include "Splash.h" +#include <algorithm> + +//------------------------------------------------------------------------ + +#define splashAAGamma 1.5 + +// distance of Bezier control point from center for circle approximation +// = (4 * (sqrt(2) - 1) / 3) * r +#define bezierCircle ((SplashCoord)0.55228475) +#define bezierCircle2 ((SplashCoord)(0.5 * 0.55228475)) + +// Divide a 16-bit value (in [0, 255*255]) by 255, returning an 8-bit result. +static inline Guchar div255(int x) { + return (Guchar)((x + (x >> 8) + 0x80) >> 8); +} + +// Clip x to lie in [0, 255]. +static inline Guchar clip255(int x) { + return x < 0 ? 0 : x > 255 ? 255 : x; +} + +template<typename T> +inline void Guswap( T&a, T&b ) { T tmp = a; a=b; b=tmp; } + +// The PDF spec says that all pixels whose *centers* lie within the +// image target region get painted, so we want to round n+0.5 down to +// n. But this causes problems, e.g., with PDF files that fill a +// rectangle with black and then draw an image to the exact same +// rectangle, so we instead use the fill scan conversion rule. +// However, the correct rule works better for glyphs, so we also +// provide that option in fillImageMask. +#if 0 +static inline int imgCoordMungeLower(SplashCoord x) { + return splashCeil(x + 0.5) - 1; +} +static inline int imgCoordMungeUpper(SplashCoord x) { + return splashCeil(x + 0.5) - 1; +} +#else +static inline int imgCoordMungeLower(SplashCoord x) { + return splashFloor(x); +} +static inline int imgCoordMungeUpper(SplashCoord x) { + return splashFloor(x) + 1; +} +static inline int imgCoordMungeLowerC(SplashCoord x, GBool glyphMode) { + return glyphMode ? (splashCeil(x + 0.5) - 1) : splashFloor(x); +} +static inline int imgCoordMungeUpperC(SplashCoord x, GBool glyphMode) { + return glyphMode ? (splashCeil(x + 0.5) - 1) : (splashFloor(x) + 1); +} +#endif + +// Used by drawImage and fillImageMask to divide the target +// quadrilateral into sections. +struct ImageSection { + int y0, y1; // actual y range + int ia0, ia1; // vertex indices for edge A + int ib0, ib1; // vertex indices for edge A + SplashCoord xa0, ya0, xa1, ya1; // edge A + SplashCoord dxdya; // slope of edge A + SplashCoord xb0, yb0, xb1, yb1; // edge B + SplashCoord dxdyb; // slope of edge B +}; + +//------------------------------------------------------------------------ +// SplashPipe +//------------------------------------------------------------------------ + +#define splashPipeMaxStages 9 + +struct SplashPipe { + // pixel coordinates + int x, y; + + // source pattern + SplashPattern *pattern; + + // source alpha and color + Guchar aInput; + GBool usesShape; + SplashColorPtr cSrc; + SplashColor cSrcVal; + + // non-isolated group alpha0 + Guchar *alpha0Ptr; + + // knockout groups + GBool knockout; + Guchar knockoutOpacity; + + // soft mask + SplashColorPtr softMaskPtr; + + // destination alpha and color + SplashColorPtr destColorPtr; + int destColorMask; + Guchar *destAlphaPtr; + + // shape + Guchar shape; + + // result alpha and color + GBool noTransparency; + SplashPipeResultColorCtrl resultColorCtrl; + + // non-isolated group correction + GBool nonIsolatedGroup; + + // the "run" function + void (Splash::*run)(SplashPipe *pipe); +}; + +SplashPipeResultColorCtrl Splash::pipeResultColorNoAlphaBlend[] = { + splashPipeResultColorNoAlphaBlendMono, + splashPipeResultColorNoAlphaBlendMono, + splashPipeResultColorNoAlphaBlendRGB, + splashPipeResultColorNoAlphaBlendRGB, + splashPipeResultColorNoAlphaBlendRGB +#if SPLASH_CMYK + , + splashPipeResultColorNoAlphaBlendCMYK, + splashPipeResultColorNoAlphaBlendDeviceN +#endif +}; + +SplashPipeResultColorCtrl Splash::pipeResultColorAlphaNoBlend[] = { + splashPipeResultColorAlphaNoBlendMono, + splashPipeResultColorAlphaNoBlendMono, + splashPipeResultColorAlphaNoBlendRGB, + splashPipeResultColorAlphaNoBlendRGB, + splashPipeResultColorAlphaNoBlendRGB +#if SPLASH_CMYK + , + splashPipeResultColorAlphaNoBlendCMYK, + splashPipeResultColorAlphaNoBlendDeviceN +#endif +}; + +SplashPipeResultColorCtrl Splash::pipeResultColorAlphaBlend[] = { + splashPipeResultColorAlphaBlendMono, + splashPipeResultColorAlphaBlendMono, + splashPipeResultColorAlphaBlendRGB, + splashPipeResultColorAlphaBlendRGB, + splashPipeResultColorAlphaBlendRGB +#if SPLASH_CMYK + , + splashPipeResultColorAlphaBlendCMYK, + splashPipeResultColorAlphaBlendDeviceN +#endif +}; + +//------------------------------------------------------------------------ + +static void blendXor(SplashColorPtr src, SplashColorPtr dest, + SplashColorPtr blend, SplashColorMode cm) { + int i; + + for (i = 0; i < splashColorModeNComps[cm]; ++i) { + blend[i] = src[i] ^ dest[i]; + } +} + +//------------------------------------------------------------------------ +// modified region +//------------------------------------------------------------------------ + +void Splash::clearModRegion() { + modXMin = bitmap->getWidth(); + modYMin = bitmap->getHeight(); + modXMax = -1; + modYMax = -1; +} + +inline void Splash::updateModX(int x) { + if (x < modXMin) { + modXMin = x; + } + if (x > modXMax) { + modXMax = x; + } +} + +inline void Splash::updateModY(int y) { + if (y < modYMin) { + modYMin = y; + } + if (y > modYMax) { + modYMax = y; + } +} + +//------------------------------------------------------------------------ +// pipeline +//------------------------------------------------------------------------ + +inline void Splash::pipeInit(SplashPipe *pipe, int x, int y, + SplashPattern *pattern, SplashColorPtr cSrc, + Guchar aInput, GBool usesShape, + GBool nonIsolatedGroup, + GBool knockout, Guchar knockoutOpacity) { + pipeSetXY(pipe, x, y); + pipe->pattern = NULL; + + // source color + if (pattern) { + if (pattern->isStatic()) { + pattern->getColor(x, y, pipe->cSrcVal); + } else { + pipe->pattern = pattern; + } + pipe->cSrc = pipe->cSrcVal; + } else { + pipe->cSrc = cSrc; + } + + // source alpha + pipe->aInput = aInput; + pipe->usesShape = usesShape; + + // knockout + pipe->knockout = knockout; + pipe->knockoutOpacity = knockoutOpacity; + + // result alpha + if (aInput == 255 && !state->softMask && !usesShape && + !state->inNonIsolatedGroup && !nonIsolatedGroup) { + pipe->noTransparency = gTrue; + } else { + pipe->noTransparency = gFalse; + } + + // result color + if (pipe->noTransparency) { + // the !state->blendFunc case is handled separately in pipeRun + pipe->resultColorCtrl = pipeResultColorNoAlphaBlend[bitmap->mode]; + } else if (!state->blendFunc) { + pipe->resultColorCtrl = pipeResultColorAlphaNoBlend[bitmap->mode]; + } else { + pipe->resultColorCtrl = pipeResultColorAlphaBlend[bitmap->mode]; + } + + // non-isolated group correction + pipe->nonIsolatedGroup = nonIsolatedGroup; + + // select the 'run' function + pipe->run = &Splash::pipeRun; + if (!pipe->pattern && pipe->noTransparency && !state->blendFunc) { + if (bitmap->mode == splashModeMono1 && !pipe->destAlphaPtr) { + pipe->run = &Splash::pipeRunSimpleMono1; + } else if (bitmap->mode == splashModeMono8 && pipe->destAlphaPtr) { + pipe->run = &Splash::pipeRunSimpleMono8; + } else if (bitmap->mode == splashModeRGB8 && pipe->destAlphaPtr) { + pipe->run = &Splash::pipeRunSimpleRGB8; + } else if (bitmap->mode == splashModeXBGR8 && pipe->destAlphaPtr) { + pipe->run = &Splash::pipeRunSimpleXBGR8; + } else if (bitmap->mode == splashModeBGR8 && pipe->destAlphaPtr) { + pipe->run = &Splash::pipeRunSimpleBGR8; +#if SPLASH_CMYK + } else if (bitmap->mode == splashModeCMYK8 && pipe->destAlphaPtr) { + pipe->run = &Splash::pipeRunSimpleCMYK8; + } else if (bitmap->mode == splashModeDeviceN8 && pipe->destAlphaPtr) { + pipe->run = &Splash::pipeRunSimpleDeviceN8; +#endif + } + } else if (!pipe->pattern && !pipe->noTransparency && !state->softMask && + pipe->usesShape && + !(state->inNonIsolatedGroup && alpha0Bitmap->alpha) && + !state->blendFunc && !pipe->nonIsolatedGroup) { + if (bitmap->mode == splashModeMono1 && !pipe->destAlphaPtr) { + pipe->run = &Splash::pipeRunAAMono1; + } else if (bitmap->mode == splashModeMono8 && pipe->destAlphaPtr) { + pipe->run = &Splash::pipeRunAAMono8; + } else if (bitmap->mode == splashModeRGB8 && pipe->destAlphaPtr) { + pipe->run = &Splash::pipeRunAARGB8; + } else if (bitmap->mode == splashModeXBGR8 && pipe->destAlphaPtr) { + pipe->run = &Splash::pipeRunAAXBGR8; + } else if (bitmap->mode == splashModeBGR8 && pipe->destAlphaPtr) { + pipe->run = &Splash::pipeRunAABGR8; +#if SPLASH_CMYK + } else if (bitmap->mode == splashModeCMYK8 && pipe->destAlphaPtr) { + pipe->run = &Splash::pipeRunAACMYK8; + } else if (bitmap->mode == splashModeDeviceN8 && pipe->destAlphaPtr) { + pipe->run = &Splash::pipeRunAADeviceN8; +#endif + } + } +} + +// general case +void Splash::pipeRun(SplashPipe *pipe) { + Guchar aSrc, aDest, alphaI, alphaIm1, alpha0, aResult; + SplashColor cSrcNonIso, cDest, cBlend; + SplashColorPtr cSrc; + Guchar cResult0, cResult1, cResult2, cResult3; + int t; +#if SPLASH_CMYK + int cp, mask; + Guchar cResult[SPOT_NCOMPS+4]; +#endif + + //----- source color + + // static pattern: handled in pipeInit + // fixed color: handled in pipeInit + + // dynamic pattern + if (pipe->pattern) { + if (!pipe->pattern->getColor(pipe->x, pipe->y, pipe->cSrcVal)) { + pipeIncX(pipe); + return; + } + } + + if (pipe->noTransparency && !state->blendFunc) { + + //----- write destination pixel + + switch (bitmap->mode) { + case splashModeMono1: + cResult0 = state->grayTransfer[pipe->cSrc[0]]; + if (state->screen->test(pipe->x, pipe->y, cResult0)) { + *pipe->destColorPtr |= pipe->destColorMask; + } else { + *pipe->destColorPtr &= ~pipe->destColorMask; + } + if (!(pipe->destColorMask >>= 1)) { + pipe->destColorMask = 0x80; + ++pipe->destColorPtr; + } + break; + case splashModeMono8: + *pipe->destColorPtr++ = state->grayTransfer[pipe->cSrc[0]]; + break; + case splashModeRGB8: + *pipe->destColorPtr++ = state->rgbTransferR[pipe->cSrc[0]]; + *pipe->destColorPtr++ = state->rgbTransferG[pipe->cSrc[1]]; + *pipe->destColorPtr++ = state->rgbTransferB[pipe->cSrc[2]]; + break; + case splashModeXBGR8: + *pipe->destColorPtr++ = state->rgbTransferB[pipe->cSrc[2]]; + *pipe->destColorPtr++ = state->rgbTransferG[pipe->cSrc[1]]; + *pipe->destColorPtr++ = state->rgbTransferR[pipe->cSrc[0]]; + *pipe->destColorPtr++ = 255; + break; + case splashModeBGR8: + *pipe->destColorPtr++ = state->rgbTransferB[pipe->cSrc[2]]; + *pipe->destColorPtr++ = state->rgbTransferG[pipe->cSrc[1]]; + *pipe->destColorPtr++ = state->rgbTransferR[pipe->cSrc[0]]; + break; +#if SPLASH_CMYK + case splashModeCMYK8: + if (state->overprintMask & 1) { + pipe->destColorPtr[0] = (state->overprintAdditive) ? + std::min<int>(pipe->destColorPtr[0] + state->cmykTransferC[pipe->cSrc[0]], 255) : + state->cmykTransferC[pipe->cSrc[0]]; + } + if (state->overprintMask & 2) { + pipe->destColorPtr[1] = (state->overprintAdditive) ? + std::min<int>(pipe->destColorPtr[1] + state->cmykTransferM[pipe->cSrc[1]], 255) : + state->cmykTransferM[pipe->cSrc[1]]; + } + if (state->overprintMask & 4) { + pipe->destColorPtr[2] = (state->overprintAdditive) ? + std::min<int>(pipe->destColorPtr[2] + state->cmykTransferY[pipe->cSrc[2]], 255) : + state->cmykTransferY[pipe->cSrc[2]]; + } + if (state->overprintMask & 8) { + pipe->destColorPtr[3] = (state->overprintAdditive) ? + std::min<int>(pipe->destColorPtr[3] + state->cmykTransferK[pipe->cSrc[3]], 255) : + state->cmykTransferK[pipe->cSrc[3]]; + } + pipe->destColorPtr += 4; + break; + case splashModeDeviceN8: + mask = 1; + for (cp = 0; cp < SPOT_NCOMPS + 4; cp ++) { + if (state->overprintMask & mask) { + pipe->destColorPtr[cp] = state->deviceNTransfer[cp][pipe->cSrc[cp]]; + } + mask <<= 1; + } + pipe->destColorPtr += (SPOT_NCOMPS+4); + break; +#endif + } + if (pipe->destAlphaPtr) { + *pipe->destAlphaPtr++ = 255; + } + + } else { + + //----- read destination pixel + + Guchar *destColorPtr; + if (pipe->shape && state->blendFunc && pipe->knockout && alpha0Bitmap != NULL) { + destColorPtr = alpha0Bitmap->data + (alpha0Y+pipe->y)*alpha0Bitmap->rowSize; + switch (bitmap->mode) { + case splashModeMono1: + destColorPtr += (alpha0X+pipe->x) / 8; + break; + case splashModeMono8: + destColorPtr += (alpha0X+pipe->x); + break; + case splashModeRGB8: + case splashModeBGR8: + destColorPtr += (alpha0X+pipe->x) * 3; + break; + case splashModeXBGR8: +#if SPLASH_CMYK + case splashModeCMYK8: +#endif + destColorPtr += (alpha0X+pipe->x) * 4; + break; +#if SPLASH_CMYK + case splashModeDeviceN8: + destColorPtr += (alpha0X+pipe->x) * (SPOT_NCOMPS + 4); + break; +#endif + } + } else { + destColorPtr = pipe->destColorPtr; + } + switch (bitmap->mode) { + case splashModeMono1: + cDest[0] = (*destColorPtr & pipe->destColorMask) ? 0xff : 0x00; + break; + case splashModeMono8: + cDest[0] = *destColorPtr; + break; + case splashModeRGB8: + cDest[0] = destColorPtr[0]; + cDest[1] = destColorPtr[1]; + cDest[2] = destColorPtr[2]; + break; + case splashModeXBGR8: + cDest[0] = destColorPtr[2]; + cDest[1] = destColorPtr[1]; + cDest[2] = destColorPtr[0]; + cDest[3] = 255; + break; + case splashModeBGR8: + cDest[0] = destColorPtr[2]; + cDest[1] = destColorPtr[1]; + cDest[2] = destColorPtr[0]; + break; +#if SPLASH_CMYK + case splashModeCMYK8: + cDest[0] = destColorPtr[0]; + cDest[1] = destColorPtr[1]; + cDest[2] = destColorPtr[2]; + cDest[3] = destColorPtr[3]; + break; + case splashModeDeviceN8: + for (cp = 0; cp < SPOT_NCOMPS + 4; cp++) + cDest[cp] = destColorPtr[cp]; + break; +#endif + } + if (pipe->destAlphaPtr) { + aDest = *pipe->destAlphaPtr; + } else { + aDest = 0xff; + } + + //----- source alpha + + if (state->softMask) { + if (pipe->usesShape) { + aSrc = div255(div255(pipe->aInput * *pipe->softMaskPtr++) * + pipe->shape); + } else { + aSrc = div255(pipe->aInput * *pipe->softMaskPtr++); + } + } else if (pipe->usesShape) { + aSrc = div255(pipe->aInput * pipe->shape); + } else { + aSrc = pipe->aInput; + } + + //----- non-isolated group correction + + if (pipe->nonIsolatedGroup) { + // This path is only used when Splash::composite() is called to + // composite a non-isolated group onto the backdrop. In this + // case, pipe->shape is the source (group) alpha. + if (pipe->shape == 0) { + // this value will be multiplied by zero later, so it doesn't + // matter what we use + cSrc = pipe->cSrc; + } else { + t = (aDest * 255) / pipe->shape - aDest; + switch (bitmap->mode) { +#if SPLASH_CMYK + case splashModeDeviceN8: + for (cp = 0; cp < SPOT_NCOMPS + 4; cp++) + cSrcNonIso[cp] = clip255(pipe->cSrc[cp] + + ((pipe->cSrc[cp] - cDest[cp]) * t) / 255); + break; + case splashModeCMYK8: + for (cp = 0; cp < 4; cp++) + cSrcNonIso[cp] = clip255(pipe->cSrc[cp] + + ((pipe->cSrc[cp] - cDest[cp]) * t) / 255); + break; +#endif + case splashModeXBGR8: + cSrcNonIso[3] = 255; + case splashModeRGB8: + case splashModeBGR8: + cSrcNonIso[2] = clip255(pipe->cSrc[2] + + ((pipe->cSrc[2] - cDest[2]) * t) / 255); + cSrcNonIso[1] = clip255(pipe->cSrc[1] + + ((pipe->cSrc[1] - cDest[1]) * t) / 255); + case splashModeMono1: + case splashModeMono8: + cSrcNonIso[0] = clip255(pipe->cSrc[0] + + ((pipe->cSrc[0] - cDest[0]) * t) / 255); + break; + } + cSrc = cSrcNonIso; + // knockout: remove backdrop color + if (pipe->knockout && pipe->shape >= pipe->knockoutOpacity) { + aDest = 0; + } + } + } else { + cSrc = pipe->cSrc; + } + + //----- blend function + + if (state->blendFunc) { + (*state->blendFunc)(cSrc, cDest, cBlend, bitmap->mode); + } + + //----- result alpha and non-isolated group element correction + + if (pipe->noTransparency) { + alphaI = alphaIm1 = aResult = 255; + } else { + aResult = aSrc + aDest - div255(aSrc * aDest); + + // alphaI = alpha_i + // alphaIm1 = alpha_(i-1) + if (pipe->alpha0Ptr) { + alpha0 = *pipe->alpha0Ptr++; + alphaI = aResult + alpha0 - div255(aResult * alpha0); + alphaIm1 = alpha0 + aDest - div255(alpha0 * aDest); + } else { + alphaI = aResult; + alphaIm1 = aDest; + } + } + + //----- result color + + cResult0 = cResult1 = cResult2 = cResult3 = 0; // make gcc happy + + switch (pipe->resultColorCtrl) { + + case splashPipeResultColorNoAlphaBlendMono: + cResult0 = state->grayTransfer[div255((255 - aDest) * cSrc[0] + + aDest * cBlend[0])]; + break; + case splashPipeResultColorNoAlphaBlendRGB: + cResult0 = state->rgbTransferR[div255((255 - aDest) * cSrc[0] + + aDest * cBlend[0])]; + cResult1 = state->rgbTransferG[div255((255 - aDest) * cSrc[1] + + aDest * cBlend[1])]; + cResult2 = state->rgbTransferB[div255((255 - aDest) * cSrc[2] + + aDest * cBlend[2])]; + break; +#if SPLASH_CMYK + case splashPipeResultColorNoAlphaBlendCMYK: + cResult0 = state->cmykTransferC[div255((255 - aDest) * cSrc[0] + + aDest * cBlend[0])]; + cResult1 = state->cmykTransferM[div255((255 - aDest) * cSrc[1] + + aDest * cBlend[1])]; + cResult2 = state->cmykTransferY[div255((255 - aDest) * cSrc[2] + + aDest * cBlend[2])]; + cResult3 = state->cmykTransferK[div255((255 - aDest) * cSrc[3] + + aDest * cBlend[3])]; + break; + case splashPipeResultColorNoAlphaBlendDeviceN: + for (cp = 0; cp < SPOT_NCOMPS+4; cp++) + cResult[cp] = state->deviceNTransfer[cp][div255((255 - aDest) * cSrc[cp] + + aDest * cBlend[cp])]; + break; +#endif + + case splashPipeResultColorAlphaNoBlendMono: + if (alphaI == 0) { + cResult0 = 0; + } else { + cResult0 = state->grayTransfer[((alphaI - aSrc) * cDest[0] + + aSrc * cSrc[0]) / alphaI]; + } + break; + case splashPipeResultColorAlphaNoBlendRGB: + if (alphaI == 0) { + cResult0 = 0; + cResult1 = 0; + cResult2 = 0; + } else { + cResult0 = state->rgbTransferR[((alphaI - aSrc) * cDest[0] + + aSrc * cSrc[0]) / alphaI]; + cResult1 = state->rgbTransferG[((alphaI - aSrc) * cDest[1] + + aSrc * cSrc[1]) / alphaI]; + cResult2 = state->rgbTransferB[((alphaI - aSrc) * cDest[2] + + aSrc * cSrc[2]) / alphaI]; + } + break; +#if SPLASH_CMYK + case splashPipeResultColorAlphaNoBlendCMYK: + if (alphaI == 0) { + cResult0 = 0; + cResult1 = 0; + cResult2 = 0; + cResult3 = 0; + } else { + cResult0 = state->cmykTransferC[((alphaI - aSrc) * cDest[0] + + aSrc * cSrc[0]) / alphaI]; + cResult1 = state->cmykTransferM[((alphaI - aSrc) * cDest[1] + + aSrc * cSrc[1]) / alphaI]; + cResult2 = state->cmykTransferY[((alphaI - aSrc) * cDest[2] + + aSrc * cSrc[2]) / alphaI]; + cResult3 = state->cmykTransferK[((alphaI - aSrc) * cDest[3] + + aSrc * cSrc[3]) / alphaI]; + } + break; + case splashPipeResultColorAlphaNoBlendDeviceN: + if (alphaI == 0) { + for (cp = 0; cp < SPOT_NCOMPS+4; cp++) + cResult[cp] = 0; + } else { + for (cp = 0; cp < SPOT_NCOMPS+4; cp++) + cResult[cp] = state->deviceNTransfer[cp][((alphaI - aSrc) * cDest[cp] + + aSrc * cSrc[cp]) / alphaI]; + } + break; +#endif + + case splashPipeResultColorAlphaBlendMono: + if (alphaI == 0) { + cResult0 = 0; + } else { + cResult0 = state->grayTransfer[((alphaI - aSrc) * cDest[0] + + aSrc * ((255 - alphaIm1) * cSrc[0] + + alphaIm1 * cBlend[0]) / 255) / + alphaI]; + } + break; + case splashPipeResultColorAlphaBlendRGB: + if (alphaI == 0) { + cResult0 = 0; + cResult1 = 0; + cResult2 = 0; + } else { + cResult0 = state->rgbTransferR[((alphaI - aSrc) * cDest[0] + + aSrc * ((255 - alphaIm1) * cSrc[0] + + alphaIm1 * cBlend[0]) / 255) / + alphaI]; + cResult1 = state->rgbTransferG[((alphaI - aSrc) * cDest[1] + + aSrc * ((255 - alphaIm1) * cSrc[1] + + alphaIm1 * cBlend[1]) / 255) / + alphaI]; + cResult2 = state->rgbTransferB[((alphaI - aSrc) * cDest[2] + + aSrc * ((255 - alphaIm1) * cSrc[2] + + alphaIm1 * cBlend[2]) / 255) / + alphaI]; + } + break; +#if SPLASH_CMYK + case splashPipeResultColorAlphaBlendCMYK: + if (alphaI == 0) { + cResult0 = 0; + cResult1 = 0; + cResult2 = 0; + cResult3 = 0; + } else { + cResult0 = state->cmykTransferC[((alphaI - aSrc) * cDest[0] + + aSrc * ((255 - alphaIm1) * cSrc[0] + + alphaIm1 * cBlend[0]) / 255) / + alphaI]; + cResult1 = state->cmykTransferM[((alphaI - aSrc) * cDest[1] + + aSrc * ((255 - alphaIm1) * cSrc[1] + + alphaIm1 * cBlend[1]) / 255) / + alphaI]; + cResult2 = state->cmykTransferY[((alphaI - aSrc) * cDest[2] + + aSrc * ((255 - alphaIm1) * cSrc[2] + + alphaIm1 * cBlend[2]) / 255) / + alphaI]; + cResult3 = state->cmykTransferK[((alphaI - aSrc) * cDest[3] + + aSrc * ((255 - alphaIm1) * cSrc[3] + + alphaIm1 * cBlend[3]) / 255) / + alphaI]; + } + break; + case splashPipeResultColorAlphaBlendDeviceN: + if (alphaI == 0) { + for (cp = 0; cp < SPOT_NCOMPS+4; cp++) + cResult[cp] = 0; + } else { + for (cp = 0; cp < SPOT_NCOMPS+4; cp++) + cResult[cp] = state->deviceNTransfer[cp][((alphaI - aSrc) * cDest[cp] + + aSrc * ((255 - alphaIm1) * cSrc[cp] + + alphaIm1 * cBlend[cp]) / 255) / + alphaI]; + } + break; +#endif + } + + //----- write destination pixel + + switch (bitmap->mode) { + case splashModeMono1: + if (state->screen->test(pipe->x, pipe->y, cResult0)) { + *pipe->destColorPtr |= pipe->destColorMask; + } else { + *pipe->destColorPtr &= ~pipe->destColorMask; + } + if (!(pipe->destColorMask >>= 1)) { + pipe->destColorMask = 0x80; + ++pipe->destColorPtr; + } + break; + case splashModeMono8: + *pipe->destColorPtr++ = cResult0; + break; + case splashModeRGB8: + *pipe->destColorPtr++ = cResult0; + *pipe->destColorPtr++ = cResult1; + *pipe->destColorPtr++ = cResult2; + break; + case splashModeXBGR8: + *pipe->destColorPtr++ = cResult2; + *pipe->destColorPtr++ = cResult1; + *pipe->destColorPtr++ = cResult0; + *pipe->destColorPtr++ = 255; + break; + case splashModeBGR8: + *pipe->destColorPtr++ = cResult2; + *pipe->destColorPtr++ = cResult1; + *pipe->destColorPtr++ = cResult0; + break; +#if SPLASH_CMYK + case splashModeCMYK8: + if (state->overprintMask & 1) { + pipe->destColorPtr[0] = (state->overprintAdditive) ? + std::min<int>(pipe->destColorPtr[0] + cResult0, 255) : + cResult0; + } + if (state->overprintMask & 2) { + pipe->destColorPtr[1] = (state->overprintAdditive) ? + std::min<int>(pipe->destColorPtr[1] + cResult1, 255) : + cResult1; + } + if (state->overprintMask & 4) { + pipe->destColorPtr[2] = (state->overprintAdditive) ? + std::min<int>(pipe->destColorPtr[2] + cResult2, 255) : + cResult2; + } + if (state->overprintMask & 8) { + pipe->destColorPtr[3] = (state->overprintAdditive) ? + std::min<int>(pipe->destColorPtr[3] + cResult3, 255) : + cResult3; + } + pipe->destColorPtr += 4; + break; + case splashModeDeviceN8: + mask = 1; + for (cp = 0; cp < SPOT_NCOMPS+4; cp++) { + if (state->overprintMask & mask) { + pipe->destColorPtr[cp] = cResult[cp]; + } + mask <<=1; + } + pipe->destColorPtr += (SPOT_NCOMPS+4); + break; +#endif + } + if (pipe->destAlphaPtr) { + *pipe->destAlphaPtr++ = aResult; + } + + } + + ++pipe->x; +} + +// special case: +// !pipe->pattern && pipe->noTransparency && !state->blendFunc && +// bitmap->mode == splashModeMono1 && !pipe->destAlphaPtr) { +void Splash::pipeRunSimpleMono1(SplashPipe *pipe) { + Guchar cResult0; + + //----- write destination pixel + cResult0 = state->grayTransfer[pipe->cSrc[0]]; + if (state->screen->test(pipe->x, pipe->y, cResult0)) { + *pipe->destColorPtr |= pipe->destColorMask; + } else { + *pipe->destColorPtr &= ~pipe->destColorMask; + } + if (!(pipe->destColorMask >>= 1)) { + pipe->destColorMask = 0x80; + ++pipe->destColorPtr; + } + + ++pipe->x; +} + +// special case: +// !pipe->pattern && pipe->noTransparency && !state->blendFunc && +// bitmap->mode == splashModeMono8 && pipe->destAlphaPtr) { +void Splash::pipeRunSimpleMono8(SplashPipe *pipe) { + //----- write destination pixel + *pipe->destColorPtr++ = state->grayTransfer[pipe->cSrc[0]]; + *pipe->destAlphaPtr++ = 255; + + ++pipe->x; +} + +// special case: +// !pipe->pattern && pipe->noTransparency && !state->blendFunc && +// bitmap->mode == splashModeRGB8 && pipe->destAlphaPtr) { +void Splash::pipeRunSimpleRGB8(SplashPipe *pipe) { + //----- write destination pixel + *pipe->destColorPtr++ = state->rgbTransferR[pipe->cSrc[0]]; + *pipe->destColorPtr++ = state->rgbTransferG[pipe->cSrc[1]]; + *pipe->destColorPtr++ = state->rgbTransferB[pipe->cSrc[2]]; + *pipe->destAlphaPtr++ = 255; + + ++pipe->x; +} + +// special case: +// !pipe->pattern && pipe->noTransparency && !state->blendFunc && +// bitmap->mode == splashModeXBGR8 && pipe->destAlphaPtr) { +void Splash::pipeRunSimpleXBGR8(SplashPipe *pipe) { + //----- write destination pixel + *pipe->destColorPtr++ = state->rgbTransferB[pipe->cSrc[2]]; + *pipe->destColorPtr++ = state->rgbTransferG[pipe->cSrc[1]]; + *pipe->destColorPtr++ = state->rgbTransferR[pipe->cSrc[0]]; + *pipe->destColorPtr++ = 255; + *pipe->destAlphaPtr++ = 255; + + ++pipe->x; +} + +// special case: +// !pipe->pattern && pipe->noTransparency && !state->blendFunc && +// bitmap->mode == splashModeBGR8 && pipe->destAlphaPtr) { +void Splash::pipeRunSimpleBGR8(SplashPipe *pipe) { + //----- write destination pixel + *pipe->destColorPtr++ = state->rgbTransferB[pipe->cSrc[2]]; + *pipe->destColorPtr++ = state->rgbTransferG[pipe->cSrc[1]]; + *pipe->destColorPtr++ = state->rgbTransferR[pipe->cSrc[0]]; + *pipe->destAlphaPtr++ = 255; + + ++pipe->x; +} + +#if SPLASH_CMYK +// special case: +// !pipe->pattern && pipe->noTransparency && !state->blendFunc && +// bitmap->mode == splashModeCMYK8 && pipe->destAlphaPtr) { +void Splash::pipeRunSimpleCMYK8(SplashPipe *pipe) { + //----- write destination pixel + if (state->overprintMask & 1) { + pipe->destColorPtr[0] = (state->overprintAdditive) ? + std::min<int>(pipe->destColorPtr[0] + state->cmykTransferC[pipe->cSrc[0]], 255) : + state->cmykTransferC[pipe->cSrc[0]]; + } + if (state->overprintMask & 2) { + pipe->destColorPtr[1] = (state->overprintAdditive) ? + std::min<int>(pipe->destColorPtr[1] + state->cmykTransferM[pipe->cSrc[1]], 255) : + state->cmykTransferM[pipe->cSrc[1]]; + } + if (state->overprintMask & 4) { + pipe->destColorPtr[2] = (state->overprintAdditive) ? + std::min<int>(pipe->destColorPtr[2] + state->cmykTransferY[pipe->cSrc[2]], 255) : + state->cmykTransferY[pipe->cSrc[2]]; + } + if (state->overprintMask & 8) { + pipe->destColorPtr[3] = (state->overprintAdditive) ? + std::min<int>(pipe->destColorPtr[3] + state->cmykTransferK[pipe->cSrc[3]], 255) : + state->cmykTransferK[pipe->cSrc[3]]; + } + pipe->destColorPtr += 4; + *pipe->destAlphaPtr++ = 255; + + ++pipe->x; +} + +// special case: +// !pipe->pattern && pipe->noTransparency && !state->blendFunc && +// bitmap->mode == splashModeDeviceN8 && pipe->destAlphaPtr) { +void Splash::pipeRunSimpleDeviceN8(SplashPipe *pipe) { + //----- write destination pixel + int mask = 1; + for (int cp = 0; cp < SPOT_NCOMPS+4; cp++) { + if (state->overprintMask & mask) { + pipe->destColorPtr[cp] = state->deviceNTransfer[cp][pipe->cSrc[cp]]; + } + mask <<=1; + } + pipe->destColorPtr += (SPOT_NCOMPS+4); + *pipe->destAlphaPtr++ = 255; + + ++pipe->x; +} +#endif + +// special case: +// !pipe->pattern && !pipe->noTransparency && !state->softMask && +// pipe->usesShape && !pipe->alpha0Ptr && !state->blendFunc && +// !pipe->nonIsolatedGroup && +// bitmap->mode == splashModeMono1 && !pipe->destAlphaPtr +void Splash::pipeRunAAMono1(SplashPipe *pipe) { + Guchar aSrc; + SplashColor cDest; + Guchar cResult0; + + //----- read destination pixel + cDest[0] = (*pipe->destColorPtr & pipe->destColorMask) ? 0xff : 0x00; + + //----- source alpha + aSrc = div255(pipe->aInput * pipe->shape); + + //----- result color + // note: aDest = alpha2 = aResult = 0xff + cResult0 = state->grayTransfer[(Guchar)div255((0xff - aSrc) * cDest[0] + + aSrc * pipe->cSrc[0])]; + + //----- write destination pixel + if (state->screen->test(pipe->x, pipe->y, cResult0)) { + *pipe->destColorPtr |= pipe->destColorMask; + } else { + *pipe->destColorPtr &= ~pipe->destColorMask; + } + if (!(pipe->destColorMask >>= 1)) { + pipe->destColorMask = 0x80; + ++pipe->destColorPtr; + } + + ++pipe->x; +} + +// special case: +// !pipe->pattern && !pipe->noTransparency && !state->softMask && +// pipe->usesShape && !pipe->alpha0Ptr && !state->blendFunc && +// !pipe->nonIsolatedGroup && +// bitmap->mode == splashModeMono8 && pipe->destAlphaPtr +void Splash::pipeRunAAMono8(SplashPipe *pipe) { + Guchar aSrc, aDest, alpha2, aResult; + SplashColor cDest; + Guchar cResult0; + + //----- read destination pixel + cDest[0] = *pipe->destColorPtr; + aDest = *pipe->destAlphaPtr; + + //----- source alpha + aSrc = div255(pipe->aInput * pipe->shape); + + //----- result alpha and non-isolated group element correction + aResult = aSrc + aDest - div255(aSrc * aDest); + alpha2 = aResult; + + //----- result color + if (alpha2 == 0) { + cResult0 = 0; + } else { + cResult0 = state->grayTransfer[(Guchar)(((alpha2 - aSrc) * cDest[0] + + aSrc * pipe->cSrc[0]) / alpha2)]; + } + + //----- write destination pixel + *pipe->destColorPtr++ = cResult0; + *pipe->destAlphaPtr++ = aResult; + + ++pipe->x; +} + +// special case: +// !pipe->pattern && !pipe->noTransparency && !state->softMask && +// pipe->usesShape && !pipe->alpha0Ptr && !state->blendFunc && +// !pipe->nonIsolatedGroup && +// bitmap->mode == splashModeRGB8 && pipe->destAlphaPtr +void Splash::pipeRunAARGB8(SplashPipe *pipe) { + Guchar aSrc, aDest, alpha2, aResult; + SplashColor cDest; + Guchar cResult0, cResult1, cResult2; + + //----- read destination pixel + cDest[0] = pipe->destColorPtr[0]; + cDest[1] = pipe->destColorPtr[1]; + cDest[2] = pipe->destColorPtr[2]; + aDest = *pipe->destAlphaPtr; + + //----- source alpha + aSrc = div255(pipe->aInput * pipe->shape); + + //----- result alpha and non-isolated group element correction + aResult = aSrc + aDest - div255(aSrc * aDest); + alpha2 = aResult; + + //----- result color + if (alpha2 == 0) { + cResult0 = 0; + cResult1 = 0; + cResult2 = 0; + } else { + cResult0 = state->rgbTransferR[(Guchar)(((alpha2 - aSrc) * cDest[0] + + aSrc * pipe->cSrc[0]) / alpha2)]; + cResult1 = state->rgbTransferG[(Guchar)(((alpha2 - aSrc) * cDest[1] + + aSrc * pipe->cSrc[1]) / alpha2)]; + cResult2 = state->rgbTransferB[(Guchar)(((alpha2 - aSrc) * cDest[2] + + aSrc * pipe->cSrc[2]) / alpha2)]; + } + + //----- write destination pixel + *pipe->destColorPtr++ = cResult0; + *pipe->destColorPtr++ = cResult1; + *pipe->destColorPtr++ = cResult2; + *pipe->destAlphaPtr++ = aResult; + + ++pipe->x; +} + +// special case: +// !pipe->pattern && !pipe->noTransparency && !state->softMask && +// pipe->usesShape && !pipe->alpha0Ptr && !state->blendFunc && +// !pipe->nonIsolatedGroup && +// bitmap->mode == splashModeXBGR8 && pipe->destAlphaPtr +void Splash::pipeRunAAXBGR8(SplashPipe *pipe) { + Guchar aSrc, aDest, alpha2, aResult; + SplashColor cDest; + Guchar cResult0, cResult1, cResult2; + + //----- read destination pixel + cDest[0] = pipe->destColorPtr[2]; + cDest[1] = pipe->destColorPtr[1]; + cDest[2] = pipe->destColorPtr[0]; + aDest = *pipe->destAlphaPtr; + + //----- source alpha + aSrc = div255(pipe->aInput * pipe->shape); + + //----- result alpha and non-isolated group element correction + aResult = aSrc + aDest - div255(aSrc * aDest); + alpha2 = aResult; + + //----- result color + if (alpha2 == 0) { + cResult0 = 0; + cResult1 = 0; + cResult2 = 0; + } else { + cResult0 = state->rgbTransferR[(Guchar)(((alpha2 - aSrc) * cDest[0] + + aSrc * pipe->cSrc[0]) / alpha2)]; + cResult1 = state->rgbTransferG[(Guchar)(((alpha2 - aSrc) * cDest[1] + + aSrc * pipe->cSrc[1]) / alpha2)]; + cResult2 = state->rgbTransferB[(Guchar)(((alpha2 - aSrc) * cDest[2] + + aSrc * pipe->cSrc[2]) / alpha2)]; + } + + //----- write destination pixel + *pipe->destColorPtr++ = cResult2; + *pipe->destColorPtr++ = cResult1; + *pipe->destColorPtr++ = cResult0; + *pipe->destColorPtr++ = 255; + *pipe->destAlphaPtr++ = aResult; + + ++pipe->x; +} + +// special case: +// !pipe->pattern && !pipe->noTransparency && !state->softMask && +// pipe->usesShape && !pipe->alpha0Ptr && !state->blendFunc && +// !pipe->nonIsolatedGroup && +// bitmap->mode == splashModeBGR8 && pipe->destAlphaPtr +void Splash::pipeRunAABGR8(SplashPipe *pipe) { + Guchar aSrc, aDest, alpha2, aResult; + SplashColor cDest; + Guchar cResult0, cResult1, cResult2; + + //----- read destination pixel + cDest[0] = pipe->destColorPtr[2]; + cDest[1] = pipe->destColorPtr[1]; + cDest[2] = pipe->destColorPtr[0]; + aDest = *pipe->destAlphaPtr; + + //----- source alpha + aSrc = div255(pipe->aInput * pipe->shape); + + //----- result alpha and non-isolated group element correction + aResult = aSrc + aDest - div255(aSrc * aDest); + alpha2 = aResult; + + //----- result color + if (alpha2 == 0) { + cResult0 = 0; + cResult1 = 0; + cResult2 = 0; + } else { + cResult0 = state->rgbTransferR[(Guchar)(((alpha2 - aSrc) * cDest[0] + + aSrc * pipe->cSrc[0]) / alpha2)]; + cResult1 = state->rgbTransferG[(Guchar)(((alpha2 - aSrc) * cDest[1] + + aSrc * pipe->cSrc[1]) / alpha2)]; + cResult2 = state->rgbTransferB[(Guchar)(((alpha2 - aSrc) * cDest[2] + + aSrc * pipe->cSrc[2]) / alpha2)]; + } + + //----- write destination pixel + *pipe->destColorPtr++ = cResult2; + *pipe->destColorPtr++ = cResult1; + *pipe->destColorPtr++ = cResult0; + *pipe->destAlphaPtr++ = aResult; + + ++pipe->x; +} + +#if SPLASH_CMYK +// special case: +// !pipe->pattern && !pipe->noTransparency && !state->softMask && +// pipe->usesShape && !pipe->alpha0Ptr && !state->blendFunc && +// !pipe->nonIsolatedGroup && +// bitmap->mode == splashModeCMYK8 && pipe->destAlphaPtr +void Splash::pipeRunAACMYK8(SplashPipe *pipe) { + Guchar aSrc, aDest, alpha2, aResult; + SplashColor cDest; + Guchar cResult0, cResult1, cResult2, cResult3; + + //----- read destination pixel + cDest[0] = pipe->destColorPtr[0]; + cDest[1] = pipe->destColorPtr[1]; + cDest[2] = pipe->destColorPtr[2]; + cDest[3] = pipe->destColorPtr[3]; + aDest = *pipe->destAlphaPtr; + + //----- source alpha + aSrc = div255(pipe->aInput * pipe->shape); + + //----- result alpha and non-isolated group element correction + aResult = aSrc + aDest - div255(aSrc * aDest); + alpha2 = aResult; + + //----- result color + if (alpha2 == 0) { + cResult0 = 0; + cResult1 = 0; + cResult2 = 0; + cResult3 = 0; + } else { + cResult0 = state->cmykTransferC[(Guchar)(((alpha2 - aSrc) * cDest[0] + + aSrc * pipe->cSrc[0]) / alpha2)]; + cResult1 = state->cmykTransferM[(Guchar)(((alpha2 - aSrc) * cDest[1] + + aSrc * pipe->cSrc[1]) / alpha2)]; + cResult2 = state->cmykTransferY[(Guchar)(((alpha2 - aSrc) * cDest[2] + + aSrc * pipe->cSrc[2]) / alpha2)]; + cResult3 = state->cmykTransferK[(Guchar)(((alpha2 - aSrc) * cDest[3] + + aSrc * pipe->cSrc[3]) / alpha2)]; + } + + //----- write destination pixel + if (state->overprintMask & 1) { + pipe->destColorPtr[0] = (state->overprintAdditive && pipe->shape != 0) ? + std::min<int>(pipe->destColorPtr[0] + cResult0, 255) : + cResult0; + } + if (state->overprintMask & 2) { + pipe->destColorPtr[1] = (state->overprintAdditive && pipe->shape != 0) ? + std::min<int>(pipe->destColorPtr[1] + cResult1, 255) : + cResult1; + } + if (state->overprintMask & 4) { + pipe->destColorPtr[2] = (state->overprintAdditive && pipe->shape != 0) ? + std::min<int>(pipe->destColorPtr[2] + cResult2, 255) : + cResult2; + } + if (state->overprintMask & 8) { + pipe->destColorPtr[3] = (state->overprintAdditive && pipe->shape != 0) ? + std::min<int>(pipe->destColorPtr[3] + cResult3, 255) : + cResult3; + } + pipe->destColorPtr += 4; + *pipe->destAlphaPtr++ = aResult; + + ++pipe->x; +} + +// special case: +// !pipe->pattern && !pipe->noTransparency && !state->softMask && +// pipe->usesShape && !pipe->alpha0Ptr && !state->blendFunc && +// !pipe->nonIsolatedGroup && +// bitmap->mode == splashModeDeviceN8 && pipe->destAlphaPtr +void Splash::pipeRunAADeviceN8(SplashPipe *pipe) { + Guchar aSrc, aDest, alpha2, aResult; + SplashColor cDest; + Guchar cResult[SPOT_NCOMPS+4]; + int cp, mask; + + //----- read destination pixel + for (cp=0; cp < SPOT_NCOMPS+4; cp++) + cDest[cp] = pipe->destColorPtr[cp]; + aDest = *pipe->destAlphaPtr; + + //----- source alpha + aSrc = div255(pipe->aInput * pipe->shape); + + //----- result alpha and non-isolated group element correction + aResult = aSrc + aDest - div255(aSrc * aDest); + alpha2 = aResult; + + //----- result color + if (alpha2 == 0) { + for (cp=0; cp < SPOT_NCOMPS+4; cp++) + cResult[cp] = 0; + } else { + for (cp=0; cp < SPOT_NCOMPS+4; cp++) + cResult[cp] = state->deviceNTransfer[cp][(Guchar)(((alpha2 - aSrc) * cDest[cp] + + aSrc * pipe->cSrc[cp]) / alpha2)]; + } + + //----- write destination pixel + mask = 1; + for (cp=0; cp < SPOT_NCOMPS+4; cp++) { + if (state->overprintMask & mask) { + pipe->destColorPtr[cp] = cResult[cp]; + } + mask <<= 1; + } + pipe->destColorPtr += (SPOT_NCOMPS+4); + *pipe->destAlphaPtr++ = aResult; + + ++pipe->x; +} +#endif + +inline void Splash::pipeSetXY(SplashPipe *pipe, int x, int y) { + pipe->x = x; + pipe->y = y; + if (state->softMask) { + pipe->softMaskPtr = + &state->softMask->data[y * state->softMask->rowSize + x]; + } + switch (bitmap->mode) { + case splashModeMono1: + pipe->destColorPtr = &bitmap->data[y * bitmap->rowSize + (x >> 3)]; + pipe->destColorMask = 0x80 >> (x & 7); + break; + case splashModeMono8: + pipe->destColorPtr = &bitmap->data[y * bitmap->rowSize + x]; + break; + case splashModeRGB8: + case splashModeBGR8: + pipe->destColorPtr = &bitmap->data[y * bitmap->rowSize + 3 * x]; + break; + case splashModeXBGR8: + pipe->destColorPtr = &bitmap->data[y * bitmap->rowSize + 4 * x]; + break; +#if SPLASH_CMYK + case splashModeCMYK8: + pipe->destColorPtr = &bitmap->data[y * bitmap->rowSize + 4 * x]; + break; + case splashModeDeviceN8: + pipe->destColorPtr = &bitmap->data[y * bitmap->rowSize + (SPOT_NCOMPS + 4) * x]; + break; +#endif + } + if (bitmap->alpha) { + pipe->destAlphaPtr = &bitmap->alpha[y * bitmap->width + x]; + } else { + pipe->destAlphaPtr = NULL; + } + if (state->inNonIsolatedGroup && alpha0Bitmap->alpha) { + pipe->alpha0Ptr = + &alpha0Bitmap->alpha[(alpha0Y + y) * alpha0Bitmap->width + + (alpha0X + x)]; + } else { + pipe->alpha0Ptr = NULL; + } +} + +inline void Splash::pipeIncX(SplashPipe *pipe) { + ++pipe->x; + if (state->softMask) { + ++pipe->softMaskPtr; + } + switch (bitmap->mode) { + case splashModeMono1: + if (!(pipe->destColorMask >>= 1)) { + pipe->destColorMask = 0x80; + ++pipe->destColorPtr; + } + break; + case splashModeMono8: + ++pipe->destColorPtr; + break; + case splashModeRGB8: + case splashModeBGR8: + pipe->destColorPtr += 3; + break; + case splashModeXBGR8: + pipe->destColorPtr += 4; + break; +#if SPLASH_CMYK + case splashModeCMYK8: + pipe->destColorPtr += 4; + break; + case splashModeDeviceN8: + pipe->destColorPtr += (SPOT_NCOMPS+4); + break; +#endif + } + if (pipe->destAlphaPtr) { + ++pipe->destAlphaPtr; + } + if (pipe->alpha0Ptr) { + ++pipe->alpha0Ptr; + } +} + +inline void Splash::drawPixel(SplashPipe *pipe, int x, int y, GBool noClip) { + if (unlikely(y < 0)) + return; + + if (noClip || state->clip->test(x, y)) { + pipeSetXY(pipe, x, y); + (this->*pipe->run)(pipe); + updateModX(x); + updateModY(y); + } +} + +inline void Splash::drawAAPixelInit() { + aaBufY = -1; +} + +inline void Splash::drawAAPixel(SplashPipe *pipe, int x, int y) { +#if splashAASize == 4 + static int bitCount4[16] = { 0, 1, 1, 2, 1, 2, 2, 3, + 1, 2, 2, 3, 2, 3, 3, 4 }; + int w; +#else + int xx, yy; +#endif + SplashColorPtr p; + int x0, x1, t; + + if (x < 0 || x >= bitmap->width || + y < state->clip->getYMinI() || y > state->clip->getYMaxI()) { + return; + } + + // update aaBuf + if (y != aaBufY) { + memset(aaBuf->getDataPtr(), 0xff, + aaBuf->getRowSize() * aaBuf->getHeight()); + x0 = 0; + x1 = bitmap->width - 1; + state->clip->clipAALine(aaBuf, &x0, &x1, y); + aaBufY = y; + } + + // compute the shape value +#if splashAASize == 4 + p = aaBuf->getDataPtr() + (x >> 1); + w = aaBuf->getRowSize(); + if (x & 1) { + t = bitCount4[*p & 0x0f] + bitCount4[p[w] & 0x0f] + + bitCount4[p[2*w] & 0x0f] + bitCount4[p[3*w] & 0x0f]; + } else { + t = bitCount4[*p >> 4] + bitCount4[p[w] >> 4] + + bitCount4[p[2*w] >> 4] + bitCount4[p[3*w] >> 4]; + } +#else + t = 0; + for (yy = 0; yy < splashAASize; ++yy) { + for (xx = 0; xx < splashAASize; ++xx) { + p = aaBuf->getDataPtr() + yy * aaBuf->getRowSize() + + ((x * splashAASize + xx) >> 3); + t += (*p >> (7 - ((x * splashAASize + xx) & 7))) & 1; + } + } +#endif + + // draw the pixel + if (t != 0) { + pipeSetXY(pipe, x, y); + pipe->shape = div255(aaGamma[t] * pipe->shape); + (this->*pipe->run)(pipe); + updateModX(x); + updateModY(y); + } +} + +inline void Splash::drawSpan(SplashPipe *pipe, int x0, int x1, int y, + GBool noClip) { + int x; + + if (noClip) { + pipeSetXY(pipe, x0, y); + for (x = x0; x <= x1; ++x) { + (this->*pipe->run)(pipe); + } + updateModX(x0); + updateModX(x1); + updateModY(y); + } else { + if (x0 < state->clip->getXMinI()) { + x0 = state->clip->getXMinI(); + } + if (x1 > state->clip->getXMaxI()) { + x1 = state->clip->getXMaxI(); + } + pipeSetXY(pipe, x0, y); + for (x = x0; x <= x1; ++x) { + if (state->clip->test(x, y)) { + (this->*pipe->run)(pipe); + updateModX(x); + updateModY(y); + } else { + pipeIncX(pipe); + } + } + } +} + +inline void Splash::drawAALine(SplashPipe *pipe, int x0, int x1, int y, GBool adjustLine, Guchar lineOpacity) { +#if splashAASize == 4 + static int bitCount4[16] = { 0, 1, 1, 2, 1, 2, 2, 3, + 1, 2, 2, 3, 2, 3, 3, 4 }; + SplashColorPtr p0, p1, p2, p3; + int t; +#else + SplashColorPtr p; + int xx, yy, t; +#endif + int x; + +#if splashAASize == 4 + p0 = aaBuf->getDataPtr() + (x0 >> 1); + p1 = p0 + aaBuf->getRowSize(); + p2 = p1 + aaBuf->getRowSize(); + p3 = p2 + aaBuf->getRowSize(); +#endif + pipeSetXY(pipe, x0, y); + for (x = x0; x <= x1; ++x) { + + // compute the shape value +#if splashAASize == 4 + if (x & 1) { + t = bitCount4[*p0 & 0x0f] + bitCount4[*p1 & 0x0f] + + bitCount4[*p2 & 0x0f] + bitCount4[*p3 & 0x0f]; + ++p0; ++p1; ++p2; ++p3; + } else { + t = bitCount4[*p0 >> 4] + bitCount4[*p1 >> 4] + + bitCount4[*p2 >> 4] + bitCount4[*p3 >> 4]; + } +#else + t = 0; + for (yy = 0; yy < splashAASize; ++yy) { + for (xx = 0; xx < splashAASize; ++xx) { + p = aaBuf->getDataPtr() + yy * aaBuf->getRowSize() + + ((x * splashAASize + xx) >> 3); + t += (*p >> (7 - ((x * splashAASize + xx) & 7))) & 1; + } + } +#endif + + if (t != 0) { + pipe->shape = (adjustLine) ? div255((int) lineOpacity * (double)aaGamma[t]) : (double)aaGamma[t]; + (this->*pipe->run)(pipe); + updateModX(x); + updateModY(y); + } else { + pipeIncX(pipe); + } + } +} + +//------------------------------------------------------------------------ + +// Transform a point from user space to device space. +inline void Splash::transform(SplashCoord *matrix, + SplashCoord xi, SplashCoord yi, + SplashCoord *xo, SplashCoord *yo) { + // [ m[0] m[1] 0 ] + // [xo yo 1] = [xi yi 1] * [ m[2] m[3] 0 ] + // [ m[4] m[5] 1 ] + *xo = xi * matrix[0] + yi * matrix[2] + matrix[4]; + *yo = xi * matrix[1] + yi * matrix[3] + matrix[5]; +} + +//------------------------------------------------------------------------ +// Splash +//------------------------------------------------------------------------ + +Splash::Splash(SplashBitmap *bitmapA, GBool vectorAntialiasA, + SplashScreenParams *screenParams) { + int i; + + bitmap = bitmapA; + vectorAntialias = vectorAntialiasA; + inShading = gFalse; + state = new SplashState(bitmap->width, bitmap->height, vectorAntialias, + screenParams); + if (vectorAntialias) { + aaBuf = new SplashBitmap(splashAASize * bitmap->width, splashAASize, + 1, splashModeMono1, gFalse); + for (i = 0; i <= splashAASize * splashAASize; ++i) { + aaGamma[i] = (Guchar)splashRound( + splashPow((SplashCoord)i / + (SplashCoord)(splashAASize * splashAASize), + splashAAGamma) * 255); + } + } else { + aaBuf = NULL; + } + minLineWidth = 0; + thinLineMode = splashThinLineDefault; + clearModRegion(); + debugMode = gFalse; + alpha0Bitmap = NULL; +} + +Splash::Splash(SplashBitmap *bitmapA, GBool vectorAntialiasA, + SplashScreen *screenA) { + int i; + + bitmap = bitmapA; + inShading = gFalse; + vectorAntialias = vectorAntialiasA; + state = new SplashState(bitmap->width, bitmap->height, vectorAntialias, + screenA); + if (vectorAntialias) { + aaBuf = new SplashBitmap(splashAASize * bitmap->width, splashAASize, + 1, splashModeMono1, gFalse); + for (i = 0; i <= splashAASize * splashAASize; ++i) { + aaGamma[i] = (Guchar)splashRound( + splashPow((SplashCoord)i / + (SplashCoord)(splashAASize * splashAASize), + splashAAGamma) * 255); + } + } else { + aaBuf = NULL; + } + minLineWidth = 0; + thinLineMode = splashThinLineDefault; + clearModRegion(); + debugMode = gFalse; + alpha0Bitmap = NULL; +} + +Splash::~Splash() { + while (state->next) { + restoreState(); + } + delete state; + if (vectorAntialias) { + delete aaBuf; + } +} + +//------------------------------------------------------------------------ +// state read +//------------------------------------------------------------------------ + +SplashCoord *Splash::getMatrix() { + return state->matrix; +} + +SplashPattern *Splash::getStrokePattern() { + return state->strokePattern; +} + +SplashPattern *Splash::getFillPattern() { + return state->fillPattern; +} + +SplashScreen *Splash::getScreen() { + return state->screen; +} + +SplashBlendFunc Splash::getBlendFunc() { + return state->blendFunc; +} + +SplashCoord Splash::getStrokeAlpha() { + return state->strokeAlpha; +} + +SplashCoord Splash::getFillAlpha() { + return state->fillAlpha; +} + +SplashCoord Splash::getLineWidth() { + return state->lineWidth; +} + +int Splash::getLineCap() { + return state->lineCap; +} + +int Splash::getLineJoin() { + return state->lineJoin; +} + +SplashCoord Splash::getMiterLimit() { + return state->miterLimit; +} + +SplashCoord Splash::getFlatness() { + return state->flatness; +} + +SplashCoord *Splash::getLineDash() { + return state->lineDash; +} + +int Splash::getLineDashLength() { + return state->lineDashLength; +} + +SplashCoord Splash::getLineDashPhase() { + return state->lineDashPhase; +} + +GBool Splash::getStrokeAdjust() { + return state->strokeAdjust; +} + +SplashClip *Splash::getClip() { + return state->clip; +} + +SplashBitmap *Splash::getSoftMask() { + return state->softMask; +} + +GBool Splash::getInNonIsolatedGroup() { + return state->inNonIsolatedGroup; +} + +//------------------------------------------------------------------------ +// state write +//------------------------------------------------------------------------ + +void Splash::setMatrix(SplashCoord *matrix) { + memcpy(state->matrix, matrix, 6 * sizeof(SplashCoord)); +} + +void Splash::setStrokePattern(SplashPattern *strokePattern) { + state->setStrokePattern(strokePattern); +} + +void Splash::setFillPattern(SplashPattern *fillPattern) { + state->setFillPattern(fillPattern); +} + +void Splash::setScreen(SplashScreen *screen) { + state->setScreen(screen); +} + +void Splash::setBlendFunc(SplashBlendFunc func) { + state->blendFunc = func; +} + +void Splash::setStrokeAlpha(SplashCoord alpha) { + state->strokeAlpha = alpha; +} + +void Splash::setFillAlpha(SplashCoord alpha) { + state->fillAlpha = alpha; +} + +void Splash::setFillOverprint(GBool fop) { + state->fillOverprint = fop; +} + +void Splash::setStrokeOverprint(GBool gop) { + state->strokeOverprint = gop; +} + +void Splash::setOverprintMode(int opm) { + state->overprintMode = opm; +} + +void Splash::setLineWidth(SplashCoord lineWidth) { + state->lineWidth = lineWidth; +} + +void Splash::setLineCap(int lineCap) { + state->lineCap = lineCap; +} + +void Splash::setLineJoin(int lineJoin) { + state->lineJoin = lineJoin; +} + +void Splash::setMiterLimit(SplashCoord miterLimit) { + state->miterLimit = miterLimit; +} + +void Splash::setFlatness(SplashCoord flatness) { + if (flatness < 1) { + state->flatness = 1; + } else { + state->flatness = flatness; + } +} + +void Splash::setLineDash(SplashCoord *lineDash, int lineDashLength, + SplashCoord lineDashPhase) { + state->setLineDash(lineDash, lineDashLength, lineDashPhase); +} + +void Splash::setStrokeAdjust(GBool strokeAdjust) { + state->strokeAdjust = strokeAdjust; +} + +void Splash::clipResetToRect(SplashCoord x0, SplashCoord y0, + SplashCoord x1, SplashCoord y1) { + state->clip->resetToRect(x0, y0, x1, y1); +} + +SplashError Splash::clipToRect(SplashCoord x0, SplashCoord y0, + SplashCoord x1, SplashCoord y1) { + return state->clip->clipToRect(x0, y0, x1, y1); +} + +SplashError Splash::clipToPath(SplashPath *path, GBool eo) { + return state->clip->clipToPath(path, state->matrix, state->flatness, eo); +} + +void Splash::setSoftMask(SplashBitmap *softMask) { + state->setSoftMask(softMask); +} + +void Splash::setInNonIsolatedGroup(SplashBitmap *alpha0BitmapA, + int alpha0XA, int alpha0YA) { + alpha0Bitmap = alpha0BitmapA; + alpha0X = alpha0XA; + alpha0Y = alpha0YA; + state->inNonIsolatedGroup = gTrue; +} + +void Splash::setTransfer(Guchar *red, Guchar *green, Guchar *blue, + Guchar *gray) { + state->setTransfer(red, green, blue, gray); +} + +void Splash::setOverprintMask(Guint overprintMask, GBool additive) { + state->overprintMask = overprintMask; + state->overprintAdditive = additive; +} + +//------------------------------------------------------------------------ +// state save/restore +//------------------------------------------------------------------------ + +void Splash::saveState() { + SplashState *newState; + + newState = state->copy(); + newState->next = state; + state = newState; +} + +SplashError Splash::restoreState() { + SplashState *oldState; + + if (!state->next) { + return splashErrNoSave; + } + oldState = state; + state = state->next; + delete oldState; + return splashOk; +} + +//------------------------------------------------------------------------ +// drawing operations +//------------------------------------------------------------------------ + +void Splash::clear(SplashColorPtr color, Guchar alpha) { + SplashColorPtr row, p; + Guchar mono; + int x, y; + + switch (bitmap->mode) { + case splashModeMono1: + mono = (color[0] & 0x80) ? 0xff : 0x00; + if (bitmap->rowSize < 0) { + memset(bitmap->data + bitmap->rowSize * (bitmap->height - 1), + mono, -bitmap->rowSize * bitmap->height); + } else { + memset(bitmap->data, mono, bitmap->rowSize * bitmap->height); + } + break; + case splashModeMono8: + if (bitmap->rowSize < 0) { + memset(bitmap->data + bitmap->rowSize * (bitmap->height - 1), + color[0], -bitmap->rowSize * bitmap->height); + } else { + memset(bitmap->data, color[0], bitmap->rowSize * bitmap->height); + } + break; + case splashModeRGB8: + if (color[0] == color[1] && color[1] == color[2]) { + if (bitmap->rowSize < 0) { + memset(bitmap->data + bitmap->rowSize * (bitmap->height - 1), + color[0], -bitmap->rowSize * bitmap->height); + } else { + memset(bitmap->data, color[0], bitmap->rowSize * bitmap->height); + } + } else { + row = bitmap->data; + for (y = 0; y < bitmap->height; ++y) { + p = row; + for (x = 0; x < bitmap->width; ++x) { + *p++ = color[2]; + *p++ = color[1]; + *p++ = color[0]; + } + row += bitmap->rowSize; + } + } + break; + case splashModeXBGR8: + if (color[0] == color[1] && color[1] == color[2]) { + if (bitmap->rowSize < 0) { + memset(bitmap->data + bitmap->rowSize * (bitmap->height - 1), + color[0], -bitmap->rowSize * bitmap->height); + } else { + memset(bitmap->data, color[0], bitmap->rowSize * bitmap->height); + } + } else { + row = bitmap->data; + for (y = 0; y < bitmap->height; ++y) { + p = row; + for (x = 0; x < bitmap->width; ++x) { + *p++ = color[0]; + *p++ = color[1]; + *p++ = color[2]; + *p++ = 255; + } + row += bitmap->rowSize; + } + } + break; + case splashModeBGR8: + if (color[0] == color[1] && color[1] == color[2]) { + if (bitmap->rowSize < 0) { + memset(bitmap->data + bitmap->rowSize * (bitmap->height - 1), + color[0], -bitmap->rowSize * bitmap->height); + } else { + memset(bitmap->data, color[0], bitmap->rowSize * bitmap->height); + } + } else { + row = bitmap->data; + for (y = 0; y < bitmap->height; ++y) { + p = row; + for (x = 0; x < bitmap->width; ++x) { + *p++ = color[0]; + *p++ = color[1]; + *p++ = color[2]; + } + row += bitmap->rowSize; + } + } + break; +#if SPLASH_CMYK + case splashModeCMYK8: + if (color[0] == color[1] && color[1] == color[2] && color[2] == color[3]) { + if (bitmap->rowSize < 0) { + memset(bitmap->data + bitmap->rowSize * (bitmap->height - 1), + color[0], -bitmap->rowSize * bitmap->height); + } else { + memset(bitmap->data, color[0], bitmap->rowSize * bitmap->height); + } + } else { + row = bitmap->data; + for (y = 0; y < bitmap->height; ++y) { + p = row; + for (x = 0; x < bitmap->width; ++x) { + *p++ = color[0]; + *p++ = color[1]; + *p++ = color[2]; + *p++ = color[3]; + } + row += bitmap->rowSize; + } + } + break; + case splashModeDeviceN8: + row = bitmap->data; + for (y = 0; y < bitmap->height; ++y) { + p = row; + for (x = 0; x < bitmap->width; ++x) { + for (int cp = 0; cp < SPOT_NCOMPS+4; cp++) + *p++ = color[cp]; + } + row += bitmap->rowSize; + } + break; +#endif + } + + if (bitmap->alpha) { + memset(bitmap->alpha, alpha, bitmap->width * bitmap->height); + } + + updateModX(0); + updateModY(0); + updateModX(bitmap->width - 1); + updateModY(bitmap->height - 1); +} + +SplashError Splash::stroke(SplashPath *path) { + SplashPath *path2, *dPath; + SplashCoord d1, d2, t1, t2, w; + + if (debugMode) { + printf("stroke [dash:%d] [width:%.2f]:\n", + state->lineDashLength, (double)state->lineWidth); + dumpPath(path); + } + opClipRes = splashClipAllOutside; + if (path->length == 0) { + return splashErrEmptyPath; + } + path2 = flattenPath(path, state->matrix, state->flatness); + if (state->lineDashLength > 0) { + dPath = makeDashedPath(path2); + delete path2; + path2 = dPath; + if (path2->length == 0) { + delete path2; + return splashErrEmptyPath; + } + } + + // transform a unit square, and take the half the max of the two + // diagonals; the product of this number and the line width is the + // (approximate) transformed line width + t1 = state->matrix[0] + state->matrix[2]; + t2 = state->matrix[1] + state->matrix[3]; + d1 = t1 * t1 + t2 * t2; + t1 = state->matrix[0] - state->matrix[2]; + t2 = state->matrix[1] - state->matrix[3]; + d2 = t1 * t1 + t2 * t2; + if (d2 > d1) { + d1 = d2; + } + d1 *= 0.5; + if (d1 > 0 && + d1 * state->lineWidth * state->lineWidth < minLineWidth * minLineWidth) { + w = minLineWidth / splashSqrt(d1); + strokeWide(path2, w); + } else if (bitmap->mode == splashModeMono1) { + // this gets close to Adobe's behavior in mono mode + if (d1 * state->lineWidth <= 2) { + strokeNarrow(path2); + } else { + strokeWide(path2, state->lineWidth); + } + } else { + if (state->lineWidth == 0) { + strokeNarrow(path2); + } else { + strokeWide(path2, state->lineWidth); + } + } + + delete path2; + return splashOk; +} + +void Splash::strokeNarrow(SplashPath *path) { + SplashPipe pipe; + SplashXPath *xPath; + SplashXPathSeg *seg; + int x0, x1, y0, y1, xa, xb, y; + SplashCoord dxdy; + SplashClipResult clipRes; + int nClipRes[3]; + int i; + + nClipRes[0] = nClipRes[1] = nClipRes[2] = 0; + + xPath = new SplashXPath(path, state->matrix, state->flatness, gFalse); + + pipeInit(&pipe, 0, 0, state->strokePattern, NULL, + (Guchar)splashRound(state->strokeAlpha * 255), + gFalse, gFalse); + + for (i = 0, seg = xPath->segs; i < xPath->length; ++i, ++seg) { + if (seg->y0 <= seg->y1) { + y0 = splashFloor(seg->y0); + y1 = splashFloor(seg->y1); + x0 = splashFloor(seg->x0); + x1 = splashFloor(seg->x1); + } else { + y0 = splashFloor(seg->y1); + y1 = splashFloor(seg->y0); + x0 = splashFloor(seg->x1); + x1 = splashFloor(seg->x0); + } + if ((clipRes = state->clip->testRect(x0 <= x1 ? x0 : x1, y0, + x0 <= x1 ? x1 : x0, y1)) + != splashClipAllOutside) { + if (y0 == y1) { + if (x0 <= x1) { + drawSpan(&pipe, x0, x1, y0, clipRes == splashClipAllInside); + } else { + drawSpan(&pipe, x1, x0, y0, clipRes == splashClipAllInside); + } + } else { + dxdy = seg->dxdy; + if (y0 < state->clip->getYMinI()) { + y0 = state->clip->getYMinI(); + x0 = splashFloor(seg->x0 + ((SplashCoord)y0 - seg->y0) * dxdy); + } + if (y1 > state->clip->getYMaxI()) { + y1 = state->clip->getYMaxI(); + x1 = splashFloor(seg->x0 + ((SplashCoord)y1 - seg->y0) * dxdy); + } + if (x0 <= x1) { + xa = x0; + for (y = y0; y <= y1; ++y) { + if (y < y1) { + xb = splashFloor(seg->x0 + + ((SplashCoord)y + 1 - seg->y0) * dxdy); + } else { + xb = x1 + 1; + } + if (xa == xb) { + drawPixel(&pipe, xa, y, clipRes == splashClipAllInside); + } else { + drawSpan(&pipe, xa, xb - 1, y, clipRes == splashClipAllInside); + } + xa = xb; + } + } else { + xa = x0; + for (y = y0; y <= y1; ++y) { + if (y < y1) { + xb = splashFloor(seg->x0 + + ((SplashCoord)y + 1 - seg->y0) * dxdy); + } else { + xb = x1 - 1; + } + if (xa == xb) { + drawPixel(&pipe, xa, y, clipRes == splashClipAllInside); + } else { + drawSpan(&pipe, xb + 1, xa, y, clipRes == splashClipAllInside); + } + xa = xb; + } + } + } + } + ++nClipRes[clipRes]; + } + if (nClipRes[splashClipPartial] || + (nClipRes[splashClipAllInside] && nClipRes[splashClipAllOutside])) { + opClipRes = splashClipPartial; + } else if (nClipRes[splashClipAllInside]) { + opClipRes = splashClipAllInside; + } else { + opClipRes = splashClipAllOutside; + } + + delete xPath; +} + +void Splash::strokeWide(SplashPath *path, SplashCoord w) { + SplashPath *path2; + + path2 = makeStrokePath(path, w, gFalse); + fillWithPattern(path2, gFalse, state->strokePattern, state->strokeAlpha); + delete path2; +} + +SplashPath *Splash::flattenPath(SplashPath *path, SplashCoord *matrix, + SplashCoord flatness) { + SplashPath *fPath; + SplashCoord flatness2; + Guchar flag; + int i; + + fPath = new SplashPath(); +#if USE_FIXEDPOINT + flatness2 = flatness; +#else + flatness2 = flatness * flatness; +#endif + i = 0; + while (i < path->length) { + flag = path->flags[i]; + if (flag & splashPathFirst) { + fPath->moveTo(path->pts[i].x, path->pts[i].y); + ++i; + } else { + if (flag & splashPathCurve) { + flattenCurve(path->pts[i-1].x, path->pts[i-1].y, + path->pts[i ].x, path->pts[i ].y, + path->pts[i+1].x, path->pts[i+1].y, + path->pts[i+2].x, path->pts[i+2].y, + matrix, flatness2, fPath); + i += 3; + } else { + fPath->lineTo(path->pts[i].x, path->pts[i].y); + ++i; + } + if (path->flags[i-1] & splashPathClosed) { + fPath->close(); + } + } + } + return fPath; +} + +void Splash::flattenCurve(SplashCoord x0, SplashCoord y0, + SplashCoord x1, SplashCoord y1, + SplashCoord x2, SplashCoord y2, + SplashCoord x3, SplashCoord y3, + SplashCoord *matrix, SplashCoord flatness2, + SplashPath *fPath) { + SplashCoord cx[splashMaxCurveSplits + 1][3]; + SplashCoord cy[splashMaxCurveSplits + 1][3]; + int cNext[splashMaxCurveSplits + 1]; + SplashCoord xl0, xl1, xl2, xr0, xr1, xr2, xr3, xx1, xx2, xh; + SplashCoord yl0, yl1, yl2, yr0, yr1, yr2, yr3, yy1, yy2, yh; + SplashCoord dx, dy, mx, my, tx, ty, d1, d2; + int p1, p2, p3; + + // initial segment + p1 = 0; + p2 = splashMaxCurveSplits; + cx[p1][0] = x0; cy[p1][0] = y0; + cx[p1][1] = x1; cy[p1][1] = y1; + cx[p1][2] = x2; cy[p1][2] = y2; + cx[p2][0] = x3; cy[p2][0] = y3; + cNext[p1] = p2; + + while (p1 < splashMaxCurveSplits) { + + // get the next segment + xl0 = cx[p1][0]; yl0 = cy[p1][0]; + xx1 = cx[p1][1]; yy1 = cy[p1][1]; + xx2 = cx[p1][2]; yy2 = cy[p1][2]; + p2 = cNext[p1]; + xr3 = cx[p2][0]; yr3 = cy[p2][0]; + + // compute the distances (in device space) from the control points + // to the midpoint of the straight line (this is a bit of a hack, + // but it's much faster than computing the actual distances to the + // line) + transform(matrix, (xl0 + xr3) * 0.5, (yl0 + yr3) * 0.5, &mx, &my); + transform(matrix, xx1, yy1, &tx, &ty); +#if USE_FIXEDPOINT + d1 = splashDist(tx, ty, mx, my); +#else + dx = tx - mx; + dy = ty - my; + d1 = dx*dx + dy*dy; +#endif + transform(matrix, xx2, yy2, &tx, &ty); +#if USE_FIXEDPOINT + d2 = splashDist(tx, ty, mx, my); +#else + dx = tx - mx; + dy = ty - my; + d2 = dx*dx + dy*dy; +#endif + + // if the curve is flat enough, or no more subdivisions are + // allowed, add the straight line segment + if (p2 - p1 == 1 || (d1 <= flatness2 && d2 <= flatness2)) { + fPath->lineTo(xr3, yr3); + p1 = p2; + + // otherwise, subdivide the curve + } else { + xl1 = splashAvg(xl0, xx1); + yl1 = splashAvg(yl0, yy1); + xh = splashAvg(xx1, xx2); + yh = splashAvg(yy1, yy2); + xl2 = splashAvg(xl1, xh); + yl2 = splashAvg(yl1, yh); + xr2 = splashAvg(xx2, xr3); + yr2 = splashAvg(yy2, yr3); + xr1 = splashAvg(xh, xr2); + yr1 = splashAvg(yh, yr2); + xr0 = splashAvg(xl2, xr1); + yr0 = splashAvg(yl2, yr1); + // add the new subdivision points + p3 = (p1 + p2) / 2; + cx[p1][1] = xl1; cy[p1][1] = yl1; + cx[p1][2] = xl2; cy[p1][2] = yl2; + cNext[p1] = p3; + cx[p3][0] = xr0; cy[p3][0] = yr0; + cx[p3][1] = xr1; cy[p3][1] = yr1; + cx[p3][2] = xr2; cy[p3][2] = yr2; + cNext[p3] = p2; + } + } +} + +SplashPath *Splash::makeDashedPath(SplashPath *path) { + SplashPath *dPath; + SplashCoord lineDashTotal; + SplashCoord lineDashStartPhase, lineDashDist, segLen; + SplashCoord x0, y0, x1, y1, xa, ya; + GBool lineDashStartOn, lineDashOn, newPath; + int lineDashStartIdx, lineDashIdx; + int i, j, k; + + lineDashTotal = 0; + for (i = 0; i < state->lineDashLength; ++i) { + lineDashTotal += state->lineDash[i]; + } + // Acrobat simply draws nothing if the dash array is [0] + if (lineDashTotal == 0) { + return new SplashPath(); + } + lineDashStartPhase = state->lineDashPhase; + i = splashFloor(lineDashStartPhase / lineDashTotal); + lineDashStartPhase -= (SplashCoord)i * lineDashTotal; + lineDashStartOn = gTrue; + lineDashStartIdx = 0; + if (lineDashStartPhase > 0) { + while (lineDashStartIdx < state->lineDashLength && lineDashStartPhase >= state->lineDash[lineDashStartIdx]) { + lineDashStartOn = !lineDashStartOn; + lineDashStartPhase -= state->lineDash[lineDashStartIdx]; + ++lineDashStartIdx; + } + if (unlikely(lineDashStartIdx == state->lineDashLength)) { + return new SplashPath(); + } + } + + dPath = new SplashPath(); + + // process each subpath + i = 0; + while (i < path->length) { + + // find the end of the subpath + for (j = i; + j < path->length - 1 && !(path->flags[j] & splashPathLast); + ++j) ; + + // initialize the dash parameters + lineDashOn = lineDashStartOn; + lineDashIdx = lineDashStartIdx; + lineDashDist = state->lineDash[lineDashIdx] - lineDashStartPhase; + + // process each segment of the subpath + newPath = gTrue; + for (k = i; k < j; ++k) { + + // grab the segment + x0 = path->pts[k].x; + y0 = path->pts[k].y; + x1 = path->pts[k+1].x; + y1 = path->pts[k+1].y; + segLen = splashDist(x0, y0, x1, y1); + + // process the segment + while (segLen > 0) { + + if (lineDashDist >= segLen) { + if (lineDashOn) { + if (newPath) { + dPath->moveTo(x0, y0); + newPath = gFalse; + } + dPath->lineTo(x1, y1); + } + lineDashDist -= segLen; + segLen = 0; + + } else { + xa = x0 + (lineDashDist / segLen) * (x1 - x0); + ya = y0 + (lineDashDist / segLen) * (y1 - y0); + if (lineDashOn) { + if (newPath) { + dPath->moveTo(x0, y0); + newPath = gFalse; + } + dPath->lineTo(xa, ya); + } + x0 = xa; + y0 = ya; + segLen -= lineDashDist; + lineDashDist = 0; + } + + // get the next entry in the dash array + if (lineDashDist <= 0) { + lineDashOn = !lineDashOn; + if (++lineDashIdx == state->lineDashLength) { + lineDashIdx = 0; + } + lineDashDist = state->lineDash[lineDashIdx]; + newPath = gTrue; + } + } + } + i = j + 1; + } + + if (dPath->length == 0) { + GBool allSame = gTrue; + for (int i = 0; allSame && i < path->length - 1; ++i) { + allSame = path->pts[i].x == path->pts[i + 1].x && path->pts[i].y == path->pts[i + 1].y; + } + if (allSame) { + x0 = path->pts[0].x; + y0 = path->pts[0].y; + dPath->moveTo(x0, y0); + dPath->lineTo(x0, y0); + } + } + + return dPath; +} + +SplashError Splash::fill(SplashPath *path, GBool eo) { + if (debugMode) { + printf("fill [eo:%d]:\n", eo); + dumpPath(path); + } + return fillWithPattern(path, eo, state->fillPattern, state->fillAlpha); +} + +inline void Splash::getBBoxFP(SplashPath *path, SplashCoord *xMinA, SplashCoord *yMinA, + SplashCoord *xMaxA, SplashCoord *yMaxA) { + SplashCoord xMinFP, yMinFP, xMaxFP, yMaxFP, tx, ty; + + // make compiler happy: + xMinFP = xMaxFP = yMinFP = yMaxFP = 0; + for (int i = 0; i < path->length; ++i) { + transform(state->matrix, path->pts[i].x, path->pts[i].y, &tx, &ty); + if (i == 0) { + xMinFP = xMaxFP = tx; + yMinFP = yMaxFP = ty; + } else { + if (tx < xMinFP) xMinFP = tx; + if (tx > xMaxFP) xMaxFP = tx; + if (ty < yMinFP) yMinFP = ty; + if (ty > yMaxFP) yMaxFP = ty; + } + } + + *xMinA = xMinFP; + *yMinA = yMinFP; + *xMaxA = xMaxFP; + *yMaxA = yMaxFP; +} + +SplashError Splash::fillWithPattern(SplashPath *path, GBool eo, + SplashPattern *pattern, + SplashCoord alpha) { + SplashPipe pipe; + SplashXPath *xPath; + SplashXPathScanner *scanner; + int xMinI, yMinI, xMaxI, yMaxI, x0, x1, y; + SplashClipResult clipRes, clipRes2; + GBool adjustLine = gFalse; + int linePosI = 0; + + if (path->length == 0) { + return splashErrEmptyPath; + } + if (pathAllOutside(path)) { + opClipRes = splashClipAllOutside; + return splashOk; + } + + // add stroke adjustment hints for filled rectangles -- this only + // applies to paths that consist of a single subpath + // (this appears to match Acrobat's behavior) + if (state->strokeAdjust && !path->hints) { + int n; + n = path->getLength(); + if (n == 4 && + !(path->flags[0] & splashPathClosed) && + !(path->flags[1] & splashPathLast) && + !(path->flags[2] & splashPathLast)) { + path->close(gTrue); + path->addStrokeAdjustHint(0, 2, 0, 4); + path->addStrokeAdjustHint(1, 3, 0, 4); + } else if (n == 5 && + (path->flags[0] & splashPathClosed) && + !(path->flags[1] & splashPathLast) && + !(path->flags[2] & splashPathLast) && + !(path->flags[3] & splashPathLast)) { + path->addStrokeAdjustHint(0, 2, 0, 4); + path->addStrokeAdjustHint(1, 3, 0, 4); + } + } + + if (thinLineMode != splashThinLineDefault) { + if (state->clip->getXMinI() == state->clip->getXMaxI()) { + linePosI = state->clip->getXMinI(); + adjustLine = gTrue; + } else if (state->clip->getXMinI() == state->clip->getXMaxI() - 1) { + adjustLine = gTrue; + linePosI = splashFloor(state->clip->getXMin() + state->lineWidth); + } else if (state->clip->getYMinI() == state->clip->getYMaxI()) { + linePosI = state->clip->getYMinI(); + adjustLine = gTrue; + } else if (state->clip->getYMinI() == state->clip->getYMaxI() - 1) { + adjustLine = gTrue; + linePosI = splashFloor(state->clip->getYMin() + state->lineWidth); + } + } + + xPath = new SplashXPath(path, state->matrix, state->flatness, gTrue, + adjustLine, linePosI); + if (vectorAntialias && !inShading) { + xPath->aaScale(); + } + xPath->sort(); + yMinI = state->clip->getYMinI(); + yMaxI = state->clip->getYMaxI(); + if (vectorAntialias && !inShading) { + yMinI = yMinI * splashAASize; + yMaxI = (yMaxI + 1) * splashAASize - 1; + } + scanner = new SplashXPathScanner(xPath, eo, yMinI, yMaxI); + + // get the min and max x and y values + if (vectorAntialias && !inShading) { + scanner->getBBoxAA(&xMinI, &yMinI, &xMaxI, &yMaxI); + } else { + scanner->getBBox(&xMinI, &yMinI, &xMaxI, &yMaxI); + } + + if (eo && (yMinI == yMaxI || xMinI == xMaxI) && thinLineMode != splashThinLineDefault) { + SplashCoord delta, xMinFP, yMinFP, xMaxFP, yMaxFP; + getBBoxFP(path, &xMinFP, &yMinFP, &xMaxFP, &yMaxFP); + delta = (yMinI == yMaxI) ? yMaxFP - yMinFP : xMaxFP - xMinFP; + if (delta < 0.2) { + opClipRes = splashClipAllOutside; + return splashOk; + } + } + + // check clipping + if ((clipRes = state->clip->testRect(xMinI, yMinI, xMaxI, yMaxI)) + != splashClipAllOutside) { + if (scanner->hasPartialClip()) { + clipRes = splashClipPartial; + } + + pipeInit(&pipe, 0, yMinI, pattern, NULL, (Guchar)splashRound(alpha * 255), + vectorAntialias && !inShading, gFalse); + + // draw the spans + if (vectorAntialias && !inShading) { + for (y = yMinI; y <= yMaxI; ++y) { + scanner->renderAALine(aaBuf, &x0, &x1, y, thinLineMode != splashThinLineDefault && xMinI == xMaxI); + if (clipRes != splashClipAllInside) { + state->clip->clipAALine(aaBuf, &x0, &x1, y, thinLineMode != splashThinLineDefault && xMinI == xMaxI); + } + Guchar lineShape = 255; + GBool adjustLine = gFalse; + if (thinLineMode == splashThinLineShape && (xMinI == xMaxI || yMinI == yMaxI)) { + // compute line shape for thin lines: + SplashCoord mx, my, delta; + transform(state->matrix, 0, 0, &mx, &my); + transform(state->matrix, state->lineWidth, 0, &delta, &my); + adjustLine = gTrue; + lineShape = clip255((delta - mx) * 255); + } + drawAALine(&pipe, x0, x1, y, adjustLine, lineShape); + } + } else { + for (y = yMinI; y <= yMaxI; ++y) { + while (scanner->getNextSpan(y, &x0, &x1)) { + if (clipRes == splashClipAllInside) { + drawSpan(&pipe, x0, x1, y, gTrue); + } else { + // limit the x range + if (x0 < state->clip->getXMinI()) { + x0 = state->clip->getXMinI(); + } + if (x1 > state->clip->getXMaxI()) { + x1 = state->clip->getXMaxI(); + } + clipRes2 = state->clip->testSpan(x0, x1, y); + drawSpan(&pipe, x0, x1, y, clipRes2 == splashClipAllInside); + } + } + } + } + } + opClipRes = clipRes; + + delete scanner; + delete xPath; + return splashOk; +} + +GBool Splash::pathAllOutside(SplashPath *path) { + SplashCoord xMin1, yMin1, xMax1, yMax1; + SplashCoord xMin2, yMin2, xMax2, yMax2; + SplashCoord x, y; + int xMinI, yMinI, xMaxI, yMaxI; + int i; + + xMin1 = xMax1 = path->pts[0].x; + yMin1 = yMax1 = path->pts[0].y; + for (i = 1; i < path->length; ++i) { + if (path->pts[i].x < xMin1) { + xMin1 = path->pts[i].x; + } else if (path->pts[i].x > xMax1) { + xMax1 = path->pts[i].x; + } + if (path->pts[i].y < yMin1) { + yMin1 = path->pts[i].y; + } else if (path->pts[i].y > yMax1) { + yMax1 = path->pts[i].y; + } + } + + transform(state->matrix, xMin1, yMin1, &x, &y); + xMin2 = xMax2 = x; + yMin2 = yMax2 = y; + transform(state->matrix, xMin1, yMax1, &x, &y); + if (x < xMin2) { + xMin2 = x; + } else if (x > xMax2) { + xMax2 = x; + } + if (y < yMin2) { + yMin2 = y; + } else if (y > yMax2) { + yMax2 = y; + } + transform(state->matrix, xMax1, yMin1, &x, &y); + if (x < xMin2) { + xMin2 = x; + } else if (x > xMax2) { + xMax2 = x; + } + if (y < yMin2) { + yMin2 = y; + } else if (y > yMax2) { + yMax2 = y; + } + transform(state->matrix, xMax1, yMax1, &x, &y); + if (x < xMin2) { + xMin2 = x; + } else if (x > xMax2) { + xMax2 = x; + } + if (y < yMin2) { + yMin2 = y; + } else if (y > yMax2) { + yMax2 = y; + } + xMinI = splashFloor(xMin2); + yMinI = splashFloor(yMin2); + xMaxI = splashFloor(xMax2); + yMaxI = splashFloor(yMax2); + + return state->clip->testRect(xMinI, yMinI, xMaxI, yMaxI) == + splashClipAllOutside; +} + +SplashError Splash::xorFill(SplashPath *path, GBool eo) { + SplashPipe pipe; + SplashXPath *xPath; + SplashXPathScanner *scanner; + int xMinI, yMinI, xMaxI, yMaxI, x0, x1, y; + SplashClipResult clipRes, clipRes2; + SplashBlendFunc origBlendFunc; + + if (path->length == 0) { + return splashErrEmptyPath; + } + xPath = new SplashXPath(path, state->matrix, state->flatness, gTrue); + xPath->sort(); + scanner = new SplashXPathScanner(xPath, eo, state->clip->getYMinI(), + state->clip->getYMaxI()); + + // get the min and max x and y values + scanner->getBBox(&xMinI, &yMinI, &xMaxI, &yMaxI); + + // check clipping + if ((clipRes = state->clip->testRect(xMinI, yMinI, xMaxI, yMaxI)) + != splashClipAllOutside) { + if (scanner->hasPartialClip()) { + clipRes = splashClipPartial; + } + + origBlendFunc = state->blendFunc; + state->blendFunc = &blendXor; + pipeInit(&pipe, 0, yMinI, state->fillPattern, NULL, 255, gFalse, gFalse); + + // draw the spans + for (y = yMinI; y <= yMaxI; ++y) { + while (scanner->getNextSpan(y, &x0, &x1)) { + if (clipRes == splashClipAllInside) { + drawSpan(&pipe, x0, x1, y, gTrue); + } else { + // limit the x range + if (x0 < state->clip->getXMinI()) { + x0 = state->clip->getXMinI(); + } + if (x1 > state->clip->getXMaxI()) { + x1 = state->clip->getXMaxI(); + } + clipRes2 = state->clip->testSpan(x0, x1, y); + drawSpan(&pipe, x0, x1, y, clipRes2 == splashClipAllInside); + } + } + } + state->blendFunc = origBlendFunc; + } + opClipRes = clipRes; + + delete scanner; + delete xPath; + return splashOk; +} + +SplashError Splash::fillChar(SplashCoord x, SplashCoord y, + int c, SplashFont *font) { + SplashGlyphBitmap glyph; + SplashCoord xt, yt; + int x0, y0, xFrac, yFrac; + SplashClipResult clipRes; + + if (debugMode) { + printf("fillChar: x=%.2f y=%.2f c=%3d=0x%02x='%c'\n", + (double)x, (double)y, c, c, c); + } + transform(state->matrix, x, y, &xt, &yt); + x0 = splashFloor(xt); + xFrac = splashFloor((xt - x0) * splashFontFraction); + y0 = splashFloor(yt); + yFrac = splashFloor((yt - y0) * splashFontFraction); + if (!font->getGlyph(c, xFrac, yFrac, &glyph, x0, y0, state->clip, &clipRes)) { + return splashErrNoGlyph; + } + if (clipRes != splashClipAllOutside) { + fillGlyph2(x0, y0, &glyph, clipRes == splashClipAllInside); + } + opClipRes = clipRes; + if (glyph.freeData) { + gfree(glyph.data); + } + return splashOk; +} + +void Splash::fillGlyph(SplashCoord x, SplashCoord y, + SplashGlyphBitmap *glyph) { + SplashCoord xt, yt; + int x0, y0; + + transform(state->matrix, x, y, &xt, &yt); + x0 = splashFloor(xt); + y0 = splashFloor(yt); + SplashClipResult clipRes = state->clip->testRect(x0 - glyph->x, + y0 - glyph->y, + x0 - glyph->x + glyph->w - 1, + y0 - glyph->y + glyph->h - 1); + if (clipRes != splashClipAllOutside) { + fillGlyph2(x0, y0, glyph, clipRes == splashClipAllInside); + } + opClipRes = clipRes; +} + +void Splash::fillGlyph2(int x0, int y0, SplashGlyphBitmap *glyph, GBool noClip) { + SplashPipe pipe; + int alpha0; + Guchar alpha; + Guchar *p; + int x1, y1, xx, xx1, yy; + + p = glyph->data; + int xStart = x0 - glyph->x; + int yStart = y0 - glyph->y; + int xxLimit = glyph->w; + int yyLimit = glyph->h; + int xShift = 0; + + if (yStart < 0) + { + p += (glyph->aa ? glyph->w : splashCeil(glyph->w / 8.0)) * -yStart; // move p to the beginning of the first painted row + yyLimit += yStart; + yStart = 0; + } + + if (xStart < 0) + { + if (glyph->aa) { + p += -xStart; + } else { + p += (-xStart) / 8; + xShift = (-xStart) % 8; + } + xxLimit += xStart; + xStart = 0; + } + + if (xxLimit + xStart >= bitmap->width) xxLimit = bitmap->width - xStart; + if (yyLimit + yStart >= bitmap->height) yyLimit = bitmap->height - yStart; + + if (noClip) { + if (glyph->aa) { + pipeInit(&pipe, xStart, yStart, + state->fillPattern, NULL, (Guchar)splashRound(state->fillAlpha * 255), gTrue, gFalse); + for (yy = 0, y1 = yStart; yy < yyLimit; ++yy, ++y1) { + pipeSetXY(&pipe, xStart, y1); + for (xx = 0, x1 = xStart; xx < xxLimit; ++xx, ++x1) { + alpha = p[xx]; + if (alpha != 0) { + pipe.shape = alpha; + (this->*pipe.run)(&pipe); + updateModX(x1); + updateModY(y1); + } else { + pipeIncX(&pipe); + } + } + p += glyph->w; + } + } else { + const int widthEight = splashCeil(glyph->w / 8.0); + + pipeInit(&pipe, xStart, yStart, + state->fillPattern, NULL, (Guchar)splashRound(state->fillAlpha * 255), gFalse, gFalse); + for (yy = 0, y1 = yStart; yy < yyLimit; ++yy, ++y1) { + pipeSetXY(&pipe, xStart, y1); + for (xx = 0, x1 = xStart; xx < xxLimit; xx += 8) { + alpha0 = (xShift > 0 ? (p[xx / 8] << xShift) | (p[xx / 8 + 1] >> (8 - xShift)) : p[xx / 8]); + for (xx1 = 0; xx1 < 8 && xx + xx1 < xxLimit; ++xx1, ++x1) { + if (alpha0 & 0x80) { + (this->*pipe.run)(&pipe); + updateModX(x1); + updateModY(y1); + } else { + pipeIncX(&pipe); + } + alpha0 <<= 1; + } + } + p += widthEight; + } + } + } else { + if (glyph->aa) { + pipeInit(&pipe, xStart, yStart, + state->fillPattern, NULL, (Guchar)splashRound(state->fillAlpha * 255), gTrue, gFalse); + for (yy = 0, y1 = yStart; yy < yyLimit; ++yy, ++y1) { + pipeSetXY(&pipe, xStart, y1); + for (xx = 0, x1 = xStart; xx < xxLimit; ++xx, ++x1) { + if (state->clip->test(x1, y1)) { + alpha = p[xx]; + if (alpha != 0) { + pipe.shape = alpha; + (this->*pipe.run)(&pipe); + updateModX(x1); + updateModY(y1); + } else { + pipeIncX(&pipe); + } + } else { + pipeIncX(&pipe); + } + } + p += glyph->w; + } + } else { + const int widthEight = splashCeil(glyph->w / 8.0); + + pipeInit(&pipe, xStart, yStart, + state->fillPattern, NULL, (Guchar)splashRound(state->fillAlpha * 255), gFalse, gFalse); + for (yy = 0, y1 = yStart; yy < yyLimit; ++yy, ++y1) { + pipeSetXY(&pipe, xStart, y1); + for (xx = 0, x1 = xStart; xx < xxLimit; xx += 8) { + alpha0 = (xShift > 0 ? (p[xx / 8] << xShift) | (p[xx / 8 + 1] >> (8 - xShift)) : p[xx / 8]); + for (xx1 = 0; xx1 < 8 && xx + xx1 < xxLimit; ++xx1, ++x1) { + if (state->clip->test(x1, y1)) { + if (alpha0 & 0x80) { + (this->*pipe.run)(&pipe); + updateModX(x1); + updateModY(y1); + } else { + pipeIncX(&pipe); + } + } else { + pipeIncX(&pipe); + } + alpha0 <<= 1; + } + } + p += widthEight; + } + } + } +} + +SplashError Splash::fillImageMask(SplashImageMaskSource src, void *srcData, + int w, int h, SplashCoord *mat, + GBool glyphMode) { + SplashBitmap *scaledMask; + SplashClipResult clipRes; + GBool minorAxisZero; + int x0, y0, x1, y1, scaledWidth, scaledHeight; + int yp; + + if (debugMode) { + printf("fillImageMask: w=%d h=%d mat=[%.2f %.2f %.2f %.2f %.2f %.2f]\n", + w, h, (double)mat[0], (double)mat[1], (double)mat[2], + (double)mat[3], (double)mat[4], (double)mat[5]); + } + + if (w == 0 && h == 0) return splashErrZeroImage; + + // check for singular matrix + if (!splashCheckDet(mat[0], mat[1], mat[2], mat[3], 0.000001)) { + return splashErrSingularMatrix; + } + + minorAxisZero = mat[1] == 0 && mat[2] == 0; + + // scaling only + if (mat[0] > 0 && minorAxisZero && mat[3] > 0) { + x0 = imgCoordMungeLowerC(mat[4], glyphMode); + y0 = imgCoordMungeLowerC(mat[5], glyphMode); + x1 = imgCoordMungeUpperC(mat[0] + mat[4], glyphMode); + y1 = imgCoordMungeUpperC(mat[3] + mat[5], glyphMode); + // make sure narrow images cover at least one pixel + if (x0 == x1) { + ++x1; + } + if (y0 == y1) { + ++y1; + } + clipRes = state->clip->testRect(x0, y0, x1 - 1, y1 - 1); + opClipRes = clipRes; + if (clipRes != splashClipAllOutside) { + scaledWidth = x1 - x0; + scaledHeight = y1 - y0; + yp = h / scaledHeight; + if (yp < 0 || yp > INT_MAX - 1) { + return splashErrBadArg; + } + scaledMask = scaleMask(src, srcData, w, h, scaledWidth, scaledHeight); + blitMask(scaledMask, x0, y0, clipRes); + delete scaledMask; + } + + // scaling plus vertical flip + } else if (mat[0] > 0 && minorAxisZero && mat[3] < 0) { + x0 = imgCoordMungeLowerC(mat[4], glyphMode); + y0 = imgCoordMungeLowerC(mat[3] + mat[5], glyphMode); + x1 = imgCoordMungeUpperC(mat[0] + mat[4], glyphMode); + y1 = imgCoordMungeUpperC(mat[5], glyphMode); + // make sure narrow images cover at least one pixel + if (x0 == x1) { + ++x1; + } + if (y0 == y1) { + ++y1; + } + clipRes = state->clip->testRect(x0, y0, x1 - 1, y1 - 1); + opClipRes = clipRes; + if (clipRes != splashClipAllOutside) { + scaledWidth = x1 - x0; + scaledHeight = y1 - y0; + yp = h / scaledHeight; + if (yp < 0 || yp > INT_MAX - 1) { + return splashErrBadArg; + } + scaledMask = scaleMask(src, srcData, w, h, scaledWidth, scaledHeight); + vertFlipImage(scaledMask, scaledWidth, scaledHeight, 1); + blitMask(scaledMask, x0, y0, clipRes); + delete scaledMask; + } + + // all other cases + } else { + arbitraryTransformMask(src, srcData, w, h, mat, glyphMode); + } + + return splashOk; +} + +void Splash::arbitraryTransformMask(SplashImageMaskSource src, void *srcData, + int srcWidth, int srcHeight, + SplashCoord *mat, GBool glyphMode) { + SplashBitmap *scaledMask; + SplashClipResult clipRes, clipRes2; + SplashPipe pipe; + int scaledWidth, scaledHeight, t0, t1; + SplashCoord r00, r01, r10, r11, det, ir00, ir01, ir10, ir11; + SplashCoord vx[4], vy[4]; + int xMin, yMin, xMax, yMax; + ImageSection section[3]; + int nSections; + int y, xa, xb, x, i, xx, yy; + + // compute the four vertices of the target quadrilateral + vx[0] = mat[4]; vy[0] = mat[5]; + vx[1] = mat[2] + mat[4]; vy[1] = mat[3] + mat[5]; + vx[2] = mat[0] + mat[2] + mat[4]; vy[2] = mat[1] + mat[3] + mat[5]; + vx[3] = mat[0] + mat[4]; vy[3] = mat[1] + mat[5]; + + // clipping + xMin = imgCoordMungeLowerC(vx[0], glyphMode); + xMax = imgCoordMungeUpperC(vx[0], glyphMode); + yMin = imgCoordMungeLowerC(vy[0], glyphMode); + yMax = imgCoordMungeUpperC(vy[0], glyphMode); + for (i = 1; i < 4; ++i) { + t0 = imgCoordMungeLowerC(vx[i], glyphMode); + if (t0 < xMin) { + xMin = t0; + } + t0 = imgCoordMungeUpperC(vx[i], glyphMode); + if (t0 > xMax) { + xMax = t0; + } + t1 = imgCoordMungeLowerC(vy[i], glyphMode); + if (t1 < yMin) { + yMin = t1; + } + t1 = imgCoordMungeUpperC(vy[i], glyphMode); + if (t1 > yMax) { + yMax = t1; + } + } + clipRes = state->clip->testRect(xMin, yMin, xMax - 1, yMax - 1); + opClipRes = clipRes; + if (clipRes == splashClipAllOutside) { + return; + } + + // compute the scale factors + if (mat[0] >= 0) { + t0 = imgCoordMungeUpperC(mat[0] + mat[4], glyphMode) - + imgCoordMungeLowerC(mat[4], glyphMode); + } else { + t0 = imgCoordMungeUpperC(mat[4], glyphMode) - + imgCoordMungeLowerC(mat[0] + mat[4], glyphMode); + } + if (mat[1] >= 0) { + t1 = imgCoordMungeUpperC(mat[1] + mat[5], glyphMode) - + imgCoordMungeLowerC(mat[5], glyphMode); + } else { + t1 = imgCoordMungeUpperC(mat[5], glyphMode) - + imgCoordMungeLowerC(mat[1] + mat[5], glyphMode); + } + scaledWidth = t0 > t1 ? t0 : t1; + if (mat[2] >= 0) { + t0 = imgCoordMungeUpperC(mat[2] + mat[4], glyphMode) - + imgCoordMungeLowerC(mat[4], glyphMode); + } else { + t0 = imgCoordMungeUpperC(mat[4], glyphMode) - + imgCoordMungeLowerC(mat[2] + mat[4], glyphMode); + } + if (mat[3] >= 0) { + t1 = imgCoordMungeUpperC(mat[3] + mat[5], glyphMode) - + imgCoordMungeLowerC(mat[5], glyphMode); + } else { + t1 = imgCoordMungeUpperC(mat[5], glyphMode) - + imgCoordMungeLowerC(mat[3] + mat[5], glyphMode); + } + scaledHeight = t0 > t1 ? t0 : t1; + if (scaledWidth == 0) { + scaledWidth = 1; + } + if (scaledHeight == 0) { + scaledHeight = 1; + } + + // compute the inverse transform (after scaling) matrix + r00 = mat[0] / scaledWidth; + r01 = mat[1] / scaledWidth; + r10 = mat[2] / scaledHeight; + r11 = mat[3] / scaledHeight; + det = r00 * r11 - r01 * r10; + if (splashAbs(det) < 1e-6) { + // this should be caught by the singular matrix check in fillImageMask + return; + } + ir00 = r11 / det; + ir01 = -r01 / det; + ir10 = -r10 / det; + ir11 = r00 / det; + + // scale the input image + scaledMask = scaleMask(src, srcData, srcWidth, srcHeight, + scaledWidth, scaledHeight); + if (scaledMask->data == NULL) { + error(errInternal, -1, "scaledMask->data is NULL in Splash::arbitraryTransformMask"); + delete scaledMask; + return; + } + + // construct the three sections + i = (vy[2] <= vy[3]) ? 2 : 3; + if (vy[1] <= vy[i]) { + i = 1; + } + if (vy[0] < vy[i] || (i != 3 && vy[0] == vy[i])) { + i = 0; + } + if (vy[i] == vy[(i+1) & 3]) { + section[0].y0 = imgCoordMungeLowerC(vy[i], glyphMode); + section[0].y1 = imgCoordMungeUpperC(vy[(i+2) & 3], glyphMode) - 1; + if (vx[i] < vx[(i+1) & 3]) { + section[0].ia0 = i; + section[0].ia1 = (i+3) & 3; + section[0].ib0 = (i+1) & 3; + section[0].ib1 = (i+2) & 3; + } else { + section[0].ia0 = (i+1) & 3; + section[0].ia1 = (i+2) & 3; + section[0].ib0 = i; + section[0].ib1 = (i+3) & 3; + } + nSections = 1; + } else { + section[0].y0 = imgCoordMungeLowerC(vy[i], glyphMode); + section[2].y1 = imgCoordMungeUpperC(vy[(i+2) & 3], glyphMode) - 1; + section[0].ia0 = section[0].ib0 = i; + section[2].ia1 = section[2].ib1 = (i+2) & 3; + if (vx[(i+1) & 3] < vx[(i+3) & 3]) { + section[0].ia1 = section[2].ia0 = (i+1) & 3; + section[0].ib1 = section[2].ib0 = (i+3) & 3; + } else { + section[0].ia1 = section[2].ia0 = (i+3) & 3; + section[0].ib1 = section[2].ib0 = (i+1) & 3; + } + if (vy[(i+1) & 3] < vy[(i+3) & 3]) { + section[1].y0 = imgCoordMungeLowerC(vy[(i+1) & 3], glyphMode); + section[2].y0 = imgCoordMungeUpperC(vy[(i+3) & 3], glyphMode); + if (vx[(i+1) & 3] < vx[(i+3) & 3]) { + section[1].ia0 = (i+1) & 3; + section[1].ia1 = (i+2) & 3; + section[1].ib0 = i; + section[1].ib1 = (i+3) & 3; + } else { + section[1].ia0 = i; + section[1].ia1 = (i+3) & 3; + section[1].ib0 = (i+1) & 3; + section[1].ib1 = (i+2) & 3; + } + } else { + section[1].y0 = imgCoordMungeLowerC(vy[(i+3) & 3], glyphMode); + section[2].y0 = imgCoordMungeUpperC(vy[(i+1) & 3], glyphMode); + if (vx[(i+1) & 3] < vx[(i+3) & 3]) { + section[1].ia0 = i; + section[1].ia1 = (i+1) & 3; + section[1].ib0 = (i+3) & 3; + section[1].ib1 = (i+2) & 3; + } else { + section[1].ia0 = (i+3) & 3; + section[1].ia1 = (i+2) & 3; + section[1].ib0 = i; + section[1].ib1 = (i+1) & 3; + } + } + section[0].y1 = section[1].y0 - 1; + section[1].y1 = section[2].y0 - 1; + nSections = 3; + } + for (i = 0; i < nSections; ++i) { + section[i].xa0 = vx[section[i].ia0]; + section[i].ya0 = vy[section[i].ia0]; + section[i].xa1 = vx[section[i].ia1]; + section[i].ya1 = vy[section[i].ia1]; + section[i].xb0 = vx[section[i].ib0]; + section[i].yb0 = vy[section[i].ib0]; + section[i].xb1 = vx[section[i].ib1]; + section[i].yb1 = vy[section[i].ib1]; + section[i].dxdya = (section[i].xa1 - section[i].xa0) / + (section[i].ya1 - section[i].ya0); + section[i].dxdyb = (section[i].xb1 - section[i].xb0) / + (section[i].yb1 - section[i].yb0); + } + + // initialize the pixel pipe + pipeInit(&pipe, 0, 0, state->fillPattern, NULL, + (Guchar)splashRound(state->fillAlpha * 255), gTrue, gFalse); + if (vectorAntialias) { + drawAAPixelInit(); + } + + // make sure narrow images cover at least one pixel + if (nSections == 1) { + if (section[0].y0 == section[0].y1) { + ++section[0].y1; + clipRes = opClipRes = splashClipPartial; + } + } else { + if (section[0].y0 == section[2].y1) { + ++section[1].y1; + clipRes = opClipRes = splashClipPartial; + } + } + + // scan all pixels inside the target region + for (i = 0; i < nSections; ++i) { + for (y = section[i].y0; y <= section[i].y1; ++y) { + xa = imgCoordMungeLowerC(section[i].xa0 + + ((SplashCoord)y + 0.5 - section[i].ya0) * + section[i].dxdya, + glyphMode); + xb = imgCoordMungeUpperC(section[i].xb0 + + ((SplashCoord)y + 0.5 - section[i].yb0) * + section[i].dxdyb, + glyphMode); + // make sure narrow images cover at least one pixel + if (xa == xb) { + ++xb; + } + if (clipRes != splashClipAllInside) { + clipRes2 = state->clip->testSpan(xa, xb - 1, y); + } else { + clipRes2 = clipRes; + } + for (x = xa; x < xb; ++x) { + // map (x+0.5, y+0.5) back to the scaled image + xx = splashFloor(((SplashCoord)x + 0.5 - mat[4]) * ir00 + + ((SplashCoord)y + 0.5 - mat[5]) * ir10); + yy = splashFloor(((SplashCoord)x + 0.5 - mat[4]) * ir01 + + ((SplashCoord)y + 0.5 - mat[5]) * ir11); + // xx should always be within bounds, but floating point + // inaccuracy can cause problems + if (xx < 0) { + xx = 0; + } else if (xx >= scaledWidth) { + xx = scaledWidth - 1; + } + if (yy < 0) { + yy = 0; + } else if (yy >= scaledHeight) { + yy = scaledHeight - 1; + } + pipe.shape = scaledMask->data[yy * scaledWidth + xx]; + if (vectorAntialias && clipRes2 != splashClipAllInside) { + drawAAPixel(&pipe, x, y); + } else { + drawPixel(&pipe, x, y, clipRes2 == splashClipAllInside); + } + } + } + } + + delete scaledMask; +} + +// Scale an image mask into a SplashBitmap. +SplashBitmap *Splash::scaleMask(SplashImageMaskSource src, void *srcData, + int srcWidth, int srcHeight, + int scaledWidth, int scaledHeight) { + SplashBitmap *dest; + + dest = new SplashBitmap(scaledWidth, scaledHeight, 1, splashModeMono8, + gFalse); + if (scaledHeight < srcHeight) { + if (scaledWidth < srcWidth) { + scaleMaskYdXd(src, srcData, srcWidth, srcHeight, + scaledWidth, scaledHeight, dest); + } else { + scaleMaskYdXu(src, srcData, srcWidth, srcHeight, + scaledWidth, scaledHeight, dest); + } + } else { + if (scaledWidth < srcWidth) { + scaleMaskYuXd(src, srcData, srcWidth, srcHeight, + scaledWidth, scaledHeight, dest); + } else { + scaleMaskYuXu(src, srcData, srcWidth, srcHeight, + scaledWidth, scaledHeight, dest); + } + } + return dest; +} + +void Splash::scaleMaskYdXd(SplashImageMaskSource src, void *srcData, + int srcWidth, int srcHeight, + int scaledWidth, int scaledHeight, + SplashBitmap *dest) { + Guchar *lineBuf; + Guint *pixBuf; + Guint pix; + Guchar *destPtr; + int yp, yq, xp, xq, yt, y, yStep, xt, x, xStep, xx, d, d0, d1; + int i, j; + + // Bresenham parameters for y scale + yp = srcHeight / scaledHeight; + yq = srcHeight % scaledHeight; + + // Bresenham parameters for x scale + xp = srcWidth / scaledWidth; + xq = srcWidth % scaledWidth; + + // allocate buffers + lineBuf = (Guchar *)gmalloc(srcWidth); + pixBuf = (Guint *)gmallocn(srcWidth, sizeof(int)); + + // init y scale Bresenham + yt = 0; + + destPtr = dest->data; + for (y = 0; y < scaledHeight; ++y) { + + // y scale Bresenham + if ((yt += yq) >= scaledHeight) { + yt -= scaledHeight; + yStep = yp + 1; + } else { + yStep = yp; + } + + // read rows from image + memset(pixBuf, 0, srcWidth * sizeof(int)); + for (i = 0; i < yStep; ++i) { + (*src)(srcData, lineBuf); + for (j = 0; j < srcWidth; ++j) { + pixBuf[j] += lineBuf[j]; + } + } + + // init x scale Bresenham + xt = 0; + d0 = (255 << 23) / (yStep * xp); + d1 = (255 << 23) / (yStep * (xp + 1)); + + xx = 0; + for (x = 0; x < scaledWidth; ++x) { + + // x scale Bresenham + if ((xt += xq) >= scaledWidth) { + xt -= scaledWidth; + xStep = xp + 1; + d = d1; + } else { + xStep = xp; + d = d0; + } + + // compute the final pixel + pix = 0; + for (i = 0; i < xStep; ++i) { + pix += pixBuf[xx++]; + } + // (255 * pix) / xStep * yStep + pix = (pix * d) >> 23; + + // store the pixel + *destPtr++ = (Guchar)pix; + } + } + + gfree(pixBuf); + gfree(lineBuf); +} + +void Splash::scaleMaskYdXu(SplashImageMaskSource src, void *srcData, + int srcWidth, int srcHeight, + int scaledWidth, int scaledHeight, + SplashBitmap *dest) { + Guchar *lineBuf; + Guint *pixBuf; + Guint pix; + Guchar *destPtr; + int yp, yq, xp, xq, yt, y, yStep, xt, x, xStep, d; + int i, j; + + destPtr = dest->data; + if (destPtr == NULL) { + error(errInternal, -1, "dest->data is NULL in Splash::scaleMaskYdXu"); + return; + } + + // Bresenham parameters for y scale + yp = srcHeight / scaledHeight; + yq = srcHeight % scaledHeight; + + // Bresenham parameters for x scale + xp = scaledWidth / srcWidth; + xq = scaledWidth % srcWidth; + + // allocate buffers + lineBuf = (Guchar *)gmalloc(srcWidth); + pixBuf = (Guint *)gmallocn(srcWidth, sizeof(int)); + + // init y scale Bresenham + yt = 0; + + for (y = 0; y < scaledHeight; ++y) { + + // y scale Bresenham + if ((yt += yq) >= scaledHeight) { + yt -= scaledHeight; + yStep = yp + 1; + } else { + yStep = yp; + } + + // read rows from image + memset(pixBuf, 0, srcWidth * sizeof(int)); + for (i = 0; i < yStep; ++i) { + (*src)(srcData, lineBuf); + for (j = 0; j < srcWidth; ++j) { + pixBuf[j] += lineBuf[j]; + } + } + + // init x scale Bresenham + xt = 0; + d = (255 << 23) / yStep; + + for (x = 0; x < srcWidth; ++x) { + + // x scale Bresenham + if ((xt += xq) >= srcWidth) { + xt -= srcWidth; + xStep = xp + 1; + } else { + xStep = xp; + } + + // compute the final pixel + pix = pixBuf[x]; + // (255 * pix) / yStep + pix = (pix * d) >> 23; + + // store the pixel + for (i = 0; i < xStep; ++i) { + *destPtr++ = (Guchar)pix; + } + } + } + + gfree(pixBuf); + gfree(lineBuf); +} + +void Splash::scaleMaskYuXd(SplashImageMaskSource src, void *srcData, + int srcWidth, int srcHeight, + int scaledWidth, int scaledHeight, + SplashBitmap *dest) { + Guchar *lineBuf; + Guint pix; + Guchar *destPtr0, *destPtr; + int yp, yq, xp, xq, yt, y, yStep, xt, x, xStep, xx, d, d0, d1; + int i; + + destPtr0 = dest->data; + if (destPtr0 == NULL) { + error(errInternal, -1, "dest->data is NULL in Splash::scaleMaskYuXd"); + return; + } + + // Bresenham parameters for y scale + yp = scaledHeight / srcHeight; + yq = scaledHeight % srcHeight; + + // Bresenham parameters for x scale + xp = srcWidth / scaledWidth; + xq = srcWidth % scaledWidth; + + // allocate buffers + lineBuf = (Guchar *)gmalloc(srcWidth); + + // init y scale Bresenham + yt = 0; + + for (y = 0; y < srcHeight; ++y) { + + // y scale Bresenham + if ((yt += yq) >= srcHeight) { + yt -= srcHeight; + yStep = yp + 1; + } else { + yStep = yp; + } + + // read row from image + (*src)(srcData, lineBuf); + + // init x scale Bresenham + xt = 0; + d0 = (255 << 23) / xp; + d1 = (255 << 23) / (xp + 1); + + xx = 0; + for (x = 0; x < scaledWidth; ++x) { + + // x scale Bresenham + if ((xt += xq) >= scaledWidth) { + xt -= scaledWidth; + xStep = xp + 1; + d = d1; + } else { + xStep = xp; + d = d0; + } + + // compute the final pixel + pix = 0; + for (i = 0; i < xStep; ++i) { + pix += lineBuf[xx++]; + } + // (255 * pix) / xStep + pix = (pix * d) >> 23; + + // store the pixel + for (i = 0; i < yStep; ++i) { + destPtr = destPtr0 + i * scaledWidth + x; + *destPtr = (Guchar)pix; + } + } + + destPtr0 += yStep * scaledWidth; + } + + gfree(lineBuf); +} + +void Splash::scaleMaskYuXu(SplashImageMaskSource src, void *srcData, + int srcWidth, int srcHeight, + int scaledWidth, int scaledHeight, + SplashBitmap *dest) { + Guchar *lineBuf; + Guint pix; + Guchar *destPtr0, *destPtr; + int yp, yq, xp, xq, yt, y, yStep, xt, x, xStep, xx; + int i, j; + + destPtr0 = dest->data; + if (destPtr0 == NULL) { + error(errInternal, -1, "dest->data is NULL in Splash::scaleMaskYuXu"); + return; + } + + // Bresenham parameters for y scale + yp = scaledHeight / srcHeight; + yq = scaledHeight % srcHeight; + + // Bresenham parameters for x scale + xp = scaledWidth / srcWidth; + xq = scaledWidth % srcWidth; + + // allocate buffers + lineBuf = (Guchar *)gmalloc(srcWidth); + + // init y scale Bresenham + yt = 0; + + for (y = 0; y < srcHeight; ++y) { + + // y scale Bresenham + if ((yt += yq) >= srcHeight) { + yt -= srcHeight; + yStep = yp + 1; + } else { + yStep = yp; + } + + // read row from image + (*src)(srcData, lineBuf); + + // init x scale Bresenham + xt = 0; + + xx = 0; + for (x = 0; x < srcWidth; ++x) { + + // x scale Bresenham + if ((xt += xq) >= srcWidth) { + xt -= srcWidth; + xStep = xp + 1; + } else { + xStep = xp; + } + + // compute the final pixel + pix = lineBuf[x] ? 255 : 0; + + // store the pixel + for (i = 0; i < yStep; ++i) { + for (j = 0; j < xStep; ++j) { + destPtr = destPtr0 + i * scaledWidth + xx + j; + *destPtr++ = (Guchar)pix; + } + } + + xx += xStep; + } + + destPtr0 += yStep * scaledWidth; + } + + gfree(lineBuf); +} + +void Splash::blitMask(SplashBitmap *src, int xDest, int yDest, + SplashClipResult clipRes) { + SplashPipe pipe; + Guchar *p; + int w, h, x, y; + + w = src->getWidth(); + h = src->getHeight(); + p = src->getDataPtr(); + if (p == NULL) { + error(errInternal, -1, "src->getDataPtr() is NULL in Splash::blitMask"); + return; + } + if (vectorAntialias && clipRes != splashClipAllInside) { + pipeInit(&pipe, xDest, yDest, state->fillPattern, NULL, + (Guchar)splashRound(state->fillAlpha * 255), gTrue, gFalse); + drawAAPixelInit(); + for (y = 0; y < h; ++y) { + for (x = 0; x < w; ++x) { + pipe.shape = *p++; + drawAAPixel(&pipe, xDest + x, yDest + y); + } + } + } else { + pipeInit(&pipe, xDest, yDest, state->fillPattern, NULL, + (Guchar)splashRound(state->fillAlpha * 255), gTrue, gFalse); + if (clipRes == splashClipAllInside) { + for (y = 0; y < h; ++y) { + pipeSetXY(&pipe, xDest, yDest + y); + for (x = 0; x < w; ++x) { + if (*p) { + pipe.shape = *p; + (this->*pipe.run)(&pipe); + } else { + pipeIncX(&pipe); + } + ++p; + } + } + updateModX(xDest); + updateModX(xDest + w - 1); + updateModY(yDest); + updateModY(yDest + h - 1); + } else { + for (y = 0; y < h; ++y) { + pipeSetXY(&pipe, xDest, yDest + y); + for (x = 0; x < w; ++x) { + if (*p && state->clip->test(xDest + x, yDest + y)) { + pipe.shape = *p; + (this->*pipe.run)(&pipe); + updateModX(xDest + x); + updateModY(yDest + y); + } else { + pipeIncX(&pipe); + } + ++p; + } + } + } + } +} + +SplashError Splash::drawImage(SplashImageSource src, void *srcData, + SplashColorMode srcMode, GBool srcAlpha, + int w, int h, SplashCoord *mat, GBool interpolate, + GBool tilingPattern) { + GBool ok; + SplashBitmap *scaledImg; + SplashClipResult clipRes; + GBool minorAxisZero; + int x0, y0, x1, y1, scaledWidth, scaledHeight; + int nComps; + int yp; + + if (debugMode) { + printf("drawImage: srcMode=%d srcAlpha=%d w=%d h=%d mat=[%.2f %.2f %.2f %.2f %.2f %.2f]\n", + srcMode, srcAlpha, w, h, (double)mat[0], (double)mat[1], (double)mat[2], + (double)mat[3], (double)mat[4], (double)mat[5]); + } + + // check color modes + ok = gFalse; // make gcc happy + nComps = 0; // make gcc happy + switch (bitmap->mode) { + case splashModeMono1: + case splashModeMono8: + ok = srcMode == splashModeMono8; + nComps = 1; + break; + case splashModeRGB8: + ok = srcMode == splashModeRGB8; + nComps = 3; + break; + case splashModeXBGR8: + ok = srcMode == splashModeXBGR8; + nComps = 4; + break; + case splashModeBGR8: + ok = srcMode == splashModeBGR8; + nComps = 3; + break; +#if SPLASH_CMYK + case splashModeCMYK8: + ok = srcMode == splashModeCMYK8; + nComps = 4; + break; + case splashModeDeviceN8: + ok = srcMode == splashModeDeviceN8; + nComps = SPOT_NCOMPS+4; + break; +#endif + default: + ok = gFalse; + break; + } + if (!ok) { + return splashErrModeMismatch; + } + + // check for singular matrix + if (!splashCheckDet(mat[0], mat[1], mat[2], mat[3], 0.000001)) { + return splashErrSingularMatrix; + } + + minorAxisZero = mat[1] == 0 && mat[2] == 0; + + // scaling only + if (mat[0] > 0 && minorAxisZero && mat[3] > 0) { + x0 = imgCoordMungeLower(mat[4]); + y0 = imgCoordMungeLower(mat[5]); + x1 = imgCoordMungeUpper(mat[0] + mat[4]); + y1 = imgCoordMungeUpper(mat[3] + mat[5]); + // make sure narrow images cover at least one pixel + if (x0 == x1) { + ++x1; + } + if (y0 == y1) { + ++y1; + } + clipRes = state->clip->testRect(x0, y0, x1 - 1, y1 - 1); + opClipRes = clipRes; + if (clipRes != splashClipAllOutside) { + scaledWidth = x1 - x0; + scaledHeight = y1 - y0; + yp = h / scaledHeight; + if (yp < 0 || yp > INT_MAX - 1) { + return splashErrBadArg; + } + scaledImg = scaleImage(src, srcData, srcMode, nComps, srcAlpha, w, h, + scaledWidth, scaledHeight, interpolate, tilingPattern); + if (scaledImg == NULL) { + return splashErrBadArg; + } + blitImage(scaledImg, srcAlpha, x0, y0, clipRes); + delete scaledImg; + } + + // scaling plus vertical flip + } else if (mat[0] > 0 && minorAxisZero && mat[3] < 0) { + x0 = imgCoordMungeLower(mat[4]); + y0 = imgCoordMungeLower(mat[3] + mat[5]); + x1 = imgCoordMungeUpper(mat[0] + mat[4]); + y1 = imgCoordMungeUpper(mat[5]); + if (x0 == x1) { + if (mat[4] + mat[0] * 0.5 < x0) { + --x0; + } else { + ++x1; + } + } + if (y0 == y1) { + if (mat[5] + mat[1] * 0.5 < y0) { + --y0; + } else { + ++y1; + } + } + clipRes = state->clip->testRect(x0, y0, x1 - 1, y1 - 1); + opClipRes = clipRes; + if (clipRes != splashClipAllOutside) { + scaledWidth = x1 - x0; + scaledHeight = y1 - y0; + yp = h / scaledHeight; + if (yp < 0 || yp > INT_MAX - 1) { + return splashErrBadArg; + } + scaledImg = scaleImage(src, srcData, srcMode, nComps, srcAlpha, w, h, + scaledWidth, scaledHeight, interpolate, tilingPattern); + if (scaledImg == NULL) { + return splashErrBadArg; + } + vertFlipImage(scaledImg, scaledWidth, scaledHeight, nComps); + blitImage(scaledImg, srcAlpha, x0, y0, clipRes); + delete scaledImg; + } + + // all other cases + } else { + return arbitraryTransformImage(src, srcData, srcMode, nComps, srcAlpha, + w, h, mat, interpolate, tilingPattern); + } + + return splashOk; +} + +SplashError Splash::arbitraryTransformImage(SplashImageSource src, void *srcData, + SplashColorMode srcMode, int nComps, + GBool srcAlpha, + int srcWidth, int srcHeight, + SplashCoord *mat, GBool interpolate, + GBool tilingPattern) { + SplashBitmap *scaledImg; + SplashClipResult clipRes, clipRes2; + SplashPipe pipe; + SplashColor pixel; + int scaledWidth, scaledHeight, t0, t1, th; + SplashCoord r00, r01, r10, r11, det, ir00, ir01, ir10, ir11; + SplashCoord vx[4], vy[4]; + int xMin, yMin, xMax, yMax; + ImageSection section[3]; + int nSections; + int y, xa, xb, x, i, xx, yy, yp; + + // compute the four vertices of the target quadrilateral + vx[0] = mat[4]; vy[0] = mat[5]; + vx[1] = mat[2] + mat[4]; vy[1] = mat[3] + mat[5]; + vx[2] = mat[0] + mat[2] + mat[4]; vy[2] = mat[1] + mat[3] + mat[5]; + vx[3] = mat[0] + mat[4]; vy[3] = mat[1] + mat[5]; + + // clipping + xMin = imgCoordMungeLower(vx[0]); + xMax = imgCoordMungeUpper(vx[0]); + yMin = imgCoordMungeLower(vy[0]); + yMax = imgCoordMungeUpper(vy[0]); + for (i = 1; i < 4; ++i) { + t0 = imgCoordMungeLower(vx[i]); + if (t0 < xMin) { + xMin = t0; + } + t0 = imgCoordMungeUpper(vx[i]); + if (t0 > xMax) { + xMax = t0; + } + t1 = imgCoordMungeLower(vy[i]); + if (t1 < yMin) { + yMin = t1; + } + t1 = imgCoordMungeUpper(vy[i]); + if (t1 > yMax) { + yMax = t1; + } + } + clipRes = state->clip->testRect(xMin, yMin, xMax - 1, yMax - 1); + opClipRes = clipRes; + if (clipRes == splashClipAllOutside) { + return splashOk; + } + + // compute the scale factors + if (splashAbs(mat[0]) >= splashAbs(mat[1])) { + scaledWidth = xMax - xMin; + scaledHeight = yMax - yMin; + } else { + scaledWidth = yMax - yMin; + scaledHeight = xMax - xMin; + } + if (scaledHeight <= 1 || scaledHeight <= 1 || tilingPattern) { + if (mat[0] >= 0) { + t0 = imgCoordMungeUpper(mat[0] + mat[4]) - imgCoordMungeLower(mat[4]); + } else { + t0 = imgCoordMungeUpper(mat[4]) - imgCoordMungeLower(mat[0] + mat[4]); + } + if (mat[1] >= 0) { + t1 = imgCoordMungeUpper(mat[1] + mat[5]) - imgCoordMungeLower(mat[5]); + } else { + t1 = imgCoordMungeUpper(mat[5]) - imgCoordMungeLower(mat[1] + mat[5]); + } + scaledWidth = t0 > t1 ? t0 : t1; + if (mat[2] >= 0) { + t0 = imgCoordMungeUpper(mat[2] + mat[4]) - imgCoordMungeLower(mat[4]); + if (splashAbs(mat[1]) >= 1) { + th = imgCoordMungeUpper(mat[2]) - imgCoordMungeLower(mat[0] * mat[3] / mat[1]); + if (th > t0) t0 = th; + } + } else { + t0 = imgCoordMungeUpper(mat[4]) - imgCoordMungeLower(mat[2] + mat[4]); + if (splashAbs(mat[1]) >= 1) { + th = imgCoordMungeUpper(mat[0] * mat[3] / mat[1]) - imgCoordMungeLower(mat[2]); + if (th > t0) t0 = th; + } + } + if (mat[3] >= 0) { + t1 = imgCoordMungeUpper(mat[3] + mat[5]) - imgCoordMungeLower(mat[5]); + if (splashAbs(mat[0]) >= 1) { + th = imgCoordMungeUpper(mat[3]) - imgCoordMungeLower(mat[1] * mat[2] / mat[0]); + if (th > t1) t1 = th; + } + } else { + t1 = imgCoordMungeUpper(mat[5]) - imgCoordMungeLower(mat[3] + mat[5]); + if (splashAbs(mat[0]) >= 1) { + th = imgCoordMungeUpper(mat[1] * mat[2] / mat[0]) - imgCoordMungeLower(mat[3]); + if (th > t1) t1 = th; + } + } + scaledHeight = t0 > t1 ? t0 : t1; + } + if (scaledWidth == 0) { + scaledWidth = 1; + } + if (scaledHeight == 0) { + scaledHeight = 1; + } + + // compute the inverse transform (after scaling) matrix + r00 = mat[0] / scaledWidth; + r01 = mat[1] / scaledWidth; + r10 = mat[2] / scaledHeight; + r11 = mat[3] / scaledHeight; + det = r00 * r11 - r01 * r10; + if (splashAbs(det) < 1e-6) { + // this should be caught by the singular matrix check in drawImage + return splashErrBadArg; + } + ir00 = r11 / det; + ir01 = -r01 / det; + ir10 = -r10 / det; + ir11 = r00 / det; + + // scale the input image + yp = srcHeight / scaledHeight; + if (yp < 0 || yp > INT_MAX - 1) { + return splashErrBadArg; + } + scaledImg = scaleImage(src, srcData, srcMode, nComps, srcAlpha, + srcWidth, srcHeight, scaledWidth, scaledHeight, interpolate); + + if (scaledImg == NULL) { + return splashErrBadArg; + } + + // construct the three sections + i = 0; + if (vy[1] < vy[i]) { + i = 1; + } + if (vy[2] < vy[i]) { + i = 2; + } + if (vy[3] < vy[i]) { + i = 3; + } + // NB: if using fixed point, 0.000001 will be truncated to zero, + // so these two comparisons must be <=, not < + if (splashAbs(vy[i] - vy[(i-1) & 3]) <= 0.000001 && + vy[(i-1) & 3] < vy[(i+1) & 3]) { + i = (i-1) & 3; + } + if (splashAbs(vy[i] - vy[(i+1) & 3]) <= 0.000001) { + section[0].y0 = imgCoordMungeLower(vy[i]); + section[0].y1 = imgCoordMungeUpper(vy[(i+2) & 3]) - 1; + if (vx[i] < vx[(i+1) & 3]) { + section[0].ia0 = i; + section[0].ia1 = (i+3) & 3; + section[0].ib0 = (i+1) & 3; + section[0].ib1 = (i+2) & 3; + } else { + section[0].ia0 = (i+1) & 3; + section[0].ia1 = (i+2) & 3; + section[0].ib0 = i; + section[0].ib1 = (i+3) & 3; + } + nSections = 1; + } else { + section[0].y0 = imgCoordMungeLower(vy[i]); + section[2].y1 = imgCoordMungeUpper(vy[(i+2) & 3]) - 1; + section[0].ia0 = section[0].ib0 = i; + section[2].ia1 = section[2].ib1 = (i+2) & 3; + if (vx[(i+1) & 3] < vx[(i+3) & 3]) { + section[0].ia1 = section[2].ia0 = (i+1) & 3; + section[0].ib1 = section[2].ib0 = (i+3) & 3; + } else { + section[0].ia1 = section[2].ia0 = (i+3) & 3; + section[0].ib1 = section[2].ib0 = (i+1) & 3; + } + if (vy[(i+1) & 3] < vy[(i+3) & 3]) { + section[1].y0 = imgCoordMungeLower(vy[(i+1) & 3]); + section[2].y0 = imgCoordMungeUpper(vy[(i+3) & 3]); + if (vx[(i+1) & 3] < vx[(i+3) & 3]) { + section[1].ia0 = (i+1) & 3; + section[1].ia1 = (i+2) & 3; + section[1].ib0 = i; + section[1].ib1 = (i+3) & 3; + } else { + section[1].ia0 = i; + section[1].ia1 = (i+3) & 3; + section[1].ib0 = (i+1) & 3; + section[1].ib1 = (i+2) & 3; + } + } else { + section[1].y0 = imgCoordMungeLower(vy[(i+3) & 3]); + section[2].y0 = imgCoordMungeUpper(vy[(i+1) & 3]); + if (vx[(i+1) & 3] < vx[(i+3) & 3]) { + section[1].ia0 = i; + section[1].ia1 = (i+1) & 3; + section[1].ib0 = (i+3) & 3; + section[1].ib1 = (i+2) & 3; + } else { + section[1].ia0 = (i+3) & 3; + section[1].ia1 = (i+2) & 3; + section[1].ib0 = i; + section[1].ib1 = (i+1) & 3; + } + } + section[0].y1 = section[1].y0 - 1; + section[1].y1 = section[2].y0 - 1; + nSections = 3; + } + for (i = 0; i < nSections; ++i) { + section[i].xa0 = vx[section[i].ia0]; + section[i].ya0 = vy[section[i].ia0]; + section[i].xa1 = vx[section[i].ia1]; + section[i].ya1 = vy[section[i].ia1]; + section[i].xb0 = vx[section[i].ib0]; + section[i].yb0 = vy[section[i].ib0]; + section[i].xb1 = vx[section[i].ib1]; + section[i].yb1 = vy[section[i].ib1]; + section[i].dxdya = (section[i].xa1 - section[i].xa0) / + (section[i].ya1 - section[i].ya0); + section[i].dxdyb = (section[i].xb1 - section[i].xb0) / + (section[i].yb1 - section[i].yb0); + } + + // initialize the pixel pipe + pipeInit(&pipe, 0, 0, NULL, pixel, + (Guchar)splashRound(state->fillAlpha * 255), + srcAlpha || (vectorAntialias && clipRes != splashClipAllInside), + gFalse); + if (vectorAntialias) { + drawAAPixelInit(); + } + + // make sure narrow images cover at least one pixel + if (nSections == 1) { + if (section[0].y0 == section[0].y1) { + ++section[0].y1; + clipRes = opClipRes = splashClipPartial; + } + } else { + if (section[0].y0 == section[2].y1) { + ++section[1].y1; + clipRes = opClipRes = splashClipPartial; + } + } + + // scan all pixels inside the target region + for (i = 0; i < nSections; ++i) { + for (y = section[i].y0; y <= section[i].y1; ++y) { + xa = imgCoordMungeLower(section[i].xa0 + + ((SplashCoord)y + 0.5 - section[i].ya0) * + section[i].dxdya); + if (unlikely(xa < 0)) + xa = 0; + xb = imgCoordMungeUpper(section[i].xb0 + + ((SplashCoord)y + 0.5 - section[i].yb0) * + section[i].dxdyb); + // make sure narrow images cover at least one pixel + if (xa == xb) { + ++xb; + } + if (clipRes != splashClipAllInside) { + clipRes2 = state->clip->testSpan(xa, xb - 1, y); + } else { + clipRes2 = clipRes; + } + for (x = xa; x < xb; ++x) { + // map (x+0.5, y+0.5) back to the scaled image + xx = splashFloor(((SplashCoord)x + 0.5 - mat[4]) * ir00 + + ((SplashCoord)y + 0.5 - mat[5]) * ir10); + yy = splashFloor(((SplashCoord)x + 0.5 - mat[4]) * ir01 + + ((SplashCoord)y + 0.5 - mat[5]) * ir11); + // xx should always be within bounds, but floating point + // inaccuracy can cause problems + if (xx < 0) { + xx = 0; + } else if (xx >= scaledWidth) { + xx = scaledWidth - 1; + } + if (yy < 0) { + yy = 0; + } else if (yy >= scaledHeight) { + yy = scaledHeight - 1; + } + scaledImg->getPixel(xx, yy, pixel); + if (srcAlpha) { + pipe.shape = scaledImg->alpha[yy * scaledWidth + xx]; + } else { + pipe.shape = 255; + } + if (vectorAntialias && clipRes2 != splashClipAllInside) { + drawAAPixel(&pipe, x, y); + } else { + drawPixel(&pipe, x, y, clipRes2 == splashClipAllInside); + } + } + } + } + + delete scaledImg; + return splashOk; +} + +// determine if a scaled image requires interpolation based on the scale and +// the interpolate flag from the image dictionary +static GBool isImageInterpolationRequired(int srcWidth, int srcHeight, + int scaledWidth, int scaledHeight, + GBool interpolate) { + if (interpolate) + return gTrue; + + /* When scale factor is >= 400% we don't interpolate. See bugs #25268, #9860 */ + if (scaledWidth / srcWidth >= 4 || scaledHeight / srcHeight >= 4) + return gFalse; + + return gTrue; +} + +// Scale an image into a SplashBitmap. +SplashBitmap *Splash::scaleImage(SplashImageSource src, void *srcData, + SplashColorMode srcMode, int nComps, + GBool srcAlpha, int srcWidth, int srcHeight, + int scaledWidth, int scaledHeight, GBool interpolate, GBool tilingPattern) { + SplashBitmap *dest; + + dest = new SplashBitmap(scaledWidth, scaledHeight, 1, srcMode, srcAlpha, gTrue, bitmap->getSeparationList()); + if (dest->getDataPtr() != NULL) { + if (scaledHeight < srcHeight) { + if (scaledWidth < srcWidth) { + scaleImageYdXd(src, srcData, srcMode, nComps, srcAlpha, + srcWidth, srcHeight, scaledWidth, scaledHeight, dest); + } else { + scaleImageYdXu(src, srcData, srcMode, nComps, srcAlpha, + srcWidth, srcHeight, scaledWidth, scaledHeight, dest); + } + } else { + if (scaledWidth < srcWidth) { + scaleImageYuXd(src, srcData, srcMode, nComps, srcAlpha, + srcWidth, srcHeight, scaledWidth, scaledHeight, dest); + } else { + if (!tilingPattern && isImageInterpolationRequired(srcWidth, srcHeight, scaledWidth, scaledHeight, interpolate)) { + scaleImageYuXuBilinear(src, srcData, srcMode, nComps, srcAlpha, + srcWidth, srcHeight, scaledWidth, scaledHeight, dest); + } else { + scaleImageYuXu(src, srcData, srcMode, nComps, srcAlpha, + srcWidth, srcHeight, scaledWidth, scaledHeight, dest); + } + } + } + } else { + delete dest; + dest = NULL; + } + return dest; +} + +void Splash::scaleImageYdXd(SplashImageSource src, void *srcData, + SplashColorMode srcMode, int nComps, + GBool srcAlpha, int srcWidth, int srcHeight, + int scaledWidth, int scaledHeight, + SplashBitmap *dest) { + Guchar *lineBuf, *alphaLineBuf; + Guint *pixBuf, *alphaPixBuf; + Guint pix0, pix1, pix2; +#if SPLASH_CMYK + Guint pix3; + Guint pix[SPOT_NCOMPS+4], cp; +#endif + Guint alpha; + Guchar *destPtr, *destAlphaPtr; + int yp, yq, xp, xq, yt, y, yStep, xt, x, xStep, xx, xxa, d, d0, d1; + int i, j; + + // Bresenham parameters for y scale + yp = srcHeight / scaledHeight; + yq = srcHeight % scaledHeight; + + // Bresenham parameters for x scale + xp = srcWidth / scaledWidth; + xq = srcWidth % scaledWidth; + + // allocate buffers + lineBuf = (Guchar *)gmallocn(srcWidth, nComps); + pixBuf = (Guint *)gmallocn(srcWidth, nComps * sizeof(int)); + if (srcAlpha) { + alphaLineBuf = (Guchar *)gmalloc(srcWidth); + alphaPixBuf = (Guint *)gmallocn(srcWidth, sizeof(int)); + } else { + alphaLineBuf = NULL; + alphaPixBuf = NULL; + } + + // init y scale Bresenham + yt = 0; + + destPtr = dest->data; + destAlphaPtr = dest->alpha; + for (y = 0; y < scaledHeight; ++y) { + + // y scale Bresenham + if ((yt += yq) >= scaledHeight) { + yt -= scaledHeight; + yStep = yp + 1; + } else { + yStep = yp; + } + + // read rows from image + memset(pixBuf, 0, srcWidth * nComps * sizeof(int)); + if (srcAlpha) { + memset(alphaPixBuf, 0, srcWidth * sizeof(int)); + } + for (i = 0; i < yStep; ++i) { + (*src)(srcData, lineBuf, alphaLineBuf); + for (j = 0; j < srcWidth * nComps; ++j) { + pixBuf[j] += lineBuf[j]; + } + if (srcAlpha) { + for (j = 0; j < srcWidth; ++j) { + alphaPixBuf[j] += alphaLineBuf[j]; + } + } + } + + // init x scale Bresenham + xt = 0; + d0 = (1 << 23) / (yStep * xp); + d1 = (1 << 23) / (yStep * (xp + 1)); + + xx = xxa = 0; + for (x = 0; x < scaledWidth; ++x) { + + // x scale Bresenham + if ((xt += xq) >= scaledWidth) { + xt -= scaledWidth; + xStep = xp + 1; + d = d1; + } else { + xStep = xp; + d = d0; + } + + switch (srcMode) { + + case splashModeMono8: + + // compute the final pixel + pix0 = 0; + for (i = 0; i < xStep; ++i) { + pix0 += pixBuf[xx++]; + } + // pix / xStep * yStep + pix0 = (pix0 * d) >> 23; + + // store the pixel + *destPtr++ = (Guchar)pix0; + break; + + case splashModeRGB8: + + // compute the final pixel + pix0 = pix1 = pix2 = 0; + for (i = 0; i < xStep; ++i) { + pix0 += pixBuf[xx]; + pix1 += pixBuf[xx+1]; + pix2 += pixBuf[xx+2]; + xx += 3; + } + // pix / xStep * yStep + pix0 = (pix0 * d) >> 23; + pix1 = (pix1 * d) >> 23; + pix2 = (pix2 * d) >> 23; + + // store the pixel + *destPtr++ = (Guchar)pix0; + *destPtr++ = (Guchar)pix1; + *destPtr++ = (Guchar)pix2; + break; + + case splashModeXBGR8: + + // compute the final pixel + pix0 = pix1 = pix2 = 0; + for (i = 0; i < xStep; ++i) { + pix0 += pixBuf[xx]; + pix1 += pixBuf[xx+1]; + pix2 += pixBuf[xx+2]; + xx += 4; + } + // pix / xStep * yStep + pix0 = (pix0 * d) >> 23; + pix1 = (pix1 * d) >> 23; + pix2 = (pix2 * d) >> 23; + + // store the pixel + *destPtr++ = (Guchar)pix2; + *destPtr++ = (Guchar)pix1; + *destPtr++ = (Guchar)pix0; + *destPtr++ = (Guchar)255; + break; + + case splashModeBGR8: + + // compute the final pixel + pix0 = pix1 = pix2 = 0; + for (i = 0; i < xStep; ++i) { + pix0 += pixBuf[xx]; + pix1 += pixBuf[xx+1]; + pix2 += pixBuf[xx+2]; + xx += 3; + } + // pix / xStep * yStep + pix0 = (pix0 * d) >> 23; + pix1 = (pix1 * d) >> 23; + pix2 = (pix2 * d) >> 23; + + // store the pixel + *destPtr++ = (Guchar)pix2; + *destPtr++ = (Guchar)pix1; + *destPtr++ = (Guchar)pix0; + break; + +#if SPLASH_CMYK + case splashModeCMYK8: + + // compute the final pixel + pix0 = pix1 = pix2 = pix3 = 0; + for (i = 0; i < xStep; ++i) { + pix0 += pixBuf[xx]; + pix1 += pixBuf[xx+1]; + pix2 += pixBuf[xx+2]; + pix3 += pixBuf[xx+3]; + xx += 4; + } + // pix / xStep * yStep + pix0 = (pix0 * d) >> 23; + pix1 = (pix1 * d) >> 23; + pix2 = (pix2 * d) >> 23; + pix3 = (pix3 * d) >> 23; + + // store the pixel + *destPtr++ = (Guchar)pix0; + *destPtr++ = (Guchar)pix1; + *destPtr++ = (Guchar)pix2; + *destPtr++ = (Guchar)pix3; + break; + case splashModeDeviceN8: + + // compute the final pixel + for (cp = 0; cp < SPOT_NCOMPS+4; cp++) + pix[cp] = 0; + for (i = 0; i < xStep; ++i) { + for (cp = 0; cp < SPOT_NCOMPS+4; cp++) { + pix[cp] += pixBuf[xx + cp]; + } + xx += (SPOT_NCOMPS+4); + } + // pix / xStep * yStep + for (cp = 0; cp < SPOT_NCOMPS+4; cp++) + pix[cp] = (pix[cp] * d) >> 23; + + // store the pixel + for (cp = 0; cp < SPOT_NCOMPS+4; cp++) + *destPtr++ = (Guchar)pix[cp]; + break; +#endif + + + case splashModeMono1: // mono1 is not allowed + default: + break; + } + + // process alpha + if (srcAlpha) { + alpha = 0; + for (i = 0; i < xStep; ++i, ++xxa) { + alpha += alphaPixBuf[xxa]; + } + // alpha / xStep * yStep + alpha = (alpha * d) >> 23; + *destAlphaPtr++ = (Guchar)alpha; + } + } + } + + gfree(alphaPixBuf); + gfree(alphaLineBuf); + gfree(pixBuf); + gfree(lineBuf); +} + +void Splash::scaleImageYdXu(SplashImageSource src, void *srcData, + SplashColorMode srcMode, int nComps, + GBool srcAlpha, int srcWidth, int srcHeight, + int scaledWidth, int scaledHeight, + SplashBitmap *dest) { + Guchar *lineBuf, *alphaLineBuf; + Guint *pixBuf, *alphaPixBuf; + Guint pix[splashMaxColorComps]; + Guint alpha; + Guchar *destPtr, *destAlphaPtr; + int yp, yq, xp, xq, yt, y, yStep, xt, x, xStep, d; + int i, j; + + // Bresenham parameters for y scale + yp = srcHeight / scaledHeight; + yq = srcHeight % scaledHeight; + + // Bresenham parameters for x scale + xp = scaledWidth / srcWidth; + xq = scaledWidth % srcWidth; + + // allocate buffers + lineBuf = (Guchar *)gmallocn(srcWidth, nComps); + pixBuf = (Guint *)gmallocn(srcWidth, nComps * sizeof(int)); + if (srcAlpha) { + alphaLineBuf = (Guchar *)gmalloc(srcWidth); + alphaPixBuf = (Guint *)gmallocn(srcWidth, sizeof(int)); + } else { + alphaLineBuf = NULL; + alphaPixBuf = NULL; + } + + // init y scale Bresenham + yt = 0; + + destPtr = dest->data; + destAlphaPtr = dest->alpha; + for (y = 0; y < scaledHeight; ++y) { + + // y scale Bresenham + if ((yt += yq) >= scaledHeight) { + yt -= scaledHeight; + yStep = yp + 1; + } else { + yStep = yp; + } + + // read rows from image + memset(pixBuf, 0, srcWidth * nComps * sizeof(int)); + if (srcAlpha) { + memset(alphaPixBuf, 0, srcWidth * sizeof(int)); + } + for (i = 0; i < yStep; ++i) { + (*src)(srcData, lineBuf, alphaLineBuf); + for (j = 0; j < srcWidth * nComps; ++j) { + pixBuf[j] += lineBuf[j]; + } + if (srcAlpha) { + for (j = 0; j < srcWidth; ++j) { + alphaPixBuf[j] += alphaLineBuf[j]; + } + } + } + + // init x scale Bresenham + xt = 0; + d = (1 << 23) / yStep; + + for (x = 0; x < srcWidth; ++x) { + + // x scale Bresenham + if ((xt += xq) >= srcWidth) { + xt -= srcWidth; + xStep = xp + 1; + } else { + xStep = xp; + } + + // compute the final pixel + for (i = 0; i < nComps; ++i) { + // pixBuf[] / yStep + pix[i] = (pixBuf[x * nComps + i] * d) >> 23; + } + + // store the pixel + switch (srcMode) { + case splashModeMono1: // mono1 is not allowed + break; + case splashModeMono8: + for (i = 0; i < xStep; ++i) { + *destPtr++ = (Guchar)pix[0]; + } + break; + case splashModeRGB8: + for (i = 0; i < xStep; ++i) { + *destPtr++ = (Guchar)pix[0]; + *destPtr++ = (Guchar)pix[1]; + *destPtr++ = (Guchar)pix[2]; + } + break; + case splashModeXBGR8: + for (i = 0; i < xStep; ++i) { + *destPtr++ = (Guchar)pix[2]; + *destPtr++ = (Guchar)pix[1]; + *destPtr++ = (Guchar)pix[0]; + *destPtr++ = (Guchar)255; + } + break; + case splashModeBGR8: + for (i = 0; i < xStep; ++i) { + *destPtr++ = (Guchar)pix[2]; + *destPtr++ = (Guchar)pix[1]; + *destPtr++ = (Guchar)pix[0]; + } + break; +#if SPLASH_CMYK + case splashModeCMYK8: + for (i = 0; i < xStep; ++i) { + *destPtr++ = (Guchar)pix[0]; + *destPtr++ = (Guchar)pix[1]; + *destPtr++ = (Guchar)pix[2]; + *destPtr++ = (Guchar)pix[3]; + } + break; + case splashModeDeviceN8: + for (i = 0; i < xStep; ++i) { + for (int cp = 0; cp < SPOT_NCOMPS+4; cp++) + *destPtr++ = (Guchar)pix[cp]; + } + break; +#endif + } + + // process alpha + if (srcAlpha) { + // alphaPixBuf[] / yStep + alpha = (alphaPixBuf[x] * d) >> 23; + for (i = 0; i < xStep; ++i) { + *destAlphaPtr++ = (Guchar)alpha; + } + } + } + } + + gfree(alphaPixBuf); + gfree(alphaLineBuf); + gfree(pixBuf); + gfree(lineBuf); +} + +void Splash::scaleImageYuXd(SplashImageSource src, void *srcData, + SplashColorMode srcMode, int nComps, + GBool srcAlpha, int srcWidth, int srcHeight, + int scaledWidth, int scaledHeight, + SplashBitmap *dest) { + Guchar *lineBuf, *alphaLineBuf; + Guint pix[splashMaxColorComps]; + Guint alpha; + Guchar *destPtr0, *destPtr, *destAlphaPtr0, *destAlphaPtr; + int yp, yq, xp, xq, yt, y, yStep, xt, x, xStep, xx, xxa, d, d0, d1; + int i, j; + + // Bresenham parameters for y scale + yp = scaledHeight / srcHeight; + yq = scaledHeight % srcHeight; + + // Bresenham parameters for x scale + xp = srcWidth / scaledWidth; + xq = srcWidth % scaledWidth; + + // allocate buffers + lineBuf = (Guchar *)gmallocn_checkoverflow(srcWidth, nComps); + if (unlikely(!lineBuf)) + return; + if (srcAlpha) { + alphaLineBuf = (Guchar *)gmalloc(srcWidth); + } else { + alphaLineBuf = NULL; + } + + // init y scale Bresenham + yt = 0; + + destPtr0 = dest->data; + destAlphaPtr0 = dest->alpha; + for (y = 0; y < srcHeight; ++y) { + + // y scale Bresenham + if ((yt += yq) >= srcHeight) { + yt -= srcHeight; + yStep = yp + 1; + } else { + yStep = yp; + } + + // read row from image + (*src)(srcData, lineBuf, alphaLineBuf); + + // init x scale Bresenham + xt = 0; + d0 = (1 << 23) / xp; + d1 = (1 << 23) / (xp + 1); + + xx = xxa = 0; + for (x = 0; x < scaledWidth; ++x) { + + // x scale Bresenham + if ((xt += xq) >= scaledWidth) { + xt -= scaledWidth; + xStep = xp + 1; + d = d1; + } else { + xStep = xp; + d = d0; + } + + // compute the final pixel + for (i = 0; i < nComps; ++i) { + pix[i] = 0; + } + for (i = 0; i < xStep; ++i) { + for (j = 0; j < nComps; ++j, ++xx) { + pix[j] += lineBuf[xx]; + } + } + for (i = 0; i < nComps; ++i) { + // pix[] / xStep + pix[i] = (pix[i] * d) >> 23; + } + + // store the pixel + switch (srcMode) { + case splashModeMono1: // mono1 is not allowed + break; + case splashModeMono8: + for (i = 0; i < yStep; ++i) { + destPtr = destPtr0 + (i * scaledWidth + x) * nComps; + *destPtr++ = (Guchar)pix[0]; + } + break; + case splashModeRGB8: + for (i = 0; i < yStep; ++i) { + destPtr = destPtr0 + (i * scaledWidth + x) * nComps; + *destPtr++ = (Guchar)pix[0]; + *destPtr++ = (Guchar)pix[1]; + *destPtr++ = (Guchar)pix[2]; + } + break; + case splashModeXBGR8: + for (i = 0; i < yStep; ++i) { + destPtr = destPtr0 + (i * scaledWidth + x) * nComps; + *destPtr++ = (Guchar)pix[2]; + *destPtr++ = (Guchar)pix[1]; + *destPtr++ = (Guchar)pix[0]; + *destPtr++ = (Guchar)255; + } + break; + case splashModeBGR8: + for (i = 0; i < yStep; ++i) { + destPtr = destPtr0 + (i * scaledWidth + x) * nComps; + *destPtr++ = (Guchar)pix[2]; + *destPtr++ = (Guchar)pix[1]; + *destPtr++ = (Guchar)pix[0]; + } + break; +#if SPLASH_CMYK + case splashModeCMYK8: + for (i = 0; i < yStep; ++i) { + destPtr = destPtr0 + (i * scaledWidth + x) * nComps; + *destPtr++ = (Guchar)pix[0]; + *destPtr++ = (Guchar)pix[1]; + *destPtr++ = (Guchar)pix[2]; + *destPtr++ = (Guchar)pix[3]; + } + break; + case splashModeDeviceN8: + for (i = 0; i < yStep; ++i) { + destPtr = destPtr0 + (i * scaledWidth + x) * nComps; + for (int cp = 0; cp < SPOT_NCOMPS+4; cp++) + *destPtr++ = (Guchar)pix[cp]; + } + break; +#endif + } + + // process alpha + if (srcAlpha) { + alpha = 0; + for (i = 0; i < xStep; ++i, ++xxa) { + alpha += alphaLineBuf[xxa]; + } + // alpha / xStep + alpha = (alpha * d) >> 23; + for (i = 0; i < yStep; ++i) { + destAlphaPtr = destAlphaPtr0 + i * scaledWidth + x; + *destAlphaPtr = (Guchar)alpha; + } + } + } + + destPtr0 += yStep * scaledWidth * nComps; + if (srcAlpha) { + destAlphaPtr0 += yStep * scaledWidth; + } + } + + gfree(alphaLineBuf); + gfree(lineBuf); +} + +void Splash::scaleImageYuXu(SplashImageSource src, void *srcData, + SplashColorMode srcMode, int nComps, + GBool srcAlpha, int srcWidth, int srcHeight, + int scaledWidth, int scaledHeight, + SplashBitmap *dest) { + Guchar *lineBuf, *alphaLineBuf; + Guint pix[splashMaxColorComps]; + Guint alpha; + Guchar *destPtr0, *destPtr, *destAlphaPtr0, *destAlphaPtr; + int yp, yq, xp, xq, yt, y, yStep, xt, x, xStep, xx; + int i, j; + + // Bresenham parameters for y scale + yp = scaledHeight / srcHeight; + yq = scaledHeight % srcHeight; + + // Bresenham parameters for x scale + xp = scaledWidth / srcWidth; + xq = scaledWidth % srcWidth; + + // allocate buffers + lineBuf = (Guchar *)gmallocn(srcWidth, nComps); + if (srcAlpha) { + alphaLineBuf = (Guchar *)gmalloc(srcWidth); + } else { + alphaLineBuf = NULL; + } + + // init y scale Bresenham + yt = 0; + + destPtr0 = dest->data; + destAlphaPtr0 = dest->alpha; + for (y = 0; y < srcHeight; ++y) { + + // y scale Bresenham + if ((yt += yq) >= srcHeight) { + yt -= srcHeight; + yStep = yp + 1; + } else { + yStep = yp; + } + + // read row from image + (*src)(srcData, lineBuf, alphaLineBuf); + + // init x scale Bresenham + xt = 0; + + xx = 0; + for (x = 0; x < srcWidth; ++x) { + + // x scale Bresenham + if ((xt += xq) >= srcWidth) { + xt -= srcWidth; + xStep = xp + 1; + } else { + xStep = xp; + } + + // compute the final pixel + for (i = 0; i < nComps; ++i) { + pix[i] = lineBuf[x * nComps + i]; + } + + // store the pixel + switch (srcMode) { + case splashModeMono1: // mono1 is not allowed + break; + case splashModeMono8: + for (i = 0; i < yStep; ++i) { + for (j = 0; j < xStep; ++j) { + destPtr = destPtr0 + (i * scaledWidth + xx + j) * nComps; + *destPtr++ = (Guchar)pix[0]; + } + } + break; + case splashModeRGB8: + for (i = 0; i < yStep; ++i) { + for (j = 0; j < xStep; ++j) { + destPtr = destPtr0 + (i * scaledWidth + xx + j) * nComps; + *destPtr++ = (Guchar)pix[0]; + *destPtr++ = (Guchar)pix[1]; + *destPtr++ = (Guchar)pix[2]; + } + } + break; + case splashModeXBGR8: + for (i = 0; i < yStep; ++i) { + for (j = 0; j < xStep; ++j) { + destPtr = destPtr0 + (i * scaledWidth + xx + j) * nComps; + *destPtr++ = (Guchar)pix[2]; + *destPtr++ = (Guchar)pix[1]; + *destPtr++ = (Guchar)pix[0]; + *destPtr++ = (Guchar)255; + } + } + break; + case splashModeBGR8: + for (i = 0; i < yStep; ++i) { + for (j = 0; j < xStep; ++j) { + destPtr = destPtr0 + (i * scaledWidth + xx + j) * nComps; + *destPtr++ = (Guchar)pix[2]; + *destPtr++ = (Guchar)pix[1]; + *destPtr++ = (Guchar)pix[0]; + } + } + break; +#if SPLASH_CMYK + case splashModeCMYK8: + for (i = 0; i < yStep; ++i) { + for (j = 0; j < xStep; ++j) { + destPtr = destPtr0 + (i * scaledWidth + xx + j) * nComps; + *destPtr++ = (Guchar)pix[0]; + *destPtr++ = (Guchar)pix[1]; + *destPtr++ = (Guchar)pix[2]; + *destPtr++ = (Guchar)pix[3]; + } + } + break; + case splashModeDeviceN8: + for (i = 0; i < yStep; ++i) { + for (j = 0; j < xStep; ++j) { + destPtr = destPtr0 + (i * scaledWidth + xx + j) * nComps; + for (int cp = 0; cp < SPOT_NCOMPS+4; cp++) + *destPtr++ = (Guchar)pix[cp]; + } + } + break; +#endif + } + + // process alpha + if (srcAlpha) { + alpha = alphaLineBuf[x]; + for (i = 0; i < yStep; ++i) { + for (j = 0; j < xStep; ++j) { + destAlphaPtr = destAlphaPtr0 + i * scaledWidth + xx + j; + *destAlphaPtr = (Guchar)alpha; + } + } + } + + xx += xStep; + } + + destPtr0 += yStep * scaledWidth * nComps; + if (srcAlpha) { + destAlphaPtr0 += yStep * scaledWidth; + } + } + + gfree(alphaLineBuf); + gfree(lineBuf); +} + +// expand source row to scaledWidth using linear interpolation +static void expandRow(Guchar *srcBuf, Guchar *dstBuf, int srcWidth, int scaledWidth, int nComps) +{ + double xStep = (double)srcWidth/scaledWidth; + double xSrc = 0.0; + double xFrac, xInt; + int p; + + // pad the source with an extra pixel equal to the last pixel + // so that when xStep is inside the last pixel we still have two + // pixels to interpolate between. + for (int i = 0; i < nComps; i++) + srcBuf[srcWidth*nComps + i] = srcBuf[(srcWidth-1)*nComps + i]; + + for (int x = 0; x < scaledWidth; x++) { + xFrac = modf(xSrc, &xInt); + p = (int)xInt; + for (int c = 0; c < nComps; c++) { + dstBuf[nComps*x + c] = srcBuf[nComps*p + c]*(1.0 - xFrac) + srcBuf[nComps*(p+1) + c]*xFrac; + } + xSrc += xStep; + } +} + +// Scale up image using bilinear interpolation +void Splash::scaleImageYuXuBilinear(SplashImageSource src, void *srcData, + SplashColorMode srcMode, int nComps, + GBool srcAlpha, int srcWidth, int srcHeight, + int scaledWidth, int scaledHeight, + SplashBitmap *dest) { + Guchar *srcBuf, *lineBuf1, *lineBuf2, *alphaSrcBuf, *alphaLineBuf1, *alphaLineBuf2; + Guint pix[splashMaxColorComps]; + Guchar *destPtr0, *destPtr, *destAlphaPtr0, *destAlphaPtr; + int i; + + // allocate buffers + srcBuf = (Guchar *)gmallocn(srcWidth+1, nComps); // + 1 pixel of padding + lineBuf1 = (Guchar *)gmallocn(scaledWidth, nComps); + lineBuf2 = (Guchar *)gmallocn(scaledWidth, nComps); + if (srcAlpha) { + alphaSrcBuf = (Guchar *)gmalloc(srcWidth+1); // + 1 pixel of padding + alphaLineBuf1 = (Guchar *)gmalloc(scaledWidth); + alphaLineBuf2 = (Guchar *)gmalloc(scaledWidth); + } else { + alphaSrcBuf = NULL; + alphaLineBuf1 = NULL; + alphaLineBuf2 = NULL; + } + + double ySrc = 0.0; + double yStep = (double)srcHeight/scaledHeight; + double yFrac, yInt; + int currentSrcRow = -1; + (*src)(srcData, srcBuf, alphaSrcBuf); + expandRow(srcBuf, lineBuf2, srcWidth, scaledWidth, nComps); + if (srcAlpha) + expandRow(alphaSrcBuf, alphaLineBuf2, srcWidth, scaledWidth, 1); + + destPtr0 = dest->data; + destAlphaPtr0 = dest->alpha; + for (int y = 0; y < scaledHeight; y++) { + yFrac = modf(ySrc, &yInt); + if ((int)yInt > currentSrcRow) { + currentSrcRow++; + // Copy line2 data to line1 and get next line2 data. + // If line2 already contains the last source row we don't touch it. + // This effectively adds an extra row of padding for interpolating the + // last source row with. + memcpy(lineBuf1, lineBuf2, scaledWidth * nComps); + if (srcAlpha) + memcpy(alphaLineBuf1, alphaLineBuf2, scaledWidth); + if (currentSrcRow < srcHeight) { + (*src)(srcData, srcBuf, alphaSrcBuf); + expandRow(srcBuf, lineBuf2, srcWidth, scaledWidth, nComps); + if (srcAlpha) + expandRow(alphaSrcBuf, alphaLineBuf2, srcWidth, scaledWidth, 1); + } + } + + // write row y using linear interpolation on lineBuf1 and lineBuf2 + for (int x = 0; x < scaledWidth; ++x) { + // compute the final pixel + for (i = 0; i < nComps; ++i) { + pix[i] = lineBuf1[x*nComps + i]*(1.0 - yFrac) + lineBuf2[x*nComps + i]*yFrac; + } + + // store the pixel + destPtr = destPtr0 + (y * scaledWidth + x) * nComps; + switch (srcMode) { + case splashModeMono1: // mono1 is not allowed + break; + case splashModeMono8: + *destPtr++ = (Guchar)pix[0]; + break; + case splashModeRGB8: + *destPtr++ = (Guchar)pix[0]; + *destPtr++ = (Guchar)pix[1]; + *destPtr++ = (Guchar)pix[2]; + break; + case splashModeXBGR8: + *destPtr++ = (Guchar)pix[2]; + *destPtr++ = (Guchar)pix[1]; + *destPtr++ = (Guchar)pix[0]; + *destPtr++ = (Guchar)255; + break; + case splashModeBGR8: + *destPtr++ = (Guchar)pix[2]; + *destPtr++ = (Guchar)pix[1]; + *destPtr++ = (Guchar)pix[0]; + break; +#if SPLASH_CMYK + case splashModeCMYK8: + *destPtr++ = (Guchar)pix[0]; + *destPtr++ = (Guchar)pix[1]; + *destPtr++ = (Guchar)pix[2]; + *destPtr++ = (Guchar)pix[3]; + break; + case splashModeDeviceN8: + for (int cp = 0; cp < SPOT_NCOMPS+4; cp++) + *destPtr++ = (Guchar)pix[cp]; + break; +#endif + } + + // process alpha + if (srcAlpha) { + destAlphaPtr = destAlphaPtr0 + y*scaledWidth + x; + *destAlphaPtr = alphaLineBuf1[x]*(1.0 - yFrac) + alphaLineBuf2[x]*yFrac; + } + } + + ySrc += yStep; + } + + gfree(alphaSrcBuf); + gfree(alphaLineBuf1); + gfree(alphaLineBuf2); + gfree(srcBuf); + gfree(lineBuf1); + gfree(lineBuf2); +} + +void Splash::vertFlipImage(SplashBitmap *img, int width, int height, + int nComps) { + Guchar *lineBuf; + Guchar *p0, *p1; + int w; + + if (unlikely(img->data == NULL)) { + error(errInternal, -1, "img->data is NULL in Splash::vertFlipImage"); + return; + } + + w = width * nComps; + lineBuf = (Guchar *)gmalloc(w); + for (p0 = img->data, p1 = img->data + (height - 1) * w; + p0 < p1; + p0 += w, p1 -= w) { + memcpy(lineBuf, p0, w); + memcpy(p0, p1, w); + memcpy(p1, lineBuf, w); + } + if (img->alpha) { + for (p0 = img->alpha, p1 = img->alpha + (height - 1) * width; + p0 < p1; + p0 += width, p1 -= width) { + memcpy(lineBuf, p0, width); + memcpy(p0, p1, width); + memcpy(p1, lineBuf, width); + } + } + 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; + SplashColor pixel; + Guchar *ap; + int w, h, x0, y0, x1, y1, x, y; + + // split the image into clipped and unclipped regions + w = src->getWidth(); + h = src->getHeight(); + if (clipRes == splashClipAllInside) { + x0 = 0; + y0 = 0; + x1 = w; + y1 = h; + } else { + if (state->clip->getNumPaths()) { + x0 = x1 = w; + y0 = y1 = h; + } else { + if ((x0 = splashCeil(state->clip->getXMin()) - xDest) < 0) { + x0 = 0; + } + if ((y0 = splashCeil(state->clip->getYMin()) - yDest) < 0) { + y0 = 0; + } + if ((x1 = splashFloor(state->clip->getXMax()) - xDest) > w) { + x1 = w; + } + if (x1 < x0) { + x1 = x0; + } + if ((y1 = splashFloor(state->clip->getYMax()) - yDest) > h) { + y1 = h; + } + if (y1 < y0) { + y1 = y0; + } + } + } + + // draw the unclipped region + if (x0 < w && y0 < h && x0 < x1 && y0 < y1) { + pipeInit(&pipe, xDest + x0, yDest + y0, NULL, pixel, + (Guchar)splashRound(state->fillAlpha * 255), srcAlpha, gFalse); + if (srcAlpha) { + for (y = y0; y < y1; ++y) { + pipeSetXY(&pipe, xDest + x0, yDest + y); + ap = src->getAlphaPtr() + y * w + x0; + for (x = x0; x < x1; ++x) { + src->getPixel(x, y, pixel); + pipe.shape = *ap++; + (this->*pipe.run)(&pipe); + } + } + } else { + for (y = y0; y < y1; ++y) { + pipeSetXY(&pipe, xDest + x0, yDest + y); + for (x = x0; x < x1; ++x) { + src->getPixel(x, y, pixel); + (this->*pipe.run)(&pipe); + } + } + } + updateModX(xDest + x0); + updateModX(xDest + x1 - 1); + updateModY(yDest + y0); + updateModY(yDest + y1 - 1); + } + + // draw the clipped regions + if (y0 > 0) { + blitImageClipped(src, srcAlpha, 0, 0, xDest, yDest, w, y0); + } + if (y1 < h) { + blitImageClipped(src, srcAlpha, 0, y1, xDest, yDest + y1, w, h - y1); + } + if (x0 > 0 && y0 < y1) { + blitImageClipped(src, srcAlpha, 0, y0, xDest, yDest + y0, x0, y1 - y0); + } + if (x1 < w && y0 < y1) { + blitImageClipped(src, srcAlpha, x1, y0, xDest + x1, yDest + y0, + w - x1, y1 - y0); + } +} + +void Splash::blitImageClipped(SplashBitmap *src, GBool srcAlpha, + int xSrc, int ySrc, int xDest, int yDest, + int w, int h) { + SplashPipe pipe; + SplashColor pixel; + Guchar *ap; + int x, y; + + if (vectorAntialias) { + pipeInit(&pipe, xDest, yDest, NULL, pixel, + (Guchar)splashRound(state->fillAlpha * 255), gTrue, gFalse); + drawAAPixelInit(); + if (srcAlpha) { + for (y = 0; y < h; ++y) { + ap = src->getAlphaPtr() + (ySrc + y) * src->getWidth() + xSrc; + for (x = 0; x < w; ++x) { + src->getPixel(xSrc + x, ySrc + y, pixel); + pipe.shape = *ap++; + drawAAPixel(&pipe, xDest + x, yDest + y); + } + } + } else { + for (y = 0; y < h; ++y) { + for (x = 0; x < w; ++x) { + src->getPixel(xSrc + x, ySrc + y, pixel); + pipe.shape = 255; + drawAAPixel(&pipe, xDest + x, yDest + y); + } + } + } + } else { + pipeInit(&pipe, xDest, yDest, NULL, pixel, + (Guchar)splashRound(state->fillAlpha * 255), srcAlpha, gFalse); + if (srcAlpha) { + for (y = 0; y < h; ++y) { + ap = src->getAlphaPtr() + (ySrc + y) * src->getWidth() + xSrc; + pipeSetXY(&pipe, xDest, yDest + y); + for (x = 0; x < w; ++x) { + if (state->clip->test(xDest + x, yDest + y)) { + src->getPixel(xSrc + x, ySrc + y, pixel); + pipe.shape = *ap++; + (this->*pipe.run)(&pipe); + updateModX(xDest + x); + updateModY(yDest + y); + } else { + pipeIncX(&pipe); + ++ap; + } + } + } + } else { + for (y = 0; y < h; ++y) { + pipeSetXY(&pipe, xDest, yDest + y); + for (x = 0; x < w; ++x) { + if (state->clip->test(xDest + x, yDest + y)) { + src->getPixel(xSrc + x, ySrc + y, pixel); + (this->*pipe.run)(&pipe); + updateModX(xDest + x); + updateModY(yDest + y); + } else { + pipeIncX(&pipe); + } + } + } + } + } +} + +SplashError Splash::composite(SplashBitmap *src, int xSrc, int ySrc, + int xDest, int yDest, int w, int h, + GBool noClip, GBool nonIsolated, + GBool knockout, SplashCoord knockoutOpacity) { + SplashPipe pipe; + SplashColor pixel; + Guchar alpha; + Guchar *ap; + int x, y; + + if (src->mode != bitmap->mode) { + return splashErrModeMismatch; + } + + if(src->getSeparationList()->getLength() > bitmap->getSeparationList()->getLength()) { + for (x = bitmap->getSeparationList()->getLength(); x < src->getSeparationList()->getLength(); x++) + bitmap->getSeparationList()->append(((GfxSeparationColorSpace *)src->getSeparationList()->get(x))->copy()); + } + if (src->alpha) { + pipeInit(&pipe, xDest, yDest, NULL, pixel, + (Guchar)splashRound(state->fillAlpha * 255), gTrue, nonIsolated, + knockout, (Guchar)splashRound(knockoutOpacity * 255)); + if (noClip) { + for (y = 0; y < h; ++y) { + pipeSetXY(&pipe, xDest, yDest + y); + ap = src->getAlphaPtr() + (ySrc + y) * src->getWidth() + xSrc; + for (x = 0; x < w; ++x) { + src->getPixel(xSrc + x, ySrc + y, pixel); + alpha = *ap++; + // this uses shape instead of alpha, which isn't technically + // correct, but works out the same + pipe.shape = alpha; + (this->*pipe.run)(&pipe); + } + } + updateModX(xDest); + updateModX(xDest + w - 1); + updateModY(yDest); + updateModY(yDest + h - 1); + } else { + for (y = 0; y < h; ++y) { + pipeSetXY(&pipe, xDest, yDest + y); + ap = src->getAlphaPtr() + (ySrc + y) * src->getWidth() + xSrc; + for (x = 0; x < w; ++x) { + src->getPixel(xSrc + x, ySrc + y, pixel); + alpha = *ap++; + if (state->clip->test(xDest + x, yDest + y)) { + // this uses shape instead of alpha, which isn't technically + // correct, but works out the same + pipe.shape = alpha; + (this->*pipe.run)(&pipe); + updateModX(xDest + x); + updateModY(yDest + y); + } else { + pipeIncX(&pipe); + } + } + } + } + } else { + pipeInit(&pipe, xDest, yDest, NULL, pixel, + (Guchar)splashRound(state->fillAlpha * 255), gFalse, nonIsolated); + if (noClip) { + for (y = 0; y < h; ++y) { + pipeSetXY(&pipe, xDest, yDest + y); + for (x = 0; x < w; ++x) { + src->getPixel(xSrc + x, ySrc + y, pixel); + (this->*pipe.run)(&pipe); + } + } + updateModX(xDest); + updateModX(xDest + w - 1); + updateModY(yDest); + updateModY(yDest + h - 1); + } else { + for (y = 0; y < h; ++y) { + pipeSetXY(&pipe, xDest, yDest + y); + for (x = 0; x < w; ++x) { + src->getPixel(xSrc + x, ySrc + y, pixel); + if (state->clip->test(xDest + x, yDest + y)) { + (this->*pipe.run)(&pipe); + updateModX(xDest + x); + updateModY(yDest + y); + } else { + pipeIncX(&pipe); + } + } + } + } + } + + return splashOk; +} + +void Splash::compositeBackground(SplashColorPtr color) { + SplashColorPtr p; + Guchar *q; + Guchar alpha, alpha1, c, color0, color1, color2; +#if SPLASH_CMYK + Guchar color3; + Guchar colorsp[SPOT_NCOMPS+4], cp; +#endif + int x, y, mask; + + if (unlikely(bitmap->alpha == NULL)) { + error(errInternal, -1, "bitmap->alpha is NULL in Splash::compositeBackground"); + return; + } + + switch (bitmap->mode) { + case splashModeMono1: + color0 = color[0]; + for (y = 0; y < bitmap->height; ++y) { + p = &bitmap->data[y * bitmap->rowSize]; + q = &bitmap->alpha[y * bitmap->width]; + mask = 0x80; + for (x = 0; x < bitmap->width; ++x) { + alpha = *q++; + alpha1 = 255 - alpha; + c = (*p & mask) ? 0xff : 0x00; + c = div255(alpha1 * color0 + alpha * c); + if (c & 0x80) { + *p |= mask; + } else { + *p &= ~mask; + } + if (!(mask >>= 1)) { + mask = 0x80; + ++p; + } + } + } + break; + case splashModeMono8: + color0 = color[0]; + for (y = 0; y < bitmap->height; ++y) { + p = &bitmap->data[y * bitmap->rowSize]; + q = &bitmap->alpha[y * bitmap->width]; + for (x = 0; x < bitmap->width; ++x) { + alpha = *q++; + alpha1 = 255 - alpha; + p[0] = div255(alpha1 * color0 + alpha * p[0]); + ++p; + } + } + break; + case splashModeRGB8: + case splashModeBGR8: + color0 = color[0]; + color1 = color[1]; + color2 = color[2]; + for (y = 0; y < bitmap->height; ++y) { + p = &bitmap->data[y * bitmap->rowSize]; + q = &bitmap->alpha[y * bitmap->width]; + for (x = 0; x < bitmap->width; ++x) { + alpha = *q++; + if (alpha == 0) + { + p[0] = color0; + p[1] = color1; + p[2] = color2; + } + else if (alpha != 255) + { + alpha1 = 255 - alpha; + p[0] = div255(alpha1 * color0 + alpha * p[0]); + p[1] = div255(alpha1 * color1 + alpha * p[1]); + p[2] = div255(alpha1 * color2 + alpha * p[2]); + } + p += 3; + } + } + break; + case splashModeXBGR8: + color0 = color[0]; + color1 = color[1]; + color2 = color[2]; + for (y = 0; y < bitmap->height; ++y) { + p = &bitmap->data[y * bitmap->rowSize]; + q = &bitmap->alpha[y * bitmap->width]; + for (x = 0; x < bitmap->width; ++x) { + alpha = *q++; + if (alpha == 0) + { + p[0] = color0; + p[1] = color1; + p[2] = color2; + } + else if (alpha != 255) + { + alpha1 = 255 - alpha; + p[0] = div255(alpha1 * color0 + alpha * p[0]); + p[1] = div255(alpha1 * color1 + alpha * p[1]); + p[2] = div255(alpha1 * color2 + alpha * p[2]); + } + p[3] = 255; + p += 4; + } + } + break; +#if SPLASH_CMYK + case splashModeCMYK8: + color0 = color[0]; + color1 = color[1]; + color2 = color[2]; + color3 = color[3]; + for (y = 0; y < bitmap->height; ++y) { + p = &bitmap->data[y * bitmap->rowSize]; + q = &bitmap->alpha[y * bitmap->width]; + for (x = 0; x < bitmap->width; ++x) { + alpha = *q++; + if (alpha == 0) + { + p[0] = color0; + p[1] = color1; + p[2] = color2; + p[3] = color3; + } + else if (alpha != 255) + { + alpha1 = 255 - alpha; + p[0] = div255(alpha1 * color0 + alpha * p[0]); + p[1] = div255(alpha1 * color1 + alpha * p[1]); + p[2] = div255(alpha1 * color2 + alpha * p[2]); + p[3] = div255(alpha1 * color3 + alpha * p[3]); + } + p += 4; + } + } + break; + case splashModeDeviceN8: + for (cp = 0; cp < SPOT_NCOMPS+4; cp++) + colorsp[cp] = color[cp]; + for (y = 0; y < bitmap->height; ++y) { + p = &bitmap->data[y * bitmap->rowSize]; + q = &bitmap->alpha[y * bitmap->width]; + for (x = 0; x < bitmap->width; ++x) { + alpha = *q++; + if (alpha == 0) + { + for (cp = 0; cp < SPOT_NCOMPS+4; cp++) + p[cp] = colorsp[cp]; + } + else if (alpha != 255) + { + alpha1 = 255 - alpha; + for (cp = 0; cp < SPOT_NCOMPS+4; cp++) + p[cp] = div255(alpha1 * colorsp[cp] + alpha * p[cp]); + } + p += (SPOT_NCOMPS+4); + } + } + break; +#endif + } + memset(bitmap->alpha, 255, bitmap->width * bitmap->height); +} + +GBool Splash::gouraudTriangleShadedFill(SplashGouraudColor *shading) +{ + double xdbl[3] = {0., 0., 0.}; + double ydbl[3] = {0., 0., 0.}; + int x[3] = {0, 0, 0}; + int y[3] = {0, 0, 0}; + double xt=0., xa=0., yt=0.; + double ca=0., ct=0.; + + // triangle interpolation: + // + double scanLimitMapL[2] = {0., 0.}; + double scanLimitMapR[2] = {0., 0.}; + double scanColorMapL[2] = {0., 0.}; + double scanColorMapR[2] = {0., 0.}; + double scanColorMap[2] = {0., 0.}; + int scanEdgeL[2] = { 0, 0 }; + int scanEdgeR[2] = { 0, 0 }; + GBool hasFurtherSegment = gFalse; + + int scanLineOff = 0; + int bitmapOff = 0; + int scanLimitR = 0, scanLimitL = 0; + + int bitmapWidth = bitmap->getWidth(); + SplashClip* clip = getClip(); + SplashBitmap *blitTarget = bitmap; + SplashColorPtr bitmapData = bitmap->getDataPtr(); + int bitmapOffLimit = bitmap->getHeight() * bitmap->getRowSize(); + SplashColorPtr bitmapAlpha = bitmap->getAlphaPtr(); + SplashColorPtr cur = NULL; + SplashCoord* userToCanvasMatrix = getMatrix(); + SplashColorMode bitmapMode = bitmap->getMode(); + GBool hasAlpha = (bitmapAlpha != NULL); + int rowSize = bitmap->getRowSize(); + int colorComps = 0; + switch (bitmapMode) { + case splashModeMono1: + break; + case splashModeMono8: + colorComps=1; + break; + case splashModeRGB8: + colorComps=3; + break; + case splashModeBGR8: + colorComps=3; + break; + case splashModeXBGR8: + colorComps=4; + break; +#if SPLASH_CMYK + case splashModeCMYK8: + colorComps=4; + break; + case splashModeDeviceN8: + colorComps=SPOT_NCOMPS+4; + break; +#endif + } + + SplashPipe pipe; + SplashColor cSrcVal; + + pipeInit(&pipe, 0, 0, NULL, cSrcVal, (Guchar)splashRound(state->strokeAlpha * 255), gFalse, gFalse); + + if (vectorAntialias) { + if (aaBuf == NULL) + return gFalse; // fall back to old behaviour + drawAAPixelInit(); + } + + // idea: + // 1. If pipe->noTransparency && !state->blendFunc + // -> blit directly into the drawing surface! + // -> disable alpha manually. + // 2. Otherwise: + // - blit also directly, but into an intermediate surface. + // Afterwards, blit the intermediate surface using the drawing pipeline. + // This is necessary because triangle elements can be on top of each + // other, so the complete shading needs to be drawn before opacity is + // applied. + // - the final step, is performed using a SplashPipe: + // - assign the actual color into cSrcVal: pipe uses cSrcVal by reference + // - invoke drawPixel(&pipe,X,Y,bNoClip); + GBool bDirectBlit = vectorAntialias ? gFalse : pipe.noTransparency && !state->blendFunc; + if (!bDirectBlit) { + blitTarget = new SplashBitmap(bitmap->getWidth(), + bitmap->getHeight(), + bitmap->getRowPad(), + bitmap->getMode(), + gTrue, + bitmap->getRowSize() >= 0); + bitmapData = blitTarget->getDataPtr(); + bitmapAlpha = blitTarget->getAlphaPtr(); + + // initialisation seems to be necessary: + int S = bitmap->getWidth() * bitmap->getHeight(); + for (int i = 0; i < S; ++i) + bitmapAlpha[i] = 0; + hasAlpha = gTrue; + } + + if (shading->isParameterized()) { + double color[3]; + double colorinterp; + + for (int i = 0; i < shading->getNTriangles(); ++i) { + shading->getTriangle(i, + xdbl + 0, ydbl + 0, color + 0, + xdbl + 1, ydbl + 1, color + 1, + xdbl + 2, ydbl + 2, color + 2); + for (int m = 0; m < 3; ++m) { + 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 + // raster image. The double offsets are of no use here. + x[m] = splashRound(xt); + y[m] = splashRound(yt); + } + // sort according to y coordinate to simplify sweep through scanlines: + // INSERTION SORT. + if (y[0] > y[1]) { + Guswap(x[0], x[1]); + Guswap(y[0], y[1]); + Guswap(color[0], color[1]); + } + // first two are sorted. + assert(y[0] <= y[1]); + if (y[1] > y[2]) { + int tmpX = x[2]; + int tmpY = y[2]; + double tmpC = color[2]; + x[2] = x[1]; y[2] = y[1]; color[2] = color[1]; + + if (y[0] > tmpY) { + x[1] = x[0]; y[1] = y[0]; color[1] = color[0]; + x[0] = tmpX; y[0] = tmpY; color[0] = tmpC; + } else { + x[1] = tmpX; y[1] = tmpY; color[1] = tmpC; + } + } + // first three are sorted + assert(y[0] <= y[1]); + assert(y[1] <= y[2]); + ///// + + // this here is det( T ) == 0 + // where T is the matrix to map to barycentric coordinates. + if ((x[0] - x[2]) * (y[1] - y[2]) - (x[1] - x[2]) * (y[0] - y[2]) == 0) + continue; // degenerate triangle. + + // this here initialises the scanline generation. + // We start with low Y coordinates and sweep up to the large Y + // coordinates. + // + // scanEdgeL[m] in {0,1,2} m=0,1 + // scanEdgeR[m] in {0,1,2} m=0,1 + // + // are the two edges between which scanlines are (currently) + // sweeped. The values {0,1,2} are indices into 'x' and 'y'. + // scanEdgeL[0] = 0 means: the left scan edge has (x[0],y[0]) as vertex. + // + scanEdgeL[0] = 0; + scanEdgeR[0] = 0; + if (y[0] == y[1]) { + scanEdgeL[0] = 1; + scanEdgeL[1] = scanEdgeR[1] = 2; + + } else { + scanEdgeL[1] = 1; scanEdgeR[1] = 2; + } + assert(y[scanEdgeL[0]] < y[scanEdgeL[1]]); + assert(y[scanEdgeR[0]] < y[scanEdgeR[1]]); + + // Ok. Now prepare the linear maps which map the y coordinate of + // the current scanline to the corresponding LEFT and RIGHT x + // coordinate (which define the scanline). + scanLimitMapL[0] = double(x[scanEdgeL[1]] - x[scanEdgeL[0]]) / (y[scanEdgeL[1]] - y[scanEdgeL[0]]); + scanLimitMapL[1] = x[scanEdgeL[0]] - y[scanEdgeL[0]] * scanLimitMapL[0]; + scanLimitMapR[0] = double(x[scanEdgeR[1]] - x[scanEdgeR[0]]) / (y[scanEdgeR[1]] - y[scanEdgeR[0]]); + scanLimitMapR[1] = x[scanEdgeR[0]] - y[scanEdgeR[0]] * scanLimitMapR[0]; + + xa = y[1] * scanLimitMapL[0] + scanLimitMapL[1]; + xt = y[1] * scanLimitMapR[0] + scanLimitMapR[1]; + if (xa > xt) { + // I have "left" is to the right of "right". + // Exchange sides! + Guswap(scanEdgeL[0], scanEdgeR[0]); + Guswap(scanEdgeL[1], scanEdgeR[1]); + Guswap(scanLimitMapL[0], scanLimitMapR[0]); + Guswap(scanLimitMapL[1], scanLimitMapR[1]); + // FIXME I'm sure there is a more efficient way to check this. + } + + // Same game: we can linearly interpolate the color based on the + // current y coordinate (that's correct for triangle + // interpolation due to linearity. We could also have done it in + // barycentric coordinates, but that's slightly more involved) + scanColorMapL[0] = (color[scanEdgeL[1]] - color[scanEdgeL[0]]) / (y[scanEdgeL[1]] - y[scanEdgeL[0]]); + scanColorMapL[1] = color[scanEdgeL[0]] - y[scanEdgeL[0]] * scanColorMapL[0]; + scanColorMapR[0] = (color[scanEdgeR[1]] - color[scanEdgeR[0]]) / (y[scanEdgeR[1]] - y[scanEdgeR[0]]); + scanColorMapR[1] = color[scanEdgeR[0]] - y[scanEdgeR[0]] * scanColorMapR[0]; + + hasFurtherSegment = (y[1] < y[2]); + scanLineOff = y[0] * rowSize; + + for (int Y = y[0]; Y <= y[2]; ++Y, scanLineOff += rowSize) { + if (hasFurtherSegment && Y == y[1]) { + // SWEEP EVENT: we encountered the next segment. + // + // switch to next segment, either at left end or at right + // end: + if (scanEdgeL[1] == 1) { + scanEdgeL[0] = 1; + scanEdgeL[1] = 2; + scanLimitMapL[0] = double(x[scanEdgeL[1]] - x[scanEdgeL[0]]) / (y[scanEdgeL[1]] - y[scanEdgeL[0]]); + scanLimitMapL[1] = x[scanEdgeL[0]] - y[scanEdgeL[0]] * scanLimitMapL[0]; + + scanColorMapL[0] = (color[scanEdgeL[1]] - color[scanEdgeL[0]]) / (y[scanEdgeL[1]] - y[scanEdgeL[0]]); + scanColorMapL[1] = color[scanEdgeL[0]] - y[scanEdgeL[0]] * scanColorMapL[0]; + } else if (scanEdgeR[1] == 1) { + scanEdgeR[0] = 1; + scanEdgeR[1] = 2; + scanLimitMapR[0] = double(x[scanEdgeR[1]] - x[scanEdgeR[0]]) / (y[scanEdgeR[1]] - y[scanEdgeR[0]]); + scanLimitMapR[1] = x[scanEdgeR[0]] - y[scanEdgeR[0]] * scanLimitMapR[0]; + + scanColorMapR[0] = (color[scanEdgeR[1]] - color[scanEdgeR[0]]) / (y[scanEdgeR[1]] - y[scanEdgeR[0]]); + scanColorMapR[1] = color[scanEdgeR[0]] - y[scanEdgeR[0]] * scanColorMapR[0]; + } + assert( y[scanEdgeL[0]] < y[scanEdgeL[1]] ); + assert( y[scanEdgeR[0]] < y[scanEdgeR[1]] ); + hasFurtherSegment = gFalse; + } + + yt = Y; + + xa = yt * scanLimitMapL[0] + scanLimitMapL[1]; + xt = yt * scanLimitMapR[0] + scanLimitMapR[1]; + + ca = yt * scanColorMapL[0] + scanColorMapL[1]; + ct = yt * scanColorMapR[0] + scanColorMapR[1]; + + scanLimitL = splashRound(xa); + scanLimitR = splashRound(xt); + + // Ok. Now: init the color interpolation depending on the X + // coordinate inside of the current scanline: + scanColorMap[0] = (scanLimitR == scanLimitL) ? 0. : ((ct - ca) / (scanLimitR - scanLimitL)); + scanColorMap[1] = ca - scanLimitL * scanColorMap[0]; + + // handled by clipping: + // assert( scanLimitL >= 0 && scanLimitR < bitmap->getWidth() ); + assert(scanLimitL <= scanLimitR || abs(scanLimitL - scanLimitR) <= 2); // allow rounding inaccuracies + assert(scanLineOff == Y * rowSize); + + 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, &bitmapData[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 { + return gFalse; + } + + if (!bDirectBlit) { + // ok. Finalize the stuff by blitting the shading into the final + // geometry, this time respecting the rendering pipe. + int W = blitTarget->getWidth(); + int H = blitTarget->getHeight(); + cur = cSrcVal; + + for (int X = 0; X < W; ++X) { + for (int Y = 0; Y < H; ++Y) { + if (!bitmapAlpha[Y * bitmapWidth + X]) + continue; // draw only parts of the shading! + bitmapOff = Y * rowSize + colorComps * X; + + for (int m = 0; m < colorComps; ++m) + cur[m] = bitmapData[bitmapOff + m]; + if (vectorAntialias) { + drawAAPixel(&pipe, X, Y); + } else { + drawPixel(&pipe, X, Y, gTrue); // no clipping - has already been done. + } + } + } + + delete blitTarget; + blitTarget = NULL; + } + + return gTrue; +} + +SplashError Splash::blitTransparent(SplashBitmap *src, int xSrc, int ySrc, + int xDest, int yDest, int w, int h) { + SplashColorPtr p, sp; + Guchar *q; + int x, y, mask, srcMask; + + if (src->mode != bitmap->mode) { + return splashErrModeMismatch; + } + + switch (bitmap->mode) { + case splashModeMono1: + for (y = 0; y < h; ++y) { + p = &bitmap->data[(yDest + y) * bitmap->rowSize + (xDest >> 3)]; + mask = 0x80 >> (xDest & 7); + sp = &src->data[(ySrc + y) * src->rowSize + (xSrc >> 3)]; + srcMask = 0x80 >> (xSrc & 7); + for (x = 0; x < w; ++x) { + if (*sp & srcMask) { + *p |= mask; + } else { + *p &= ~mask; + } + if (!(mask >>= 1)) { + mask = 0x80; + ++p; + } + if (!(srcMask >>= 1)) { + srcMask = 0x80; + ++sp; + } + } + } + break; + case splashModeMono8: + for (y = 0; y < h; ++y) { + p = &bitmap->data[(yDest + y) * bitmap->rowSize + xDest]; + sp = &src->data[(ySrc + y) * bitmap->rowSize + xSrc]; + for (x = 0; x < w; ++x) { + *p++ = *sp++; + } + } + break; + case splashModeRGB8: + case splashModeBGR8: + for (y = 0; y < h; ++y) { + p = &bitmap->data[(yDest + y) * bitmap->rowSize + 3 * xDest]; + sp = &src->data[(ySrc + y) * src->rowSize + 3 * xSrc]; + for (x = 0; x < w; ++x) { + *p++ = *sp++; + *p++ = *sp++; + *p++ = *sp++; + } + } + break; + case splashModeXBGR8: + for (y = 0; y < h; ++y) { + p = &bitmap->data[(yDest + y) * bitmap->rowSize + 4 * xDest]; + sp = &src->data[(ySrc + y) * src->rowSize + 4 * xSrc]; + for (x = 0; x < w; ++x) { + *p++ = *sp++; + *p++ = *sp++; + *p++ = *sp++; + *p++ = 255; + sp++; + } + } + break; +#if SPLASH_CMYK + case splashModeCMYK8: + for (y = 0; y < h; ++y) { + p = &bitmap->data[(yDest + y) * bitmap->rowSize + 4 * xDest]; + sp = &src->data[(ySrc + y) * src->rowSize + 4 * xSrc]; + for (x = 0; x < w; ++x) { + *p++ = *sp++; + *p++ = *sp++; + *p++ = *sp++; + *p++ = *sp++; + } + } + break; + case splashModeDeviceN8: + for (y = 0; y < h; ++y) { + p = &bitmap->data[(yDest + y) * bitmap->rowSize + (SPOT_NCOMPS+4) * xDest]; + sp = &src->data[(ySrc + y) * src->rowSize + (SPOT_NCOMPS+4) * xSrc]; + for (x = 0; x < w; ++x) { + for (int cp=0; cp < SPOT_NCOMPS+4; cp++) + *p++ = *sp++; + } + } + break; +#endif + } + + if (bitmap->alpha) { + for (y = 0; y < h; ++y) { + q = &bitmap->alpha[(yDest + y) * bitmap->width + xDest]; + memset(q, 0x00, w); + } + } + + return splashOk; +} + +SplashPath *Splash::makeStrokePath(SplashPath *path, SplashCoord w, + GBool flatten) { +SplashPath *pathIn, *dashPath, *pathOut; + SplashCoord d, dx, dy, wdx, wdy, dxNext, dyNext, wdxNext, wdyNext; + SplashCoord crossprod, dotprod, miter, m; + GBool first, last, closed; + int subpathStart0, subpathStart1, seg, i0, i1, j0, j1, k0, k1; + int left0, left1, left2, right0, right1, right2, join0, join1, join2; + int leftFirst, rightFirst, firstPt; + + pathOut = new SplashPath(); + + if (path->length == 0) { + return pathOut; + } + + if (flatten) { + pathIn = flattenPath(path, state->matrix, state->flatness); + if (state->lineDashLength > 0) { + dashPath = makeDashedPath(pathIn); + delete pathIn; + pathIn = dashPath; + if (pathIn->length == 0) { + delete pathIn; + return pathOut; + } + } + } else { + pathIn = path; + } + + subpathStart0 = subpathStart1 = 0; // make gcc happy + seg = 0; // make gcc happy + closed = gFalse; // make gcc happy + left0 = left1 = right0 = right1 = join0 = join1 = 0; // make gcc happy + leftFirst = rightFirst = firstPt = 0; // make gcc happy + + i0 = 0; + for (i1 = i0; + !(pathIn->flags[i1] & splashPathLast) && + i1 + 1 < pathIn->length && + pathIn->pts[i1+1].x == pathIn->pts[i1].x && + pathIn->pts[i1+1].y == pathIn->pts[i1].y; + ++i1) ; + + while (i1 < pathIn->length) { + if ((first = pathIn->flags[i0] & splashPathFirst)) { + subpathStart0 = i0; + subpathStart1 = i1; + seg = 0; + closed = pathIn->flags[i0] & splashPathClosed; + } + j0 = i1 + 1; + if (j0 < pathIn->length) { + for (j1 = j0; + !(pathIn->flags[j1] & splashPathLast) && + j1 + 1 < pathIn->length && + pathIn->pts[j1+1].x == pathIn->pts[j1].x && + pathIn->pts[j1+1].y == pathIn->pts[j1].y; + ++j1) ; + } else { + j1 = j0; + } + if (pathIn->flags[i1] & splashPathLast) { + if (first && state->lineCap == splashLineCapRound) { + // special case: zero-length subpath with round line caps --> + // draw a circle + pathOut->moveTo(pathIn->pts[i0].x + (SplashCoord)0.5 * w, + pathIn->pts[i0].y); + pathOut->curveTo(pathIn->pts[i0].x + (SplashCoord)0.5 * w, + pathIn->pts[i0].y + bezierCircle2 * w, + pathIn->pts[i0].x + bezierCircle2 * w, + pathIn->pts[i0].y + (SplashCoord)0.5 * w, + pathIn->pts[i0].x, + pathIn->pts[i0].y + (SplashCoord)0.5 * w); + pathOut->curveTo(pathIn->pts[i0].x - bezierCircle2 * w, + pathIn->pts[i0].y + (SplashCoord)0.5 * w, + pathIn->pts[i0].x - (SplashCoord)0.5 * w, + pathIn->pts[i0].y + bezierCircle2 * w, + pathIn->pts[i0].x - (SplashCoord)0.5 * w, + pathIn->pts[i0].y); + pathOut->curveTo(pathIn->pts[i0].x - (SplashCoord)0.5 * w, + pathIn->pts[i0].y - bezierCircle2 * w, + pathIn->pts[i0].x - bezierCircle2 * w, + pathIn->pts[i0].y - (SplashCoord)0.5 * w, + pathIn->pts[i0].x, + pathIn->pts[i0].y - (SplashCoord)0.5 * w); + pathOut->curveTo(pathIn->pts[i0].x + bezierCircle2 * w, + pathIn->pts[i0].y - (SplashCoord)0.5 * w, + pathIn->pts[i0].x + (SplashCoord)0.5 * w, + pathIn->pts[i0].y - bezierCircle2 * w, + pathIn->pts[i0].x + (SplashCoord)0.5 * w, + pathIn->pts[i0].y); + pathOut->close(); + } + i0 = j0; + i1 = j1; + continue; + } + last = pathIn->flags[j1] & splashPathLast; + if (last) { + k0 = subpathStart1 + 1; + } else { + k0 = j1 + 1; + } + for (k1 = k0; + !(pathIn->flags[k1] & splashPathLast) && + k1 + 1 < pathIn->length && + pathIn->pts[k1+1].x == pathIn->pts[k1].x && + pathIn->pts[k1+1].y == pathIn->pts[k1].y; + ++k1) ; + + // compute the deltas for segment (i1, j0) +#if USE_FIXEDPOINT + // the 1/d value can be small, which introduces significant + // inaccuracies in fixed point mode + d = splashDist(pathIn->pts[i1].x, pathIn->pts[i1].y, + pathIn->pts[j0].x, pathIn->pts[j0].y); + dx = (pathIn->pts[j0].x - pathIn->pts[i1].x) / d; + dy = (pathIn->pts[j0].y - pathIn->pts[i1].y) / d; +#else + d = (SplashCoord)1 / splashDist(pathIn->pts[i1].x, pathIn->pts[i1].y, + pathIn->pts[j0].x, pathIn->pts[j0].y); + dx = d * (pathIn->pts[j0].x - pathIn->pts[i1].x); + dy = d * (pathIn->pts[j0].y - pathIn->pts[i1].y); +#endif + wdx = (SplashCoord)0.5 * w * dx; + wdy = (SplashCoord)0.5 * w * dy; + + // draw the start cap + pathOut->moveTo(pathIn->pts[i0].x - wdy, pathIn->pts[i0].y + wdx); + if (i0 == subpathStart0) { + firstPt = pathOut->length - 1; + } + if (first && !closed) { + switch (state->lineCap) { + case splashLineCapButt: + pathOut->lineTo(pathIn->pts[i0].x + wdy, pathIn->pts[i0].y - wdx); + break; + case splashLineCapRound: + pathOut->curveTo(pathIn->pts[i0].x - wdy - bezierCircle * wdx, + pathIn->pts[i0].y + wdx - bezierCircle * wdy, + pathIn->pts[i0].x - wdx - bezierCircle * wdy, + pathIn->pts[i0].y - wdy + bezierCircle * wdx, + pathIn->pts[i0].x - wdx, + pathIn->pts[i0].y - wdy); + pathOut->curveTo(pathIn->pts[i0].x - wdx + bezierCircle * wdy, + pathIn->pts[i0].y - wdy - bezierCircle * wdx, + pathIn->pts[i0].x + wdy - bezierCircle * wdx, + pathIn->pts[i0].y - wdx - bezierCircle * wdy, + pathIn->pts[i0].x + wdy, + pathIn->pts[i0].y - wdx); + break; + case splashLineCapProjecting: + pathOut->lineTo(pathIn->pts[i0].x - wdx - wdy, + pathIn->pts[i0].y + wdx - wdy); + pathOut->lineTo(pathIn->pts[i0].x - wdx + wdy, + pathIn->pts[i0].y - wdx - wdy); + pathOut->lineTo(pathIn->pts[i0].x + wdy, + pathIn->pts[i0].y - wdx); + break; + } + } else { + pathOut->lineTo(pathIn->pts[i0].x + wdy, pathIn->pts[i0].y - wdx); + } + + // draw the left side of the segment rectangle + left2 = pathOut->length - 1; + pathOut->lineTo(pathIn->pts[j0].x + wdy, pathIn->pts[j0].y - wdx); + + // draw the end cap + if (last && !closed) { + switch (state->lineCap) { + case splashLineCapButt: + pathOut->lineTo(pathIn->pts[j0].x - wdy, pathIn->pts[j0].y + wdx); + break; + case splashLineCapRound: + pathOut->curveTo(pathIn->pts[j0].x + wdy + bezierCircle * wdx, + pathIn->pts[j0].y - wdx + bezierCircle * wdy, + pathIn->pts[j0].x + wdx + bezierCircle * wdy, + pathIn->pts[j0].y + wdy - bezierCircle * wdx, + pathIn->pts[j0].x + wdx, + pathIn->pts[j0].y + wdy); + pathOut->curveTo(pathIn->pts[j0].x + wdx - bezierCircle * wdy, + pathIn->pts[j0].y + wdy + bezierCircle * wdx, + pathIn->pts[j0].x - wdy + bezierCircle * wdx, + pathIn->pts[j0].y + wdx + bezierCircle * wdy, + pathIn->pts[j0].x - wdy, + pathIn->pts[j0].y + wdx); + break; + case splashLineCapProjecting: + pathOut->lineTo(pathIn->pts[j0].x + wdy + wdx, + pathIn->pts[j0].y - wdx + wdy); + pathOut->lineTo(pathIn->pts[j0].x - wdy + wdx, + pathIn->pts[j0].y + wdx + wdy); + pathOut->lineTo(pathIn->pts[j0].x - wdy, + pathIn->pts[j0].y + wdx); + break; + } + } else { + pathOut->lineTo(pathIn->pts[j0].x - wdy, pathIn->pts[j0].y + wdx); + } + + // draw the right side of the segment rectangle + // (NB: if stroke adjustment is enabled, the closepath operation MUST + // add a segment because this segment is used for a hint) + right2 = pathOut->length - 1; + pathOut->close(state->strokeAdjust); + + // draw the join + join2 = pathOut->length; + if (!last || closed) { + + // compute the deltas for segment (j1, k0) +#if USE_FIXEDPOINT + // the 1/d value can be small, which introduces significant + // inaccuracies in fixed point mode + d = splashDist(pathIn->pts[j1].x, pathIn->pts[j1].y, + pathIn->pts[k0].x, pathIn->pts[k0].y); + dxNext = (pathIn->pts[k0].x - pathIn->pts[j1].x) / d; + dyNext = (pathIn->pts[k0].y - pathIn->pts[j1].y) / d; +#else + d = (SplashCoord)1 / splashDist(pathIn->pts[j1].x, pathIn->pts[j1].y, + pathIn->pts[k0].x, pathIn->pts[k0].y); + dxNext = d * (pathIn->pts[k0].x - pathIn->pts[j1].x); + dyNext = d * (pathIn->pts[k0].y - pathIn->pts[j1].y); +#endif + wdxNext = (SplashCoord)0.5 * w * dxNext; + wdyNext = (SplashCoord)0.5 * w * dyNext; + + // compute the join parameters + crossprod = dx * dyNext - dy * dxNext; + dotprod = -(dx * dxNext + dy * dyNext); + if (dotprod > 0.9999) { + // avoid a divide-by-zero -- set miter to something arbitrary + // such that sqrt(miter) will exceed miterLimit (and m is never + // used in that situation) + // (note: the comparison value (0.9999) has to be less than + // 1-epsilon, where epsilon is the smallest value + // representable in the fixed point format) + miter = (state->miterLimit + 1) * (state->miterLimit + 1); + m = 0; + } else { + miter = (SplashCoord)2 / ((SplashCoord)1 - dotprod); + if (miter < 1) { + // this can happen because of floating point inaccuracies + miter = 1; + } + m = splashSqrt(miter - 1); + } + + // round join + if (state->lineJoin == splashLineJoinRound) { + pathOut->moveTo(pathIn->pts[j0].x + (SplashCoord)0.5 * w, + pathIn->pts[j0].y); + pathOut->curveTo(pathIn->pts[j0].x + (SplashCoord)0.5 * w, + pathIn->pts[j0].y + bezierCircle2 * w, + pathIn->pts[j0].x + bezierCircle2 * w, + pathIn->pts[j0].y + (SplashCoord)0.5 * w, + pathIn->pts[j0].x, + pathIn->pts[j0].y + (SplashCoord)0.5 * w); + pathOut->curveTo(pathIn->pts[j0].x - bezierCircle2 * w, + pathIn->pts[j0].y + (SplashCoord)0.5 * w, + pathIn->pts[j0].x - (SplashCoord)0.5 * w, + pathIn->pts[j0].y + bezierCircle2 * w, + pathIn->pts[j0].x - (SplashCoord)0.5 * w, + pathIn->pts[j0].y); + pathOut->curveTo(pathIn->pts[j0].x - (SplashCoord)0.5 * w, + pathIn->pts[j0].y - bezierCircle2 * w, + pathIn->pts[j0].x - bezierCircle2 * w, + pathIn->pts[j0].y - (SplashCoord)0.5 * w, + pathIn->pts[j0].x, + pathIn->pts[j0].y - (SplashCoord)0.5 * w); + pathOut->curveTo(pathIn->pts[j0].x + bezierCircle2 * w, + pathIn->pts[j0].y - (SplashCoord)0.5 * w, + pathIn->pts[j0].x + (SplashCoord)0.5 * w, + pathIn->pts[j0].y - bezierCircle2 * w, + pathIn->pts[j0].x + (SplashCoord)0.5 * w, + pathIn->pts[j0].y); + + } else { + pathOut->moveTo(pathIn->pts[j0].x, pathIn->pts[j0].y); + + // angle < 180 + if (crossprod < 0) { + pathOut->lineTo(pathIn->pts[j0].x - wdyNext, + pathIn->pts[j0].y + wdxNext); + // miter join inside limit + if (state->lineJoin == splashLineJoinMiter && + splashSqrt(miter) <= state->miterLimit) { + pathOut->lineTo(pathIn->pts[j0].x - wdy + wdx * m, + pathIn->pts[j0].y + wdx + wdy * m); + pathOut->lineTo(pathIn->pts[j0].x - wdy, + pathIn->pts[j0].y + wdx); + // bevel join or miter join outside limit + } else { + pathOut->lineTo(pathIn->pts[j0].x - wdy, + pathIn->pts[j0].y + wdx); + } + + // angle >= 180 + } else { + pathOut->lineTo(pathIn->pts[j0].x + wdy, + pathIn->pts[j0].y - wdx); + // miter join inside limit + if (state->lineJoin == splashLineJoinMiter && + splashSqrt(miter) <= state->miterLimit) { + pathOut->lineTo(pathIn->pts[j0].x + wdy + wdx * m, + pathIn->pts[j0].y - wdx + wdy * m); + pathOut->lineTo(pathIn->pts[j0].x + wdyNext, + pathIn->pts[j0].y - wdxNext); + // bevel join or miter join outside limit + } else { + pathOut->lineTo(pathIn->pts[j0].x + wdyNext, + pathIn->pts[j0].y - wdxNext); + } + } + } + + pathOut->close(); + } + + // add stroke adjustment hints + if (state->strokeAdjust) { + if (seg == 0 && !closed) { + if (state->lineCap == splashLineCapButt) { + pathOut->addStrokeAdjustHint(firstPt, left2 + 1, + firstPt, firstPt + 1); + if (last) { + pathOut->addStrokeAdjustHint(firstPt, left2 + 1, + left2 + 1, left2 + 2); + } + } else if (state->lineCap == splashLineCapProjecting) { + if (last) { + pathOut->addStrokeAdjustHint(firstPt + 1, left2 + 2, + firstPt + 1, firstPt + 2); + pathOut->addStrokeAdjustHint(firstPt + 1, left2 + 2, + left2 + 2, left2 + 3); + } else { + pathOut->addStrokeAdjustHint(firstPt + 1, left2 + 1, + firstPt + 1, firstPt + 2); + } + } + } + if (seg >= 1) { + if (seg >= 2) { + pathOut->addStrokeAdjustHint(left1, right1, left0 + 1, right0); + pathOut->addStrokeAdjustHint(left1, right1, join0, left2); + } else { + pathOut->addStrokeAdjustHint(left1, right1, firstPt, left2); + } + pathOut->addStrokeAdjustHint(left1, right1, right2 + 1, right2 + 1); + } + left0 = left1; + left1 = left2; + right0 = right1; + right1 = right2; + join0 = join1; + join1 = join2; + if (seg == 0) { + leftFirst = left2; + rightFirst = right2; + } + if (last) { + if (seg >= 2) { + pathOut->addStrokeAdjustHint(left1, right1, left0 + 1, right0); + pathOut->addStrokeAdjustHint(left1, right1, + join0, pathOut->length - 1); + } else { + pathOut->addStrokeAdjustHint(left1, right1, + firstPt, pathOut->length - 1); + } + if (closed) { + pathOut->addStrokeAdjustHint(left1, right1, firstPt, leftFirst); + pathOut->addStrokeAdjustHint(left1, right1, + rightFirst + 1, rightFirst + 1); + pathOut->addStrokeAdjustHint(leftFirst, rightFirst, + left1 + 1, right1); + pathOut->addStrokeAdjustHint(leftFirst, rightFirst, + join1, pathOut->length - 1); + } + if (!closed && seg > 0) { + if (state->lineCap == splashLineCapButt) { + pathOut->addStrokeAdjustHint(left1 - 1, left1 + 1, + left1 + 1, left1 + 2); + } else if (state->lineCap == splashLineCapProjecting) { + pathOut->addStrokeAdjustHint(left1 - 1, left1 + 2, + left1 + 2, left1 + 3); + } + } + } + } + + i0 = j0; + i1 = j1; + ++seg; + } + + if (pathIn != path) { + delete pathIn; + } + + return pathOut; +} + +void Splash::dumpPath(SplashPath *path) { + int i; + + for (i = 0; i < path->length; ++i) { + printf(" %3d: x=%8.2f y=%8.2f%s%s%s%s\n", + i, (double)path->pts[i].x, (double)path->pts[i].y, + (path->flags[i] & splashPathFirst) ? " first" : "", + (path->flags[i] & splashPathLast) ? " last" : "", + (path->flags[i] & splashPathClosed) ? " closed" : "", + (path->flags[i] & splashPathCurve) ? " curve" : ""); + } +} + +void Splash::dumpXPath(SplashXPath *path) { + int i; + + for (i = 0; i < path->length; ++i) { + printf(" %4d: x0=%8.2f y0=%8.2f x1=%8.2f y1=%8.2f %s%s%s\n", + i, (double)path->segs[i].x0, (double)path->segs[i].y0, + (double)path->segs[i].x1, (double)path->segs[i].y1, + (path->segs[i].flags & splashXPathHoriz) ? "H" : " ", + (path->segs[i].flags & splashXPathVert) ? "V" : " ", + (path->segs[i].flags & splashXPathFlip) ? "P" : " "); + } +} + +SplashError Splash::shadedFill(SplashPath *path, GBool hasBBox, + SplashPattern *pattern) { + SplashPipe pipe; + SplashXPath *xPath; + SplashXPathScanner *scanner; + int xMinI, yMinI, xMaxI, yMaxI, x0, x1, y; + SplashClipResult clipRes; + + if (vectorAntialias && aaBuf == NULL) { // should not happen, but to be secure + return splashErrGeneric; + } + if (path->length == 0) { + return splashErrEmptyPath; + } + xPath = new SplashXPath(path, state->matrix, state->flatness, gTrue); + if (vectorAntialias) { + xPath->aaScale(); + } + xPath->sort(); + yMinI = state->clip->getYMinI(); + yMaxI = state->clip->getYMaxI(); + if (vectorAntialias && !inShading) { + yMinI = yMinI * splashAASize; + yMaxI = (yMaxI + 1) * splashAASize - 1; + } + scanner = new SplashXPathScanner(xPath, gFalse, yMinI, yMaxI); + + // get the min and max x and y values + if (vectorAntialias) { + scanner->getBBoxAA(&xMinI, &yMinI, &xMaxI, &yMaxI); + } else { + scanner->getBBox(&xMinI, &yMinI, &xMaxI, &yMaxI); + } + + // check clipping + if ((clipRes = state->clip->testRect(xMinI, yMinI, xMaxI, yMaxI)) != splashClipAllOutside) { + // limit the y range + if (yMinI < state->clip->getYMinI()) { + yMinI = state->clip->getYMinI(); + } + if (yMaxI > state->clip->getYMaxI()) { + yMaxI = state->clip->getYMaxI(); + } + + pipeInit(&pipe, 0, yMinI, pattern, NULL, (Guchar)splashRound(state->fillAlpha * 255), vectorAntialias && !hasBBox, gFalse); + + // draw the spans + if (vectorAntialias) { + for (y = yMinI; y <= yMaxI; ++y) { + scanner->renderAALine(aaBuf, &x0, &x1, y); + if (clipRes != splashClipAllInside) { + state->clip->clipAALine(aaBuf, &x0, &x1, y); + } +#if splashAASize == 4 + if (!hasBBox && y > yMinI && y < yMaxI) { + // correct shape on left side if clip is + // vertical through the middle of shading: + Guchar *p0, *p1, *p2, *p3; + Guchar c1, c2, c3, c4; + p0 = aaBuf->getDataPtr() + (x0 >> 1); + p1 = p0 + aaBuf->getRowSize(); + p2 = p1 + aaBuf->getRowSize(); + p3 = p2 + aaBuf->getRowSize(); + if (x0 & 1) { + c1 = (*p0 & 0x0f); c2 =(*p1 & 0x0f); c3 = (*p2 & 0x0f) ; c4 = (*p3 & 0x0f); + } else { + c1 = (*p0 >> 4); c2 = (*p1 >> 4); c3 = (*p2 >> 4); c4 = (*p3 >> 4); + } + if ( (c1 & 0x03) == 0x03 && (c2 & 0x03) == 0x03 && (c3 & 0x03) == 0x03 && (c4 & 0x03) == 0x03 + && c1 == c2 && c2 == c3 && c3 == c4 && + pattern->testPosition(x0 - 1, y) ) + { + Guchar shapeCorrection = (x0 & 1) ? 0x0f : 0xf0; + *p0 |= shapeCorrection; + *p1 |= shapeCorrection; + *p2 |= shapeCorrection; + *p3 |= shapeCorrection; + } + // correct shape on right side if clip is + // through the middle of shading: + p0 = aaBuf->getDataPtr() + (x1 >> 1); + p1 = p0 + aaBuf->getRowSize(); + p2 = p1 + aaBuf->getRowSize(); + p3 = p2 + aaBuf->getRowSize(); + if (x1 & 1) { + c1 = (*p0 & 0x0f); c2 =(*p1 & 0x0f); c3 = (*p2 & 0x0f) ; c4 = (*p3 & 0x0f); + } else { + c1 = (*p0 >> 4); c2 = (*p1 >> 4); c3 = (*p2 >> 4); c4 = (*p3 >> 4); + } + + if ( (c1 & 0xc) == 0x0c && (c2 & 0x0c) == 0x0c && (c3 & 0x0c) == 0x0c && (c4 & 0x0c) == 0x0c + && c1 == c2 && c2 == c3 && c3 == c4 && + pattern->testPosition(x1 + 1, y) ) + { + Guchar shapeCorrection = (x1 & 1) ? 0x0f : 0xf0; + *p0 |= shapeCorrection; + *p1 |= shapeCorrection; + *p2 |= shapeCorrection; + *p3 |= shapeCorrection; + } + } +#endif + drawAALine(&pipe, x0, x1, y); + } + } else { + SplashClipResult clipRes2; + for (y = yMinI; y <= yMaxI; ++y) { + while (scanner->getNextSpan(y, &x0, &x1)) { + if (clipRes == splashClipAllInside) { + drawSpan(&pipe, x0, x1, y, gTrue); + } else { + // limit the x range + if (x0 < state->clip->getXMinI()) { + x0 = state->clip->getXMinI(); + } + if (x1 > state->clip->getXMaxI()) { + x1 = state->clip->getXMaxI(); + } + clipRes2 = state->clip->testSpan(x0, x1, y); + drawSpan(&pipe, x0, x1, y, clipRes2 == splashClipAllInside); + } + } + } + } + } + opClipRes = clipRes; + + delete scanner; + delete xPath; + return splashOk; +} diff --git a/Build/source/libs/poppler/poppler-0.25.0/splash/Splash.h b/Build/source/libs/poppler/poppler-0.25.0/splash/Splash.h new file mode 100644 index 00000000000..cf98e6c6824 --- /dev/null +++ b/Build/source/libs/poppler/poppler-0.25.0/splash/Splash.h @@ -0,0 +1,426 @@ +//======================================================================== +// +// Splash.h +// +//======================================================================== + +//======================================================================== +// +// Modified under the Poppler project - http://poppler.freedesktop.org +// +// All changes made under the Poppler project to this file are licensed +// under GPL version 2 or later +// +// Copyright (C) 2005 Marco Pesenti Gritti <mpg@redhat.com> +// Copyright (C) 2007, 2011 Albert Astals Cid <aacid@kde.org> +// Copyright (C) 2010-2013 Thomas Freitag <Thomas.Freitag@alfa.de> +// Copyright (C) 2010 Christian Feuersänger <cfeuersaenger@googlemail.com> +// Copyright (C) 2012 Adrian Johnson <ajohnson@redneon.com> +// +// To see a description of the changes please see the Changelog file that +// came with your tarball or type make ChangeLog if you are building from git +// +//======================================================================== + +#ifndef SPLASH_H +#define SPLASH_H + +#ifdef USE_GCC_PRAGMAS +#pragma interface +#endif + +#include <stddef.h> +#include "SplashTypes.h" +#include "SplashClip.h" +#include "SplashPattern.h" + +class SplashBitmap; +struct SplashGlyphBitmap; +class SplashState; +class SplashScreen; +class SplashPath; +class SplashXPath; +class SplashFont; +struct SplashPipe; + +//------------------------------------------------------------------------ + +// Retrieves the next line of pixels in an image mask. Normally, +// fills in *<line> and returns true. If the image stream is +// exhausted, returns false. +typedef GBool (*SplashImageMaskSource)(void *data, SplashColorPtr pixel); + +// Retrieves the next line of pixels in an image. Normally, fills in +// *<line> and returns true. If the image stream is exhausted, +// returns false. +typedef GBool (*SplashImageSource)(void *data, SplashColorPtr colorLine, + Guchar *alphaLine); + +//------------------------------------------------------------------------ + +enum SplashPipeResultColorCtrl { +#if SPLASH_CMYK + splashPipeResultColorNoAlphaBlendCMYK, + splashPipeResultColorNoAlphaBlendDeviceN, +#endif + splashPipeResultColorNoAlphaBlendRGB, + splashPipeResultColorNoAlphaBlendMono, + splashPipeResultColorAlphaNoBlendMono, + splashPipeResultColorAlphaNoBlendRGB, +#if SPLASH_CMYK + splashPipeResultColorAlphaNoBlendCMYK, + splashPipeResultColorAlphaNoBlendDeviceN, +#endif + splashPipeResultColorAlphaBlendMono, + splashPipeResultColorAlphaBlendRGB +#if SPLASH_CMYK + , + splashPipeResultColorAlphaBlendCMYK, + splashPipeResultColorAlphaBlendDeviceN +#endif +}; + +//------------------------------------------------------------------------ +// Splash +//------------------------------------------------------------------------ + +class Splash { +public: + + // Create a new rasterizer object. + Splash(SplashBitmap *bitmapA, GBool vectorAntialiasA, + SplashScreenParams *screenParams = NULL); + Splash(SplashBitmap *bitmapA, GBool vectorAntialiasA, + SplashScreen *screenA); + + ~Splash(); + + //----- state read + + SplashCoord *getMatrix(); + SplashPattern *getStrokePattern(); + SplashPattern *getFillPattern(); + SplashScreen *getScreen(); + SplashBlendFunc getBlendFunc(); + SplashCoord getStrokeAlpha(); + SplashCoord getFillAlpha(); + SplashCoord getLineWidth(); + int getLineCap(); + int getLineJoin(); + SplashCoord getMiterLimit(); + SplashCoord getFlatness(); + SplashCoord *getLineDash(); + int getLineDashLength(); + SplashCoord getLineDashPhase(); + GBool getStrokeAdjust(); + SplashClip *getClip(); + SplashBitmap *getSoftMask(); + GBool getInNonIsolatedGroup(); + + //----- state write + + void setMatrix(SplashCoord *matrix); + void setStrokePattern(SplashPattern *strokeColor); + void setFillPattern(SplashPattern *fillColor); + void setScreen(SplashScreen *screen); + void setBlendFunc(SplashBlendFunc func); + void setStrokeAlpha(SplashCoord alpha); + void setFillAlpha(SplashCoord alpha); + void setFillOverprint(GBool fop); + void setStrokeOverprint(GBool sop); + void setOverprintMode(int opm); + void setLineWidth(SplashCoord lineWidth); + void setLineCap(int lineCap); + void setLineJoin(int lineJoin); + void setMiterLimit(SplashCoord miterLimit); + void setFlatness(SplashCoord flatness); + // the <lineDash> array will be copied + void setLineDash(SplashCoord *lineDash, int lineDashLength, + SplashCoord lineDashPhase); + void setStrokeAdjust(GBool strokeAdjust); + // NB: uses transformed coordinates. + void clipResetToRect(SplashCoord x0, SplashCoord y0, + SplashCoord x1, SplashCoord y1); + // NB: uses transformed coordinates. + SplashError clipToRect(SplashCoord x0, SplashCoord y0, + SplashCoord x1, SplashCoord y1); + // NB: uses untransformed coordinates. + SplashError clipToPath(SplashPath *path, GBool eo); + void setSoftMask(SplashBitmap *softMask); + void setInNonIsolatedGroup(SplashBitmap *alpha0BitmapA, + int alpha0XA, int alpha0YA); + void setTransfer(Guchar *red, Guchar *green, Guchar *blue, Guchar *gray); + void setOverprintMask(Guint overprintMask, GBool additive); + + //----- state save/restore + + void saveState(); + SplashError restoreState(); + + //----- drawing operations + + // Fill the bitmap with <color>. This is not subject to clipping. + void clear(SplashColorPtr color, Guchar alpha = 0x00); + + // Stroke a path using the current stroke pattern. + SplashError stroke(SplashPath *path); + + // Fill a path using the current fill pattern. + SplashError fill(SplashPath *path, GBool eo); + + // Fill a path, XORing with the current fill pattern. + SplashError xorFill(SplashPath *path, GBool eo); + + // Draw a character, using the current fill pattern. + SplashError fillChar(SplashCoord x, SplashCoord y, int c, SplashFont *font); + + // Draw a glyph, using the current fill pattern. This function does + // not free any data, i.e., it ignores glyph->freeData. + void fillGlyph(SplashCoord x, SplashCoord y, + SplashGlyphBitmap *glyph); + + // Draws an image mask using the fill color. This will read <h> + // lines of <w> pixels from <src>, starting with the top line. "1" + // pixels will be drawn with the current fill color; "0" pixels are + // transparent. The matrix: + // [ mat[0] mat[1] 0 ] + // [ mat[2] mat[3] 0 ] + // [ mat[4] mat[5] 1 ] + // maps a unit square to the desired destination for the image, in + // PostScript style: + // [x' y' 1] = [x y 1] * mat + // Note that the Splash y axis points downward, and the image source + // is assumed to produce pixels in raster order, starting from the + // top line. + SplashError fillImageMask(SplashImageMaskSource src, void *srcData, + int w, int h, SplashCoord *mat, + GBool glyphMode); + + // Draw an image. This will read <h> lines of <w> pixels from + // <src>, starting with the top line. These pixels are assumed to + // be in the source mode, <srcMode>. If <srcAlpha> is true, the + // alpha values returned by <src> are used; otherwise they are + // ignored. The following combinations of source and target modes + // are supported: + // source target + // ------ ------ + // Mono1 Mono1 + // Mono8 Mono1 -- with dithering + // Mono8 Mono8 + // RGB8 RGB8 + // BGR8 BGR8 + // CMYK8 CMYK8 + // The matrix behaves as for fillImageMask. + SplashError drawImage(SplashImageSource src, void *srcData, + SplashColorMode srcMode, GBool srcAlpha, + int w, int h, SplashCoord *mat, GBool interpolate, + GBool tilingPattern = gFalse); + + // Composite a rectangular region from <src> onto this Splash + // object. + SplashError composite(SplashBitmap *src, int xSrc, int ySrc, + int xDest, int yDest, int w, int h, + GBool noClip, GBool nonIsolated, + GBool knockout = gFalse, SplashCoord knockoutOpacity = 1.0); + + // Composite this Splash object onto a background color. The + // background alpha is assumed to be 1. + void compositeBackground(SplashColorPtr color); + + // Copy a rectangular region from <src> onto the bitmap belonging to + // this Splash object. The destination alpha values are all set to + // 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 + + // Construct a path for a stroke, given the path to be stroked and + // the line width <w>. All other stroke parameters are taken from + // the current state. If <flatten> is true, this function will + // first flatten the path and handle the linedash. + SplashPath *makeStrokePath(SplashPath *path, SplashCoord w, + GBool flatten = gTrue); + + // Return the associated bitmap. + SplashBitmap *getBitmap() { return bitmap; } + + // Set the minimum line width. + void setMinLineWidth(SplashCoord w) { minLineWidth = w; } + + // Setter/Getter for thin line mode + void setThinLineMode(SplashThinLineMode thinLineModeA) { thinLineMode = thinLineModeA; } + SplashThinLineMode getThinLineMode() { return thinLineMode; } + + // Get a bounding box which includes all modifications since the + // last call to clearModRegion. + void getModRegion(int *xMin, int *yMin, int *xMax, int *yMax) + { *xMin = modXMin; *yMin = modYMin; *xMax = modXMax; *yMax = modYMax; } + + // Clear the modified region bounding box. + void clearModRegion(); + + // Get clipping status for the last drawing operation subject to + // clipping. + SplashClipResult getClipRes() { return opClipRes; } + + // Toggle debug mode on or off. + void setDebugMode(GBool debugModeA) { debugMode = debugModeA; } + +#if 1 //~tmp: turn off anti-aliasing temporarily + void setInShading(GBool sh) { inShading = sh; } + GBool getVectorAntialias() { return vectorAntialias; } + void setVectorAntialias(GBool vaa) { vectorAntialias = vaa; } +#endif + + // Do shaded fills with dynamic patterns + SplashError shadedFill(SplashPath *path, GBool hasBBox, + SplashPattern *pattern); + // Draw a gouraud triangle shading. + GBool gouraudTriangleShadedFill(SplashGouraudColor *shading); + +private: + + void pipeInit(SplashPipe *pipe, int x, int y, + SplashPattern *pattern, SplashColorPtr cSrc, + Guchar aInput, GBool usesShape, + GBool nonIsolatedGroup, + GBool knockout = gFalse, Guchar knockoutOpacity = 255); + void pipeRun(SplashPipe *pipe); + void pipeRunSimpleMono1(SplashPipe *pipe); + void pipeRunSimpleMono8(SplashPipe *pipe); + void pipeRunSimpleRGB8(SplashPipe *pipe); + void pipeRunSimpleXBGR8(SplashPipe *pipe); + void pipeRunSimpleBGR8(SplashPipe *pipe); +#if SPLASH_CMYK + void pipeRunSimpleCMYK8(SplashPipe *pipe); + void pipeRunSimpleDeviceN8(SplashPipe *pipe); +#endif + void pipeRunAAMono1(SplashPipe *pipe); + void pipeRunAAMono8(SplashPipe *pipe); + void pipeRunAARGB8(SplashPipe *pipe); + void pipeRunAAXBGR8(SplashPipe *pipe); + void pipeRunAABGR8(SplashPipe *pipe); +#if SPLASH_CMYK + void pipeRunAACMYK8(SplashPipe *pipe); + void pipeRunAADeviceN8(SplashPipe *pipe); +#endif + void pipeSetXY(SplashPipe *pipe, int x, int y); + void pipeIncX(SplashPipe *pipe); + void drawPixel(SplashPipe *pipe, int x, int y, GBool noClip); + void drawAAPixelInit(); + void drawAAPixel(SplashPipe *pipe, int x, int y); + void drawSpan(SplashPipe *pipe, int x0, int x1, int y, GBool noClip); + void drawAALine(SplashPipe *pipe, int x0, int x1, int y, GBool adjustLine = gFalse, Guchar lineOpacity = 0); + void transform(SplashCoord *matrix, SplashCoord xi, SplashCoord yi, + SplashCoord *xo, SplashCoord *yo); + void updateModX(int x); + void updateModY(int y); + void strokeNarrow(SplashPath *path); + void strokeWide(SplashPath *path, SplashCoord w); + SplashPath *flattenPath(SplashPath *path, SplashCoord *matrix, + SplashCoord flatness); + void flattenCurve(SplashCoord x0, SplashCoord y0, + SplashCoord x1, SplashCoord y1, + SplashCoord x2, SplashCoord y2, + SplashCoord x3, SplashCoord y3, + SplashCoord *matrix, SplashCoord flatness2, + SplashPath *fPath); + SplashPath *makeDashedPath(SplashPath *xPath); + void getBBoxFP(SplashPath *path, SplashCoord *xMinA, SplashCoord *yMinA, SplashCoord *xMaxA, SplashCoord *yMaxA); + SplashError fillWithPattern(SplashPath *path, GBool eo, + SplashPattern *pattern, SplashCoord alpha); + GBool pathAllOutside(SplashPath *path); + void fillGlyph2(int x0, int y0, SplashGlyphBitmap *glyph, GBool noclip); + void arbitraryTransformMask(SplashImageMaskSource src, void *srcData, + int srcWidth, int srcHeight, + SplashCoord *mat, GBool glyphMode); + SplashBitmap *scaleMask(SplashImageMaskSource src, void *srcData, + int srcWidth, int srcHeight, + int scaledWidth, int scaledHeight); + void scaleMaskYdXd(SplashImageMaskSource src, void *srcData, + int srcWidth, int srcHeight, + int scaledWidth, int scaledHeight, + SplashBitmap *dest); + void scaleMaskYdXu(SplashImageMaskSource src, void *srcData, + int srcWidth, int srcHeight, + int scaledWidth, int scaledHeight, + SplashBitmap *dest); + void scaleMaskYuXd(SplashImageMaskSource src, void *srcData, + int srcWidth, int srcHeight, + int scaledWidth, int scaledHeight, + SplashBitmap *dest); + void scaleMaskYuXu(SplashImageMaskSource src, void *srcData, + int srcWidth, int srcHeight, + int scaledWidth, int scaledHeight, + SplashBitmap *dest); + void blitMask(SplashBitmap *src, int xDest, int yDest, + SplashClipResult clipRes); + SplashError arbitraryTransformImage(SplashImageSource src, void *srcData, + SplashColorMode srcMode, int nComps, + GBool srcAlpha, + int srcWidth, int srcHeight, + SplashCoord *mat, GBool interpolate, GBool tilingPattern = gFalse); + SplashBitmap *scaleImage(SplashImageSource src, void *srcData, + SplashColorMode srcMode, int nComps, + GBool srcAlpha, int srcWidth, int srcHeight, + 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, + int scaledWidth, int scaledHeight, + SplashBitmap *dest); + void scaleImageYdXu(SplashImageSource src, void *srcData, + SplashColorMode srcMode, int nComps, + GBool srcAlpha, int srcWidth, int srcHeight, + int scaledWidth, int scaledHeight, + SplashBitmap *dest); + void scaleImageYuXd(SplashImageSource src, void *srcData, + SplashColorMode srcMode, int nComps, + GBool srcAlpha, int srcWidth, int srcHeight, + int scaledWidth, int scaledHeight, + SplashBitmap *dest); + void scaleImageYuXu(SplashImageSource src, void *srcData, + SplashColorMode srcMode, int nComps, + GBool srcAlpha, int srcWidth, int srcHeight, + int scaledWidth, int scaledHeight, + SplashBitmap *dest); + void scaleImageYuXuBilinear(SplashImageSource src, void *srcData, + SplashColorMode srcMode, int nComps, + GBool srcAlpha, int srcWidth, int srcHeight, + int scaledWidth, int scaledHeight, + SplashBitmap *dest); + void vertFlipImage(SplashBitmap *img, int width, int height, + int nComps); + void blitImage(SplashBitmap *src, GBool srcAlpha, int xDest, int yDest, + SplashClipResult clipRes); + void blitImageClipped(SplashBitmap *src, GBool srcAlpha, + int xSrc, int ySrc, int xDest, int yDest, + int w, int h); + void dumpPath(SplashPath *path); + void dumpXPath(SplashXPath *path); + + static SplashPipeResultColorCtrl pipeResultColorNoAlphaBlend[]; + static SplashPipeResultColorCtrl pipeResultColorAlphaNoBlend[]; + static SplashPipeResultColorCtrl pipeResultColorAlphaBlend[]; + static int pipeNonIsoGroupCorrection[]; + + SplashBitmap *bitmap; + SplashState *state; + SplashBitmap *aaBuf; + int aaBufY; + SplashBitmap *alpha0Bitmap; // for non-isolated groups, this is the + // bitmap containing the alpha0 values + int alpha0X, alpha0Y; // offset within alpha0Bitmap + SplashCoord aaGamma[splashAASize * splashAASize + 1]; + SplashCoord minLineWidth; + SplashThinLineMode thinLineMode; + int modXMin, modYMin, modXMax, modYMax; + SplashClipResult opClipRes; + GBool vectorAntialias; + GBool inShading; + GBool debugMode; +}; + +#endif diff --git a/Build/source/libs/poppler/poppler-0.25.0/splash/SplashBitmap.cc b/Build/source/libs/poppler/poppler-0.25.0/splash/SplashBitmap.cc new file mode 100644 index 00000000000..ac344f17c35 --- /dev/null +++ b/Build/source/libs/poppler/poppler-0.25.0/splash/SplashBitmap.cc @@ -0,0 +1,750 @@ +//======================================================================== +// +// SplashBitmap.cc +// +//======================================================================== + +//======================================================================== +// +// Modified under the Poppler project - http://poppler.freedesktop.org +// +// All changes made under the Poppler project to this file are licensed +// under GPL version 2 or later +// +// Copyright (C) 2006, 2009, 2010, 2012 Albert Astals Cid <aacid@kde.org> +// Copyright (C) 2007 Ilmari Heikkinen <ilmari.heikkinen@gmail.com> +// Copyright (C) 2009 Shen Liang <shenzhuxi@gmail.com> +// Copyright (C) 2009 Stefan Thomas <thomas@eload24.com> +// Copyright (C) 2010, 2012 Adrian Johnson <ajohnson@redneon.com> +// Copyright (C) 2010 Harry Roberts <harry.roberts@midnight-labs.org> +// Copyright (C) 2010 Christian Feuersänger <cfeuersaenger@googlemail.com> +// Copyright (C) 2010 William Bader <williambader@hotmail.com> +// Copyright (C) 2011-2013 Thomas Freitag <Thomas.Freitag@alfa.de> +// Copyright (C) 2012 Anthony Wesley <awesley@smartnetworks.com.au> +// +// To see a description of the changes please see the Changelog file that +// came with your tarball or type make ChangeLog if you are building from git +// +//======================================================================== + +#include <config.h> + +#ifdef USE_GCC_PRAGMAS +#pragma implementation +#endif + +#include <stdio.h> +#include <string.h> +#include <stdlib.h> +#include <limits.h> +#include "goo/gmem.h" +#include "SplashErrorCodes.h" +#include "SplashBitmap.h" +#include "poppler/Error.h" +#include "goo/JpegWriter.h" +#include "goo/PNGWriter.h" +#include "goo/TiffWriter.h" +#include "goo/ImgWriter.h" +#include "goo/GooList.h" + +//------------------------------------------------------------------------ +// SplashBitmap +//------------------------------------------------------------------------ + +SplashBitmap::SplashBitmap(int widthA, int heightA, int rowPadA, + SplashColorMode modeA, GBool alphaA, + GBool topDown, GooList *separationListA) { + width = widthA; + height = heightA; + mode = modeA; + rowPad = rowPadA; + switch (mode) { + case splashModeMono1: + if (width > 0) { + rowSize = (width + 7) >> 3; + } else { + rowSize = -1; + } + break; + case splashModeMono8: + if (width > 0) { + rowSize = width; + } else { + rowSize = -1; + } + break; + case splashModeRGB8: + case splashModeBGR8: + if (width > 0 && width <= INT_MAX / 3) { + rowSize = width * 3; + } else { + rowSize = -1; + } + break; + case splashModeXBGR8: + if (width > 0 && width <= INT_MAX / 4) { + rowSize = width * 4; + } else { + rowSize = -1; + } + break; +#if SPLASH_CMYK + case splashModeCMYK8: + if (width > 0 && width <= INT_MAX / 4) { + rowSize = width * 4; + } else { + rowSize = -1; + } + break; + case splashModeDeviceN8: + if (width > 0 && width <= INT_MAX / 4) { + rowSize = width * (SPOT_NCOMPS + 4); + } else { + rowSize = -1; + } + break; +#endif + } + if (rowSize > 0) { + rowSize += rowPad - 1; + rowSize -= rowSize % rowPad; + } + data = (SplashColorPtr)gmallocn_checkoverflow(rowSize, height); + if (data != NULL) { + if (!topDown) { + data += (height - 1) * rowSize; + rowSize = -rowSize; + } + if (alphaA) { + alpha = (Guchar *)gmallocn(width, height); + } else { + alpha = NULL; + } + } else { + alpha = NULL; + } + separationList = new GooList(); + if (separationListA != NULL) + for (int i = 0; i < separationListA->getLength(); i++) + separationList->append(((GfxSeparationColorSpace *) separationListA->get(i))->copy()); +} + +SplashBitmap *SplashBitmap::copy(SplashBitmap *src) { + SplashBitmap *result = new SplashBitmap(src->getWidth(), src->getHeight(), src->getRowPad(), + src->getMode(), src->getAlphaPtr() != NULL, src->getRowSize() >= 0, src->getSeparationList()); + Guchar *dataSource = src->getDataPtr(); + Guchar *dataDest = result->getDataPtr(); + int amount = src->getRowSize(); + if (amount < 0) { + dataSource = dataSource + (src->getHeight() - 1) * amount; + dataDest = dataDest + (src->getHeight() - 1) * amount; + amount *= -src->getHeight(); + } else { + amount *= src->getHeight(); + } + memcpy(dataDest, dataSource, amount); + if (src->getAlphaPtr() != NULL) { + memcpy(result->getAlphaPtr(), src->getAlphaPtr(), src->getWidth() * src->getHeight()); + } + return result; +} + +SplashBitmap::~SplashBitmap() { + if (data) { + if (rowSize < 0) { + gfree(data + (height - 1) * rowSize); + } else { + gfree(data); + } + } + gfree(alpha); + deleteGooList(separationList, GfxSeparationColorSpace); +} + + +SplashError SplashBitmap::writePNMFile(char *fileName) { + FILE *f; + SplashError e; + + if (!(f = fopen(fileName, "wb"))) { + return splashErrOpenFile; + } + + e = this->writePNMFile(f); + + fclose(f); + return e; +} + + +SplashError SplashBitmap::writePNMFile(FILE *f) { + SplashColorPtr row, p; + int x, y; + + switch (mode) { + + case splashModeMono1: + fprintf(f, "P4\n%d %d\n", width, height); + row = data; + for (y = 0; y < height; ++y) { + p = row; + for (x = 0; x < width; x += 8) { + fputc(*p ^ 0xff, f); + ++p; + } + row += rowSize; + } + break; + + case splashModeMono8: + fprintf(f, "P5\n%d %d\n255\n", width, height); + row = data; + for (y = 0; y < height; ++y) { + fwrite(row, 1, width, f); + row += rowSize; + } + break; + + case splashModeRGB8: + fprintf(f, "P6\n%d %d\n255\n", width, height); + row = data; + for (y = 0; y < height; ++y) { + fwrite(row, 1, 3 * width, f); + row += rowSize; + } + break; + + case splashModeXBGR8: + fprintf(f, "P6\n%d %d\n255\n", width, height); + row = data; + for (y = 0; y < height; ++y) { + p = row; + for (x = 0; x < width; ++x) { + fputc(splashBGR8R(p), f); + fputc(splashBGR8G(p), f); + fputc(splashBGR8B(p), f); + p += 4; + } + row += rowSize; + } + break; + + + case splashModeBGR8: + fprintf(f, "P6\n%d %d\n255\n", width, height); + row = data; + for (y = 0; y < height; ++y) { + p = row; + for (x = 0; x < width; ++x) { + fputc(splashBGR8R(p), f); + fputc(splashBGR8G(p), f); + fputc(splashBGR8B(p), f); + p += 3; + } + row += rowSize; + } + break; + +#if SPLASH_CMYK + case splashModeCMYK8: + case splashModeDeviceN8: + // PNM doesn't support CMYK + error(errInternal, -1, "unsupported SplashBitmap mode"); + return splashErrGeneric; + break; +#endif + } + return splashOk; +} + +SplashError SplashBitmap::writeAlphaPGMFile(char *fileName) { + FILE *f; + + if (!alpha) { + return splashErrModeMismatch; + } + if (!(f = fopen(fileName, "wb"))) { + return splashErrOpenFile; + } + fprintf(f, "P5\n%d %d\n255\n", width, height); + fwrite(alpha, 1, width * height, f); + fclose(f); + return splashOk; +} + +void SplashBitmap::getPixel(int x, int y, SplashColorPtr pixel) { + SplashColorPtr p; + + if (y < 0 || y >= height || x < 0 || x >= width) { + return; + } + switch (mode) { + case splashModeMono1: + p = &data[y * rowSize + (x >> 3)]; + pixel[0] = (p[0] & (0x80 >> (x & 7))) ? 0xff : 0x00; + break; + case splashModeMono8: + p = &data[y * rowSize + x]; + pixel[0] = p[0]; + break; + case splashModeRGB8: + p = &data[y * rowSize + 3 * x]; + pixel[0] = p[0]; + pixel[1] = p[1]; + pixel[2] = p[2]; + break; + case splashModeXBGR8: + p = &data[y * rowSize + 4 * x]; + pixel[0] = p[2]; + pixel[1] = p[1]; + pixel[2] = p[0]; + pixel[3] = p[3]; + break; + case splashModeBGR8: + p = &data[y * rowSize + 3 * x]; + pixel[0] = p[2]; + pixel[1] = p[1]; + pixel[2] = p[0]; + break; +#if SPLASH_CMYK + case splashModeCMYK8: + p = &data[y * rowSize + 4 * x]; + pixel[0] = p[0]; + pixel[1] = p[1]; + pixel[2] = p[2]; + pixel[3] = p[3]; + break; + case splashModeDeviceN8: + p = &data[y * rowSize + (SPOT_NCOMPS + 4) * x]; + for (int cp = 0; cp < SPOT_NCOMPS + 4; cp++) + pixel[cp] = p[cp]; + break; +#endif + } +} + +Guchar SplashBitmap::getAlpha(int x, int y) { + return alpha[y * width + x]; +} + +SplashColorPtr SplashBitmap::takeData() { + SplashColorPtr data2; + + data2 = data; + data = NULL; + return data2; +} + +SplashError SplashBitmap::writeImgFile(SplashImageFileFormat format, char *fileName, int hDPI, int vDPI, const char *compressionString) { + FILE *f; + SplashError e; + + if (!(f = fopen(fileName, "wb"))) { + return splashErrOpenFile; + } + + e = writeImgFile(format, f, hDPI, vDPI, compressionString); + + fclose(f); + return e; +} + +SplashError SplashBitmap::writeImgFile(SplashImageFileFormat format, FILE *f, int hDPI, int vDPI, const char *compressionString) { + ImgWriter *writer; + SplashError e; + + switch (format) { + #ifdef ENABLE_LIBPNG + case splashFormatPng: + writer = new PNGWriter(); + break; + #endif + + #ifdef ENABLE_LIBJPEG + #ifdef SPLASH_CMYK + case splashFormatJpegCMYK: + writer = new JpegWriter(JpegWriter::CMYK); + break; + #endif + case splashFormatJpeg: + writer = new JpegWriter(); + break; + #endif + + #ifdef ENABLE_LIBTIFF + case splashFormatTiff: + switch (mode) { + case splashModeMono1: + writer = new TiffWriter(TiffWriter::MONOCHROME); + break; + case splashModeMono8: + writer = new TiffWriter(TiffWriter::GRAY); + break; + case splashModeRGB8: + case splashModeBGR8: + writer = new TiffWriter(TiffWriter::RGB); + break; +#if SPLASH_CMYK + case splashModeCMYK8: + case splashModeDeviceN8: + writer = new TiffWriter(TiffWriter::CMYK); + break; +#endif + default: + fprintf(stderr, "TiffWriter: Mode %d not supported\n", mode); + writer = new TiffWriter(); + } + if (writer) { + ((TiffWriter *)writer)->setCompressionString(compressionString); + } + break; + #endif + + default: + // Not the greatest error message, but users of this function should + // have already checked whether their desired format is compiled in. + error(errInternal, -1, "Support for this image type not compiled in"); + return splashErrGeneric; + } + + e = writeImgFile(writer, f, hDPI, vDPI); + delete writer; + return e; +} + +#include "poppler/GfxState_helpers.h" + +void SplashBitmap::getRGBLine(int yl, SplashColorPtr line) { + SplashColor col; + double c, m, y, k, c1, m1, y1, k1, r, g, b; + + for (int x = 0; x < width; x++) { + getPixel(x, yl, col); + c = byteToDbl(col[0]); + m = byteToDbl(col[1]); + y = byteToDbl(col[2]); + k = byteToDbl(col[3]); +#if SPLASH_CMYK + if (separationList->getLength() > 0) { + for (int i = 0; i < separationList->getLength(); i++) { + if (col[i+4] > 0) { + GfxCMYK cmyk; + GfxColor input; + input.c[0] = byteToCol(col[i+4]); + GfxSeparationColorSpace *sepCS = (GfxSeparationColorSpace *)separationList->get(i); + sepCS->getCMYK(&input, &cmyk); + col[0] = colToByte(cmyk.c); + col[1] = colToByte(cmyk.m); + col[2] = colToByte(cmyk.y); + col[3] = colToByte(cmyk.k); + c += byteToDbl(col[0]); + m += byteToDbl(col[1]); + y += byteToDbl(col[2]); + k += byteToDbl(col[3]); + } + } + if (c > 1) c = 1; + if (m > 1) m = 1; + if (y > 1) y = 1; + if (k > 1) k = 1; + } +#endif + c1 = 1 - c; + m1 = 1 - m; + y1 = 1 - y; + k1 = 1 - k; + cmykToRGBMatrixMultiplication(c, m, y, k, c1, m1, y1, k1, r, g, b); + *line++ = dblToByte(clip01(r)); + *line++ = dblToByte(clip01(g)); + *line++ = dblToByte(clip01(b)); + } +} + +void SplashBitmap::getXBGRLine(int yl, SplashColorPtr line) { + SplashColor col; + double c, m, y, k, c1, m1, y1, k1, r, g, b; + + for (int x = 0; x < width; x++) { + getPixel(x, yl, col); + c = byteToDbl(col[0]); + m = byteToDbl(col[1]); + y = byteToDbl(col[2]); + k = byteToDbl(col[3]); +#if SPLASH_CMYK + if (separationList->getLength() > 0) { + for (int i = 0; i < separationList->getLength(); i++) { + if (col[i+4] > 0) { + GfxCMYK cmyk; + GfxColor input; + input.c[0] = byteToCol(col[i+4]); + GfxSeparationColorSpace *sepCS = (GfxSeparationColorSpace *)separationList->get(i); + sepCS->getCMYK(&input, &cmyk); + col[0] = colToByte(cmyk.c); + col[1] = colToByte(cmyk.m); + col[2] = colToByte(cmyk.y); + col[3] = colToByte(cmyk.k); + c += byteToDbl(col[0]); + m += byteToDbl(col[1]); + y += byteToDbl(col[2]); + k += byteToDbl(col[3]); + } + } + if (c > 1) c = 1; + if (m > 1) m = 1; + if (y > 1) y = 1; + if (k > 1) k = 1; + } +#endif + c1 = 1 - c; + m1 = 1 - m; + y1 = 1 - y; + k1 = 1 - k; + cmykToRGBMatrixMultiplication(c, m, y, k, c1, m1, y1, k1, r, g, b); + *line++ = dblToByte(clip01(b)); + *line++ = dblToByte(clip01(g)); + *line++ = dblToByte(clip01(r)); + *line++ = 255; + } +} + +GBool SplashBitmap::convertToXBGR() { + if (mode == splashModeXBGR8) + return gTrue; + + int newrowSize = width * 4; + SplashColorPtr newdata = (SplashColorPtr)gmallocn_checkoverflow(newrowSize, height); + if (newdata != NULL) { + for (int y = 0; y < height; y++) { + unsigned char *row = newdata + y * newrowSize; + getXBGRLine(y, row); + } + if (rowSize < 0) { + gfree(data + (height - 1) * rowSize); + } else { + gfree(data); + } + data = newdata; + rowSize = newrowSize; + mode = splashModeXBGR8; + } + return newdata != NULL; +} + +#if SPLASH_CMYK +void SplashBitmap::getCMYKLine(int yl, SplashColorPtr line) { + SplashColor col; + + for (int x = 0; x < width; x++) { + getPixel(x, yl, col); + if (separationList->getLength() > 0) { + double c, m, y, k; + c = byteToDbl(col[0]); + m = byteToDbl(col[1]); + y = byteToDbl(col[2]); + k = byteToDbl(col[3]); + for (int i = 0; i < separationList->getLength(); i++) { + if (col[i+4] > 0) { + GfxCMYK cmyk; + GfxColor input; + input.c[0] = byteToCol(col[i+4]); + GfxSeparationColorSpace *sepCS = (GfxSeparationColorSpace *)separationList->get(i); + sepCS->getCMYK(&input, &cmyk); + col[0] = colToByte(cmyk.c); + col[1] = colToByte(cmyk.m); + col[2] = colToByte(cmyk.y); + col[3] = colToByte(cmyk.k); + c += byteToDbl(col[0]); + m += byteToDbl(col[1]); + y += byteToDbl(col[2]); + k += byteToDbl(col[3]); + } + } + col[0] = dblToByte(clip01(c)); + col[1] = dblToByte(clip01(m)); + col[2] = dblToByte(clip01(y)); + col[3] = dblToByte(clip01(k)); + } + *line++ = col[0]; + *line++ = col[1]; + *line++ = col[2]; + *line++ = col[3]; + } +} +#endif + +SplashError SplashBitmap::writeImgFile(ImgWriter *writer, FILE *f, int hDPI, int vDPI) { + if (mode != splashModeRGB8 && mode != splashModeMono8 && mode != splashModeMono1 && mode != splashModeXBGR8 && mode != splashModeBGR8 +#if SPLASH_CMYK + && mode != splashModeCMYK8 && mode != splashModeDeviceN8 +#endif + ) { + error(errInternal, -1, "unsupported SplashBitmap mode"); + return splashErrGeneric; + } + + if (!writer->init(f, width, height, hDPI, vDPI)) { + return splashErrGeneric; + } + + switch (mode) { +#if SPLASH_CMYK + case splashModeCMYK8: + if (writer->supportCMYK()) { + SplashColorPtr row; + unsigned char **row_pointers = new unsigned char*[height]; + row = data; + + for (int y = 0; y < height; ++y) { + row_pointers[y] = row; + row += rowSize; + } + if (!writer->writePointers(row_pointers, height)) { + delete[] row_pointers; + return splashErrGeneric; + } + delete[] row_pointers; + } else { + unsigned char *row = new unsigned char[3 * width]; + for (int y = 0; y < height; y++) { + getRGBLine(y, row); + if (!writer->writeRow(&row)) { + delete[] row; + return splashErrGeneric; + } + } + delete[] row; + } + break; + case splashModeDeviceN8: + if (writer->supportCMYK()) { + unsigned char *row = new unsigned char[4 * width]; + for (int y = 0; y < height; y++) { + getCMYKLine(y, row); + if (!writer->writeRow(&row)) { + delete[] row; + return splashErrGeneric; + } + } + delete[] row; + } else { + unsigned char *row = new unsigned char[3 * width]; + for (int y = 0; y < height; y++) { + getRGBLine(y, row); + if (!writer->writeRow(&row)) { + delete[] row; + return splashErrGeneric; + } + } + delete[] row; + } + break; +#endif + case splashModeRGB8: + { + SplashColorPtr row; + unsigned char **row_pointers = new unsigned char*[height]; + row = data; + + for (int y = 0; y < height; ++y) { + row_pointers[y] = row; + row += rowSize; + } + if (!writer->writePointers(row_pointers, height)) { + delete[] row_pointers; + return splashErrGeneric; + } + delete[] row_pointers; + } + break; + + case splashModeBGR8: + { + unsigned char *row = new unsigned char[3 * width]; + for (int y = 0; y < height; y++) { + // Convert into a PNG row + for (int x = 0; x < width; x++) { + row[3*x] = data[y * rowSize + x * 3 + 2]; + row[3*x+1] = data[y * rowSize + x * 3 + 1]; + row[3*x+2] = data[y * rowSize + x * 3]; + } + + if (!writer->writeRow(&row)) { + delete[] row; + return splashErrGeneric; + } + } + delete[] row; + } + break; + + case splashModeXBGR8: + { + unsigned char *row = new unsigned char[3 * width]; + for (int y = 0; y < height; y++) { + // Convert into a PNG row + for (int x = 0; x < width; x++) { + row[3*x] = data[y * rowSize + x * 4 + 2]; + row[3*x+1] = data[y * rowSize + x * 4 + 1]; + row[3*x+2] = data[y * rowSize + x * 4]; + } + + if (!writer->writeRow(&row)) { + delete[] row; + return splashErrGeneric; + } + } + delete[] row; + } + break; + + case splashModeMono8: + { + unsigned char *row = new unsigned char[3 * width]; + for (int y = 0; y < height; y++) { + // Convert into a PNG row + for (int x = 0; x < width; x++) { + row[3*x] = data[y * rowSize + x]; + row[3*x+1] = data[y * rowSize + x]; + row[3*x+2] = data[y * rowSize + x]; + } + + if (!writer->writeRow(&row)) { + delete[] row; + return splashErrGeneric; + } + } + delete[] row; + } + break; + + case splashModeMono1: + { + unsigned char *row = new unsigned char[3 * width]; + for (int y = 0; y < height; y++) { + // Convert into a PNG row + for (int x = 0; x < width; x++) { + getPixel(x, y, &row[3*x]); + row[3*x+1] = row[3*x]; + row[3*x+2] = row[3*x]; + } + + if (!writer->writeRow(&row)) { + delete[] row; + return splashErrGeneric; + } + } + delete[] row; + } + break; + + default: + // can't happen + break; + } + + if (!writer->close()) { + return splashErrGeneric; + } + + return splashOk; +} diff --git a/Build/source/libs/poppler/poppler-0.25.0/splash/SplashBitmap.h b/Build/source/libs/poppler/poppler-0.25.0/splash/SplashBitmap.h new file mode 100644 index 00000000000..70509abcfaa --- /dev/null +++ b/Build/source/libs/poppler/poppler-0.25.0/splash/SplashBitmap.h @@ -0,0 +1,108 @@ +//======================================================================== +// +// SplashBitmap.h +// +//======================================================================== + +//======================================================================== +// +// Modified under the Poppler project - http://poppler.freedesktop.org +// +// All changes made under the Poppler project to this file are licensed +// under GPL version 2 or later +// +// Copyright (C) 2007 Ilmari Heikkinen <ilmari.heikkinen@gmail.com> +// Copyright (C) 2009 Shen Liang <shenzhuxi@gmail.com> +// Copyright (C) 2009, 2012 Albert Astals Cid <aacid@kde.org> +// Copyright (C) 2009 Stefan Thomas <thomas@eload24.com> +// Copyright (C) 2010 Adrian Johnson <ajohnson@redneon.com> +// Copyright (C) 2010 Harry Roberts <harry.roberts@midnight-labs.org> +// Copyright (C) 2010 Christian Feuersänger <cfeuersaenger@googlemail.com> +// Copyright (C) 2010 William Bader <williambader@hotmail.com> +// Copyright (C) 2012 Thomas Freitag <Thomas.Freitag@alfa.de> +// +// To see a description of the changes please see the Changelog file that +// came with your tarball or type make ChangeLog if you are building from git +// +//======================================================================== + +#ifndef SPLASHBITMAP_H +#define SPLASHBITMAP_H + +#ifdef USE_GCC_PRAGMAS +#pragma interface +#endif + +#include "SplashTypes.h" +#include "poppler/GfxState.h" +#include <stdio.h> + +class ImgWriter; + +//------------------------------------------------------------------------ +// SplashBitmap +//------------------------------------------------------------------------ + +class SplashBitmap { +public: + + // Create a new bitmap. It will have <widthA> x <heightA> pixels in + // color mode <modeA>. Rows will be padded out to a multiple of + // <rowPad> bytes. If <topDown> is false, the bitmap will be stored + // upside-down, i.e., with the last row first in memory. + SplashBitmap(int widthA, int heightA, int rowPad, + SplashColorMode modeA, GBool alphaA, + GBool topDown = gTrue, GooList *separationList = NULL); + static SplashBitmap *copy(SplashBitmap *src); + + ~SplashBitmap(); + + int getWidth() { return width; } + int getHeight() { return height; } + int getRowSize() { return rowSize; } + int getAlphaRowSize() { return width; } + int getRowPad() { return rowPad; } + SplashColorMode getMode() { return mode; } + SplashColorPtr getDataPtr() { return data; } + Guchar *getAlphaPtr() { return alpha; } + GooList *getSeparationList() { return separationList; } + + SplashError writePNMFile(char *fileName); + SplashError writePNMFile(FILE *f); + SplashError writeAlphaPGMFile(char *fileName); + + SplashError writeImgFile(SplashImageFileFormat format, char *fileName, int hDPI, int vDPI, const char *compressionString = ""); + SplashError writeImgFile(SplashImageFileFormat format, FILE *f, int hDPI, int vDPI, const char *compressionString = ""); + SplashError writeImgFile(ImgWriter *writer, FILE *f, int hDPI, int vDPI); + + GBool convertToXBGR(); + + void getPixel(int x, int y, SplashColorPtr pixel); + void getRGBLine(int y, SplashColorPtr line); + void getXBGRLine(int y, SplashColorPtr line); +#if SPLASH_CMYK + void getCMYKLine(int y, SplashColorPtr line); +#endif + Guchar getAlpha(int x, int y); + + // Caller takes ownership of the bitmap data. The SplashBitmap + // object is no longer valid -- the next call should be to the + // destructor. + SplashColorPtr takeData(); + +private: + + int width, height; // size of bitmap + int rowPad; + int rowSize; // size of one row of data, in bytes + // - negative for bottom-up bitmaps + SplashColorMode mode; // color mode + SplashColorPtr data; // pointer to row zero of the color data + Guchar *alpha; // pointer to row zero of the alpha data + // (always top-down) + GooList *separationList; // list of spot colorants and their mapping functions + + friend class Splash; +}; + +#endif diff --git a/Build/source/libs/poppler/poppler-0.25.0/splash/SplashClip.cc b/Build/source/libs/poppler/poppler-0.25.0/splash/SplashClip.cc new file mode 100644 index 00000000000..85c6b11473d --- /dev/null +++ b/Build/source/libs/poppler/poppler-0.25.0/splash/SplashClip.cc @@ -0,0 +1,411 @@ +//======================================================================== +// +// SplashClip.cc +// +//======================================================================== + +//======================================================================== +// +// Modified under the Poppler project - http://poppler.freedesktop.org +// +// All changes made under the Poppler project to this file are licensed +// under GPL version 2 or later +// +// Copyright (C) 2010 Albert Astals Cid <aacid@kde.org> +// Copyright (C) 2013 Thomas Freitag <Thomas.Freitag@alfa.de> +// +// To see a description of the changes please see the Changelog file that +// came with your tarball or type make ChangeLog if you are building from git +// +//======================================================================== + +#include <config.h> + +#ifdef USE_GCC_PRAGMAS +#pragma implementation +#endif + +#include <stdlib.h> +#include <string.h> +#include "goo/gmem.h" +#include "SplashErrorCodes.h" +#include "SplashPath.h" +#include "SplashXPath.h" +#include "SplashXPathScanner.h" +#include "SplashBitmap.h" +#include "SplashClip.h" + +//------------------------------------------------------------------------ +// SplashClip.flags +//------------------------------------------------------------------------ + +#define splashClipEO 0x01 // use even-odd rule + +//------------------------------------------------------------------------ +// SplashClip +//------------------------------------------------------------------------ + +SplashClip::SplashClip(SplashCoord x0, SplashCoord y0, + SplashCoord x1, SplashCoord y1, + GBool antialiasA) { + antialias = antialiasA; + if (x0 < x1) { + xMin = x0; + xMax = x1; + } else { + xMin = x1; + xMax = x0; + } + if (y0 < y1) { + yMin = y0; + yMax = y1; + } else { + yMin = y1; + yMax = y0; + } + xMinI = splashFloor(xMin); + yMinI = splashFloor(yMin); + xMaxI = splashCeil(xMax) - 1; + yMaxI = splashCeil(yMax) - 1; + paths = NULL; + flags = NULL; + scanners = NULL; + length = size = 0; +} + +SplashClip::SplashClip(SplashClip *clip) { + int yMinAA, yMaxAA; + int i; + + antialias = clip->antialias; + xMin = clip->xMin; + yMin = clip->yMin; + xMax = clip->xMax; + yMax = clip->yMax; + xMinI = clip->xMinI; + yMinI = clip->yMinI; + xMaxI = clip->xMaxI; + yMaxI = clip->yMaxI; + length = clip->length; + size = clip->size; + paths = (SplashXPath **)gmallocn(size, sizeof(SplashXPath *)); + flags = (Guchar *)gmallocn(size, sizeof(Guchar)); + scanners = (SplashXPathScanner **) + gmallocn(size, sizeof(SplashXPathScanner *)); + 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); + } +} + +SplashClip::~SplashClip() { + int i; + + for (i = 0; i < length; ++i) { + delete paths[i]; + delete scanners[i]; + } + gfree(paths); + gfree(flags); + gfree(scanners); +} + +void SplashClip::grow(int nPaths) { + if (length + nPaths > size) { + if (size == 0) { + size = 32; + } + while (size < length + nPaths) { + size *= 2; + } + paths = (SplashXPath **)greallocn(paths, size, sizeof(SplashXPath *)); + flags = (Guchar *)greallocn(flags, size, sizeof(Guchar)); + scanners = (SplashXPathScanner **) + greallocn(scanners, size, sizeof(SplashXPathScanner *)); + } +} + +void SplashClip::resetToRect(SplashCoord x0, SplashCoord y0, + SplashCoord x1, SplashCoord y1) { + int i; + + for (i = 0; i < length; ++i) { + delete paths[i]; + delete scanners[i]; + } + gfree(paths); + gfree(flags); + gfree(scanners); + paths = NULL; + flags = NULL; + scanners = NULL; + length = size = 0; + + if (x0 < x1) { + xMin = x0; + xMax = x1; + } else { + xMin = x1; + xMax = x0; + } + if (y0 < y1) { + yMin = y0; + yMax = y1; + } else { + yMin = y1; + yMax = y0; + } + xMinI = splashFloor(xMin); + yMinI = splashFloor(yMin); + xMaxI = splashCeil(xMax) - 1; + yMaxI = splashCeil(yMax) - 1; +} + +SplashError SplashClip::clipToRect(SplashCoord x0, SplashCoord y0, + SplashCoord x1, SplashCoord y1) { + if (x0 < x1) { + if (x0 > xMin) { + xMin = x0; + xMinI = splashFloor(xMin); + } + if (x1 < xMax) { + xMax = x1; + xMaxI = splashCeil(xMax) - 1; + } + } else { + if (x1 > xMin) { + xMin = x1; + xMinI = splashFloor(xMin); + } + if (x0 < xMax) { + xMax = x0; + xMaxI = splashCeil(xMax) - 1; + } + } + if (y0 < y1) { + if (y0 > yMin) { + yMin = y0; + yMinI = splashFloor(yMin); + } + if (y1 < yMax) { + yMax = y1; + yMaxI = splashCeil(yMax) - 1; + } + } else { + if (y1 > yMin) { + yMin = y1; + yMinI = splashFloor(yMin); + } + if (y0 < yMax) { + yMax = y0; + yMaxI = splashCeil(yMax) - 1; + } + } + return splashOk; +} + +SplashError SplashClip::clipToPath(SplashPath *path, SplashCoord *matrix, + SplashCoord flatness, GBool eo) { + SplashXPath *xPath; + int yMinAA, yMaxAA; + + xPath = new SplashXPath(path, matrix, flatness, gTrue); + + // check for an empty path + if (xPath->length == 0) { + xMax = xMin - 1; + yMax = yMin - 1; + xMaxI = splashCeil(xMax) - 1; + yMaxI = splashCeil(yMax) - 1; + delete xPath; + + // check for a rectangle + } else if (xPath->length == 4 && + ((xPath->segs[0].x0 == xPath->segs[0].x1 && + xPath->segs[0].x0 == xPath->segs[1].x0 && + xPath->segs[0].x0 == xPath->segs[3].x1 && + xPath->segs[2].x0 == xPath->segs[2].x1 && + xPath->segs[2].x0 == xPath->segs[1].x1 && + xPath->segs[2].x0 == xPath->segs[3].x0 && + xPath->segs[1].y0 == xPath->segs[1].y1 && + xPath->segs[1].y0 == xPath->segs[0].y1 && + xPath->segs[1].y0 == xPath->segs[2].y0 && + xPath->segs[3].y0 == xPath->segs[3].y1 && + xPath->segs[3].y0 == xPath->segs[0].y0 && + xPath->segs[3].y0 == xPath->segs[2].y1) || + (xPath->segs[0].y0 == xPath->segs[0].y1 && + xPath->segs[0].y0 == xPath->segs[1].y0 && + xPath->segs[0].y0 == xPath->segs[3].y1 && + xPath->segs[2].y0 == xPath->segs[2].y1 && + xPath->segs[2].y0 == xPath->segs[1].y1 && + xPath->segs[2].y0 == xPath->segs[3].y0 && + xPath->segs[1].x0 == xPath->segs[1].x1 && + xPath->segs[1].x0 == xPath->segs[0].x1 && + xPath->segs[1].x0 == xPath->segs[2].x0 && + xPath->segs[3].x0 == xPath->segs[3].x1 && + xPath->segs[3].x0 == xPath->segs[0].x0 && + xPath->segs[3].x0 == xPath->segs[2].x1))) { + clipToRect(xPath->segs[0].x0, xPath->segs[0].y0, + xPath->segs[2].x0, xPath->segs[2].y0); + delete xPath; + + } else { + grow(1); + if (antialias) { + xPath->aaScale(); + } + xPath->sort(); + paths[length] = xPath; + flags[length] = eo ? splashClipEO : 0; + if (antialias) { + yMinAA = yMinI * splashAASize; + yMaxAA = (yMaxI + 1) * splashAASize - 1; + } else { + yMinAA = yMinI; + yMaxAA = yMaxI; + } + scanners[length] = new SplashXPathScanner(xPath, eo, yMinAA, yMaxAA); + ++length; + } + + return splashOk; +} + +SplashClipResult SplashClip::testRect(int rectXMin, int rectYMin, + int rectXMax, int rectYMax) { + // This tests the rectangle: + // x = [rectXMin, rectXMax + 1) (note: rect coords are ints) + // y = [rectYMin, rectYMax + 1) + // against the clipping region: + // x = [xMin, xMax) (note: clipping coords are fp) + // y = [yMin, yMax) + if ((SplashCoord)(rectXMax + 1) <= xMin || (SplashCoord)rectXMin >= xMax || + (SplashCoord)(rectYMax + 1) <= yMin || (SplashCoord)rectYMin >= yMax) { + return splashClipAllOutside; + } + if ((SplashCoord)rectXMin >= xMin && (SplashCoord)(rectXMax + 1) <= xMax && + (SplashCoord)rectYMin >= yMin && (SplashCoord)(rectYMax + 1) <= yMax && + length == 0) { + return splashClipAllInside; + } + return splashClipPartial; +} + +SplashClipResult SplashClip::testSpan(int spanXMin, int spanXMax, int spanY) { + int i; + + // This tests the rectangle: + // x = [spanXMin, spanXMax + 1) (note: span coords are ints) + // y = [spanY, spanY + 1) + // against the clipping region: + // x = [xMin, xMax) (note: clipping coords are fp) + // y = [yMin, yMax) + if ((SplashCoord)(spanXMax + 1) <= xMin || (SplashCoord)spanXMin >= xMax || + (SplashCoord)(spanY + 1) <= yMin || (SplashCoord)spanY >= yMax) { + return splashClipAllOutside; + } + if (!((SplashCoord)spanXMin >= xMin && (SplashCoord)(spanXMax + 1) <= xMax && + (SplashCoord)spanY >= yMin && (SplashCoord)(spanY + 1) <= yMax)) { + return splashClipPartial; + } + if (antialias) { + for (i = 0; i < length; ++i) { + if (!scanners[i]->testSpan(spanXMin * splashAASize, + spanXMax * splashAASize + (splashAASize - 1), + spanY * splashAASize)) { + return splashClipPartial; + } + } + } else { + for (i = 0; i < length; ++i) { + if (!scanners[i]->testSpan(spanXMin, spanXMax, spanY)) { + return splashClipPartial; + } + } + } + return splashClipAllInside; +} + +void SplashClip::clipAALine(SplashBitmap *aaBuf, int *x0, int *x1, int y, GBool adjustVertLine) { + int xx0, xx1, xx, yy, i; + SplashColorPtr p; + + // zero out pixels with x < xMin + xx0 = *x0 * splashAASize; + xx1 = splashFloor(xMin * splashAASize); + if (xx1 > aaBuf->getWidth()) { + xx1 = aaBuf->getWidth(); + } + if (xx0 < xx1) { + xx0 &= ~7; + for (yy = 0; yy < splashAASize; ++yy) { + p = aaBuf->getDataPtr() + yy * aaBuf->getRowSize() + (xx0 >> 3); + for (xx = xx0; xx + 7 < xx1; xx += 8) { + *p++ = 0; + } + if (xx < xx1 && !adjustVertLine) { + *p &= 0xff >> (xx1 & 7); + } + } + *x0 = splashFloor(xMin); + } + + // zero out pixels with x > xMax + xx0 = splashFloor(xMax * splashAASize) + 1; + if (xx0 < 0) { + xx0 = 0; + } + xx1 = (*x1 + 1) * splashAASize; + if (xx0 < xx1 && !adjustVertLine) { + for (yy = 0; yy < splashAASize; ++yy) { + p = aaBuf->getDataPtr() + yy * aaBuf->getRowSize() + (xx0 >> 3); + xx = xx0; + if (xx & 7) { + *p &= 0xff00 >> (xx & 7); + xx = (xx & ~7) + 8; + ++p; + } + for (; xx < xx1; xx += 8) { + *p++ = 0; + } + } + *x1 = splashFloor(xMax); + } + + // check the paths + for (i = 0; i < length; ++i) { + scanners[i]->clipAALine(aaBuf, x0, x1, y); + } + if (*x0 > *x1) { + *x0 = *x1; + } + if (*x0 < 0) { + *x0 = 0; + } + if ((*x0>>1) >= aaBuf->getRowSize()) { + xx0 = *x0; + *x0 = (aaBuf->getRowSize() - 1) << 1; + if (xx0 & 1) { + *x0 = *x0 + 1; + } + } + if (*x1 < *x0) { + *x1 = *x0; + } + if ((*x1>>1) >= aaBuf->getRowSize()) { + xx0 = *x1; + *x1 = (aaBuf->getRowSize() - 1) << 1; + if (xx0 & 1) { + *x1 = *x1 + 1; + } + } +} diff --git a/Build/source/libs/poppler/poppler-0.25.0/splash/SplashClip.h b/Build/source/libs/poppler/poppler-0.25.0/splash/SplashClip.h new file mode 100644 index 00000000000..5c0fdba99a7 --- /dev/null +++ b/Build/source/libs/poppler/poppler-0.25.0/splash/SplashClip.h @@ -0,0 +1,152 @@ +//======================================================================== +// +// SplashClip.h +// +//======================================================================== + +//======================================================================== +// +// Modified under the Poppler project - http://poppler.freedesktop.org +// +// All changes made under the Poppler project to this file are licensed +// under GPL version 2 or later +// +// Copyright (C) 2010 Albert Astals Cid <aacid@kde.org> +// Copyright (C) 2013 Thomas Freitag <Thomas.Freitag@alfa.de> +// +// To see a description of the changes please see the Changelog file that +// came with your tarball or type make ChangeLog if you are building from git +// +//======================================================================== + +#ifndef SPLASHCLIP_H +#define SPLASHCLIP_H + +#ifdef USE_GCC_PRAGMAS +#pragma interface +#endif + +#include "SplashTypes.h" +#include "SplashMath.h" +#include "SplashXPathScanner.h" + +class SplashPath; +class SplashXPath; +class SplashBitmap; + +//------------------------------------------------------------------------ + +enum SplashClipResult { + splashClipAllInside, + splashClipAllOutside, + splashClipPartial +}; + +//------------------------------------------------------------------------ +// SplashClip +//------------------------------------------------------------------------ + +class SplashClip { +public: + + // Create a clip, for the given rectangle. + SplashClip(SplashCoord x0, SplashCoord y0, + SplashCoord x1, SplashCoord y1, + GBool antialiasA); + + // Copy a clip. + SplashClip *copy() { return new SplashClip(this); } + + ~SplashClip(); + + // Reset the clip to a rectangle. + void resetToRect(SplashCoord x0, SplashCoord y0, + SplashCoord x1, SplashCoord y1); + + // Intersect the clip with a rectangle. + SplashError clipToRect(SplashCoord x0, SplashCoord y0, + SplashCoord x1, SplashCoord y1); + + // Interesect the clip with <path>. + SplashError clipToPath(SplashPath *path, SplashCoord *matrix, + SplashCoord flatness, GBool eo); + + // Returns true if (<x>,<y>) is inside the clip. + GBool test(int x, int y) + { + int i; + + // check the rectangle + if (x < xMinI || x > xMaxI || y < yMinI || y > yMaxI) { + return gFalse; + } + + // check the paths + if (antialias) { + for (i = 0; i < length; ++i) { + if (!scanners[i]->test(x * splashAASize, y * splashAASize)) { + return gFalse; + } + } + } else { + for (i = 0; i < length; ++i) { + if (!scanners[i]->test(x, y)) { + return gFalse; + } + } + } + + return gTrue; + } + + // Tests a rectangle against the clipping region. Returns one of: + // - splashClipAllInside if the entire rectangle is inside the + // clipping region, i.e., all pixels in the rectangle are + // visible + // - splashClipAllOutside if the entire rectangle is outside the + // clipping region, i.e., all the pixels in the rectangle are + // clipped + // - splashClipPartial if the rectangle is part inside and part + // outside the clipping region + SplashClipResult testRect(int rectXMin, int rectYMin, + int rectXMax, int rectYMax); + + // Similar to testRect, but tests a horizontal span. + SplashClipResult testSpan(int spanXMin, int spanXMax, int spanY); + + // Clips an anti-aliased line by setting pixels to zero. On entry, + // all non-zero pixels are between <x0> and <x1>. This function + // will update <x0> and <x1>. + void clipAALine(SplashBitmap *aaBuf, int *x0, int *x1, int y, + GBool adjustVertLine = gFalse); + + // 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; } + int getYMinI() { return yMinI; } + int getYMaxI() { return yMaxI; } + + // Get the number of arbitrary paths used by the clip region. + int getNumPaths() { return length; } + +protected: + + SplashClip(SplashClip *clip); + void grow(int nPaths); + + GBool antialias; + SplashCoord xMin, yMin, xMax, yMax; + int xMinI, yMinI, xMaxI, yMaxI; + SplashXPath **paths; + Guchar *flags; + SplashXPathScanner **scanners; + int length, size; +}; + +#endif diff --git a/Build/source/libs/poppler/poppler-0.25.0/splash/SplashErrorCodes.h b/Build/source/libs/poppler/poppler-0.25.0/splash/SplashErrorCodes.h new file mode 100644 index 00000000000..d1f81f85dd8 --- /dev/null +++ b/Build/source/libs/poppler/poppler-0.25.0/splash/SplashErrorCodes.h @@ -0,0 +1,50 @@ +//======================================================================== +// +// SplashErrorCodes.h +// +//======================================================================== + +//======================================================================== +// +// Modified under the Poppler project - http://poppler.freedesktop.org +// +// All changes made under the Poppler project to this file are licensed +// under GPL version 2 or later +// +// Copyright (C) 2006, 2009 Albert Astals Cid <aacid@kde.org> +// +// To see a description of the changes please see the Changelog file that +// came with your tarball or type make ChangeLog if you are building from git +// +//======================================================================== + +#ifndef SPLASHERRORCODES_H +#define SPLASHERRORCODES_H + +//------------------------------------------------------------------------ + +#define splashOk 0 // no error + +#define splashErrNoCurPt 1 // no current point + +#define splashErrEmptyPath 2 // zero points in path + +#define splashErrBogusPath 3 // only one point in subpath + +#define splashErrNoSave 4 // state stack is empty + +#define splashErrOpenFile 5 // couldn't open file + +#define splashErrNoGlyph 6 // couldn't get the requested glyph + +#define splashErrModeMismatch 7 // invalid combination of color modes + +#define splashErrSingularMatrix 8 // matrix is singular + +#define splashErrBadArg 9 // bad argument + +#define splashErrZeroImage 254 // image of 0x0 + +#define splashErrGeneric 255 + +#endif diff --git a/Build/source/libs/poppler/poppler-0.25.0/splash/SplashFTFont.cc b/Build/source/libs/poppler/poppler-0.25.0/splash/SplashFTFont.cc new file mode 100644 index 00000000000..2a2362520cb --- /dev/null +++ b/Build/source/libs/poppler/poppler-0.25.0/splash/SplashFTFont.cc @@ -0,0 +1,513 @@ +//======================================================================== +// +// SplashFTFont.cc +// +//======================================================================== + +//======================================================================== +// +// Modified under the Poppler project - http://poppler.freedesktop.org +// +// All changes made under the Poppler project to this file are licensed +// under GPL version 2 or later +// +// Copyright (C) 2005, 2007-2011 Albert Astals Cid <aacid@kde.org> +// Copyright (C) 2006 Kristian Høgsberg <krh@bitplanet.net> +// Copyright (C) 2009 Petr Gajdos <pgajdos@novell.com> +// Copyright (C) 2010 Suzuki Toshiya <mpsuzuki@hiroshima-u.ac.jp> +// Copyright (C) 2011 Andreas Hartmetz <ahartmetz@gmail.com> +// Copyright (C) 2012 Thomas Freitag <Thomas.Freitag@alfa.de> +// +// To see a description of the changes please see the Changelog file that +// came with your tarball or type make ChangeLog if you are building from git +// +//======================================================================== + +#include <config.h> + +#if HAVE_FREETYPE_FREETYPE_H || HAVE_FREETYPE_H + +#ifdef USE_GCC_PRAGMAS +#pragma implementation +#endif + +#include <ft2build.h> +#include FT_OUTLINE_H +#include FT_SIZES_H +#include FT_GLYPH_H +#include "goo/gmem.h" +#include "SplashMath.h" +#include "SplashGlyphBitmap.h" +#include "SplashPath.h" +#include "SplashFTFontEngine.h" +#include "SplashFTFontFile.h" +#include "SplashFTFont.h" + +//------------------------------------------------------------------------ + +static int glyphPathMoveTo(const FT_Vector *pt, void *path); +static int glyphPathLineTo(const FT_Vector *pt, void *path); +static int glyphPathConicTo(const FT_Vector *ctrl, const FT_Vector *pt, + void *path); +static int glyphPathCubicTo(const FT_Vector *ctrl1, const FT_Vector *ctrl2, + const FT_Vector *pt, void *path); + +//------------------------------------------------------------------------ +// SplashFTFont +//------------------------------------------------------------------------ + +SplashFTFont::SplashFTFont(SplashFTFontFile *fontFileA, SplashCoord *matA, + SplashCoord *textMatA): + SplashFont(fontFileA, matA, textMatA, fontFileA->engine->aa), + enableFreeTypeHinting(fontFileA->engine->enableFreeTypeHinting), + enableSlightHinting(fontFileA->engine->enableSlightHinting) +{ + FT_Face face; + int div; + int x, y; +#if USE_FIXEDPOINT + SplashCoord scale; +#endif + + face = fontFileA->face; + if (FT_New_Size(face, &sizeObj)) { + return; + } + face->size = sizeObj; + size = splashRound(splashDist(0, 0, mat[2], mat[3])); + if (size < 1) { + size = 1; + } + if (FT_Set_Pixel_Sizes(face, 0, size)) { + return; + } + // if the textMat values are too small, FreeType's fixed point + // arithmetic doesn't work so well + textScale = splashDist(0, 0, textMat[2], textMat[3]) / size; + + div = face->bbox.xMax > 20000 ? 65536 : 1; + +#if USE_FIXEDPOINT + scale = (SplashCoord)1 / (SplashCoord)face->units_per_EM; + + // transform the four corners of the font bounding box -- the min + // and max values form the bounding box of the transformed font + x = (int)(mat[0] * (scale * (face->bbox.xMin / div)) + + mat[2] * (scale * (face->bbox.yMin / div))); + xMin = xMax = x; + y = (int)(mat[1] * (scale * (face->bbox.xMin / div)) + + mat[3] * (scale * (face->bbox.yMin / div))); + yMin = yMax = y; + x = (int)(mat[0] * (scale * (face->bbox.xMin / div)) + + mat[2] * (scale * (face->bbox.yMax / div))); + if (x < xMin) { + xMin = x; + } else if (x > xMax) { + xMax = x; + } + y = (int)(mat[1] * (scale * (face->bbox.xMin / div)) + + mat[3] * (scale * (face->bbox.yMax / div))); + if (y < yMin) { + yMin = y; + } else if (y > yMax) { + yMax = y; + } + x = (int)(mat[0] * (scale * (face->bbox.xMax / div)) + + mat[2] * (scale * (face->bbox.yMin / div))); + if (x < xMin) { + xMin = x; + } else if (x > xMax) { + xMax = x; + } + y = (int)(mat[1] * (scale * (face->bbox.xMax / div)) + + mat[3] * (scale * (face->bbox.yMin / div))); + if (y < yMin) { + yMin = y; + } else if (y > yMax) { + yMax = y; + } + x = (int)(mat[0] * (scale * (face->bbox.xMax / div)) + + mat[2] * (scale * (face->bbox.yMax / div))); + if (x < xMin) { + xMin = x; + } else if (x > xMax) { + xMax = x; + } + y = (int)(mat[1] * (scale * (face->bbox.xMax / div)) + + mat[3] * (scale * (face->bbox.yMax / div))); + if (y < yMin) { + yMin = y; + } else if (y > yMax) { + yMax = y; + } +#else // USE_FIXEDPOINT + // transform the four corners of the font bounding box -- the min + // and max values form the bounding box of the transformed font + x = (int)((mat[0] * face->bbox.xMin + mat[2] * face->bbox.yMin) / + (div * face->units_per_EM)); + xMin = xMax = x; + y = (int)((mat[1] * face->bbox.xMin + mat[3] * face->bbox.yMin) / + (div * face->units_per_EM)); + yMin = yMax = y; + x = (int)((mat[0] * face->bbox.xMin + mat[2] * face->bbox.yMax) / + (div * face->units_per_EM)); + if (x < xMin) { + xMin = x; + } else if (x > xMax) { + xMax = x; + } + y = (int)((mat[1] * face->bbox.xMin + mat[3] * face->bbox.yMax) / + (div * face->units_per_EM)); + if (y < yMin) { + yMin = y; + } else if (y > yMax) { + yMax = y; + } + x = (int)((mat[0] * face->bbox.xMax + mat[2] * face->bbox.yMin) / + (div * face->units_per_EM)); + if (x < xMin) { + xMin = x; + } else if (x > xMax) { + xMax = x; + } + y = (int)((mat[1] * face->bbox.xMax + mat[3] * face->bbox.yMin) / + (div * face->units_per_EM)); + if (y < yMin) { + yMin = y; + } else if (y > yMax) { + yMax = y; + } + x = (int)((mat[0] * face->bbox.xMax + mat[2] * face->bbox.yMax) / + (div * face->units_per_EM)); + if (x < xMin) { + xMin = x; + } else if (x > xMax) { + xMax = x; + } + y = (int)((mat[1] * face->bbox.xMax + mat[3] * face->bbox.yMax) / + (div * face->units_per_EM)); + if (y < yMin) { + yMin = y; + } else if (y > yMax) { + yMax = y; + } +#endif // USE_FIXEDPOINT + // This is a kludge: some buggy PDF generators embed fonts with + // zero bounding boxes. + if (xMax == xMin) { + xMin = 0; + xMax = size; + } + if (yMax == yMin) { + yMin = 0; + yMax = (int)((SplashCoord)1.2 * size); + } + + // compute the transform matrix +#if USE_FIXEDPOINT + matrix.xx = (FT_Fixed)((mat[0] / size).get16Dot16()); + matrix.yx = (FT_Fixed)((mat[1] / size).get16Dot16()); + matrix.xy = (FT_Fixed)((mat[2] / size).get16Dot16()); + matrix.yy = (FT_Fixed)((mat[3] / size).get16Dot16()); + textMatrix.xx = (FT_Fixed)((textMat[0] / (textScale * size)).get16Dot16()); + textMatrix.yx = (FT_Fixed)((textMat[1] / (textScale * size)).get16Dot16()); + textMatrix.xy = (FT_Fixed)((textMat[2] / (textScale * size)).get16Dot16()); + textMatrix.yy = (FT_Fixed)((textMat[3] / (textScale * size)).get16Dot16()); +#else + matrix.xx = (FT_Fixed)((mat[0] / size) * 65536); + matrix.yx = (FT_Fixed)((mat[1] / size) * 65536); + matrix.xy = (FT_Fixed)((mat[2] / size) * 65536); + matrix.yy = (FT_Fixed)((mat[3] / size) * 65536); + textMatrix.xx = (FT_Fixed)((textMat[0] / (textScale * size)) * 65536); + textMatrix.yx = (FT_Fixed)((textMat[1] / (textScale * size)) * 65536); + textMatrix.xy = (FT_Fixed)((textMat[2] / (textScale * size)) * 65536); + textMatrix.yy = (FT_Fixed)((textMat[3] / (textScale * size)) * 65536); +#endif +} + +SplashFTFont::~SplashFTFont() { +} + +GBool SplashFTFont::getGlyph(int c, int xFrac, int yFrac, + SplashGlyphBitmap *bitmap, int x0, int y0, SplashClip *clip, SplashClipResult *clipRes) { + return SplashFont::getGlyph(c, xFrac, 0, bitmap, x0, y0, clip, clipRes); +} + +static FT_Int32 getFTLoadFlags(GBool type1, GBool trueType, GBool aa, GBool enableFreeTypeHinting, GBool enableSlightHinting) +{ + int ret = FT_LOAD_DEFAULT; + if (aa) + ret |= FT_LOAD_NO_BITMAP; + + if (enableFreeTypeHinting) { + if (enableSlightHinting) { + ret |= FT_LOAD_TARGET_LIGHT; + } else { + if (trueType) { + // 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 (aa) { + ret |= FT_LOAD_NO_AUTOHINT; + } + } else if (type1) { + // Type 1 fonts seem to look better with 'light' hinting mode + ret |= FT_LOAD_TARGET_LIGHT; + } + } + } else { + ret |= FT_LOAD_NO_HINTING; + } + return ret; +} + +GBool SplashFTFont::makeGlyph(int c, int xFrac, int yFrac, + SplashGlyphBitmap *bitmap, int x0, int y0, SplashClip *clip, SplashClipResult *clipRes) { + SplashFTFontFile *ff; + FT_Vector offset; + FT_GlyphSlot slot; + FT_UInt gid; + int rowSize; + Guchar *p, *q; + int i; + + ff = (SplashFTFontFile *)fontFile; + + ff->face->size = sizeObj; + offset.x = (FT_Pos)(int)((SplashCoord)xFrac * splashFontFractionMul * 64); + offset.y = 0; + FT_Set_Transform(ff->face, &matrix, &offset); + slot = ff->face->glyph; + + if (ff->codeToGID && c < ff->codeToGIDLen) { + gid = (FT_UInt)ff->codeToGID[c]; + } else { + gid = (FT_UInt)c; + } + + if (FT_Load_Glyph(ff->face, gid, getFTLoadFlags(ff->type1, ff->trueType, aa, enableFreeTypeHinting, enableSlightHinting))) { + return gFalse; + } + + // prelimirary values based on FT_Outline_Get_CBox + // we add two pixels to each side to be in the safe side + FT_BBox cbox; + FT_Outline_Get_CBox(&ff->face->glyph->outline, &cbox); + bitmap->x = -(cbox.xMin / 64) + 2; + bitmap->y = (cbox.yMax / 64) + 2; + bitmap->w = ((cbox.xMax - cbox.xMin) / 64) + 4; + bitmap->h = ((cbox.yMax - cbox.yMin) / 64) + 4; + + *clipRes = clip->testRect(x0 - bitmap->x, + y0 - bitmap->y, + x0 - bitmap->x + bitmap->w, + y0 - bitmap->y + bitmap->h); + if (*clipRes == splashClipAllOutside) { + bitmap->freeData = gFalse; + return gTrue; + } + + if (FT_Render_Glyph(slot, aa ? ft_render_mode_normal + : ft_render_mode_mono)) { + return gFalse; + } + + if (slot->bitmap.width == 0 || slot->bitmap.rows == 0) { + // this can happen if (a) the glyph is really tiny or (b) the + // metrics in the TrueType file are broken + return gFalse; + } + + bitmap->x = -slot->bitmap_left; + bitmap->y = slot->bitmap_top; + bitmap->w = slot->bitmap.width; + bitmap->h = slot->bitmap.rows; + bitmap->aa = aa; + if (aa) { + rowSize = bitmap->w; + } else { + rowSize = (bitmap->w + 7) >> 3; + } + bitmap->data = (Guchar *)gmallocn_checkoverflow(rowSize, bitmap->h); + if (!bitmap->data) { + return gFalse; + } + bitmap->freeData = gTrue; + for (i = 0, p = bitmap->data, q = slot->bitmap.buffer; + i < bitmap->h; + ++i, p += rowSize, q += slot->bitmap.pitch) { + memcpy(p, q, rowSize); + } + + 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; + + ff->face->size = sizeObj; + 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 (FT_Load_Glyph(ff->face, gid, getFTLoadFlags(ff->type1, ff->trueType, aa, enableFreeTypeHinting, enableSlightHinting))) { + return -1; + } + + // 64.0 is 1 in 26.6 format + return ff->face->glyph->metrics.horiAdvance / 64.0 / size; +} + +struct SplashFTFontPath { + SplashPath *path; + SplashCoord textScale; + GBool needClose; +}; + +SplashPath *SplashFTFont::getGlyphPath(int c) { + static FT_Outline_Funcs outlineFuncs = { +#if FREETYPE_MINOR <= 1 + (int (*)(FT_Vector *, void *))&glyphPathMoveTo, + (int (*)(FT_Vector *, void *))&glyphPathLineTo, + (int (*)(FT_Vector *, FT_Vector *, void *))&glyphPathConicTo, + (int (*)(FT_Vector *, FT_Vector *, FT_Vector *, void *))&glyphPathCubicTo, +#else + &glyphPathMoveTo, + &glyphPathLineTo, + &glyphPathConicTo, + &glyphPathCubicTo, +#endif + 0, 0 + }; + SplashFTFontFile *ff; + SplashFTFontPath path; + FT_GlyphSlot slot; + FT_UInt gid; + FT_Glyph glyph; + + ff = (SplashFTFontFile *)fontFile; + ff->face->size = sizeObj; + FT_Set_Transform(ff->face, &textMatrix, NULL); + slot = ff->face->glyph; + if (ff->codeToGID && c < ff->codeToGIDLen) { + gid = ff->codeToGID[c]; + } else { + gid = (FT_UInt)c; + } + if (FT_Load_Glyph(ff->face, gid, getFTLoadFlags(ff->type1, ff->trueType, aa, enableFreeTypeHinting, enableSlightHinting))) { + return NULL; + } + if (FT_Get_Glyph(slot, &glyph)) { + return NULL; + } + if (FT_Outline_Check(&((FT_OutlineGlyph)glyph)->outline)) { + return NULL; + } + path.path = new SplashPath(); + path.textScale = textScale; + path.needClose = gFalse; + FT_Outline_Decompose(&((FT_OutlineGlyph)glyph)->outline, + &outlineFuncs, &path); + if (path.needClose) { + path.path->close(); + } + FT_Done_Glyph(glyph); + return path.path; +} + +static int glyphPathMoveTo(const FT_Vector *pt, void *path) { + SplashFTFontPath *p = (SplashFTFontPath *)path; + + if (p->needClose) { + p->path->close(); + p->needClose = gFalse; + } + p->path->moveTo((SplashCoord)pt->x * p->textScale / 64.0, + (SplashCoord)pt->y * p->textScale / 64.0); + return 0; +} + +static int glyphPathLineTo(const FT_Vector *pt, void *path) { + SplashFTFontPath *p = (SplashFTFontPath *)path; + + p->path->lineTo((SplashCoord)pt->x * p->textScale / 64.0, + (SplashCoord)pt->y * p->textScale / 64.0); + p->needClose = gTrue; + return 0; +} + +static int glyphPathConicTo(const FT_Vector *ctrl, const FT_Vector *pt, + void *path) { + SplashFTFontPath *p = (SplashFTFontPath *)path; + SplashCoord x0, y0, x1, y1, x2, y2, x3, y3, xc, yc; + + if (!p->path->getCurPt(&x0, &y0)) { + return 0; + } + xc = (SplashCoord)ctrl->x * p->textScale / 64.0; + yc = (SplashCoord)ctrl->y * p->textScale / 64.0; + x3 = (SplashCoord)pt->x * p->textScale / 64.0; + y3 = (SplashCoord)pt->y * p->textScale / 64.0; + + // A second-order Bezier curve is defined by two endpoints, p0 and + // p3, and one control point, pc: + // + // p(t) = (1-t)^2*p0 + t*(1-t)*pc + t^2*p3 + // + // A third-order Bezier curve is defined by the same two endpoints, + // p0 and p3, and two control points, p1 and p2: + // + // p(t) = (1-t)^3*p0 + 3t*(1-t)^2*p1 + 3t^2*(1-t)*p2 + t^3*p3 + // + // Applying some algebra, we can convert a second-order curve to a + // third-order curve: + // + // p1 = (1/3) * (p0 + 2pc) + // p2 = (1/3) * (2pc + p3) + + x1 = (SplashCoord)(1.0 / 3.0) * (x0 + (SplashCoord)2 * xc); + y1 = (SplashCoord)(1.0 / 3.0) * (y0 + (SplashCoord)2 * yc); + x2 = (SplashCoord)(1.0 / 3.0) * ((SplashCoord)2 * xc + x3); + y2 = (SplashCoord)(1.0 / 3.0) * ((SplashCoord)2 * yc + y3); + + p->path->curveTo(x1, y1, x2, y2, x3, y3); + p->needClose = gTrue; + return 0; +} + +static int glyphPathCubicTo(const FT_Vector *ctrl1, const FT_Vector *ctrl2, + const FT_Vector *pt, void *path) { + SplashFTFontPath *p = (SplashFTFontPath *)path; + + p->path->curveTo((SplashCoord)ctrl1->x * p->textScale / 64.0, + (SplashCoord)ctrl1->y * p->textScale / 64.0, + (SplashCoord)ctrl2->x * p->textScale / 64.0, + (SplashCoord)ctrl2->y * p->textScale / 64.0, + (SplashCoord)pt->x * p->textScale / 64.0, + (SplashCoord)pt->y * p->textScale / 64.0); + p->needClose = gTrue; + return 0; +} + +#endif // HAVE_FREETYPE_FREETYPE_H || HAVE_FREETYPE_H diff --git a/Build/source/libs/poppler/poppler-0.25.0/splash/SplashFTFont.h b/Build/source/libs/poppler/poppler-0.25.0/splash/SplashFTFont.h new file mode 100644 index 00000000000..98cb29dfbba --- /dev/null +++ b/Build/source/libs/poppler/poppler-0.25.0/splash/SplashFTFont.h @@ -0,0 +1,80 @@ +//======================================================================== +// +// SplashFTFont.h +// +//======================================================================== + +//======================================================================== +// +// Modified under the Poppler project - http://poppler.freedesktop.org +// +// All changes made under the Poppler project to this file are licensed +// under GPL version 2 or later +// +// Copyright (C) 2007-2009, 2011 Albert Astals Cid <aacid@kde.org> +// Copyright (C) 2009 Petr Gajdos <pgajdos@novell.com> +// Copyright (C) 2011 Andreas Hartmetz <ahartmetz@gmail.com> +// +// To see a description of the changes please see the Changelog file that +// came with your tarball or type make ChangeLog if you are building from git +// +//======================================================================== + +#ifndef SPLASHFTFONT_H +#define SPLASHFTFONT_H + +#include "poppler-config.h" + +#if HAVE_FREETYPE_FREETYPE_H || HAVE_FREETYPE_H + +#ifdef USE_GCC_PRAGMAS +#pragma interface +#endif + +#include <ft2build.h> +#include FT_FREETYPE_H +#include "SplashFont.h" + +class SplashFTFontFile; + +//------------------------------------------------------------------------ +// SplashFTFont +//------------------------------------------------------------------------ + +class SplashFTFont: public SplashFont { +public: + + SplashFTFont(SplashFTFontFile *fontFileA, SplashCoord *matA, + SplashCoord *textMatA); + + virtual ~SplashFTFont(); + + // Munge xFrac and yFrac before calling SplashFont::getGlyph. + virtual GBool getGlyph(int c, int xFrac, int yFrac, + SplashGlyphBitmap *bitmap, int x0, int y0, SplashClip *clip, SplashClipResult *clipRes); + + // Rasterize a glyph. The <xFrac> and <yFrac> values are the same + // as described for getGlyph. + virtual GBool makeGlyph(int c, int xFrac, int yFrac, + SplashGlyphBitmap *bitmap, int x0, int y0, SplashClip *clip, SplashClipResult *clipRes); + + // 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; + int size; + GBool enableFreeTypeHinting; + GBool enableSlightHinting; +}; + +#endif // HAVE_FREETYPE_FREETYPE_H || HAVE_FREETYPE_H + +#endif diff --git a/Build/source/libs/poppler/poppler-0.25.0/splash/SplashFTFontEngine.cc b/Build/source/libs/poppler/poppler-0.25.0/splash/SplashFTFontEngine.cc new file mode 100644 index 00000000000..9fef8f007d1 --- /dev/null +++ b/Build/source/libs/poppler/poppler-0.25.0/splash/SplashFTFontEngine.cc @@ -0,0 +1,180 @@ +//======================================================================== +// +// SplashFTFontEngine.cc +// +//======================================================================== + +//======================================================================== +// +// Modified under the Poppler project - http://poppler.freedesktop.org +// +// All changes made under the Poppler project to this file are licensed +// under GPL version 2 or later +// +// Copyright (C) 2006 Takashi Iwai <tiwai@suse.de> +// Copyright (C) 2009, 2011, 2012 Albert Astals Cid <aacid@kde.org> +// Copyright (C) 2009 Petr Gajdos <pgajdos@novell.com> +// Copyright (C) 2011 Andreas Hartmetz <ahartmetz@gmail.com> +// +// To see a description of the changes please see the Changelog file that +// came with your tarball or type make ChangeLog if you are building from git +// +//======================================================================== + +#include <config.h> + +#if HAVE_FREETYPE_FREETYPE_H || HAVE_FREETYPE_H + +#ifdef USE_GCC_PRAGMAS +#pragma implementation +#endif + +#include <stdio.h> +#ifdef HAVE_UNISTD_H +#include <unistd.h> +#endif +#include "goo/gmem.h" +#include "goo/GooString.h" +#include "goo/gfile.h" +#include "fofi/FoFiTrueType.h" +#include "fofi/FoFiType1C.h" +#include "SplashFTFontFile.h" +#include "SplashFTFontEngine.h" + +#ifdef VMS +#if (__VMS_VER < 70000000) +extern "C" int unlink(char *filename); +#endif +#endif + +//------------------------------------------------------------------------ +// SplashFTFontEngine +//------------------------------------------------------------------------ + +SplashFTFontEngine::SplashFTFontEngine(GBool aaA, GBool enableFreeTypeHintingA, + GBool enableSlightHintingA, FT_Library libA) { + FT_Int major, minor, patch; + + aa = aaA; + enableFreeTypeHinting = enableFreeTypeHintingA; + enableSlightHinting = enableSlightHintingA; + lib = libA; + + // as of FT 2.1.8, CID fonts are indexed by CID instead of GID + FT_Library_Version(lib, &major, &minor, &patch); + useCIDs = major > 2 || + (major == 2 && (minor > 1 || (minor == 1 && patch > 7))); +} + +SplashFTFontEngine *SplashFTFontEngine::init(GBool aaA, GBool enableFreeTypeHintingA, + GBool enableSlightHintingA) { + FT_Library libA; + + if (FT_Init_FreeType(&libA)) { + return NULL; + } + return new SplashFTFontEngine(aaA, enableFreeTypeHintingA, enableSlightHintingA, libA); +} + +SplashFTFontEngine::~SplashFTFontEngine() { + FT_Done_FreeType(lib); +} + +SplashFontFile *SplashFTFontEngine::loadType1Font(SplashFontFileID *idA, + SplashFontSrc *src, + const char **enc) { + return SplashFTFontFile::loadType1Font(this, idA, src, enc); +} + +SplashFontFile *SplashFTFontEngine::loadType1CFont(SplashFontFileID *idA, + SplashFontSrc *src, + const char **enc) { + return SplashFTFontFile::loadType1Font(this, idA, src, enc); +} + +SplashFontFile *SplashFTFontEngine::loadOpenTypeT1CFont(SplashFontFileID *idA, + SplashFontSrc *src, + const char **enc) { + return SplashFTFontFile::loadType1Font(this, idA, src, enc); +} + +SplashFontFile *SplashFTFontEngine::loadCIDFont(SplashFontFileID *idA, + SplashFontSrc *src) { + FoFiType1C *ff; + int *cidToGIDMap; + int nCIDs; + SplashFontFile *ret; + + // check for a CFF font + if (useCIDs) { + cidToGIDMap = NULL; + nCIDs = 0; + } else { + if (src->isFile) { + ff = FoFiType1C::load(src->fileName->getCString()); + } else { + ff = FoFiType1C::make(src->buf, src->bufLen); + } + if (ff) { + cidToGIDMap = ff->getCIDToGIDMap(&nCIDs); + delete ff; + } else { + cidToGIDMap = NULL; + nCIDs = 0; + } + } + ret = SplashFTFontFile::loadCIDFont(this, idA, src, cidToGIDMap, nCIDs); + if (!ret) { + gfree(cidToGIDMap); + } + return ret; +} + +SplashFontFile *SplashFTFontEngine::loadOpenTypeCFFFont(SplashFontFileID *idA, + SplashFontSrc *src, + int *codeToGID, + int codeToGIDLen) { + FoFiTrueType *ff; + int *cidToGIDMap; + int nCIDs; + SplashFontFile *ret; + + cidToGIDMap = NULL; + nCIDs = 0; + if (!codeToGID) { + if (!useCIDs) { + if (src->isFile) { + ff = FoFiTrueType::load(src->fileName->getCString()); + } else { + ff = FoFiTrueType::make(src->buf, src->bufLen); + } + if (ff) { + if (ff->isOpenTypeCFF()) { + cidToGIDMap = ff->getCIDToGIDMap(&nCIDs); + } + delete ff; + } + } + } + ret = SplashFTFontFile::loadCIDFont(this, idA, src, + codeToGID ? codeToGID : cidToGIDMap, + codeToGID ? codeToGIDLen : nCIDs); + if (!ret) { + gfree(cidToGIDMap); + } + return ret; +} + +SplashFontFile *SplashFTFontEngine::loadTrueTypeFont(SplashFontFileID *idA, + SplashFontSrc *src, + int *codeToGID, + int codeToGIDLen, + int faceIndex) { + SplashFontFile *ret; + ret = SplashFTFontFile::loadTrueTypeFont(this, idA, src, + codeToGID, codeToGIDLen, + faceIndex); + return ret; +} + +#endif // HAVE_FREETYPE_FREETYPE_H || HAVE_FREETYPE_H diff --git a/Build/source/libs/poppler/poppler-0.25.0/splash/SplashFTFontEngine.h b/Build/source/libs/poppler/poppler-0.25.0/splash/SplashFTFontEngine.h new file mode 100644 index 00000000000..11bbea74a80 --- /dev/null +++ b/Build/source/libs/poppler/poppler-0.25.0/splash/SplashFTFontEngine.h @@ -0,0 +1,81 @@ +//======================================================================== +// +// SplashFTFontEngine.h +// +//======================================================================== + +//======================================================================== +// +// Modified under the Poppler project - http://poppler.freedesktop.org +// +// All changes made under the Poppler project to this file are licensed +// under GPL version 2 or later +// +// Copyright (C) 2006 Takashi Iwai <tiwai@suse.de> +// Copyright (C) 2009 Petr Gajdos <pgajdos@novell.com> +// Copyright (C) 2009 Albert Astals Cid <aacid@kde.org> +// Copyright (C) 2011 Andreas Hartmetz <ahartmetz@gmail.com> +// Copyright (C) 2013 Thomas Freitag <Thomas.Freitag@alfa.de> +// +// To see a description of the changes please see the Changelog file that +// came with your tarball or type make ChangeLog if you are building from git +// +//======================================================================== + +#ifndef SPLASHFTFONTENGINE_H +#define SPLASHFTFONTENGINE_H + +#if HAVE_FREETYPE_FREETYPE_H || HAVE_FREETYPE_H + +#ifdef USE_GCC_PRAGMAS +#pragma interface +#endif + +#include <ft2build.h> +#include FT_FREETYPE_H +#include "goo/gtypes.h" + +class SplashFontFile; +class SplashFontFileID; +class SplashFontSrc; + +//------------------------------------------------------------------------ +// SplashFTFontEngine +//------------------------------------------------------------------------ + +class SplashFTFontEngine { +public: + + static SplashFTFontEngine *init(GBool aaA, GBool enableFreeTypeHintingA, GBool enableSlightHinting); + + ~SplashFTFontEngine(); + + // Load fonts. + SplashFontFile *loadType1Font(SplashFontFileID *idA, SplashFontSrc *src, const char **enc); + SplashFontFile *loadType1CFont(SplashFontFileID *idA, SplashFontSrc *src, const char **enc); + SplashFontFile *loadOpenTypeT1CFont(SplashFontFileID *idA, SplashFontSrc *src, const char **enc); + SplashFontFile *loadCIDFont(SplashFontFileID *idA, SplashFontSrc *src); + SplashFontFile *loadOpenTypeCFFFont(SplashFontFileID *idA, SplashFontSrc *src, + int *codeToGID, int codeToGIDLen); + SplashFontFile *loadTrueTypeFont(SplashFontFileID *idA, SplashFontSrc *src, + int *codeToGID, int codeToGIDLen, int faceIndex = 0); + GBool getAA() { return aa; } + void setAA(GBool aaA) { aa = aaA; } + +private: + + SplashFTFontEngine(GBool aaA, GBool enableFreeTypeHintingA, GBool enableSlightHintingA, FT_Library libA); + + GBool aa; + GBool enableFreeTypeHinting; + GBool enableSlightHinting; + FT_Library lib; + GBool useCIDs; + + friend class SplashFTFontFile; + friend class SplashFTFont; +}; + +#endif // HAVE_FREETYPE_FREETYPE_H || HAVE_FREETYPE_H + +#endif diff --git a/Build/source/libs/poppler/poppler-0.25.0/splash/SplashFTFontFile.cc b/Build/source/libs/poppler/poppler-0.25.0/splash/SplashFTFontFile.cc new file mode 100644 index 00000000000..34f6ce5c6b4 --- /dev/null +++ b/Build/source/libs/poppler/poppler-0.25.0/splash/SplashFTFontFile.cc @@ -0,0 +1,140 @@ +//======================================================================== +// +// SplashFTFontFile.cc +// +//======================================================================== + +//======================================================================== +// +// Modified under the Poppler project - http://poppler.freedesktop.org +// +// All changes made under the Poppler project to this file are licensed +// under GPL version 2 or later +// +// Copyright (C) 2006 Takashi Iwai <tiwai@suse.de> +// +// To see a description of the changes please see the Changelog file that +// came with your tarball or type make ChangeLog if you are building from git +// +//======================================================================== + +#include <config.h> + +#if HAVE_FREETYPE_FREETYPE_H || HAVE_FREETYPE_H + +#ifdef USE_GCC_PRAGMAS +#pragma implementation +#endif + +#include "goo/gmem.h" +#include "goo/GooString.h" +#include "SplashFTFontEngine.h" +#include "SplashFTFont.h" +#include "SplashFTFontFile.h" + +//------------------------------------------------------------------------ +// SplashFTFontFile +//------------------------------------------------------------------------ + +SplashFontFile *SplashFTFontFile::loadType1Font(SplashFTFontEngine *engineA, + SplashFontFileID *idA, + SplashFontSrc *src, + const char **encA) { + FT_Face faceA; + int *codeToGIDA; + const char *name; + int i; + + if (src->isFile) { + if (FT_New_Face(engineA->lib, src->fileName->getCString(), 0, &faceA)) + return NULL; + } else { + if (FT_New_Memory_Face(engineA->lib, (const FT_Byte *)src->buf, src->bufLen, 0, &faceA)) + return NULL; + } + codeToGIDA = (int *)gmallocn(256, sizeof(int)); + for (i = 0; i < 256; ++i) { + codeToGIDA[i] = 0; + if ((name = encA[i])) { + codeToGIDA[i] = (int)FT_Get_Name_Index(faceA, (char *)name); + } + } + + return new SplashFTFontFile(engineA, idA, src, + faceA, codeToGIDA, 256, gFalse, gTrue); +} + +SplashFontFile *SplashFTFontFile::loadCIDFont(SplashFTFontEngine *engineA, + SplashFontFileID *idA, + SplashFontSrc *src, + int *codeToGIDA, + int codeToGIDLenA) { + FT_Face faceA; + + if (src->isFile) { + if (FT_New_Face(engineA->lib, src->fileName->getCString(), 0, &faceA)) + return NULL; + } else { + if (FT_New_Memory_Face(engineA->lib, (const FT_Byte *)src->buf, src->bufLen, 0, &faceA)) + return NULL; + } + + return new SplashFTFontFile(engineA, idA, src, + faceA, codeToGIDA, codeToGIDLenA, gFalse, gFalse); +} + +SplashFontFile *SplashFTFontFile::loadTrueTypeFont(SplashFTFontEngine *engineA, + SplashFontFileID *idA, + SplashFontSrc *src, + int *codeToGIDA, + int codeToGIDLenA, + int faceIndexA) { + FT_Face faceA; + + if (src->isFile) { + if (FT_New_Face(engineA->lib, src->fileName->getCString(), faceIndexA, &faceA)) + return NULL; + } else { + if (FT_New_Memory_Face(engineA->lib, (const FT_Byte *)src->buf, src->bufLen, faceIndexA, &faceA)) + return NULL; + } + + return new SplashFTFontFile(engineA, idA, src, + faceA, codeToGIDA, codeToGIDLenA, gTrue, gFalse); +} + +SplashFTFontFile::SplashFTFontFile(SplashFTFontEngine *engineA, + SplashFontFileID *idA, + SplashFontSrc *src, + FT_Face faceA, + int *codeToGIDA, int codeToGIDLenA, + GBool trueTypeA, GBool type1A): + SplashFontFile(idA, src) +{ + engine = engineA; + face = faceA; + codeToGID = codeToGIDA; + codeToGIDLen = codeToGIDLenA; + trueType = trueTypeA; + type1 = type1A; +} + +SplashFTFontFile::~SplashFTFontFile() { + if (face) { + FT_Done_Face(face); + } + if (codeToGID) { + gfree(codeToGID); + } +} + +SplashFont *SplashFTFontFile::makeFont(SplashCoord *mat, + SplashCoord *textMat) { + SplashFont *font; + + font = new SplashFTFont(this, mat, textMat); + font->initCache(); + return font; +} + +#endif // HAVE_FREETYPE_FREETYPE_H || HAVE_FREETYPE_H diff --git a/Build/source/libs/poppler/poppler-0.25.0/splash/SplashFTFontFile.h b/Build/source/libs/poppler/poppler-0.25.0/splash/SplashFTFontFile.h new file mode 100644 index 00000000000..d642af0a0ab --- /dev/null +++ b/Build/source/libs/poppler/poppler-0.25.0/splash/SplashFTFontFile.h @@ -0,0 +1,86 @@ +//======================================================================== +// +// SplashFTFontFile.h +// +//======================================================================== + +//======================================================================== +// +// Modified under the Poppler project - http://poppler.freedesktop.org +// +// All changes made under the Poppler project to this file are licensed +// under GPL version 2 or later +// +// Copyright (C) 2006 Takashi Iwai <tiwai@suse.de> +// +// To see a description of the changes please see the Changelog file that +// came with your tarball or type make ChangeLog if you are building from git +// +//======================================================================== + +#ifndef SPLASHFTFONTFILE_H +#define SPLASHFTFONTFILE_H + +#if HAVE_FREETYPE_FREETYPE_H || HAVE_FREETYPE_H + +#ifdef USE_GCC_PRAGMAS +#pragma interface +#endif + +#include <ft2build.h> +#include FT_FREETYPE_H +#include "SplashFontFile.h" + +class SplashFontFileID; +class SplashFTFontEngine; + +//------------------------------------------------------------------------ +// SplashFTFontFile +//------------------------------------------------------------------------ + +class SplashFTFontFile: public SplashFontFile { +public: + + static SplashFontFile *loadType1Font(SplashFTFontEngine *engineA, + SplashFontFileID *idA, + SplashFontSrc *src, const char **encA); + static SplashFontFile *loadCIDFont(SplashFTFontEngine *engineA, + SplashFontFileID *idA, + SplashFontSrc *src, + int *codeToCIDA, int codeToGIDLenA); + static SplashFontFile *loadTrueTypeFont(SplashFTFontEngine *engineA, + SplashFontFileID *idA, + SplashFontSrc *src, + int *codeToGIDA, + int codeToGIDLenA, + int faceIndexA=0); + + virtual ~SplashFTFontFile(); + + // Create a new SplashFTFont, i.e., a scaled instance of this font + // file. + virtual SplashFont *makeFont(SplashCoord *mat, + SplashCoord *textMat); + +private: + + SplashFTFontFile(SplashFTFontEngine *engineA, + SplashFontFileID *idA, + SplashFontSrc *src, + FT_Face faceA, + int *codeToGIDA, int codeToGIDLenA, + GBool trueTypeA, GBool type1A); + + SplashFTFontEngine *engine; + FT_Face face; + int *codeToGID; + int codeToGIDLen; + GBool trueType; + GBool type1; + + friend class SplashFTFont; +}; + +#endif // HAVE_FREETYPE_FREETYPE_H || HAVE_FREETYPE_H + +#endif diff --git a/Build/source/libs/poppler/poppler-0.25.0/splash/SplashFont.cc b/Build/source/libs/poppler/poppler-0.25.0/splash/SplashFont.cc new file mode 100644 index 00000000000..2bfcdc8719e --- /dev/null +++ b/Build/source/libs/poppler/poppler-0.25.0/splash/SplashFont.cc @@ -0,0 +1,219 @@ +//======================================================================== +// +// SplashFont.cc +// +//======================================================================== + +//======================================================================== +// +// Modified under the Poppler project - http://poppler.freedesktop.org +// +// All changes made under the Poppler project to this file are licensed +// under GPL version 2 or later +// +// Copyright (C) 2007-2008, 2010 Albert Astals Cid <aacid@kde.org> +// +// To see a description of the changes please see the Changelog file that +// came with your tarball or type make ChangeLog if you are building from git +// +//======================================================================== + +#include <config.h> + +#ifdef USE_GCC_PRAGMAS +#pragma implementation +#endif + +#include <string.h> +#include "goo/gmem.h" +#include "SplashMath.h" +#include "SplashGlyphBitmap.h" +#include "SplashFontFile.h" +#include "SplashFont.h" + +//------------------------------------------------------------------------ + +struct SplashFontCacheTag { + int c; + short xFrac, yFrac; // x and y fractions + int mru; // valid bit (0x80000000) and MRU index + int x, y, w, h; // offset and size of glyph +}; + +//------------------------------------------------------------------------ +// SplashFont +//------------------------------------------------------------------------ + +SplashFont::SplashFont(SplashFontFile *fontFileA, SplashCoord *matA, + SplashCoord *textMatA, GBool aaA) { + fontFile = fontFileA; + fontFile->incRefCnt(); + mat[0] = matA[0]; + mat[1] = matA[1]; + mat[2] = matA[2]; + mat[3] = matA[3]; + textMat[0] = textMatA[0]; + textMat[1] = textMatA[1]; + textMat[2] = textMatA[2]; + textMat[3] = textMatA[3]; + aa = aaA; + + cache = NULL; + cacheTags = NULL; + + xMin = yMin = xMax = yMax = 0; +} + +void SplashFont::initCache() { + int i; + + // this should be (max - min + 1), but we add some padding to + // deal with rounding errors + glyphW = xMax - xMin + 3; + glyphH = yMax - yMin + 3; + if (aa) { + glyphSize = glyphW * glyphH; + } else { + glyphSize = ((glyphW + 7) >> 3) * glyphH; + } + + // set up the glyph pixmap cache + cacheAssoc = 8; + if (glyphSize <= 64) { + cacheSets = 32; + } else if (glyphSize <= 128) { + cacheSets = 16; + } else if (glyphSize <= 256) { + cacheSets = 8; + } else if (glyphSize <= 512) { + cacheSets = 4; + } else if (glyphSize <= 1024) { + cacheSets = 2; + } else { + cacheSets = 1; + } + cache = (Guchar *)gmallocn_checkoverflow(cacheSets* cacheAssoc, glyphSize); + if (cache != NULL) { + cacheTags = (SplashFontCacheTag *)gmallocn(cacheSets * cacheAssoc, + sizeof(SplashFontCacheTag)); + for (i = 0; i < cacheSets * cacheAssoc; ++i) { + cacheTags[i].mru = i & (cacheAssoc - 1); + } + } else { + cacheAssoc = 0; + } +} + +SplashFont::~SplashFont() { + fontFile->decRefCnt(); + if (cache) { + gfree(cache); + } + if (cacheTags) { + gfree(cacheTags); + } +} + +GBool SplashFont::getGlyph(int c, int xFrac, int yFrac, + SplashGlyphBitmap *bitmap, int x0, int y0, SplashClip *clip, SplashClipResult *clipRes) { + SplashGlyphBitmap bitmap2; + int size; + Guchar *p; + int i, j, k; + + // no fractional coordinates for large glyphs or non-anti-aliased + // glyphs + if (!aa || glyphH > 50) { + xFrac = yFrac = 0; + } + + // check the cache + i = (c & (cacheSets - 1)) * cacheAssoc; + for (j = 0; j < cacheAssoc; ++j) { + if ((cacheTags[i+j].mru & 0x80000000) && + cacheTags[i+j].c == c && + (int)cacheTags[i+j].xFrac == xFrac && + (int)cacheTags[i+j].yFrac == yFrac) { + bitmap->x = cacheTags[i+j].x; + bitmap->y = cacheTags[i+j].y; + bitmap->w = cacheTags[i+j].w; + bitmap->h = cacheTags[i+j].h; + for (k = 0; k < cacheAssoc; ++k) { + if (k != j && + (cacheTags[i+k].mru & 0x7fffffff) < + (cacheTags[i+j].mru & 0x7fffffff)) { + ++cacheTags[i+k].mru; + } + } + cacheTags[i+j].mru = 0x80000000; + bitmap->aa = aa; + bitmap->data = cache + (i+j) * glyphSize; + bitmap->freeData = gFalse; + + *clipRes = clip->testRect(x0 - bitmap->x, + y0 - bitmap->y, + x0 - bitmap->x + bitmap->w - 1, + y0 - bitmap->y + bitmap->h - 1); + + return gTrue; + } + } + + // generate the glyph bitmap + if (!makeGlyph(c, xFrac, yFrac, &bitmap2, x0, y0, clip, clipRes)) { + return gFalse; + } + + if (*clipRes == splashClipAllOutside) + { + bitmap->freeData = gFalse; + if (bitmap2.freeData) gfree(bitmap2.data); + return gTrue; + } + + // if the glyph doesn't fit in the bounding box, return a temporary + // uncached bitmap + if (bitmap2.w > glyphW || bitmap2.h > glyphH) { + *bitmap = bitmap2; + return gTrue; + } + + // insert glyph pixmap in cache + if (aa) { + size = bitmap2.w * bitmap2.h; + } else { + size = ((bitmap2.w + 7) >> 3) * bitmap2.h; + } + p = NULL; // make gcc happy + if (cacheAssoc == 0) + { + // we had problems on the malloc of the cache, so ignore it + *bitmap = bitmap2; + } + else + { + for (j = 0; j < cacheAssoc; ++j) { + if ((cacheTags[i+j].mru & 0x7fffffff) == cacheAssoc - 1) { + cacheTags[i+j].mru = 0x80000000; + cacheTags[i+j].c = c; + cacheTags[i+j].xFrac = (short)xFrac; + cacheTags[i+j].yFrac = (short)yFrac; + cacheTags[i+j].x = bitmap2.x; + cacheTags[i+j].y = bitmap2.y; + cacheTags[i+j].w = bitmap2.w; + cacheTags[i+j].h = bitmap2.h; + p = cache + (i+j) * glyphSize; + memcpy(p, bitmap2.data, size); + } else { + ++cacheTags[i+j].mru; + } + } + *bitmap = bitmap2; + bitmap->data = p; + bitmap->freeData = gFalse; + if (bitmap2.freeData) { + gfree(bitmap2.data); + } + } + return gTrue; +} diff --git a/Build/source/libs/poppler/poppler-0.25.0/splash/SplashFont.h b/Build/source/libs/poppler/poppler-0.25.0/splash/SplashFont.h new file mode 100644 index 00000000000..78b00d2dcaf --- /dev/null +++ b/Build/source/libs/poppler/poppler-0.25.0/splash/SplashFont.h @@ -0,0 +1,121 @@ +//======================================================================== +// +// SplashFont.h +// +//======================================================================== + +//======================================================================== +// +// Modified under the Poppler project - http://poppler.freedesktop.org +// +// All changes made under the Poppler project to this file are licensed +// under GPL version 2 or later +// +// Copyright (C) 2007-2008 Albert Astals Cid <aacid@kde.org> +// +// To see a description of the changes please see the Changelog file that +// came with your tarball or type make ChangeLog if you are building from git +// +//======================================================================== + +#ifndef SPLASHFONT_H +#define SPLASHFONT_H + +#ifdef USE_GCC_PRAGMAS +#pragma interface +#endif + +#include "goo/gtypes.h" +#include "SplashTypes.h" +#include "SplashClip.h" + +struct SplashGlyphBitmap; +struct SplashFontCacheTag; +class SplashFontFile; +class SplashPath; + +//------------------------------------------------------------------------ + +// Fractional positioning uses this many bits to the right of the +// decimal points. +#define splashFontFractionBits 2 +#define splashFontFraction (1 << splashFontFractionBits) +#define splashFontFractionMul \ + ((SplashCoord)1 / (SplashCoord)splashFontFraction) + +//------------------------------------------------------------------------ +// SplashFont +//------------------------------------------------------------------------ + +class SplashFont { +public: + + SplashFont(SplashFontFile *fontFileA, SplashCoord *matA, + SplashCoord *textMatA, GBool aaA); + + // This must be called after the constructor, so that the subclass + // constructor has a chance to compute the bbox. + void initCache(); + + virtual ~SplashFont(); + + SplashFontFile *getFontFile() { return fontFile; } + + // Return true if <this> matches the specified font file and matrix. + GBool matches(SplashFontFile *fontFileA, SplashCoord *matA, + SplashCoord *textMatA) { + return fontFileA == fontFile && + matA[0] == mat[0] && matA[1] == mat[1] && + matA[2] == mat[2] && matA[3] == mat[3] && + textMatA[0] == textMat[0] && textMatA[1] == textMat[1] && + textMatA[2] == textMat[2] && textMatA[3] == textMat[3]; + } + + // Get a glyph - this does a cache lookup first, and if not found, + // creates a new bitmap and adds it to the cache. The <xFrac> and + // <yFrac> values are splashFontFractionBits bits each, representing + // the numerators of fractions in [0, 1), where the denominator is + // splashFontFraction = 1 << splashFontFractionBits. Subclasses + // should override this to zero out xFrac and/or yFrac if they don't + // support fractional coordinates. + virtual GBool getGlyph(int c, int xFrac, int yFrac, + SplashGlyphBitmap *bitmap, int x0, int y0, SplashClip *clip, SplashClipResult *clipRes); + + // Rasterize a glyph. The <xFrac> and <yFrac> values are the same + // as described for getGlyph. + virtual GBool makeGlyph(int c, int xFrac, int yFrac, + SplashGlyphBitmap *bitmap, int x0, int y0, SplashClip *clip, SplashClipResult *clipRes) = 0; + + // Return the path for a glyph. + virtual SplashPath *getGlyphPath(int c) = 0; + + // Return the advance of a glyph. (in 0..1 range) + // < 0 means not known + virtual double getGlyphAdvance(int c) { return -1; } + + // Return the font transform matrix. + SplashCoord *getMatrix() { return mat; } + + // Return the glyph bounding box. + void getBBox(int *xMinA, int *yMinA, int *xMaxA, int *yMaxA) + { *xMinA = xMin; *yMinA = yMin; *xMaxA = xMax; *yMaxA = yMax; } + +protected: + + SplashFontFile *fontFile; + SplashCoord mat[4]; // font transform matrix + // (text space -> device space) + SplashCoord textMat[4]; // text transform matrix + // (text space -> user space) + GBool aa; // anti-aliasing + int xMin, yMin, xMax, yMax; // glyph bounding box + Guchar *cache; // glyph bitmap cache + SplashFontCacheTag * // cache tags + cacheTags; + int glyphW, glyphH; // size of glyph bitmaps + int glyphSize; // size of glyph bitmaps, in bytes + int cacheSets; // number of sets in cache + int cacheAssoc; // cache associativity (glyphs per set) +}; + +#endif diff --git a/Build/source/libs/poppler/poppler-0.25.0/splash/SplashFontEngine.cc b/Build/source/libs/poppler/poppler-0.25.0/splash/SplashFontEngine.cc new file mode 100644 index 00000000000..968e8207362 --- /dev/null +++ b/Build/source/libs/poppler/poppler-0.25.0/splash/SplashFontEngine.cc @@ -0,0 +1,344 @@ +//======================================================================== +// +// SplashFontEngine.cc +// +//======================================================================== + +//======================================================================== +// +// Modified under the Poppler project - http://poppler.freedesktop.org +// +// All changes made under the Poppler project to this file are licensed +// under GPL version 2 or later +// +// Copyright (C) 2006 Takashi Iwai <tiwai@suse.de> +// Copyright (C) 2009 Petr Gajdos <pgajdos@novell.com> +// Copyright (C) 2009 Kovid Goyal <kovid@kovidgoyal.net> +// Copyright (C) 2009 Albert Astals Cid <aacid@kde.org> +// Copyright (C) 2011 Andreas Hartmetz <ahartmetz@gmail.com> +// Copyright (C) 2013 Thomas Freitag <Thomas.Freitag@alfa.de> +// +// To see a description of the changes please see the Changelog file that +// came with your tarball or type make ChangeLog if you are building from git +// +//======================================================================== + +#include <config.h> + +#ifdef USE_GCC_PRAGMAS +#pragma implementation +#endif + +#if HAVE_T1LIB_H +#include <t1lib.h> +#endif + +#include <stdlib.h> +#include <stdio.h> +#ifdef HAVE_UNISTD_H +# include <unistd.h> +#endif +#include "goo/gmem.h" +#include "goo/GooString.h" +#include "SplashMath.h" +#include "SplashT1FontEngine.h" +#include "SplashFTFontEngine.h" +#include "SplashFontFile.h" +#include "SplashFontFileID.h" +#include "SplashFont.h" +#include "SplashFontEngine.h" + +#ifdef VMS +#if (__VMS_VER < 70000000) +extern "C" int unlink(char *filename); +#endif +#endif + +#ifdef VMS +#if (__VMS_VER < 70000000) +extern "C" int unlink(char *filename); +#endif +#endif + +//------------------------------------------------------------------------ +// SplashFontEngine +//------------------------------------------------------------------------ + +SplashFontEngine::SplashFontEngine( +#if HAVE_T1LIB_H + GBool enableT1lib, +#endif +#if HAVE_FREETYPE_FREETYPE_H || HAVE_FREETYPE_H + GBool enableFreeType, + GBool enableFreeTypeHinting, + GBool enableSlightHinting, +#endif + GBool aa) { + int i; + + for (i = 0; i < splashFontCacheSize; ++i) { + fontCache[i] = NULL; + } + +#if HAVE_T1LIB_H + if (enableT1lib) { + t1Engine = SplashT1FontEngine::init(aa); + } else { + t1Engine = NULL; + } +#endif +#if HAVE_FREETYPE_FREETYPE_H || HAVE_FREETYPE_H + if (enableFreeType) { + ftEngine = SplashFTFontEngine::init(aa, enableFreeTypeHinting, enableSlightHinting); + } else { + ftEngine = NULL; + } +#endif +} + +SplashFontEngine::~SplashFontEngine() { + int i; + + for (i = 0; i < splashFontCacheSize; ++i) { + if (fontCache[i]) { + delete fontCache[i]; + } + } + +#if HAVE_T1LIB_H + if (t1Engine) { + delete t1Engine; + } +#endif +#if HAVE_FREETYPE_FREETYPE_H || HAVE_FREETYPE_H + if (ftEngine) { + delete ftEngine; + } +#endif +} + +SplashFontFile *SplashFontEngine::getFontFile(SplashFontFileID *id) { + SplashFontFile *fontFile; + int i; + + for (i = 0; i < splashFontCacheSize; ++i) { + if (fontCache[i]) { + fontFile = fontCache[i]->getFontFile(); + if (fontFile && fontFile->getID()->matches(id)) { + return fontFile; + } + } + } + return NULL; +} + +SplashFontFile *SplashFontEngine::loadType1Font(SplashFontFileID *idA, + SplashFontSrc *src, + const char **enc) { + SplashFontFile *fontFile; + + fontFile = NULL; +#if HAVE_T1LIB_H + if (!fontFile && t1Engine) { + fontFile = t1Engine->loadType1Font(idA, src, enc); + } +#endif +#if HAVE_FREETYPE_FREETYPE_H || HAVE_FREETYPE_H + if (!fontFile && ftEngine) { + fontFile = ftEngine->loadType1Font(idA, src, enc); + } +#endif + +#ifndef _WIN32 + // delete the (temporary) font file -- with Unix hard link + // semantics, this will remove the last link; otherwise it will + // return an error, leaving the file to be deleted later (if + // loadXYZFont failed, the file will always be deleted) + if (src->isFile) + src->unref(); +#endif + + return fontFile; +} + +SplashFontFile *SplashFontEngine::loadType1CFont(SplashFontFileID *idA, + SplashFontSrc *src, + const char **enc) { + SplashFontFile *fontFile; + + fontFile = NULL; +#if HAVE_T1LIB_H + if (!fontFile && t1Engine) { + fontFile = t1Engine->loadType1CFont(idA, src, enc); + } +#endif +#if HAVE_FREETYPE_FREETYPE_H || HAVE_FREETYPE_H + if (!fontFile && ftEngine) { + fontFile = ftEngine->loadType1CFont(idA, src, enc); + } +#endif + +#ifndef _WIN32 + // delete the (temporary) font file -- with Unix hard link + // semantics, this will remove the last link; otherwise it will + // return an error, leaving the file to be deleted later (if + // loadXYZFont failed, the file will always be deleted) + if (src->isFile) + src->unref(); +#endif + + return fontFile; +} + +SplashFontFile *SplashFontEngine::loadOpenTypeT1CFont(SplashFontFileID *idA, + SplashFontSrc *src, + const char **enc) { + SplashFontFile *fontFile; + + fontFile = NULL; +#if HAVE_FREETYPE_FREETYPE_H || HAVE_FREETYPE_H + if (!fontFile && ftEngine) { + fontFile = ftEngine->loadOpenTypeT1CFont(idA, src, enc); + } +#endif + + // delete the (temporary) font file -- with Unix hard link + // semantics, this will remove the last link; otherwise it will + // return an error, leaving the file to be deleted later (if + // loadXYZFont failed, the file will always be deleted) + if (src->isFile) + src->unref(); + + return fontFile; +} + +SplashFontFile *SplashFontEngine::loadCIDFont(SplashFontFileID *idA, + SplashFontSrc *src) { + SplashFontFile *fontFile; + + fontFile = NULL; +#if HAVE_FREETYPE_FREETYPE_H || HAVE_FREETYPE_H + if (!fontFile && ftEngine) { + fontFile = ftEngine->loadCIDFont(idA, src); + } +#endif + +#ifndef _WIN32 + // delete the (temporary) font file -- with Unix hard link + // semantics, this will remove the last link; otherwise it will + // return an error, leaving the file to be deleted later (if + // loadXYZFont failed, the file will always be deleted) + if (src->isFile) + src->unref(); +#endif + + return fontFile; +} + +SplashFontFile *SplashFontEngine::loadOpenTypeCFFFont(SplashFontFileID *idA, + SplashFontSrc *src, + int *codeToGID, + int codeToGIDLen) { + SplashFontFile *fontFile; + + fontFile = NULL; +#if HAVE_FREETYPE_FREETYPE_H || HAVE_FREETYPE_H + if (!fontFile && ftEngine) { + fontFile = ftEngine->loadOpenTypeCFFFont(idA, src, codeToGID, codeToGIDLen); + } +#endif + + // delete the (temporary) font file -- with Unix hard link + // semantics, this will remove the last link; otherwise it will + // return an error, leaving the file to be deleted later (if + // loadXYZFont failed, the file will always be deleted) + if (src->isFile) + src->unref(); + + return fontFile; +} + +SplashFontFile *SplashFontEngine::loadTrueTypeFont(SplashFontFileID *idA, + SplashFontSrc *src, + int *codeToGID, + int codeToGIDLen, + int faceIndex) { + SplashFontFile *fontFile; + + fontFile = NULL; +#if HAVE_FREETYPE_FREETYPE_H || HAVE_FREETYPE_H + if (!fontFile && ftEngine) { + fontFile = ftEngine->loadTrueTypeFont(idA, src, + codeToGID, codeToGIDLen, faceIndex); + } +#endif + + if (!fontFile) { + gfree(codeToGID); + } + +#ifndef _WIN32 + // delete the (temporary) font file -- with Unix hard link + // semantics, this will remove the last link; otherwise it will + // return an error, leaving the file to be deleted later (if + // loadXYZFont failed, the file will always be deleted) + if (src->isFile) + src->unref(); +#endif + + return fontFile; +} + +#if HAVE_FREETYPE_FREETYPE_H || HAVE_FREETYPE_H +GBool SplashFontEngine::getAA() { + return (ftEngine == NULL) ? gFalse : ftEngine->getAA(); +} + +void SplashFontEngine::setAA(GBool aa) { + if (ftEngine != NULL) { + ftEngine->setAA(aa); + } +} +#endif + +SplashFont *SplashFontEngine::getFont(SplashFontFile *fontFile, + SplashCoord *textMat, + SplashCoord *ctm) { + SplashCoord mat[4]; + SplashFont *font; + int i, j; + + mat[0] = textMat[0] * ctm[0] + textMat[1] * ctm[2]; + mat[1] = -(textMat[0] * ctm[1] + textMat[1] * ctm[3]); + mat[2] = textMat[2] * ctm[0] + textMat[3] * ctm[2]; + mat[3] = -(textMat[2] * ctm[1] + textMat[3] * ctm[3]); + if (!splashCheckDet(mat[0], mat[1], mat[2], mat[3], 0.01)) { + // avoid a singular (or close-to-singular) matrix + mat[0] = 0.01; mat[1] = 0; + mat[2] = 0; mat[3] = 0.01; + } + + font = fontCache[0]; + if (font && font->matches(fontFile, mat, textMat)) { + return font; + } + for (i = 1; i < splashFontCacheSize; ++i) { + font = fontCache[i]; + if (font && font->matches(fontFile, mat, textMat)) { + for (j = i; j > 0; --j) { + fontCache[j] = fontCache[j-1]; + } + fontCache[0] = font; + return font; + } + } + font = fontFile->makeFont(mat, textMat); + if (fontCache[splashFontCacheSize - 1]) { + delete fontCache[splashFontCacheSize - 1]; + } + for (j = splashFontCacheSize - 1; j > 0; --j) { + fontCache[j] = fontCache[j-1]; + } + fontCache[0] = font; + return font; +} diff --git a/Build/source/libs/poppler/poppler-0.25.0/splash/SplashFontEngine.h b/Build/source/libs/poppler/poppler-0.25.0/splash/SplashFontEngine.h new file mode 100644 index 00000000000..6502ea5a7fa --- /dev/null +++ b/Build/source/libs/poppler/poppler-0.25.0/splash/SplashFontEngine.h @@ -0,0 +1,110 @@ +//======================================================================== +// +// SplashFontEngine.h +// +//======================================================================== + +//======================================================================== +// +// Modified under the Poppler project - http://poppler.freedesktop.org +// +// All changes made under the Poppler project to this file are licensed +// under GPL version 2 or later +// +// Copyright (C) 2006 Takashi Iwai <tiwai@suse.de> +// Copyright (C) 2009 Petr Gajdos <pgajdos@novell.com> +// Copyright (C) 2009, 2011 Albert Astals Cid <aacid@kde.org> +// Copyright (C) 2011 Andreas Hartmetz <ahartmetz@gmail.com> +// Copyright (C) 2013 Thomas Freitag <Thomas.Freitag@alfa.de> +// +// To see a description of the changes please see the Changelog file that +// came with your tarball or type make ChangeLog if you are building from git +// +//======================================================================== + +#ifndef SPLASHFONTENGINE_H +#define SPLASHFONTENGINE_H + +#ifdef USE_GCC_PRAGMAS +#pragma interface +#endif + +#include "goo/gtypes.h" +#include "SplashTypes.h" + +class SplashT1FontEngine; +class SplashFTFontEngine; +class SplashDTFontEngine; +class SplashDT4FontEngine; +class SplashFontFile; +class SplashFontFileID; +class SplashFont; +class SplashFontSrc; + +//------------------------------------------------------------------------ + +#define splashFontCacheSize 16 + +//------------------------------------------------------------------------ +// SplashFontEngine +//------------------------------------------------------------------------ + +class SplashFontEngine { +public: + + // Create a font engine. + SplashFontEngine( +#if HAVE_T1LIB_H + GBool enableT1lib, +#endif +#if HAVE_FREETYPE_FREETYPE_H || HAVE_FREETYPE_H + GBool enableFreeType, + GBool enableFreeTypeHinting, + GBool enableSlightHinting, +#endif + GBool aa); + + ~SplashFontEngine(); + + // Get a font file from the cache. Returns NULL if there is no + // matching entry in the cache. + SplashFontFile *getFontFile(SplashFontFileID *id); + + // Load fonts - these create new SplashFontFile objects. + SplashFontFile *loadType1Font(SplashFontFileID *idA, SplashFontSrc *src, const char **enc); + SplashFontFile *loadType1CFont(SplashFontFileID *idA, SplashFontSrc *src, const char **enc); + SplashFontFile *loadOpenTypeT1CFont(SplashFontFileID *idA, SplashFontSrc *src, const char **enc); + SplashFontFile *loadCIDFont(SplashFontFileID *idA, SplashFontSrc *src); + SplashFontFile *loadOpenTypeCFFFont(SplashFontFileID *idA, SplashFontSrc *src, + int *codeToGID, int codeToGIDLen); + SplashFontFile *loadTrueTypeFont(SplashFontFileID *idA, SplashFontSrc *src, + int *codeToGID, int codeToGIDLen, int faceIndex = 0); + + // Get a font - this does a cache lookup first, and if not found, + // creates a new SplashFont object and adds it to the cache. The + // matrix, mat = textMat * ctm: + // [ mat[0] mat[1] ] + // [ mat[2] mat[3] ] + // specifies the font transform in PostScript style: + // [x' y'] = [x y] * mat + // Note that the Splash y axis points downward. + SplashFont *getFont(SplashFontFile *fontFile, + SplashCoord *textMat, SplashCoord *ctm); +#if HAVE_FREETYPE_FREETYPE_H || HAVE_FREETYPE_H + GBool getAA(); + void setAA(GBool aa); +#endif + +private: + + SplashFont *fontCache[splashFontCacheSize]; + +#if HAVE_T1LIB_H + SplashT1FontEngine *t1Engine; +#endif +#if HAVE_FREETYPE_FREETYPE_H || HAVE_FREETYPE_H + SplashFTFontEngine *ftEngine; +#endif +}; + +#endif diff --git a/Build/source/libs/poppler/poppler-0.25.0/splash/SplashFontFile.cc b/Build/source/libs/poppler/poppler-0.25.0/splash/SplashFontFile.cc new file mode 100644 index 00000000000..68e8608b6a7 --- /dev/null +++ b/Build/source/libs/poppler/poppler-0.25.0/splash/SplashFontFile.cc @@ -0,0 +1,124 @@ +//======================================================================== +// +// SplashFontFile.cc +// +//======================================================================== + +//======================================================================== +// +// Modified under the Poppler project - http://poppler.freedesktop.org +// +// All changes made under the Poppler project to this file are licensed +// under GPL version 2 or later +// +// Copyright (C) 2006 Takashi Iwai <tiwai@suse.de> +// Copyright (C) 2008 Albert Astals Cid <aacid@kde.org> +// +// To see a description of the changes please see the Changelog file that +// came with your tarball or type make ChangeLog if you are building from git +// +//======================================================================== + +#include <config.h> + +#ifdef USE_GCC_PRAGMAS +#pragma implementation +#endif + +#include <stdio.h> +#ifdef HAVE_UNISTD_H +#include <unistd.h> +#endif +#include "goo/gmem.h" +#include "goo/GooString.h" +#include "SplashFontFile.h" +#include "SplashFontFileID.h" + +#ifdef VMS +#if (__VMS_VER < 70000000) +extern "C" int unlink(char *filename); +#endif +#endif + +//------------------------------------------------------------------------ +// SplashFontFile +//------------------------------------------------------------------------ + +SplashFontFile::SplashFontFile(SplashFontFileID *idA, SplashFontSrc *srcA) { + id = idA; + src = srcA; + src->ref(); + refCnt = 0; + doAdjustMatrix = gFalse; +} + +SplashFontFile::~SplashFontFile() { + src->unref(); + delete id; +} + +void SplashFontFile::incRefCnt() { + ++refCnt; +} + +void SplashFontFile::decRefCnt() { + if (!--refCnt) { + delete this; + } +} + +// + +SplashFontSrc::SplashFontSrc() { + isFile = gFalse; + deleteSrc = gFalse; + fileName = NULL; + buf = NULL; + refcnt = 1; +} + +SplashFontSrc::~SplashFontSrc() { + if (deleteSrc) { + if (isFile) { + if (fileName) + unlink(fileName->getCString()); + } else { + if (buf) + gfree(buf); + } + } + + if (isFile && fileName) + delete fileName; +} + +void SplashFontSrc::ref() { + refcnt++; +} + +void SplashFontSrc::unref() { + if (! --refcnt) + delete this; +} + +void SplashFontSrc::setFile(GooString *file, GBool del) +{ + isFile = gTrue; + fileName = file->copy(); + deleteSrc = del; +} + +void SplashFontSrc::setFile(const char *file, GBool del) +{ + isFile = gTrue; + fileName = new GooString(file); + deleteSrc = del; +} + +void SplashFontSrc::setBuf(char *bufA, int bufLenA, GBool del) +{ + isFile = gFalse; + buf = bufA; + bufLen = bufLenA; + deleteSrc = del; +} diff --git a/Build/source/libs/poppler/poppler-0.25.0/splash/SplashFontFile.h b/Build/source/libs/poppler/poppler-0.25.0/splash/SplashFontFile.h new file mode 100644 index 00000000000..ec87504b9bc --- /dev/null +++ b/Build/source/libs/poppler/poppler-0.25.0/splash/SplashFontFile.h @@ -0,0 +1,95 @@ +//======================================================================== +// +// SplashFontFile.h +// +//======================================================================== + +//======================================================================== +// +// Modified under the Poppler project - http://poppler.freedesktop.org +// +// All changes made under the Poppler project to this file are licensed +// under GPL version 2 or later +// +// Copyright (C) 2006 Takashi Iwai <tiwai@suse.de> +// Copyright (C) 2008, 2010 Albert Astals Cid <aacid@kde.org> +// +// To see a description of the changes please see the Changelog file that +// came with your tarball or type make ChangeLog if you are building from git +// +//======================================================================== + +#ifndef SPLASHFONTFILE_H +#define SPLASHFONTFILE_H + +#ifdef USE_GCC_PRAGMAS +#pragma interface +#endif + +#include "goo/gtypes.h" +#include "SplashTypes.h" + +class GooString; +class SplashFontEngine; +class SplashFont; +class SplashFontFileID; + +//------------------------------------------------------------------------ +// SplashFontFile +//------------------------------------------------------------------------ + +class SplashFontSrc { +public: + SplashFontSrc(); + + void setFile(GooString *file, GBool del); + void setFile(const char *file, GBool del); + void setBuf(char *bufA, int buflenA, GBool del); + + void ref(); + void unref(); + + GBool isFile; + GooString *fileName; + char *buf; + int bufLen; + +private: + ~SplashFontSrc(); + int refcnt; + GBool deleteSrc; +}; + +class SplashFontFile { +public: + + virtual ~SplashFontFile(); + + // Create a new SplashFont, i.e., a scaled instance of this font + // file. + virtual SplashFont *makeFont(SplashCoord *mat, SplashCoord *textMat) = 0; + + // Get the font file ID. + SplashFontFileID *getID() { return id; } + + // Increment the reference count. + void incRefCnt(); + + // Decrement the reference count. If the new value is zero, delete + // the SplashFontFile object. + void decRefCnt(); + + GBool doAdjustMatrix; + +protected: + + SplashFontFile(SplashFontFileID *idA, SplashFontSrc *srcA); + + SplashFontFileID *id; + SplashFontSrc *src; + int refCnt; + + friend class SplashFontEngine; +}; + +#endif diff --git a/Build/source/libs/poppler/poppler-0.25.0/splash/SplashFontFileID.cc b/Build/source/libs/poppler/poppler-0.25.0/splash/SplashFontFileID.cc new file mode 100644 index 00000000000..a66dabf61e3 --- /dev/null +++ b/Build/source/libs/poppler/poppler-0.25.0/splash/SplashFontFileID.cc @@ -0,0 +1,23 @@ +//======================================================================== +// +// SplashFontFileID.cc +// +//======================================================================== + +#include <config.h> + +#ifdef USE_GCC_PRAGMAS +#pragma implementation +#endif + +#include "SplashFontFileID.h" + +//------------------------------------------------------------------------ +// SplashFontFileID +//------------------------------------------------------------------------ + +SplashFontFileID::SplashFontFileID() { +} + +SplashFontFileID::~SplashFontFileID() { +} diff --git a/Build/source/libs/poppler/poppler-0.25.0/splash/SplashFontFileID.h b/Build/source/libs/poppler/poppler-0.25.0/splash/SplashFontFileID.h new file mode 100644 index 00000000000..cfd89ebb56a --- /dev/null +++ b/Build/source/libs/poppler/poppler-0.25.0/splash/SplashFontFileID.h @@ -0,0 +1,28 @@ +//======================================================================== +// +// SplashFontFileID.h +// +//======================================================================== + +#ifndef SPLASHFONTFILEID_H +#define SPLASHFONTFILEID_H + +#ifdef USE_GCC_PRAGMAS +#pragma interface +#endif + +#include "goo/gtypes.h" + +//------------------------------------------------------------------------ +// SplashFontFileID +//------------------------------------------------------------------------ + +class SplashFontFileID { +public: + + SplashFontFileID(); + virtual ~SplashFontFileID(); + virtual GBool matches(SplashFontFileID *id) = 0; +}; + +#endif diff --git a/Build/source/libs/poppler/poppler-0.25.0/splash/SplashGlyphBitmap.h b/Build/source/libs/poppler/poppler-0.25.0/splash/SplashGlyphBitmap.h new file mode 100644 index 00000000000..c062c106e6a --- /dev/null +++ b/Build/source/libs/poppler/poppler-0.25.0/splash/SplashGlyphBitmap.h @@ -0,0 +1,24 @@ +//======================================================================== +// +// SplashGlyphBitmap.h +// +//======================================================================== + +#ifndef SPLASHGLYPHBITMAP_H +#define SPLASHGLYPHBITMAP_H + +#include "goo/gtypes.h" + +//------------------------------------------------------------------------ +// SplashGlyphBitmap +//------------------------------------------------------------------------ + +struct SplashGlyphBitmap { + int x, y, w, h; // offset and size of glyph + GBool aa; // anti-aliased: true means 8-bit alpha + // bitmap; false means 1-bit + Guchar *data; // bitmap data + GBool freeData; // true if data memory should be freed +}; + +#endif diff --git a/Build/source/libs/poppler/poppler-0.25.0/splash/SplashMath.h b/Build/source/libs/poppler/poppler-0.25.0/splash/SplashMath.h new file mode 100644 index 00000000000..ca73c2bd1f3 --- /dev/null +++ b/Build/source/libs/poppler/poppler-0.25.0/splash/SplashMath.h @@ -0,0 +1,245 @@ +//======================================================================== +// +// SplashMath.h +// +//======================================================================== + +//======================================================================== +// +// Modified under the Poppler project - http://poppler.freedesktop.org +// +// All changes made under the Poppler project to this file are licensed +// under GPL version 2 or later +// +// Copyright (C) 2009-2011 Albert Astals Cid <aacid@kde.org> +// +// To see a description of the changes please see the Changelog file that +// came with your tarball or type make ChangeLog if you are building from git +// +//======================================================================== + +#ifndef SPLASHMATH_H +#define SPLASHMATH_H + +#include "poppler-config.h" + +#if USE_FIXEDPOINT +#include "goo/FixedPoint.h" +#else +#include <math.h> +#endif +#include "SplashTypes.h" + +static inline SplashCoord splashAbs(SplashCoord x) { +#if USE_FIXEDPOINT + return FixedPoint::abs(x); +#elif USE_FLOAT + return fabsf(x); +#else + return fabs(x); +#endif +} + +static inline int splashFloor(SplashCoord x) { + #if USE_FIXEDPOINT + 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); + #endif +} + +static inline int splashCeil(SplashCoord x) { +#if USE_FIXEDPOINT + 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 +} + +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 +} + +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); +#elif USE_FLOAT + return sqrtf(x); +#else + return sqrt(x); +#endif +} + +static inline SplashCoord splashPow(SplashCoord x, SplashCoord y) { +#if USE_FIXEDPOINT + return FixedPoint::pow(x, y); +#elif USE_FLOAT + return powf(x, y); +#else + return pow(x, y); +#endif +} + +static inline SplashCoord splashDist(SplashCoord x0, SplashCoord y0, + SplashCoord x1, SplashCoord y1) { + SplashCoord dx, dy; + dx = x1 - x0; + dy = y1 - y0; +#if USE_FIXEDPOINT + // this handles the situation where dx*dx or dy*dy is too large to + // fit in the 16.16 fixed point format + SplashCoord dxa, dya, d; + dxa = splashAbs(dx); + dya = splashAbs(dy); + if (dxa == 0 && dya == 0) { + return 0; + } else if (dxa > dya) { + d = dya / dxa; + return dxa * FixedPoint::sqrt(d*d + 1); + } else { + d = dxa / dya; + return dya * FixedPoint::sqrt(d*d + 1); + } +#else + return splashSqrt(dx * dx + dy * dy); +#endif +} + +static inline GBool splashCheckDet(SplashCoord m11, SplashCoord m12, + SplashCoord m21, SplashCoord m22, + SplashCoord epsilon) { +#if USE_FIXEDPOINT + return FixedPoint::checkDet(m11, m12, m21, m22, epsilon); +#else + return fabs(m11 * m22 - m12 * m21) >= epsilon; +#endif +} + +#endif diff --git a/Build/source/libs/poppler/poppler-0.25.0/splash/SplashPath.cc b/Build/source/libs/poppler/poppler-0.25.0/splash/SplashPath.cc new file mode 100644 index 00000000000..bc4ccd524a4 --- /dev/null +++ b/Build/source/libs/poppler/poppler-0.25.0/splash/SplashPath.cc @@ -0,0 +1,185 @@ +//======================================================================== +// +// SplashPath.cc +// +//======================================================================== + +#include <config.h> + +#ifdef USE_GCC_PRAGMAS +#pragma implementation +#endif + +#include <string.h> +#include "goo/gmem.h" +#include "SplashErrorCodes.h" +#include "SplashPath.h" + +//------------------------------------------------------------------------ +// SplashPath +//------------------------------------------------------------------------ + +// A path can be in three possible states: +// +// 1. no current point -- zero or more finished subpaths +// [curSubpath == length] +// +// 2. one point in subpath +// [curSubpath == length - 1] +// +// 3. open subpath with two or more points +// [curSubpath < length - 1] + +SplashPath::SplashPath() { + pts = NULL; + flags = NULL; + length = size = 0; + curSubpath = 0; + hints = NULL; + hintsLength = hintsSize = 0; +} + +SplashPath::SplashPath(SplashPath *path) { + length = path->length; + size = path->size; + pts = (SplashPathPoint *)gmallocn(size, sizeof(SplashPathPoint)); + flags = (Guchar *)gmallocn(size, sizeof(Guchar)); + memcpy(pts, path->pts, length * sizeof(SplashPathPoint)); + memcpy(flags, path->flags, length * sizeof(Guchar)); + curSubpath = path->curSubpath; + if (path->hints) { + hintsLength = hintsSize = path->hintsLength; + hints = (SplashPathHint *)gmallocn(hintsSize, sizeof(SplashPathHint)); + memcpy(hints, path->hints, hintsLength * sizeof(SplashPathHint)); + } else { + hints = NULL; + } +} + +SplashPath::~SplashPath() { + gfree(pts); + gfree(flags); + gfree(hints); +} + +// Add space for <nPts> more points. +void SplashPath::grow(int nPts) { + if (length + nPts > size) { + if (size == 0) { + size = 32; + } + while (size < length + nPts) { + size *= 2; + } + pts = (SplashPathPoint *)greallocn(pts, size, sizeof(SplashPathPoint)); + flags = (Guchar *)greallocn(flags, size, sizeof(Guchar)); + } +} + +void SplashPath::append(SplashPath *path) { + int i; + + curSubpath = length + path->curSubpath; + grow(path->length); + for (i = 0; i < path->length; ++i) { + pts[length] = path->pts[i]; + flags[length] = path->flags[i]; + ++length; + } +} + +SplashError SplashPath::moveTo(SplashCoord x, SplashCoord y) { + if (onePointSubpath()) { + return splashErrBogusPath; + } + grow(1); + pts[length].x = x; + pts[length].y = y; + flags[length] = splashPathFirst | splashPathLast; + curSubpath = length++; + return splashOk; +} + +SplashError SplashPath::lineTo(SplashCoord x, SplashCoord y) { + if (noCurrentPoint()) { + return splashErrNoCurPt; + } + flags[length-1] &= ~splashPathLast; + grow(1); + pts[length].x = x; + pts[length].y = y; + flags[length] = splashPathLast; + ++length; + return splashOk; +} + +SplashError SplashPath::curveTo(SplashCoord x1, SplashCoord y1, + SplashCoord x2, SplashCoord y2, + SplashCoord x3, SplashCoord y3) { + if (noCurrentPoint()) { + return splashErrNoCurPt; + } + flags[length-1] &= ~splashPathLast; + grow(3); + pts[length].x = x1; + pts[length].y = y1; + flags[length] = splashPathCurve; + ++length; + pts[length].x = x2; + pts[length].y = y2; + flags[length] = splashPathCurve; + ++length; + pts[length].x = x3; + pts[length].y = y3; + flags[length] = splashPathLast; + ++length; + return splashOk; +} + +SplashError SplashPath::close(GBool force) { + if (noCurrentPoint()) { + return splashErrNoCurPt; + } + if (force || + curSubpath == length - 1 || + pts[length - 1].x != pts[curSubpath].x || + pts[length - 1].y != pts[curSubpath].y) { + lineTo(pts[curSubpath].x, pts[curSubpath].y); + } + flags[curSubpath] |= splashPathClosed; + flags[length - 1] |= splashPathClosed; + curSubpath = length; + return splashOk; +} + +void SplashPath::addStrokeAdjustHint(int ctrl0, int ctrl1, + int firstPt, int lastPt) { + if (hintsLength == hintsSize) { + hintsSize = hintsLength ? 2 * hintsLength : 8; + hints = (SplashPathHint *)greallocn(hints, hintsSize, + sizeof(SplashPathHint)); + } + hints[hintsLength].ctrl0 = ctrl0; + hints[hintsLength].ctrl1 = ctrl1; + hints[hintsLength].firstPt = firstPt; + hints[hintsLength].lastPt = lastPt; + ++hintsLength; +} + +void SplashPath::offset(SplashCoord dx, SplashCoord dy) { + int i; + + for (i = 0; i < length; ++i) { + pts[i].x += dx; + pts[i].y += dy; + } +} + +GBool SplashPath::getCurPt(SplashCoord *x, SplashCoord *y) { + if (noCurrentPoint()) { + return gFalse; + } + *x = pts[length - 1].x; + *y = pts[length - 1].y; + return gTrue; +} diff --git a/Build/source/libs/poppler/poppler-0.25.0/splash/SplashPath.h b/Build/source/libs/poppler/poppler-0.25.0/splash/SplashPath.h new file mode 100644 index 00000000000..81273c613e5 --- /dev/null +++ b/Build/source/libs/poppler/poppler-0.25.0/splash/SplashPath.h @@ -0,0 +1,123 @@ +//======================================================================== +// +// SplashPath.h +// +//======================================================================== + +#ifndef SPLASHPATH_H +#define SPLASHPATH_H + +#ifdef USE_GCC_PRAGMAS +#pragma interface +#endif + +#include "SplashTypes.h" + +//------------------------------------------------------------------------ +// SplashPathPoint +//------------------------------------------------------------------------ + +struct SplashPathPoint { + SplashCoord x, y; +}; + +//------------------------------------------------------------------------ +// SplashPath.flags +//------------------------------------------------------------------------ + +// first point on each subpath sets this flag +#define splashPathFirst 0x01 + +// last point on each subpath sets this flag +#define splashPathLast 0x02 + +// if the subpath is closed, its first and last points must be +// identical, and must set this flag +#define splashPathClosed 0x04 + +// curve control points set this flag +#define splashPathCurve 0x08 + +//------------------------------------------------------------------------ +// SplashPathHint +//------------------------------------------------------------------------ + +struct SplashPathHint { + int ctrl0, ctrl1; + int firstPt, lastPt; +}; + +//------------------------------------------------------------------------ +// SplashPath +//------------------------------------------------------------------------ + +class SplashPath { +public: + + // Create an empty path. + SplashPath(); + + // Copy a path. + SplashPath *copy() { return new SplashPath(this); } + + ~SplashPath(); + + // Append <path> to <this>. + void append(SplashPath *path); + + // Start a new subpath. + SplashError moveTo(SplashCoord x, SplashCoord y); + + // Add a line segment to the last subpath. + SplashError lineTo(SplashCoord x, SplashCoord y); + + // Add a third-order (cubic) Bezier curve segment to the last + // subpath. + SplashError curveTo(SplashCoord x1, SplashCoord y1, + SplashCoord x2, SplashCoord y2, + SplashCoord x3, SplashCoord y3); + + // Close the last subpath, adding a line segment if necessary. If + // <force> is true, this adds a line segment even if the current + // point is equal to the first point in the subpath. + SplashError close(GBool force = gFalse); + + // Add a stroke adjustment hint. The controlling segments are + // <ctrl0> and <ctrl1> (where segments are identified by their first + // point), and the points to be adjusted are <firstPt> .. <lastPt>. + void addStrokeAdjustHint(int ctrl0, int ctrl1, int firstPt, int lastPt); + + // Add (<dx>, <dy>) to every point on this path. + void offset(SplashCoord dx, SplashCoord dy); + + // Get the points on the path. + int getLength() { return length; } + void getPoint(int i, double *x, double *y, Guchar *f) + { *x = pts[i].x; *y = pts[i].y; *f = flags[i]; } + + // Get the current point. + GBool getCurPt(SplashCoord *x, SplashCoord *y); + +protected: + + SplashPath(SplashPath *path); + void grow(int nPts); + GBool noCurrentPoint() { return curSubpath == length; } + GBool onePointSubpath() { return curSubpath == length - 1; } + GBool openSubpath() { return curSubpath < length - 1; } + + SplashPathPoint *pts; // array of points + Guchar *flags; // array of flags + int length, size; // length/size of the pts and flags arrays + int curSubpath; // index of first point in last subpath + + SplashPathHint *hints; // list of hints + int hintsLength, hintsSize; + + friend class SplashXPath; + friend class Splash; + // this is a temporary hack, until we read FreeType paths directly + friend class ArthurOutputDev; +}; + +#endif diff --git a/Build/source/libs/poppler/poppler-0.25.0/splash/SplashPattern.cc b/Build/source/libs/poppler/poppler-0.25.0/splash/SplashPattern.cc new file mode 100644 index 00000000000..28ca4995882 --- /dev/null +++ b/Build/source/libs/poppler/poppler-0.25.0/splash/SplashPattern.cc @@ -0,0 +1,55 @@ +//======================================================================== +// +// SplashPattern.cc +// +//======================================================================== + +//======================================================================== +// +// Modified under the Poppler project - http://poppler.freedesktop.org +// +// All changes made under the Poppler project to this file are licensed +// under GPL version 2 or later +// +// Copyright (C) 2010, 2011 Thomas Freitag <Thomas.Freitag@alfa.de> +// +// To see a description of the changes please see the Changelog file that +// came with your tarball or type make ChangeLog if you are building from git +// +//======================================================================== + +#include <config.h> + +#ifdef USE_GCC_PRAGMAS +#pragma implementation +#endif + +#include "SplashMath.h" +#include "SplashScreen.h" +#include "SplashPattern.h" + +//------------------------------------------------------------------------ +// SplashPattern +//------------------------------------------------------------------------ + +SplashPattern::SplashPattern() { +} + +SplashPattern::~SplashPattern() { +} + +//------------------------------------------------------------------------ +// SplashSolidColor +//------------------------------------------------------------------------ + +SplashSolidColor::SplashSolidColor(SplashColorPtr colorA) { + splashColorCopy(color, colorA); +} + +SplashSolidColor::~SplashSolidColor() { +} + +GBool SplashSolidColor::getColor(int x, int y, SplashColorPtr c) { + splashColorCopy(c, color); + return gTrue; +} diff --git a/Build/source/libs/poppler/poppler-0.25.0/splash/SplashPattern.h b/Build/source/libs/poppler/poppler-0.25.0/splash/SplashPattern.h new file mode 100644 index 00000000000..42c1660f126 --- /dev/null +++ b/Build/source/libs/poppler/poppler-0.25.0/splash/SplashPattern.h @@ -0,0 +1,100 @@ +//======================================================================== +// +// SplashPattern.h +// +//======================================================================== + +//======================================================================== +// +// Modified under the Poppler project - http://poppler.freedesktop.org +// +// All changes made under the Poppler project to this file are licensed +// under GPL version 2 or later +// +// Copyright (C) 2010, 2011 Thomas Freitag <Thomas.Freitag@alfa.de> +// +// To see a description of the changes please see the Changelog file that +// came with your tarball or type make ChangeLog if you are building from git +// +//======================================================================== + +#ifndef SPLASHPATTERN_H +#define SPLASHPATTERN_H + +#ifdef USE_GCC_PRAGMAS +#pragma interface +#endif + +#include "SplashTypes.h" + +class SplashScreen; + +//------------------------------------------------------------------------ +// SplashPattern +//------------------------------------------------------------------------ + +class SplashPattern { +public: + + SplashPattern(); + + virtual SplashPattern *copy() = 0; + + virtual ~SplashPattern(); + + // Return the color value for a specific pixel. + virtual GBool getColor(int x, int y, SplashColorPtr c) = 0; + + // Test if x,y-position is inside pattern. + virtual GBool testPosition(int x, int y) = 0; + + // Returns true if this pattern object will return the same color + // value for all pixels. + virtual GBool isStatic() = 0; + +private: +}; + +//------------------------------------------------------------------------ +// SplashSolidColor +//------------------------------------------------------------------------ + +class SplashSolidColor: public SplashPattern { +public: + + SplashSolidColor(SplashColorPtr colorA); + + virtual SplashPattern *copy() { return new SplashSolidColor(color); } + + virtual ~SplashSolidColor(); + + virtual GBool getColor(int x, int y, SplashColorPtr c); + + virtual GBool testPosition(int x, int y) { return gFalse; } + + virtual GBool isStatic() { return gTrue; } + +private: + + SplashColor color; +}; + +//------------------------------------------------------------------------ +// SplashGouraudColor (needed for gouraudTriangleShadedFill) +//------------------------------------------------------------------------ + +class SplashGouraudColor: public SplashPattern { +public: + + virtual GBool isParameterized() = 0; + + virtual int getNTriangles() = 0; + + virtual void getTriangle(int i, double *x0, double *y0, double *color0, + double *x1, double *y1, double *color1, + double *x2, double *y2, double *color2) = 0; + + virtual void getParameterizedColor(double t, SplashColorMode mode, SplashColorPtr c) = 0; +}; + +#endif diff --git a/Build/source/libs/poppler/poppler-0.25.0/splash/SplashScreen.cc b/Build/source/libs/poppler/poppler-0.25.0/splash/SplashScreen.cc new file mode 100644 index 00000000000..68ccd7ddda0 --- /dev/null +++ b/Build/source/libs/poppler/poppler-0.25.0/splash/SplashScreen.cc @@ -0,0 +1,387 @@ +//======================================================================== +// +// SplashScreen.cc +// +//======================================================================== + +//======================================================================== +// +// Modified under the Poppler project - http://poppler.freedesktop.org +// +// All changes made under the Poppler project to this file are licensed +// under GPL version 2 or later +// +// Copyright (C) 2009 Albert Astals Cid <aacid@kde.org> +// Copyright (C) 2012 Fabio D'Urso <fabiodurso@hotmail.it> +// +// To see a description of the changes please see the Changelog file that +// came with your tarball or type make ChangeLog if you are building from git +// +//======================================================================== + +#include <config.h> + +#ifdef USE_GCC_PRAGMAS +#pragma implementation +#endif + +#include <stdlib.h> +#include <string.h> +#include <algorithm> +#include "goo/gmem.h" +#include "goo/grandom.h" +#include "SplashMath.h" +#include "SplashScreen.h" + +static SplashScreenParams defaultParams = { + splashScreenDispersed, // type + 2, // size + 2, // dotRadius + 1.0, // gamma + 0.0, // blackThreshold + 1.0 // whiteThreshold +}; + +//------------------------------------------------------------------------ + +struct SplashScreenPoint { + int x, y; + int dist; +}; + + +struct cmpDistancesFunctor { + bool operator()(const SplashScreenPoint &p0, const SplashScreenPoint &p1) { + return p0.dist < p1.dist; + } +}; + +//------------------------------------------------------------------------ +// SplashScreen +//------------------------------------------------------------------------ + +// If <clustered> is true, this generates a 45 degree screen using a +// circular dot spot function. DPI = resolution / ((size / 2) * +// sqrt(2)). If <clustered> is false, this generates an optimal +// threshold matrix using recursive tesselation. Gamma correction +// (gamma = 1 / 1.33) is also computed here. +SplashScreen::SplashScreen(SplashScreenParams *params) { + + if (!params) { + params = &defaultParams; + } + + screenParams = params; + mat = NULL; + size = 0; + maxVal = 0; + minVal = 0; +} + +void SplashScreen::createMatrix() +{ + Guchar u; + int black, white, i; + + SplashScreenParams *params = screenParams; + + // size must be a power of 2, and at least 2 + for (size = 2, log2Size = 1; size < params->size; size <<= 1, ++log2Size) ; + + switch (params->type) { + + case splashScreenDispersed: + mat = (Guchar *)gmallocn(size * size, sizeof(Guchar)); + buildDispersedMatrix(size/2, size/2, 1, size/2, 1); + break; + + case splashScreenClustered: + mat = (Guchar *)gmallocn(size * size, sizeof(Guchar)); + buildClusteredMatrix(); + break; + + case splashScreenStochasticClustered: + // size must be at least 2*r + while (size < (params->dotRadius << 1)) { + size <<= 1; + ++log2Size; + } + mat = (Guchar *)gmallocn(size * size, sizeof(Guchar)); + buildSCDMatrix(params->dotRadius); + break; + } + + sizeM1 = size - 1; + + // do gamma correction and compute minVal/maxVal + minVal = 255; + maxVal = 0; + black = splashRound((SplashCoord)255.0 * params->blackThreshold); + if (black < 1) { + black = 1; + } + int whiteAux = splashRound((SplashCoord)255.0 * params->whiteThreshold); + if (whiteAux > 255) { + white = 255; + } else { + white = whiteAux; + } + for (i = 0; i < size * size; ++i) { + u = splashRound((SplashCoord)255.0 * + splashPow((SplashCoord)mat[i] / 255.0, params->gamma)); + if (u < black) { + u = (Guchar)black; + } else if (u >= white) { + u = (Guchar)white; + } + mat[i] = u; + if (u < minVal) { + minVal = u; + } else if (u > maxVal) { + maxVal = u; + } + } +} + +void SplashScreen::buildDispersedMatrix(int i, int j, int val, + int delta, int offset) { + if (delta == 0) { + // map values in [1, size^2] --> [1, 255] + mat[(i << log2Size) + j] = 1 + (254 * (val - 1)) / (size * size - 1); + } else { + buildDispersedMatrix(i, j, + val, delta / 2, 4*offset); + buildDispersedMatrix((i + delta) % size, (j + delta) % size, + val + offset, delta / 2, 4*offset); + buildDispersedMatrix((i + delta) % size, j, + val + 2*offset, delta / 2, 4*offset); + buildDispersedMatrix((i + 2*delta) % size, (j + delta) % size, + val + 3*offset, delta / 2, 4*offset); + } +} + +void SplashScreen::buildClusteredMatrix() { + SplashCoord *dist; + SplashCoord u, v, d; + Guchar val; + int size2, x, y, x1, y1, i; + + size2 = size >> 1; + + // initialize the threshold matrix + for (y = 0; y < size; ++y) { + for (x = 0; x < size; ++x) { + mat[(y << log2Size) + x] = 0; + } + } + + // build the distance matrix + dist = (SplashCoord *)gmallocn(size * size2, sizeof(SplashCoord)); + for (y = 0; y < size2; ++y) { + for (x = 0; x < size2; ++x) { + if (x + y < size2 - 1) { + u = (SplashCoord)x + 0.5 - 0; + v = (SplashCoord)y + 0.5 - 0; + } else { + u = (SplashCoord)x + 0.5 - (SplashCoord)size2; + v = (SplashCoord)y + 0.5 - (SplashCoord)size2; + } + dist[y * size2 + x] = u*u + v*v; + } + } + for (y = 0; y < size2; ++y) { + for (x = 0; x < size2; ++x) { + if (x < y) { + u = (SplashCoord)x + 0.5 - 0; + v = (SplashCoord)y + 0.5 - (SplashCoord)size2; + } else { + u = (SplashCoord)x + 0.5 - (SplashCoord)size2; + v = (SplashCoord)y + 0.5 - 0; + } + dist[(size2 + y) * size2 + x] = u*u + v*v; + } + } + + // build the threshold matrix + x1 = y1 = 0; // make gcc happy + for (i = 0; i < size * size2; ++i) { + d = -1; + for (y = 0; y < size; ++y) { + for (x = 0; x < size2; ++x) { + if (mat[(y << log2Size) + x] == 0 && + dist[y * size2 + x] > d) { + x1 = x; + y1 = y; + d = dist[y1 * size2 + x1]; + } + } + } + // map values in [0, 2*size*size2-1] --> [1, 255] + val = 1 + (254 * (2*i)) / (2*size*size2 - 1); + mat[(y1 << log2Size) + x1] = val; + val = 1 + (254 * (2*i+1)) / (2*size*size2 - 1); + if (y1 < size2) { + mat[((y1 + size2) << log2Size) + x1 + size2] = val; + } else { + mat[((y1 - size2) << log2Size) + x1 + size2] = val; + } + } + + gfree(dist); +} + +// Compute the distance between two points on a toroid. +int SplashScreen::distance(int x0, int y0, int x1, int y1) { + int dx0, dx1, dx, dy0, dy1, dy; + + dx0 = abs(x0 - x1); + dx1 = size - dx0; + dx = dx0 < dx1 ? dx0 : dx1; + dy0 = abs(y0 - y1); + dy1 = size - dy0; + dy = dy0 < dy1 ? dy0 : dy1; + return dx * dx + dy * dy; +} + +// Algorithm taken from: +// Victor Ostromoukhov and Roger D. Hersch, "Stochastic Clustered-Dot +// Dithering" in Color Imaging: Device-Independent Color, Color +// Hardcopy, and Graphic Arts IV, SPIE Vol. 3648, pp. 496-505, 1999. +void SplashScreen::buildSCDMatrix(int r) { + SplashScreenPoint *dots, *pts; + int dotsLen, dotsSize; + char *tmpl; + char *grid; + int *region, *dist; + int x, y, xx, yy, x0, x1, y0, y1, i, j, d, iMin, dMin, n; + + // generate the random space-filling curve + pts = (SplashScreenPoint *)gmallocn(size * size, sizeof(SplashScreenPoint)); + i = 0; + for (y = 0; y < size; ++y) { + for (x = 0; x < size; ++x) { + pts[i].x = x; + pts[i].y = y; + ++i; + } + } + for (i = 0; i < size * size; ++i) { + j = i + (int)((double)(size * size - i) * grandom_double()); + x = pts[i].x; + y = pts[i].y; + pts[i].x = pts[j].x; + pts[i].y = pts[j].y; + pts[j].x = x; + pts[j].y = y; + } + + // construct the circle template + tmpl = (char *)gmallocn((r+1)*(r+1), sizeof(char)); + for (y = 0; y <= r; ++y) { + for (x = 0; x <= r; ++x) { + tmpl[y*(r+1) + x] = (x * y <= r * r) ? 1 : 0; + } + } + + // mark all grid cells as free + grid = (char *)gmallocn(size * size, sizeof(char)); + for (y = 0; y < size; ++y) { + for (x = 0; x < size; ++x) { + grid[(y << log2Size) + x] = 0; + } + } + + // walk the space-filling curve, adding dots + dotsLen = 0; + dotsSize = 32; + dots = (SplashScreenPoint *)gmallocn(dotsSize, sizeof(SplashScreenPoint)); + for (i = 0; i < size * size; ++i) { + x = pts[i].x; + y = pts[i].y; + if (!grid[(y << log2Size) + x]) { + if (dotsLen == dotsSize) { + dotsSize *= 2; + dots = (SplashScreenPoint *)greallocn(dots, dotsSize, + sizeof(SplashScreenPoint)); + } + dots[dotsLen++] = pts[i]; + for (yy = 0; yy <= r; ++yy) { + y0 = (y + yy) % size; + y1 = (y - yy + size) % size; + for (xx = 0; xx <= r; ++xx) { + if (tmpl[yy*(r+1) + xx]) { + x0 = (x + xx) % size; + x1 = (x - xx + size) % size; + grid[(y0 << log2Size) + x0] = 1; + grid[(y0 << log2Size) + x1] = 1; + grid[(y1 << log2Size) + x0] = 1; + grid[(y1 << log2Size) + x1] = 1; + } + } + } + } + } + + gfree(tmpl); + gfree(grid); + + // assign each cell to a dot, compute distance to center of dot + region = (int *)gmallocn(size * size, sizeof(int)); + dist = (int *)gmallocn(size * size, sizeof(int)); + for (y = 0; y < size; ++y) { + for (x = 0; x < size; ++x) { + iMin = 0; + dMin = distance(dots[0].x, dots[0].y, x, y); + for (i = 1; i < dotsLen; ++i) { + d = distance(dots[i].x, dots[i].y, x, y); + if (d < dMin) { + iMin = i; + dMin = d; + } + } + region[(y << log2Size) + x] = iMin; + dist[(y << log2Size) + x] = dMin; + } + } + + // compute threshold values + for (i = 0; i < dotsLen; ++i) { + n = 0; + for (y = 0; y < size; ++y) { + for (x = 0; x < size; ++x) { + if (region[(y << log2Size) + x] == i) { + pts[n].x = x; + pts[n].y = y; + pts[n].dist = distance(dots[i].x, dots[i].y, x, y); + ++n; + } + } + } + std::sort(pts, pts + n, cmpDistancesFunctor()); + for (j = 0; j < n; ++j) { + // map values in [0 .. n-1] --> [255 .. 1] + mat[(pts[j].y << log2Size) + pts[j].x] = 255 - (254 * j) / (n - 1); + } + } + + gfree(pts); + gfree(region); + gfree(dist); + + gfree(dots); +} + +SplashScreen::SplashScreen(SplashScreen *screen) { + screenParams = screen->screenParams; + size = screen->size; + sizeM1 = screen->sizeM1; + log2Size = screen->log2Size; + mat = (Guchar *)gmallocn(size * size, sizeof(Guchar)); + memcpy(mat, screen->mat, size * size * sizeof(Guchar)); + minVal = screen->minVal; + maxVal = screen->maxVal; +} + +SplashScreen::~SplashScreen() { + gfree(mat); +} diff --git a/Build/source/libs/poppler/poppler-0.25.0/splash/SplashScreen.h b/Build/source/libs/poppler/poppler-0.25.0/splash/SplashScreen.h new file mode 100644 index 00000000000..a7fc4559148 --- /dev/null +++ b/Build/source/libs/poppler/poppler-0.25.0/splash/SplashScreen.h @@ -0,0 +1,80 @@ +//======================================================================== +// +// SplashScreen.h +// +//======================================================================== + +//======================================================================== +// +// Modified under the Poppler project - http://poppler.freedesktop.org +// +// All changes made under the Poppler project to this file are licensed +// under GPL version 2 or later +// +// Copyright (C) 2009 Albert Astals Cid <aacid@kde.org> +// +// To see a description of the changes please see the Changelog file that +// came with your tarball or type make ChangeLog if you are building from git +// +//======================================================================== + +#ifndef SPLASHSCREEN_H +#define SPLASHSCREEN_H + +#ifdef USE_GCC_PRAGMAS +#pragma interface +#endif + +#include "SplashTypes.h" + +#include <stdlib.h> + +//------------------------------------------------------------------------ +// SplashScreen +//------------------------------------------------------------------------ + +class SplashScreen { +public: + + SplashScreen(SplashScreenParams *params); + SplashScreen(SplashScreen *screen); + ~SplashScreen(); + + SplashScreen *copy() { return new SplashScreen(this); } + + // Return the computed pixel value (0=black, 1=white) for the gray + // level <value> at (<x>, <y>). + int test(int x, int y, Guchar value) { + int xx, yy; + if (mat == NULL) createMatrix(); + xx = x & sizeM1; + yy = y & sizeM1; + return value < mat[(yy << log2Size) + xx] ? 0 : 1; + } + + // Returns true if value is above the white threshold or below the + // black threshold, i.e., if the corresponding halftone will be + // solid white or black. + GBool isStatic(Guchar value) { if (mat == NULL) createMatrix(); return value < minVal || value >= maxVal; } + +private: + void createMatrix(); + + void buildDispersedMatrix(int i, int j, int val, + int delta, int offset); + void buildClusteredMatrix(); + int distance(int x0, int y0, int x1, int y1); + void buildSCDMatrix(int r); + + SplashScreenParams *screenParams; // params to create the other members + Guchar *mat; // threshold matrix + int size; // size of the threshold matrix + int sizeM1; // size - 1 + int log2Size; // log2(size) + Guchar minVal; // any pixel value below minVal generates + // solid black + Guchar maxVal; // any pixel value above maxVal generates + // solid white +}; + +#endif diff --git a/Build/source/libs/poppler/poppler-0.25.0/splash/SplashState.cc b/Build/source/libs/poppler/poppler-0.25.0/splash/SplashState.cc new file mode 100644 index 00000000000..fd2789d02f9 --- /dev/null +++ b/Build/source/libs/poppler/poppler-0.25.0/splash/SplashState.cc @@ -0,0 +1,263 @@ +//======================================================================== +// +// SplashState.cc +// +//======================================================================== + +//======================================================================== +// +// Modified under the Poppler project - http://poppler.freedesktop.org +// +// All changes made under the Poppler project to this file are licensed +// under GPL version 2 or later +// +// Copyright (C) 2009, 2011, 2012 Thomas Freitag <Thomas.Freitag@alfa.de> +// +// To see a description of the changes please see the Changelog file that +// came with your tarball or type make ChangeLog if you are building from git +// +//======================================================================== + +#include <config.h> + +#ifdef USE_GCC_PRAGMAS +#pragma implementation +#endif + +#include <string.h> +#include "goo/gmem.h" +#include "SplashPattern.h" +#include "SplashScreen.h" +#include "SplashClip.h" +#include "SplashBitmap.h" +#include "SplashState.h" + +//------------------------------------------------------------------------ +// SplashState +//------------------------------------------------------------------------ + +// number of components in each color mode +int splashColorModeNComps[] = { + 1, 1, 3, 3, 4 +#if SPLASH_CMYK + , 4, 4 + SPOT_NCOMPS +#endif +}; + +SplashState::SplashState(int width, int height, GBool vectorAntialias, + SplashScreenParams *screenParams) { + SplashColor color; + int i; + + matrix[0] = 1; matrix[1] = 0; + matrix[2] = 0; matrix[3] = 1; + matrix[4] = 0; matrix[5] = 0; + memset(&color, 0, sizeof(SplashColor)); + strokePattern = new SplashSolidColor(color); + fillPattern = new SplashSolidColor(color); + screen = new SplashScreen(screenParams); + blendFunc = NULL; + strokeAlpha = 1; + fillAlpha = 1; + lineWidth = 0; + lineCap = splashLineCapButt; + lineJoin = splashLineJoinMiter; + miterLimit = 10; + flatness = 1; + lineDash = NULL; + lineDashLength = 0; + lineDashPhase = 0; + strokeAdjust = gFalse; + clip = new SplashClip(0, 0, width - 0.001, height - 0.001, vectorAntialias); + softMask = NULL; + deleteSoftMask = gFalse; + inNonIsolatedGroup = gFalse; + fillOverprint = gFalse; + strokeOverprint = gFalse; + overprintMode = 0; + for (i = 0; i < 256; ++i) { + rgbTransferR[i] = (Guchar)i; + rgbTransferG[i] = (Guchar)i; + rgbTransferB[i] = (Guchar)i; + grayTransfer[i] = (Guchar)i; +#if SPLASH_CMYK + cmykTransferC[i] = (Guchar)i; + cmykTransferM[i] = (Guchar)i; + cmykTransferY[i] = (Guchar)i; + cmykTransferK[i] = (Guchar)i; + for (int cp = 0; cp < SPOT_NCOMPS+4; cp++) + deviceNTransfer[cp][i] = (Guchar)i; +#endif + } + overprintMask = 0xffffffff; + overprintAdditive = gFalse; + next = NULL; +} + +SplashState::SplashState(int width, int height, GBool vectorAntialias, + SplashScreen *screenA) { + SplashColor color; + int i; + + matrix[0] = 1; matrix[1] = 0; + matrix[2] = 0; matrix[3] = 1; + matrix[4] = 0; matrix[5] = 0; + memset(&color, 0, sizeof(SplashColor)); + strokePattern = new SplashSolidColor(color); + fillPattern = new SplashSolidColor(color); + screen = screenA->copy(); + blendFunc = NULL; + strokeAlpha = 1; + fillAlpha = 1; + lineWidth = 0; + lineCap = splashLineCapButt; + lineJoin = splashLineJoinMiter; + miterLimit = 10; + flatness = 1; + lineDash = NULL; + lineDashLength = 0; + lineDashPhase = 0; + strokeAdjust = gFalse; + clip = new SplashClip(0, 0, width - 0.001, height - 0.001, vectorAntialias); + softMask = NULL; + deleteSoftMask = gFalse; + inNonIsolatedGroup = gFalse; + fillOverprint = gFalse; + strokeOverprint = gFalse; + overprintMode = 0; + for (i = 0; i < 256; ++i) { + rgbTransferR[i] = (Guchar)i; + rgbTransferG[i] = (Guchar)i; + rgbTransferB[i] = (Guchar)i; + grayTransfer[i] = (Guchar)i; +#if SPLASH_CMYK + cmykTransferC[i] = (Guchar)i; + cmykTransferM[i] = (Guchar)i; + cmykTransferY[i] = (Guchar)i; + cmykTransferK[i] = (Guchar)i; + for (int cp = 0; cp < SPOT_NCOMPS+4; cp++) + deviceNTransfer[cp][i] = (Guchar)i; +#endif + } + overprintMask = 0xffffffff; + overprintAdditive = gFalse; + next = NULL; +} + +SplashState::SplashState(SplashState *state) { + memcpy(matrix, state->matrix, 6 * sizeof(SplashCoord)); + strokePattern = state->strokePattern->copy(); + fillPattern = state->fillPattern->copy(); + screen = state->screen->copy(); + blendFunc = state->blendFunc; + strokeAlpha = state->strokeAlpha; + fillAlpha = state->fillAlpha; + lineWidth = state->lineWidth; + lineCap = state->lineCap; + lineJoin = state->lineJoin; + miterLimit = state->miterLimit; + flatness = state->flatness; + if (state->lineDash) { + lineDashLength = state->lineDashLength; + lineDash = (SplashCoord *)gmallocn(lineDashLength, sizeof(SplashCoord)); + memcpy(lineDash, state->lineDash, lineDashLength * sizeof(SplashCoord)); + } else { + lineDash = NULL; + lineDashLength = 0; + } + lineDashPhase = state->lineDashPhase; + strokeAdjust = state->strokeAdjust; + clip = state->clip->copy(); + softMask = state->softMask; + deleteSoftMask = gFalse; + inNonIsolatedGroup = state->inNonIsolatedGroup; + fillOverprint = state->fillOverprint; + strokeOverprint = state->strokeOverprint; + overprintMode = state->overprintMode; + memcpy(rgbTransferR, state->rgbTransferR, 256); + memcpy(rgbTransferG, state->rgbTransferG, 256); + memcpy(rgbTransferB, state->rgbTransferB, 256); + memcpy(grayTransfer, state->grayTransfer, 256); +#if SPLASH_CMYK + memcpy(cmykTransferC, state->cmykTransferC, 256); + memcpy(cmykTransferM, state->cmykTransferM, 256); + memcpy(cmykTransferY, state->cmykTransferY, 256); + memcpy(cmykTransferK, state->cmykTransferK, 256); + for (int cp = 0; cp < SPOT_NCOMPS+4; cp++) + memcpy(deviceNTransfer[cp], state->deviceNTransfer[cp], 256); +#endif + overprintMask = state->overprintMask; + overprintAdditive = state->overprintAdditive; + next = NULL; +} + +SplashState::~SplashState() { + delete strokePattern; + delete fillPattern; + delete screen; + gfree(lineDash); + delete clip; + if (deleteSoftMask && softMask) { + delete softMask; + } +} + +void SplashState::setStrokePattern(SplashPattern *strokePatternA) { + delete strokePattern; + strokePattern = strokePatternA; +} + +void SplashState::setFillPattern(SplashPattern *fillPatternA) { + delete fillPattern; + fillPattern = fillPatternA; +} + +void SplashState::setScreen(SplashScreen *screenA) { + delete screen; + screen = screenA; +} + +void SplashState::setLineDash(SplashCoord *lineDashA, int lineDashLengthA, + SplashCoord lineDashPhaseA) { + gfree(lineDash); + lineDashLength = lineDashLengthA; + if (lineDashLength > 0) { + lineDash = (SplashCoord *)gmallocn(lineDashLength, sizeof(SplashCoord)); + memcpy(lineDash, lineDashA, lineDashLength * sizeof(SplashCoord)); + } else { + lineDash = NULL; + } + lineDashPhase = lineDashPhaseA; +} + +void SplashState::setSoftMask(SplashBitmap *softMaskA) { + if (deleteSoftMask) { + delete softMask; + } + softMask = softMaskA; + deleteSoftMask = gTrue; +} + +void SplashState::setTransfer(Guchar *red, Guchar *green, Guchar *blue, + Guchar *gray) { +#if SPLASH_CMYK + int i; + + for (i = 0; i < 256; ++i) { + cmykTransferC[i] = 255 - rgbTransferR[255 - i]; + cmykTransferM[i] = 255 - rgbTransferG[255 - i]; + cmykTransferY[i] = 255 - rgbTransferB[255 - i]; + cmykTransferK[i] = 255 - grayTransfer[255 - i]; + } + for (i = 0; i < 256; ++i) { + deviceNTransfer[0][i] = 255 - rgbTransferR[255 - i]; + deviceNTransfer[1][i] = 255 - rgbTransferG[255 - i]; + deviceNTransfer[2][i] = 255 - rgbTransferB[255 - i]; + deviceNTransfer[3][i] = 255 - grayTransfer[255 - i]; + } +#endif + memcpy(rgbTransferR, red, 256); + memcpy(rgbTransferG, green, 256); + memcpy(rgbTransferB, blue, 256); + memcpy(grayTransfer, gray, 256); +} diff --git a/Build/source/libs/poppler/poppler-0.25.0/splash/SplashState.h b/Build/source/libs/poppler/poppler-0.25.0/splash/SplashState.h new file mode 100644 index 00000000000..2c603531cfd --- /dev/null +++ b/Build/source/libs/poppler/poppler-0.25.0/splash/SplashState.h @@ -0,0 +1,139 @@ +//======================================================================== +// +// SplashState.h +// +//======================================================================== + +//======================================================================== +// +// Modified under the Poppler project - http://poppler.freedesktop.org +// +// All changes made under the Poppler project to this file are licensed +// under GPL version 2 or later +// +// Copyright (C) 2011, 2012 Thomas Freitag <Thomas.Freitag@alfa.de> +// +// To see a description of the changes please see the Changelog file that +// came with your tarball or type make ChangeLog if you are building from git +// +//======================================================================== + +#ifndef SPLASHSTATE_H +#define SPLASHSTATE_H + +#ifdef USE_GCC_PRAGMAS +#pragma interface +#endif + +#include "SplashTypes.h" + +class SplashPattern; +class SplashScreen; +class SplashClip; +class SplashBitmap; + +//------------------------------------------------------------------------ +// line cap values +//------------------------------------------------------------------------ + +#define splashLineCapButt 0 +#define splashLineCapRound 1 +#define splashLineCapProjecting 2 + +//------------------------------------------------------------------------ +// line join values +//------------------------------------------------------------------------ + +#define splashLineJoinMiter 0 +#define splashLineJoinRound 1 +#define splashLineJoinBevel 2 + +//------------------------------------------------------------------------ +// SplashState +//------------------------------------------------------------------------ + +class SplashState { +public: + + // Create a new state object, initialized with default settings. + SplashState(int width, int height, GBool vectorAntialias, + SplashScreenParams *screenParams); + SplashState(int width, int height, GBool vectorAntialias, + SplashScreen *screenA); + + // Copy a state object. + SplashState *copy() { return new SplashState(this); } + + ~SplashState(); + + // Set the stroke pattern. This does not copy <strokePatternA>. + void setStrokePattern(SplashPattern *strokePatternA); + + // Set the fill pattern. This does not copy <fillPatternA>. + void setFillPattern(SplashPattern *fillPatternA); + + // Set the screen. This does not copy <screenA>. + void setScreen(SplashScreen *screenA); + + // Set the line dash pattern. This copies the <lineDashA> array. + void setLineDash(SplashCoord *lineDashA, int lineDashLengthA, + SplashCoord lineDashPhaseA); + + // Set the soft mask bitmap. + void setSoftMask(SplashBitmap *softMaskA); + + // Set the overprint parametes. + void setFillOverprint(GBool fillOverprintA) { fillOverprint = fillOverprintA; } + void setStrokeOverprint(GBool strokeOverprintA) { strokeOverprint = strokeOverprintA; } + void setOverprintMode(int overprintModeA) { overprintMode = overprintModeA; } + + // Set the transfer function. + void setTransfer(Guchar *red, Guchar *green, Guchar *blue, Guchar *gray); + +private: + + SplashState(SplashState *state); + + SplashCoord matrix[6]; + SplashPattern *strokePattern; + SplashPattern *fillPattern; + SplashScreen *screen; + SplashBlendFunc blendFunc; + SplashCoord strokeAlpha; + SplashCoord fillAlpha; + SplashCoord lineWidth; + int lineCap; + int lineJoin; + SplashCoord miterLimit; + SplashCoord flatness; + SplashCoord *lineDash; + int lineDashLength; + SplashCoord lineDashPhase; + GBool strokeAdjust; + SplashClip *clip; + SplashBitmap *softMask; + GBool deleteSoftMask; + GBool inNonIsolatedGroup; + GBool fillOverprint; + GBool strokeOverprint; + int overprintMode; + Guchar rgbTransferR[256], + rgbTransferG[256], + rgbTransferB[256]; + Guchar grayTransfer[256]; +#if SPLASH_CMYK + Guchar cmykTransferC[256], + cmykTransferM[256], + cmykTransferY[256], + cmykTransferK[256]; + Guchar deviceNTransfer[SPOT_NCOMPS+4][256]; +#endif + Guint overprintMask; + GBool overprintAdditive; + + SplashState *next; // used by Splash class + + friend class Splash; +}; + +#endif diff --git a/Build/source/libs/poppler/poppler-0.25.0/splash/SplashT1Font.cc b/Build/source/libs/poppler/poppler-0.25.0/splash/SplashT1Font.cc new file mode 100644 index 00000000000..0fdfaaf5150 --- /dev/null +++ b/Build/source/libs/poppler/poppler-0.25.0/splash/SplashT1Font.cc @@ -0,0 +1,309 @@ +//======================================================================== +// +// SplashT1Font.cc +// +//======================================================================== + +//======================================================================== +// +// Modified under the Poppler project - http://poppler.freedesktop.org +// +// All changes made under the Poppler project to this file are licensed +// under GPL version 2 or later +// +// Copyright (C) 2007 Albert Astals Cid <aacid@kde.org> +// +// To see a description of the changes please see the Changelog file that +// came with your tarball or type make ChangeLog if you are building from git +// +//======================================================================== + +#include <config.h> + +#if HAVE_T1LIB_H + +#ifdef USE_GCC_PRAGMAS +#pragma implementation +#endif + +#include <stdlib.h> +#include <t1lib.h> +#include "goo/gmem.h" +#include "SplashMath.h" +#include "SplashGlyphBitmap.h" +#include "SplashPath.h" +#include "SplashT1FontEngine.h" +#include "SplashT1FontFile.h" +#include "SplashT1Font.h" + +//------------------------------------------------------------------------ + +static Guchar bitReverse[256] = { + 0x00, 0x80, 0x40, 0xc0, 0x20, 0xa0, 0x60, 0xe0, + 0x10, 0x90, 0x50, 0xd0, 0x30, 0xb0, 0x70, 0xf0, + 0x08, 0x88, 0x48, 0xc8, 0x28, 0xa8, 0x68, 0xe8, + 0x18, 0x98, 0x58, 0xd8, 0x38, 0xb8, 0x78, 0xf8, + 0x04, 0x84, 0x44, 0xc4, 0x24, 0xa4, 0x64, 0xe4, + 0x14, 0x94, 0x54, 0xd4, 0x34, 0xb4, 0x74, 0xf4, + 0x0c, 0x8c, 0x4c, 0xcc, 0x2c, 0xac, 0x6c, 0xec, + 0x1c, 0x9c, 0x5c, 0xdc, 0x3c, 0xbc, 0x7c, 0xfc, + 0x02, 0x82, 0x42, 0xc2, 0x22, 0xa2, 0x62, 0xe2, + 0x12, 0x92, 0x52, 0xd2, 0x32, 0xb2, 0x72, 0xf2, + 0x0a, 0x8a, 0x4a, 0xca, 0x2a, 0xaa, 0x6a, 0xea, + 0x1a, 0x9a, 0x5a, 0xda, 0x3a, 0xba, 0x7a, 0xfa, + 0x06, 0x86, 0x46, 0xc6, 0x26, 0xa6, 0x66, 0xe6, + 0x16, 0x96, 0x56, 0xd6, 0x36, 0xb6, 0x76, 0xf6, + 0x0e, 0x8e, 0x4e, 0xce, 0x2e, 0xae, 0x6e, 0xee, + 0x1e, 0x9e, 0x5e, 0xde, 0x3e, 0xbe, 0x7e, 0xfe, + 0x01, 0x81, 0x41, 0xc1, 0x21, 0xa1, 0x61, 0xe1, + 0x11, 0x91, 0x51, 0xd1, 0x31, 0xb1, 0x71, 0xf1, + 0x09, 0x89, 0x49, 0xc9, 0x29, 0xa9, 0x69, 0xe9, + 0x19, 0x99, 0x59, 0xd9, 0x39, 0xb9, 0x79, 0xf9, + 0x05, 0x85, 0x45, 0xc5, 0x25, 0xa5, 0x65, 0xe5, + 0x15, 0x95, 0x55, 0xd5, 0x35, 0xb5, 0x75, 0xf5, + 0x0d, 0x8d, 0x4d, 0xcd, 0x2d, 0xad, 0x6d, 0xed, + 0x1d, 0x9d, 0x5d, 0xdd, 0x3d, 0xbd, 0x7d, 0xfd, + 0x03, 0x83, 0x43, 0xc3, 0x23, 0xa3, 0x63, 0xe3, + 0x13, 0x93, 0x53, 0xd3, 0x33, 0xb3, 0x73, 0xf3, + 0x0b, 0x8b, 0x4b, 0xcb, 0x2b, 0xab, 0x6b, 0xeb, + 0x1b, 0x9b, 0x5b, 0xdb, 0x3b, 0xbb, 0x7b, 0xfb, + 0x07, 0x87, 0x47, 0xc7, 0x27, 0xa7, 0x67, 0xe7, + 0x17, 0x97, 0x57, 0xd7, 0x37, 0xb7, 0x77, 0xf7, + 0x0f, 0x8f, 0x4f, 0xcf, 0x2f, 0xaf, 0x6f, 0xef, + 0x1f, 0x9f, 0x5f, 0xdf, 0x3f, 0xbf, 0x7f, 0xff +}; + +//------------------------------------------------------------------------ +// SplashT1Font +//------------------------------------------------------------------------ + +SplashT1Font::SplashT1Font(SplashT1FontFile *fontFileA, SplashCoord *matA, + SplashCoord *textMatA): + SplashFont(fontFileA, matA, textMatA, fontFileA->engine->aa) +{ + T1_TMATRIX matrix; + BBox bbox; + SplashCoord bbx0, bby0, bbx1, bby1; + int x, y; + + t1libID = T1_CopyFont(fontFileA->t1libID); + outlineID = -1; + + // compute font size + size = (float)splashDist(0, 0, mat[2], mat[3]); + + // transform the four corners of the font bounding box -- the min + // and max values form the bounding box of the transformed font + bbox = T1_GetFontBBox(t1libID); + bbx0 = 0.001 * bbox.llx; + bby0 = 0.001 * bbox.lly; + bbx1 = 0.001 * bbox.urx; + bby1 = 0.001 * bbox.ury; + // some fonts are completely broken, so we fake it (with values + // large enough that most glyphs should fit) + if (bbx0 == 0 && bby0 == 0 && bbx1 == 0 && bby1 == 0) { + bbx0 = bby0 = -0.5; + bbx1 = bby1 = 1.5; + } + x = (int)(mat[0] * bbx0 + mat[2] * bby0); + xMin = xMax = x; + y = (int)(mat[1] * bbx0 + mat[3] * bby0); + yMin = yMax = y; + x = (int)(mat[0] * bbx0 + mat[2] * bby1); + if (x < xMin) { + xMin = x; + } else if (x > xMax) { + xMax = x; + } + y = (int)(mat[1] * bbx0 + mat[3] * bby1); + if (y < yMin) { + yMin = y; + } else if (y > yMax) { + yMax = y; + } + x = (int)(mat[0] * bbx1 + mat[2] * bby0); + if (x < xMin) { + xMin = x; + } else if (x > xMax) { + xMax = x; + } + y = (int)(mat[1] * bbx1 + mat[3] * bby0); + if (y < yMin) { + yMin = y; + } else if (y > yMax) { + yMax = y; + } + x = (int)(mat[0] * bbx1 + mat[2] * bby1); + if (x < xMin) { + xMin = x; + } else if (x > xMax) { + xMax = x; + } + y = (int)(mat[1] * bbx1 + mat[3] * bby1); + if (y < yMin) { + yMin = y; + } else if (y > yMax) { + yMax = y; + } + // This is a kludge: some buggy PDF generators embed fonts with + // zero bounding boxes. + if (xMax == xMin) { + xMin = 0; + xMax = (int)size; + } + if (yMax == yMin) { + yMin = 0; + yMax = (int)(1.2 * size); + } + // Another kludge: an unusually large xMin or yMin coordinate is + // probably wrong. + if (xMin > 0) { + xMin = 0; + } + if (yMin > 0) { + yMin = 0; + } + // Another kludge: t1lib doesn't correctly handle fonts with + // real (non-integer) bounding box coordinates. + if (xMax - xMin > 5000) { + xMin = 0; + xMax = (int)size; + } + if (yMax - yMin > 5000) { + yMin = 0; + yMax = (int)(1.2 * size); + } + + // transform the font + matrix.cxx = (double)mat[0] / size; + matrix.cxy = (double)mat[1] / size; + matrix.cyx = (double)mat[2] / size; + matrix.cyy = (double)mat[3] / size; + T1_TransformFont(t1libID, &matrix); +} + +SplashT1Font::~SplashT1Font() { + T1_DeleteFont(t1libID); + if (outlineID >= 0) { + T1_DeleteFont(outlineID); + } +} + +GBool SplashT1Font::getGlyph(int c, int xFrac, int yFrac, + SplashGlyphBitmap *bitmap, int x0, int y0, SplashClip *clip, SplashClipResult *clipRes) { + return SplashFont::getGlyph(c, 0, 0, bitmap, x0, y0, clip, clipRes); +} + +GBool SplashT1Font::makeGlyph(int c, int xFrac, int yFrac, + SplashGlyphBitmap *bitmap, int x0, int y0, SplashClip *clip, SplashClipResult *clipRes) { + GLYPH *glyph; + int n, i; + + if (aa) { + glyph = T1_AASetChar(t1libID, c, size, NULL); + } else { + glyph = T1_SetChar(t1libID, c, size, NULL); + } + if (!glyph) { + return gFalse; + } + + bitmap->x = -glyph->metrics.leftSideBearing; + bitmap->y = glyph->metrics.ascent; + bitmap->w = glyph->metrics.rightSideBearing - glyph->metrics.leftSideBearing; + bitmap->h = glyph->metrics.ascent - glyph->metrics.descent; + bitmap->aa = aa; + if (aa) { + bitmap->data = (Guchar *)glyph->bits; + bitmap->freeData = gFalse; + } else { + n = bitmap->h * ((bitmap->w + 7) >> 3); + bitmap->data = (Guchar *)gmalloc(n); + for (i = 0; i < n; ++i) { + bitmap->data[i] = bitReverse[glyph->bits[i] & 0xff]; + } + bitmap->freeData = gTrue; + } + + *clipRes = clip->testRect(x0 - bitmap->x, + y0 - bitmap->y, + x0 - bitmap->x + bitmap->w - 1, + y0 - bitmap->y + bitmap->h - 1); + + return gTrue; +} + +SplashPath *SplashT1Font::getGlyphPath(int c) { + T1_TMATRIX matrix; + SplashPath *path; + T1_OUTLINE *outline; + T1_PATHSEGMENT *seg; + T1_BEZIERSEGMENT *bez; + int x, y, x1, y1; + GBool needClose; + + if (outlineID < 0) { + outlineID = T1_CopyFont(((SplashT1FontFile *)fontFile)->t1libID); + outlineSize = (float)splashDist(0, 0, textMat[2], textMat[3]); + matrix.cxx = (double)textMat[0] / outlineSize; + matrix.cxy = (double)textMat[1] / outlineSize; + matrix.cyx = (double)textMat[2] / outlineSize; + matrix.cyy = (double)textMat[3] / outlineSize; + // t1lib doesn't seem to handle small sizes correctly here, so set + // the size to 1000, and scale the resulting coordinates later + outlineMul = (float)(outlineSize / 65536000.0); + outlineSize = 1000; + T1_TransformFont(outlineID, &matrix); + } + + path = new SplashPath(); + if ((outline = T1_GetCharOutline(outlineID, c, outlineSize, NULL))) { + // NB: t1lib uses integer coordinates here; we keep a running + // (x,y) total as integers, so that the final point in the path is + // exactly the same as the first point, thus avoiding weird + // mitered join glitches + x = y = 0; + needClose = gFalse; + for (seg = outline; seg; seg = seg->link) { + switch (seg->type) { + case T1_PATHTYPE_MOVE: + if (needClose) { + path->close(); + needClose = gFalse; + } + x += seg->dest.x; + y += seg->dest.y; + path->moveTo(outlineMul * x, -outlineMul * y); + break; + case T1_PATHTYPE_LINE: + x += seg->dest.x; + y += seg->dest.y; + path->lineTo(outlineMul * x, -outlineMul * y); + needClose = gTrue; + break; + case T1_PATHTYPE_BEZIER: + bez = (T1_BEZIERSEGMENT *)seg; + x1 = x + bez->dest.x; + y1 = y + bez->dest.y; + path->curveTo(outlineMul * (x + bez->B.x), + -outlineMul * (y + bez->B.y), + outlineMul * (x + bez->C.x), + -outlineMul * (y + bez->C.y), + outlineMul * x1, + -outlineMul * y1); + x = x1; + y = y1; + needClose = gTrue; + break; + } + } + if (needClose) { + path->close(); + } + T1_FreeOutline(outline); + } + + return path; +} + +#endif // HAVE_T1LIB_H diff --git a/Build/source/libs/poppler/poppler-0.25.0/splash/SplashT1Font.h b/Build/source/libs/poppler/poppler-0.25.0/splash/SplashT1Font.h new file mode 100644 index 00000000000..1dbe66cd7fc --- /dev/null +++ b/Build/source/libs/poppler/poppler-0.25.0/splash/SplashT1Font.h @@ -0,0 +1,69 @@ +//======================================================================== +// +// SplashT1Font.h +// +//======================================================================== + +//======================================================================== +// +// Modified under the Poppler project - http://poppler.freedesktop.org +// +// All changes made under the Poppler project to this file are licensed +// under GPL version 2 or later +// +// Copyright (C) 2007 Albert Astals Cid <aacid@kde.org> +// +// To see a description of the changes please see the Changelog file that +// came with your tarball or type make ChangeLog if you are building from git +// +//======================================================================== + +#ifndef SPLASHT1FONT_H +#define SPLASHT1FONT_H + +#if HAVE_T1LIB_H + +#ifdef USE_GCC_PRAGMAS +#pragma interface +#endif + +#include "SplashFont.h" + +class SplashT1FontFile; + +//------------------------------------------------------------------------ +// SplashT1Font +//------------------------------------------------------------------------ + +class SplashT1Font: public SplashFont { +public: + + SplashT1Font(SplashT1FontFile *fontFileA, SplashCoord *matA, + SplashCoord *textMatA); + + virtual ~SplashT1Font(); + + // Munge xFrac and yFrac before calling SplashFont::getGlyph. + virtual GBool getGlyph(int c, int xFrac, int yFrac, + SplashGlyphBitmap *bitmap, int x0, int y0, SplashClip *clip, SplashClipResult *clipRes); + + // Rasterize a glyph. The <xFrac> and <yFrac> values are the same + // as described for getGlyph. + virtual GBool makeGlyph(int c, int xFrac, int yFrac, + SplashGlyphBitmap *bitmap, int x0, int y0, SplashClip *clip, SplashClipResult *clipRes); + + // Return the path for a glyph. + virtual SplashPath *getGlyphPath(int c); + +private: + + int t1libID; // t1lib font ID + int outlineID; // t1lib font ID for glyph outlines + float size; + float outlineSize; // size for glyph outlines + float outlineMul; +}; + +#endif // HAVE_T1LIB_H + +#endif diff --git a/Build/source/libs/poppler/poppler-0.25.0/splash/SplashT1FontEngine.cc b/Build/source/libs/poppler/poppler-0.25.0/splash/SplashT1FontEngine.cc new file mode 100644 index 00000000000..fb4b38dae88 --- /dev/null +++ b/Build/source/libs/poppler/poppler-0.25.0/splash/SplashT1FontEngine.cc @@ -0,0 +1,138 @@ +//======================================================================== +// +// SplashT1FontEngine.cc +// +//======================================================================== + +//======================================================================== +// +// Modified under the Poppler project - http://poppler.freedesktop.org +// +// All changes made under the Poppler project to this file are licensed +// under GPL version 2 or later +// +// Copyright (C) 2006 Takashi Iwai <tiwai@suse.de> +// Copyright (C) 2009 Albert Astals Cid <aacid@kde.org> +// +// To see a description of the changes please see the Changelog file that +// came with your tarball or type make ChangeLog if you are building from git +// +//======================================================================== + +#include <config.h> + +#if HAVE_T1LIB_H + +#ifdef USE_GCC_PRAGMAS +#pragma implementation +#endif + +#include <stdlib.h> +#include <stdio.h> +#ifdef HAVE_UNISTD_H +# include <unistd.h> +#endif +#include <t1lib.h> +#include "goo/GooString.h" +#include "goo/gfile.h" +#include "fofi/FoFiType1C.h" +#include "SplashT1FontFile.h" +#include "SplashT1FontEngine.h" + +#ifdef VMS +#if (__VMS_VER < 70000000) +extern "C" int unlink(char *filename); +#endif +#endif + +//------------------------------------------------------------------------ + +int SplashT1FontEngine::t1libInitCount = 0; + +//------------------------------------------------------------------------ + +static void fileWrite(void *stream, const char *data, int len) { + fwrite(data, 1, len, (FILE *)stream); +} + +//------------------------------------------------------------------------ +// SplashT1FontEngine +//------------------------------------------------------------------------ + +SplashT1FontEngine::SplashT1FontEngine(GBool aaA) { + aa = aaA; +} + +SplashT1FontEngine *SplashT1FontEngine::init(GBool aaA) { + // grayVals[i] = round(i * 255 / 16) + static unsigned long grayVals[17] = { + 0, 16, 32, 48, 64, 80, 96, 112, 128, 143, 159, 175, 191, 207, 223, 239, 255 + }; + + //~ for multithreading: need a mutex here + if (t1libInitCount == 0) { + T1_SetBitmapPad(8); + if (!T1_InitLib(NO_LOGFILE | IGNORE_CONFIGFILE | IGNORE_FONTDATABASE | + T1_NO_AFM)) { + return NULL; + } + if (aaA) { + T1_AASetBitsPerPixel(8); + T1_AASetLevel(T1_AA_HIGH); + T1_AAHSetGrayValues(grayVals); + } else { + T1_AANSetGrayValues(0, 1); + } + } + ++t1libInitCount; + + return new SplashT1FontEngine(aaA); +} + +SplashT1FontEngine::~SplashT1FontEngine() { + //~ for multithreading: need a mutex here + if (--t1libInitCount == 0) { + T1_CloseLib(); + } +} + +SplashFontFile *SplashT1FontEngine::loadType1Font(SplashFontFileID *idA, + SplashFontSrc *src, + const char **enc) { + return SplashT1FontFile::loadType1Font(this, idA, src, enc); +} + +SplashFontFile *SplashT1FontEngine::loadType1CFont(SplashFontFileID *idA, + SplashFontSrc *src, + const char **enc) { + FoFiType1C *ff; + GooString *tmpFileName; + FILE *tmpFile; + SplashFontFile *ret; + + SplashFontSrc *newsrc; + + if (src->isFile) + ff = FoFiType1C::load(src->fileName->getCString()); + else + ff = FoFiType1C::make(src->buf, src->bufLen); + if (! ff) + return NULL; + + tmpFileName = NULL; + if (!openTempFile(&tmpFileName, &tmpFile, "wb")) { + delete ff; + return NULL; + } + ff->convertToType1(NULL, NULL, gTrue, &fileWrite, tmpFile); + delete ff; + fclose(tmpFile); + newsrc = new SplashFontSrc; + newsrc->setFile(tmpFileName, gTrue); + delete tmpFileName; + ret = SplashT1FontFile::loadType1Font(this, idA, newsrc, enc); + newsrc->unref(); + return ret; +} + +#endif // HAVE_T1LIB_H diff --git a/Build/source/libs/poppler/poppler-0.25.0/splash/SplashT1FontEngine.h b/Build/source/libs/poppler/poppler-0.25.0/splash/SplashT1FontEngine.h new file mode 100644 index 00000000000..268a01479b0 --- /dev/null +++ b/Build/source/libs/poppler/poppler-0.25.0/splash/SplashT1FontEngine.h @@ -0,0 +1,50 @@ +//======================================================================== +// +// SplashT1FontEngine.h +// +//======================================================================== + +#ifndef SPLASHT1FONTENGINE_H +#define SPLASHT1FONTENGINE_H + +#if HAVE_T1LIB_H + +#ifdef USE_GCC_PRAGMAS +#pragma interface +#endif + +#include "goo/gtypes.h" + +class SplashFontFile; +class SplashFontFileID; +class SplashFontSrc; + +//------------------------------------------------------------------------ +// SplashT1FontEngine +//------------------------------------------------------------------------ + +class SplashT1FontEngine { +public: + + static SplashT1FontEngine *init(GBool aaA); + + ~SplashT1FontEngine(); + + // Load fonts. + SplashFontFile *loadType1Font(SplashFontFileID *idA, SplashFontSrc *src, const char **enc); + SplashFontFile *loadType1CFont(SplashFontFileID *idA, SplashFontSrc *src, const char **enc); + +private: + + SplashT1FontEngine(GBool aaA); + + static int t1libInitCount; + GBool aa; + + friend class SplashT1FontFile; + friend class SplashT1Font; +}; + +#endif // HAVE_T1LIB_H + +#endif diff --git a/Build/source/libs/poppler/poppler-0.25.0/splash/SplashT1FontFile.cc b/Build/source/libs/poppler/poppler-0.25.0/splash/SplashT1FontFile.cc new file mode 100644 index 00000000000..1832a916d9a --- /dev/null +++ b/Build/source/libs/poppler/poppler-0.25.0/splash/SplashT1FontFile.cc @@ -0,0 +1,134 @@ +//======================================================================== +// +// SplashT1FontFile.cc +// +//======================================================================== + +//======================================================================== +// +// Modified under the Poppler project - http://poppler.freedesktop.org +// +// All changes made under the Poppler project to this file are licensed +// under GPL version 2 or later +// +// Copyright (C) 2006 Takashi Iwai <tiwai@suse.de> +// Copyright (C) 2009 Albert Astals Cid <aacid@kde.org> +// +// To see a description of the changes please see the Changelog file that +// came with your tarball or type make ChangeLog if you are building from git +// +//======================================================================== + +#include <config.h> + +#if HAVE_T1LIB_H + +#ifdef USE_GCC_PRAGMAS +#pragma implementation +#endif + +#include <string.h> +#include <t1lib.h> +#include "goo/GooString.h" +#include "goo/gfile.h" +#include "goo/gmem.h" +#include "SplashT1FontEngine.h" +#include "SplashT1Font.h" +#include "SplashT1FontFile.h" + +//------------------------------------------------------------------------ +// SplashT1FontFile +//------------------------------------------------------------------------ + +SplashFontFile *SplashT1FontFile::loadType1Font(SplashT1FontEngine *engineA, + SplashFontFileID *idA, + SplashFontSrc *src, + const char **encA) { + int t1libIDA; + const char **encTmp; + char *encStrTmp; + int encStrSize; + char *encPtr; + int i; + + GooString *fileNameA; + SplashFontSrc *newsrc = NULL; + SplashFontFile *ff; + + if (! src->isFile) { + GooString *tmpFileName; + FILE *tmpFile; + if (!openTempFile(&tmpFileName, &tmpFile, "wb")) + return NULL; + fwrite(src->buf, 1, src->bufLen, tmpFile); + fclose(tmpFile); + newsrc = new SplashFontSrc; + newsrc->setFile(tmpFileName, gTrue); + src = newsrc; + delete tmpFileName; + } + fileNameA = src->fileName; + // load the font file + if ((t1libIDA = T1_AddFont(fileNameA->getCString())) < 0) { + delete newsrc; + return NULL; + } + T1_LoadFont(t1libIDA); + + // reencode it + encStrSize = 0; + for (i = 0; i < 256; ++i) { + if (encA[i]) { + encStrSize += strlen(encA[i]) + 1; + } + } + encTmp = (const char **)gmallocn(257, sizeof(char *)); + encStrTmp = (char *)gmallocn(encStrSize, sizeof(char)); + encPtr = encStrTmp; + for (i = 0; i < 256; ++i) { + if (encA[i]) { + strcpy(encPtr, encA[i]); + encTmp[i] = encPtr; + encPtr += strlen(encPtr) + 1; + } else { + encTmp[i] = ".notdef"; + } + } + encTmp[256] = "custom"; + T1_ReencodeFont(t1libIDA, (char **)encTmp); + + ff = new SplashT1FontFile(engineA, idA, src, + t1libIDA, encTmp, encStrTmp); + if (newsrc) + newsrc->unref(); + return ff; +} + +SplashT1FontFile::SplashT1FontFile(SplashT1FontEngine *engineA, + SplashFontFileID *idA, + SplashFontSrc *srcA, + int t1libIDA, const char **encA, char *encStrA): + SplashFontFile(idA, srcA) +{ + engine = engineA; + t1libID = t1libIDA; + enc = encA; + encStr = encStrA; +} + +SplashT1FontFile::~SplashT1FontFile() { + gfree(encStr); + gfree(enc); + T1_DeleteFont(t1libID); +} + +SplashFont *SplashT1FontFile::makeFont(SplashCoord *mat, + SplashCoord *textMat) { + SplashFont *font; + + font = new SplashT1Font(this, mat, textMat); + font->initCache(); + return font; +} + +#endif // HAVE_T1LIB_H diff --git a/Build/source/libs/poppler/poppler-0.25.0/splash/SplashT1FontFile.h b/Build/source/libs/poppler/poppler-0.25.0/splash/SplashT1FontFile.h new file mode 100644 index 00000000000..c094b6d8b29 --- /dev/null +++ b/Build/source/libs/poppler/poppler-0.25.0/splash/SplashT1FontFile.h @@ -0,0 +1,70 @@ +//======================================================================== +// +// SplashT1FontFile.h +// +//======================================================================== + +//======================================================================== +// +// Modified under the Poppler project - http://poppler.freedesktop.org +// +// All changes made under the Poppler project to this file are licensed +// under GPL version 2 or later +// +// Copyright (C) 2006 Takashi Iwai <tiwai@suse.de> +// +// To see a description of the changes please see the Changelog file that +// came with your tarball or type make ChangeLog if you are building from git +// +//======================================================================== + +#ifndef SPLASHT1FONTFILE_H +#define SPLASHT1FONTFILE_H + +#if HAVE_T1LIB_H + +#ifdef USE_GCC_PRAGMAS +#pragma interface +#endif + +#include "SplashFontFile.h" + +class SplashT1FontEngine; + +//------------------------------------------------------------------------ +// SplashT1FontFile +//------------------------------------------------------------------------ + +class SplashT1FontFile: public SplashFontFile { +public: + + static SplashFontFile *loadType1Font(SplashT1FontEngine *engineA, + SplashFontFileID *idA, + SplashFontSrc *src, + const char **encA); + + virtual ~SplashT1FontFile(); + + // Create a new SplashT1Font, i.e., a scaled instance of this font + // file. + virtual SplashFont *makeFont(SplashCoord *mat, + SplashCoord *textMat); + +private: + + SplashT1FontFile(SplashT1FontEngine *engineA, + SplashFontFileID *idA, + SplashFontSrc *src, + int t1libIDA, const char **encA, char *encStrA); + + SplashT1FontEngine *engine; + int t1libID; // t1lib font ID + const char **enc; + char *encStr; + + friend class SplashT1Font; +}; + +#endif // HAVE_T1LIB_H + +#endif diff --git a/Build/source/libs/poppler/poppler-0.25.0/splash/SplashTypes.h b/Build/source/libs/poppler/poppler-0.25.0/splash/SplashTypes.h new file mode 100644 index 00000000000..5ea816007f8 --- /dev/null +++ b/Build/source/libs/poppler/poppler-0.25.0/splash/SplashTypes.h @@ -0,0 +1,199 @@ +//======================================================================== +// +// SplashTypes.h +// +//======================================================================== + +//======================================================================== +// +// Modified under the Poppler project - http://poppler.freedesktop.org +// +// All changes made under the Poppler project to this file are licensed +// under GPL version 2 or later +// +// Copyright (C) 2006, 2010 Albert Astals Cid <aacid@kde.org> +// Copyright (C) 2008 Tomas Are Haavet <tomasare@gmail.com> +// Copyright (C) 2009, 2011-2013 Thomas Freitag <Thomas.Freitag@alfa.de> +// Copyright (C) 2009 Stefan Thomas <thomas@eload24.com> +// Copyright (C) 2010 William Bader <williambader@hotmail.com> +// +// To see a description of the changes please see the Changelog file that +// came with your tarball or type make ChangeLog if you are building from git +// +//======================================================================== + +#ifndef SPLASHTYPES_H +#define SPLASHTYPES_H + +#include "goo/gtypes.h" + +//------------------------------------------------------------------------ +// coordinates +//------------------------------------------------------------------------ + +#if USE_FIXEDPOINT +#include "goo/FixedPoint.h" +typedef FixedPoint SplashCoord; +#elif USE_FLOAT +typedef float SplashCoord; +#else +typedef double SplashCoord; +#endif + +//------------------------------------------------------------------------ +// antialiasing +//------------------------------------------------------------------------ + +#define splashAASize 4 + +#ifndef SPOT_NCOMPS +#define SPOT_NCOMPS 4 +#endif + +//------------------------------------------------------------------------ +// colors +//------------------------------------------------------------------------ + +enum SplashColorMode { + splashModeMono1, // 1 bit per component, 8 pixels per byte, + // MSbit is on the left + splashModeMono8, // 1 byte per component, 1 byte per pixel + splashModeRGB8, // 1 byte per component, 3 bytes per pixel: + // RGBRGB... + splashModeBGR8, // 1 byte per component, 3 bytes per pixel: + // BGRBGR... + splashModeXBGR8 // 1 byte per component, 4 bytes per pixel: + // XBGRXBGR... +#if SPLASH_CMYK + , + splashModeCMYK8, // 1 byte per component, 4 bytes per pixel: + // CMYKCMYK... + splashModeDeviceN8 // 1 byte per component, + // 4 bytes + n bytes spot colors per pixel: + // CMYKSSSSCMYKSSSS... +#endif +}; + +enum SplashThinLineMode { + splashThinLineDefault, // if SA on: draw solid if requested line width, transformed into + // device space, is less than half a pixel and a shaped line else + splashThinLineSolid, // draw line solid at least with 1 pixel + splashThinLineShape // draw line shaped at least with 1 pixel +}; +// number of components in each color mode +// (defined in SplashState.cc) +extern int splashColorModeNComps[]; + +// max number of components in any SplashColor +#if SPLASH_CMYK +#define splashMaxColorComps SPOT_NCOMPS+4 +#else +#define splashMaxColorComps 4 +#endif + +typedef Guchar SplashColor[splashMaxColorComps]; +typedef Guchar *SplashColorPtr; + +// RGB8 +static inline Guchar splashRGB8R(SplashColorPtr rgb8) { return rgb8[0]; } +static inline Guchar splashRGB8G(SplashColorPtr rgb8) { return rgb8[1]; } +static inline Guchar splashRGB8B(SplashColorPtr rgb8) { return rgb8[2]; } + +// BGR8 +static inline Guchar splashBGR8R(SplashColorPtr bgr8) { return bgr8[2]; } +static inline Guchar splashBGR8G(SplashColorPtr bgr8) { return bgr8[1]; } +static inline Guchar splashBGR8B(SplashColorPtr bgr8) { return bgr8[0]; } + +#if SPLASH_CMYK +// CMYK8 +static inline Guchar splashCMYK8C(SplashColorPtr cmyk8) { return cmyk8[0]; } +static inline Guchar splashCMYK8M(SplashColorPtr cmyk8) { return cmyk8[1]; } +static inline Guchar splashCMYK8Y(SplashColorPtr cmyk8) { return cmyk8[2]; } +static inline Guchar splashCMYK8K(SplashColorPtr cmyk8) { return cmyk8[3]; } + +// DEVICEN8 +static inline Guchar splashDeviceN8C(SplashColorPtr deviceN8) { return deviceN8[0]; } +static inline Guchar splashDeviceN8M(SplashColorPtr deviceN8) { return deviceN8[1]; } +static inline Guchar splashDeviceN8Y(SplashColorPtr deviceN8) { return deviceN8[2]; } +static inline Guchar splashDeviceN8K(SplashColorPtr deviceN8) { return deviceN8[3]; } +static inline Guchar splashDeviceN8S(SplashColorPtr deviceN8, int nSpot) { return deviceN8[4 + nSpot]; } +#endif + +static inline void splashClearColor(SplashColorPtr dest) { + dest[0] = 0; + dest[1] = 0; + dest[2] = 0; +#if SPLASH_CMYK + dest[3] = 0; + for (int i = SPOT_NCOMPS; i < SPOT_NCOMPS + 4; i++) + dest[i] = 0; +#endif +} + +static inline void splashColorCopy(SplashColorPtr dest, SplashColorPtr src) { + dest[0] = src[0]; + dest[1] = src[1]; + dest[2] = src[2]; +#if SPLASH_CMYK + dest[3] = src[3]; + for (int i = SPOT_NCOMPS; i < SPOT_NCOMPS + 4; i++) + dest[i] = src[i]; +#endif +} + +static inline void splashColorXor(SplashColorPtr dest, SplashColorPtr src) { + dest[0] ^= src[0]; + dest[1] ^= src[1]; + dest[2] ^= src[2]; +#if SPLASH_CMYK + dest[3] ^= src[3]; + for (int i = SPOT_NCOMPS; i < SPOT_NCOMPS + 4; i++) + dest[i] ^= src[i]; +#endif +} + +//------------------------------------------------------------------------ +// blend functions +//------------------------------------------------------------------------ + +typedef void (*SplashBlendFunc)(SplashColorPtr src, SplashColorPtr dest, + SplashColorPtr blend, SplashColorMode cm); + +//------------------------------------------------------------------------ +// screen parameters +//------------------------------------------------------------------------ + +enum SplashScreenType { + splashScreenDispersed, + splashScreenClustered, + splashScreenStochasticClustered +}; + +struct SplashScreenParams { + SplashScreenType type; + int size; + int dotRadius; + SplashCoord gamma; + SplashCoord blackThreshold; + SplashCoord whiteThreshold; +}; + +//------------------------------------------------------------------------ +// error results +//------------------------------------------------------------------------ + +typedef int SplashError; + + +//------------------------------------------------------------------------ +// image file formats +//------------------------------------------------------------------------ + +enum SplashImageFileFormat { + splashFormatJpeg, + splashFormatPng, + splashFormatTiff, + splashFormatJpegCMYK +}; + +#endif diff --git a/Build/source/libs/poppler/poppler-0.25.0/splash/SplashXPath.cc b/Build/source/libs/poppler/poppler-0.25.0/splash/SplashXPath.cc new file mode 100644 index 00000000000..27106ee3d14 --- /dev/null +++ b/Build/source/libs/poppler/poppler-0.25.0/splash/SplashXPath.cc @@ -0,0 +1,472 @@ +//======================================================================== +// +// SplashXPath.cc +// +//======================================================================== + +//======================================================================== +// +// Modified under the Poppler project - http://poppler.freedesktop.org +// +// All changes made under the Poppler project to this file are licensed +// under GPL version 2 or later +// +// Copyright (C) 2010 PaweÅ‚ Wiejacha <pawel.wiejacha@gmail.com> +// Copyright (C) 2010, 2011 Albert Astals Cid <aacid@kde.org> +// Copyright (C) 2013 Thomas Freitag <Thomas.Freitag@alfa.de> +// +// To see a description of the changes please see the Changelog file that +// came with your tarball or type make ChangeLog if you are building from git +// +//======================================================================== + +#include <config.h> + +#ifdef USE_GCC_PRAGMAS +#pragma implementation +#endif + +#include <stdlib.h> +#include <string.h> +#include <algorithm> +#include "goo/gmem.h" +#include "SplashMath.h" +#include "SplashPath.h" +#include "SplashXPath.h" + +//------------------------------------------------------------------------ + +struct SplashXPathPoint { + SplashCoord x, y; +}; + +struct SplashXPathAdjust { + int firstPt, lastPt; // range of points + GBool vert; // vertical or horizontal hint + SplashCoord x0a, x0b, // hint boundaries + xma, xmb, + x1a, x1b; + SplashCoord x0, x1, xm; // adjusted coordinates +}; + +//------------------------------------------------------------------------ + +// Transform a point from user space to device space. +inline void SplashXPath::transform(SplashCoord *matrix, + SplashCoord xi, SplashCoord yi, + SplashCoord *xo, SplashCoord *yo) { + // [ m[0] m[1] 0 ] + // [xo yo 1] = [xi yi 1] * [ m[2] m[3] 0 ] + // [ m[4] m[5] 1 ] + *xo = xi * matrix[0] + yi * matrix[2] + matrix[4]; + *yo = xi * matrix[1] + yi * matrix[3] + matrix[5]; +} + +//------------------------------------------------------------------------ +// SplashXPath +//------------------------------------------------------------------------ + +SplashXPath::SplashXPath(SplashPath *path, SplashCoord *matrix, + SplashCoord flatness, GBool closeSubpaths, + GBool adjustLines, int linePosI) { + SplashPathHint *hint; + SplashXPathPoint *pts; + SplashXPathAdjust *adjusts, *adjust; + SplashCoord x0, y0, x1, y1, x2, y2, x3, y3, xsp, ysp; + SplashCoord adj0, adj1; + int curSubpath, i, j; + + // transform the points + pts = (SplashXPathPoint *)gmallocn(path->length, sizeof(SplashXPathPoint)); + for (i = 0; i < path->length; ++i) { + transform(matrix, path->pts[i].x, path->pts[i].y, &pts[i].x, &pts[i].y); + } + + // set up the stroke adjustment hints + if (path->hints) { + adjusts = (SplashXPathAdjust *)gmallocn(path->hintsLength, + sizeof(SplashXPathAdjust)); + for (i = 0; i < path->hintsLength; ++i) { + hint = &path->hints[i]; + if (hint->ctrl0 + 1 >= path->length || hint->ctrl1 + 1 >= path->length) { + gfree(adjusts); + adjusts = NULL; + break; + } + x0 = pts[hint->ctrl0 ].x; y0 = pts[hint->ctrl0 ].y; + x1 = pts[hint->ctrl0 + 1].x; y1 = pts[hint->ctrl0 + 1].y; + x2 = pts[hint->ctrl1 ].x; y2 = pts[hint->ctrl1 ].y; + x3 = pts[hint->ctrl1 + 1].x; y3 = pts[hint->ctrl1 + 1].y; + if (x0 == x1 && x2 == x3) { + adjusts[i].vert = gTrue; + adj0 = x0; + adj1 = x2; + } else if (y0 == y1 && y2 == y3) { + adjusts[i].vert = gFalse; + adj0 = y0; + adj1 = y2; + } else { + gfree(adjusts); + adjusts = NULL; + break; + } + if (adj0 > adj1) { + x0 = adj0; + adj0 = adj1; + adj1 = x0; + } + adjusts[i].x0a = adj0 - 0.01; + adjusts[i].x0b = adj0 + 0.01; + adjusts[i].xma = (SplashCoord)0.5 * (adj0 + adj1) - 0.01; + adjusts[i].xmb = (SplashCoord)0.5 * (adj0 + adj1) + 0.01; + adjusts[i].x1a = adj1 - 0.01; + adjusts[i].x1b = adj1 + 0.01; + // rounding both edge coordinates can result in lines of + // different widths (e.g., adj=10.1, adj1=11.3 --> x0=10, x1=11; + // adj0=10.4, adj1=11.6 --> x0=10, x1=12), but it has the + // benefit of making adjacent strokes/fills line up without any + // gaps between them + x0 = splashRound(adj0); + x1 = splashRound(adj1); + if (x1 == x0) { + if (adjustLines) { + // the adjustment moves thin lines (clip rectangle with + // empty width or height) out of clip area, here we need + // a special adjustment: + x0 = linePosI; + x1 = x0 + 1; + } else { + x1 = x1 + 1; + } + } + adjusts[i].x0 = (SplashCoord)x0; + adjusts[i].x1 = (SplashCoord)x1 - 0.01; + adjusts[i].xm = (SplashCoord)0.5 * (adjusts[i].x0 + adjusts[i].x1); + adjusts[i].firstPt = hint->firstPt; + adjusts[i].lastPt = hint->lastPt; + } + + } else { + adjusts = NULL; + } + + // perform stroke adjustment + if (adjusts) { + for (i = 0, adjust = adjusts; i < path->hintsLength; ++i, ++adjust) { + for (j = adjust->firstPt; j <= adjust->lastPt; ++j) { + strokeAdjust(adjust, &pts[j].x, &pts[j].y); + } + } + gfree(adjusts); + } + + segs = NULL; + length = size = 0; + + x0 = y0 = xsp = ysp = 0; // make gcc happy + adj0 = adj1 = 0; // make gcc happy + curSubpath = 0; + i = 0; + while (i < path->length) { + + // first point in subpath - skip it + if (path->flags[i] & splashPathFirst) { + x0 = pts[i].x; + y0 = pts[i].y; + xsp = x0; + ysp = y0; + curSubpath = i; + ++i; + + } else { + + // curve segment + if (path->flags[i] & splashPathCurve) { + x1 = pts[i].x; + y1 = pts[i].y; + x2 = pts[i+1].x; + y2 = pts[i+1].y; + x3 = pts[i+2].x; + y3 = pts[i+2].y; + addCurve(x0, y0, x1, y1, x2, y2, x3, y3, + flatness, + (path->flags[i-1] & splashPathFirst), + (path->flags[i+2] & splashPathLast), + !closeSubpaths && + (path->flags[i-1] & splashPathFirst) && + !(path->flags[i-1] & splashPathClosed), + !closeSubpaths && + (path->flags[i+2] & splashPathLast) && + !(path->flags[i+2] & splashPathClosed)); + x0 = x3; + y0 = y3; + i += 3; + + // line segment + } else { + x1 = pts[i].x; + y1 = pts[i].y; + addSegment(x0, y0, x1, y1); + x0 = x1; + y0 = y1; + ++i; + } + + // close a subpath + if (closeSubpaths && + (path->flags[i-1] & splashPathLast) && + (pts[i-1].x != pts[curSubpath].x || + pts[i-1].y != pts[curSubpath].y)) { + addSegment(x0, y0, xsp, ysp); + } + } + } + + gfree(pts); +} + +// Apply the stroke adjust hints to point <pt>: (*<xp>, *<yp>). +void SplashXPath::strokeAdjust(SplashXPathAdjust *adjust, + SplashCoord *xp, SplashCoord *yp) { + SplashCoord x, y; + + if (adjust->vert) { + x = *xp; + if (x > adjust->x0a && x < adjust->x0b) { + *xp = adjust->x0; + } else if (x > adjust->xma && x < adjust->xmb) { + *xp = adjust->xm; + } else if (x > adjust->x1a && x < adjust->x1b) { + *xp = adjust->x1; + } + } else { + y = *yp; + if (y > adjust->x0a && y < adjust->x0b) { + *yp = adjust->x0; + } else if (y > adjust->xma && y < adjust->xmb) { + *yp = adjust->xm; + } else if (y > adjust->x1a && y < adjust->x1b) { + *yp = adjust->x1; + } + } +} + +SplashXPath::SplashXPath(SplashXPath *xPath) { + length = xPath->length; + size = xPath->size; + segs = (SplashXPathSeg *)gmallocn(size, sizeof(SplashXPathSeg)); + memcpy(segs, xPath->segs, length * sizeof(SplashXPathSeg)); +} + +SplashXPath::~SplashXPath() { + gfree(segs); +} + +// Add space for <nSegs> more segments +void SplashXPath::grow(int nSegs) { + if (length + nSegs > size) { + if (size == 0) { + size = 32; + } + while (size < length + nSegs) { + size *= 2; + } + segs = (SplashXPathSeg *)greallocn(segs, size, sizeof(SplashXPathSeg)); + } +} + +void SplashXPath::addCurve(SplashCoord x0, SplashCoord y0, + SplashCoord x1, SplashCoord y1, + SplashCoord x2, SplashCoord y2, + SplashCoord x3, SplashCoord y3, + SplashCoord flatness, + GBool first, GBool last, GBool end0, GBool end1) { + SplashCoord *cx = new SplashCoord[(splashMaxCurveSplits + 1) * 3]; + SplashCoord *cy = new SplashCoord[(splashMaxCurveSplits + 1) * 3]; + int *cNext = new int[splashMaxCurveSplits + 1]; + SplashCoord xl0, xl1, xl2, xr0, xr1, xr2, xr3, xx1, xx2, xh; + SplashCoord yl0, yl1, yl2, yr0, yr1, yr2, yr3, yy1, yy2, yh; + SplashCoord dx, dy, mx, my, d1, d2, flatness2; + int p1, p2, p3; + +#if USE_FIXEDPOINT + flatness2 = flatness; +#else + flatness2 = flatness * flatness; +#endif + + // initial segment + p1 = 0; + p2 = splashMaxCurveSplits; + + *(cx + p1 * 3 + 0) = x0; + *(cx + p1 * 3 + 1) = x1; + *(cx + p1 * 3 + 2) = x2; + *(cx + p2 * 3 + 0) = x3; + + *(cy + p1 * 3 + 0) = y0; + *(cy + p1 * 3 + 1) = y1; + *(cy + p1 * 3 + 2) = y2; + *(cy + p2 * 3 + 0) = y3; + + *(cNext + p1) = p2; + + while (p1 < splashMaxCurveSplits) { + + // get the next segment + xl0 = *(cx + p1 * 3 + 0); + xx1 = *(cx + p1 * 3 + 1); + xx2 = *(cx + p1 * 3 + 2); + + yl0 = *(cy + p1 * 3 + 0); + yy1 = *(cy + p1 * 3 + 1); + yy2 = *(cy + p1 * 3 + 2); + + p2 = *(cNext + p1); + + xr3 = *(cx + p2 * 3 + 0); + yr3 = *(cy + p2 * 3 + 0); + + // compute the distances from the control points to the + // midpoint of the straight line (this is a bit of a hack, but + // it's much faster than computing the actual distances to the + // line) + mx = (xl0 + xr3) * 0.5; + my = (yl0 + yr3) * 0.5; +#if USE_FIXEDPOINT + d1 = splashDist(xx1, yy1, mx, my); + d2 = splashDist(xx2, yy2, mx, my); +#else + dx = xx1 - mx; + dy = yy1 - my; + d1 = dx*dx + dy*dy; + dx = xx2 - mx; + dy = yy2 - my; + d2 = dx*dx + dy*dy; +#endif + + // if the curve is flat enough, or no more subdivisions are + // allowed, add the straight line segment + if (p2 - p1 == 1 || (d1 <= flatness2 && d2 <= flatness2)) { + addSegment(xl0, yl0, xr3, yr3); + p1 = p2; + + // otherwise, subdivide the curve + } else { + xl1 = (xl0 + xx1) * 0.5; + yl1 = (yl0 + yy1) * 0.5; + xh = (xx1 + xx2) * 0.5; + yh = (yy1 + yy2) * 0.5; + xl2 = (xl1 + xh) * 0.5; + yl2 = (yl1 + yh) * 0.5; + xr2 = (xx2 + xr3) * 0.5; + yr2 = (yy2 + yr3) * 0.5; + xr1 = (xh + xr2) * 0.5; + yr1 = (yh + yr2) * 0.5; + xr0 = (xl2 + xr1) * 0.5; + yr0 = (yl2 + yr1) * 0.5; + // add the new subdivision points + p3 = (p1 + p2) / 2; + + *(cx + p1 * 3 + 1) = xl1; + *(cx + p1 * 3 + 2) = xl2; + + *(cy + p1 * 3 + 1) = yl1; + *(cy + p1 * 3 + 2) = yl2; + + *(cNext + p1) = p3; + + *(cx + p3 * 3 + 0) = xr0; + *(cx + p3 * 3 + 1) = xr1; + *(cx + p3 * 3 + 2) = xr2; + + *(cy + p3 * 3 + 0) = yr0; + *(cy + p3 * 3 + 1) = yr1; + *(cy + p3 * 3 + 2) = yr2; + + *(cNext + p3) = p2; + } + } + + delete [] cx; + delete [] cy; + delete [] cNext; +} + +void SplashXPath::addSegment(SplashCoord x0, SplashCoord y0, + SplashCoord x1, SplashCoord y1) { + grow(1); + segs[length].x0 = x0; + segs[length].y0 = y0; + segs[length].x1 = x1; + segs[length].y1 = y1; + segs[length].flags = 0; + if (y1 == y0) { + segs[length].dxdy = segs[length].dydx = 0; + segs[length].flags |= splashXPathHoriz; + if (x1 == x0) { + segs[length].flags |= splashXPathVert; + } + } else if (x1 == x0) { + segs[length].dxdy = segs[length].dydx = 0; + segs[length].flags |= splashXPathVert; + } else { +#if USE_FIXEDPOINT + if (FixedPoint::divCheck(x1 - x0, y1 - y0, &segs[length].dxdy)) { + segs[length].dydx = (SplashCoord)1 / segs[length].dxdy; + } else { + segs[length].dxdy = segs[length].dydx = 0; + if (splashAbs(x1 - x0) > splashAbs(y1 - y0)) { + segs[length].flags |= splashXPathHoriz; + } else { + segs[length].flags |= splashXPathVert; + } + } +#else + segs[length].dxdy = (x1 - x0) / (y1 - y0); + segs[length].dydx = (SplashCoord)1 / segs[length].dxdy; +#endif + } + if (y0 > y1) { + segs[length].flags |= splashXPathFlip; + } + ++length; +} + +struct cmpXPathSegsFunctor { + bool operator()(const SplashXPathSeg &seg0, const SplashXPathSeg &seg1) { + SplashCoord x0, y0, x1, y1; + + if (seg0.flags & splashXPathFlip) { + x0 = seg0.x1; + y0 = seg0.y1; + } else { + x0 = seg0.x0; + y0 = seg0.y0; + } + if (seg1.flags & splashXPathFlip) { + x1 = seg1.x1; + y1 = seg1.y1; + } else { + x1 = seg1.x0; + y1 = seg1.y0; + } + return (y0 != y1) ? (y0 < y1) : (x0 < x1); + } +}; + +void SplashXPath::aaScale() { + SplashXPathSeg *seg; + int i; + + for (i = 0, seg = segs; i < length; ++i, ++seg) { + seg->x0 *= splashAASize; + seg->y0 *= splashAASize; + seg->x1 *= splashAASize; + seg->y1 *= splashAASize; + } +} + +void SplashXPath::sort() { + std::sort(segs, segs + length, cmpXPathSegsFunctor()); +} diff --git a/Build/source/libs/poppler/poppler-0.25.0/splash/SplashXPath.h b/Build/source/libs/poppler/poppler-0.25.0/splash/SplashXPath.h new file mode 100644 index 00000000000..1c7040daa23 --- /dev/null +++ b/Build/source/libs/poppler/poppler-0.25.0/splash/SplashXPath.h @@ -0,0 +1,107 @@ +//======================================================================== +// +// SplashXPath.h +// +//======================================================================== + +//======================================================================== +// +// Modified under the Poppler project - http://poppler.freedesktop.org +// +// All changes made under the Poppler project to this file are licensed +// under GPL version 2 or later +// +// Copyright (C) 2013 Thomas Freitag <Thomas.Freitag@alfa.de> +// +// To see a description of the changes please see the Changelog file that +// came with your tarball or type make ChangeLog if you are building from git +// +//======================================================================== + +#ifndef SPLASHXPATH_H +#define SPLASHXPATH_H + +#ifdef USE_GCC_PRAGMAS +#pragma interface +#endif + +#include "SplashTypes.h" + +class SplashPath; +struct SplashXPathAdjust; + +//------------------------------------------------------------------------ + +#define splashMaxCurveSplits (1 << 10) + +//------------------------------------------------------------------------ +// SplashXPathSeg +//------------------------------------------------------------------------ + +struct SplashXPathSeg { + SplashCoord x0, y0; // first endpoint + SplashCoord x1, y1; // second endpoint + SplashCoord dxdy; // slope: delta-x / delta-y + SplashCoord dydx; // slope: delta-y / delta-x + Guint flags; +}; + +#define splashXPathHoriz 0x01 // segment is vertical (y0 == y1) + // (dxdy is undef) +#define splashXPathVert 0x02 // segment is horizontal (x0 == x1) + // (dydx is undef) +#define splashXPathFlip 0x04 // y0 > y1 + +//------------------------------------------------------------------------ +// SplashXPath +//------------------------------------------------------------------------ + +class SplashXPath { +public: + + // Expands (converts to segments) and flattens (converts curves to + // lines) <path>. Transforms all points from user space to device + // space, via <matrix>. If <closeSubpaths> is true, closes all open + // subpaths. + SplashXPath(SplashPath *path, SplashCoord *matrix, + SplashCoord flatness, GBool closeSubpaths, + GBool adjustLines = gFalse, int linePosI = 0); + + // Copy an expanded path. + SplashXPath *copy() { return new SplashXPath(this); } + + ~SplashXPath(); + + // Multiply all coordinates by splashAASize, in preparation for + // anti-aliased rendering. + void aaScale(); + + // Sort by upper coordinate (lower y), in y-major order. + void sort(); + +protected: + + SplashXPath(SplashXPath *xPath); + void transform(SplashCoord *matrix, SplashCoord xi, SplashCoord yi, + SplashCoord *xo, SplashCoord *yo); + void strokeAdjust(SplashXPathAdjust *adjust, + SplashCoord *xp, SplashCoord *yp); + void grow(int nSegs); + void addCurve(SplashCoord x0, SplashCoord y0, + SplashCoord x1, SplashCoord y1, + SplashCoord x2, SplashCoord y2, + SplashCoord x3, SplashCoord y3, + SplashCoord flatness, + GBool first, GBool last, GBool end0, GBool end1); + void addSegment(SplashCoord x0, SplashCoord y0, + SplashCoord x1, SplashCoord y1); + + SplashXPathSeg *segs; + int length, size; // length and size of segs array + + friend class SplashXPathScanner; + friend class SplashClip; + friend class Splash; +}; + +#endif diff --git a/Build/source/libs/poppler/poppler-0.25.0/splash/SplashXPathScanner.cc b/Build/source/libs/poppler/poppler-0.25.0/splash/SplashXPathScanner.cc new file mode 100644 index 00000000000..0fd5ccdc59d --- /dev/null +++ b/Build/source/libs/poppler/poppler-0.25.0/splash/SplashXPathScanner.cc @@ -0,0 +1,535 @@ +//======================================================================== +// +// SplashXPathScanner.cc +// +//======================================================================== + +//======================================================================== +// +// Modified under the Poppler project - http://poppler.freedesktop.org +// +// All changes made under the Poppler project to this file are licensed +// under GPL version 2 or later +// +// Copyright (C) 2008, 2010 Albert Astals Cid <aacid@kde.org> +// Copyright (C) 2010 PaweÅ‚ Wiejacha <pawel.wiejacha@gmail.com> +// Copyright (C) 2013 Thomas Freitag <Thomas.Freitag@alfa.de> +// +// To see a description of the changes please see the Changelog file that +// came with your tarball or type make ChangeLog if you are building from git +// +//======================================================================== + +#include <config.h> + +#ifdef USE_GCC_PRAGMAS +#pragma implementation +#endif + +#include <stdlib.h> +#include <string.h> +#include <algorithm> +#include "goo/gmem.h" +#include "SplashMath.h" +#include "SplashXPath.h" +#include "SplashBitmap.h" +#include "SplashXPathScanner.h" + +//------------------------------------------------------------------------ + +struct SplashIntersect { + int y; + int x0, x1; // intersection of segment with [y, y+1) + int count; // EO/NZWN counter increment +}; + +struct cmpIntersectFunctor { + bool operator()(const SplashIntersect &i0, const SplashIntersect &i1) { + return (i0.y != i1.y) ? (i0.y < i1.y) : (i0.x0 < i1.x0); + } +}; + +//------------------------------------------------------------------------ +// SplashXPathScanner +//------------------------------------------------------------------------ + +SplashXPathScanner::SplashXPathScanner(SplashXPath *xPathA, GBool eoA, + int clipYMin, int clipYMax) { + SplashXPathSeg *seg; + SplashCoord xMinFP, yMinFP, xMaxFP, yMaxFP; + int i; + + xPath = xPathA; + eo = eoA; + partialClip = gFalse; + + // compute the bbox + if (xPath->length == 0) { + xMin = yMin = 1; + xMax = yMax = 0; + } else { + seg = &xPath->segs[0]; + if (seg->x0 <= seg->x1) { + xMinFP = seg->x0; + xMaxFP = seg->x1; + } else { + xMinFP = seg->x1; + xMaxFP = seg->x0; + } + if (seg->flags & splashXPathFlip) { + yMinFP = seg->y1; + yMaxFP = seg->y0; + } else { + yMinFP = seg->y0; + yMaxFP = seg->y1; + } + for (i = 1; i < xPath->length; ++i) { + seg = &xPath->segs[i]; + if (seg->x0 < xMinFP) { + xMinFP = seg->x0; + } else if (seg->x0 > xMaxFP) { + xMaxFP = seg->x0; + } + if (seg->x1 < xMinFP) { + xMinFP = seg->x1; + } else if (seg->x1 > xMaxFP) { + xMaxFP = seg->x1; + } + if (seg->flags & splashXPathFlip) { + if (seg->y0 > yMaxFP) { + yMaxFP = seg->y0; + } + } else { + if (seg->y1 > yMaxFP) { + yMaxFP = seg->y1; + } + } + } + xMin = splashFloor(xMinFP); + xMax = splashFloor(xMaxFP); + yMin = splashFloor(yMinFP); + yMax = splashFloor(yMaxFP); + if (clipYMin > yMin) { + yMin = clipYMin; + partialClip = gTrue; + } + if (clipYMax < yMax) { + yMax = clipYMax; + partialClip = gTrue; + } + } + + allInter = NULL; + inter = NULL; + computeIntersections(); + interY = yMin - 1; +} + +SplashXPathScanner::~SplashXPathScanner() { + gfree(inter); + gfree(allInter); +} + +void SplashXPathScanner::getBBoxAA(int *xMinA, int *yMinA, + int *xMaxA, int *yMaxA) { + *xMinA = xMin / splashAASize; + *yMinA = yMin / splashAASize; + *xMaxA = xMax / splashAASize; + *yMaxA = yMax / splashAASize; +} + +void SplashXPathScanner::getSpanBounds(int y, int *spanXMin, int *spanXMax) { + int interBegin, interEnd, xx, i; + + if (y < yMin || y > yMax) { + interBegin = interEnd = 0; + } else { + interBegin = inter[y - yMin]; + interEnd = inter[y - yMin + 1]; + } + if (interBegin < interEnd) { + *spanXMin = allInter[interBegin].x0; + xx = allInter[interBegin].x1; + for (i = interBegin + 1; i < interEnd; ++i) { + if (allInter[i].x1 > xx) { + xx = allInter[i].x1; + } + } + *spanXMax = xx; + } else { + *spanXMin = xMax + 1; + *spanXMax = xMax; + } +} + +GBool SplashXPathScanner::test(int x, int y) { + int interBegin, interEnd, count, i; + + if (y < yMin || y > yMax) { + return gFalse; + } + interBegin = inter[y - yMin]; + interEnd = inter[y - yMin + 1]; + count = 0; + for (i = interBegin; i < interEnd && allInter[i].x0 <= x; ++i) { + if (x <= allInter[i].x1) { + return gTrue; + } + count += allInter[i].count; + } + return eo ? (count & 1) : (count != 0); +} + +GBool SplashXPathScanner::testSpan(int x0, int x1, int y) { + int interBegin, interEnd, count, xx1, i; + + if (y < yMin || y > yMax) { + return gFalse; + } + interBegin = inter[y - yMin]; + interEnd = inter[y - yMin + 1]; + count = 0; + for (i = interBegin; i < interEnd && allInter[i].x1 < x0; ++i) { + count += allInter[i].count; + } + + // invariant: the subspan [x0,xx1] is inside the path + xx1 = x0 - 1; + while (xx1 < x1) { + if (i >= interEnd) { + return gFalse; + } + if (allInter[i].x0 > xx1 + 1 && + !(eo ? (count & 1) : (count != 0))) { + return gFalse; + } + if (allInter[i].x1 > xx1) { + xx1 = allInter[i].x1; + } + count += allInter[i].count; + ++i; + } + + return gTrue; +} + +GBool SplashXPathScanner::getNextSpan(int y, int *x0, int *x1) { + int interEnd, xx0, xx1; + + if (y < yMin || y > yMax) { + return gFalse; + } + if (interY != y) { + interY = y; + interIdx = inter[y - yMin]; + interCount = 0; + } + interEnd = inter[y - yMin + 1]; + if (interIdx >= interEnd) { + return gFalse; + } + xx0 = allInter[interIdx].x0; + xx1 = allInter[interIdx].x1; + interCount += allInter[interIdx].count; + ++interIdx; + while (interIdx < interEnd && + (allInter[interIdx].x0 <= xx1 || + (eo ? (interCount & 1) : (interCount != 0)))) { + if (allInter[interIdx].x1 > xx1) { + xx1 = allInter[interIdx].x1; + } + interCount += allInter[interIdx].count; + ++interIdx; + } + *x0 = xx0; + *x1 = xx1; + return gTrue; +} + +void SplashXPathScanner::computeIntersections() { + SplashXPathSeg *seg; + SplashCoord segXMin, segXMax, segYMin, segYMax, xx0, xx1; + int x, y, y0, y1, i; + + if (yMin > yMax) { + return; + } + + // build the list of all intersections + allInterLen = 0; + allInterSize = 16; + allInter = (SplashIntersect *)gmallocn(allInterSize, + sizeof(SplashIntersect)); + for (i = 0; i < xPath->length; ++i) { + seg = &xPath->segs[i]; + if (seg->flags & splashXPathFlip) { + segYMin = seg->y1; + segYMax = seg->y0; + } else { + segYMin = seg->y0; + segYMax = seg->y1; + } + if (seg->flags & splashXPathHoriz) { + y = splashFloor(seg->y0); + if (y >= yMin && y <= yMax) { + addIntersection(segYMin, segYMax, seg->flags, + y, splashFloor(seg->x0), splashFloor(seg->x1)); + } + } else if (seg->flags & splashXPathVert) { + y0 = splashFloor(segYMin); + if (y0 < yMin) { + y0 = yMin; + } + y1 = splashFloor(segYMax); + if (y1 > yMax) { + y1 = yMax; + } + x = splashFloor(seg->x0); + for (y = y0; y <= y1; ++y) { + addIntersection(segYMin, segYMax, seg->flags, y, x, x); + } + } else { + if (seg->x0 < seg->x1) { + segXMin = seg->x0; + segXMax = seg->x1; + } else { + segXMin = seg->x1; + segXMax = seg->x0; + } + y0 = splashFloor(segYMin); + if (y0 < yMin) { + y0 = yMin; + } + y1 = splashFloor(segYMax); + if (y1 > yMax) { + y1 = yMax; + } + // this loop could just add seg->dxdy to xx1 on each iteration, + // but that introduces numerical accuracy problems + xx1 = seg->x0 + ((SplashCoord)y0 - seg->y0) * seg->dxdy; + for (y = y0; y <= y1; ++y) { + xx0 = xx1; + xx1 = seg->x0 + ((SplashCoord)(y + 1) - seg->y0) * seg->dxdy; + // the segment may not actually extend to the top and/or bottom edges + if (xx0 < segXMin) { + xx0 = segXMin; + } else if (xx0 > segXMax) { + xx0 = segXMax; + } + if (xx1 < segXMin) { + xx1 = segXMin; + } else if (xx1 > segXMax) { + xx1 = segXMax; + } + addIntersection(segYMin, segYMax, seg->flags, y, + splashFloor(xx0), splashFloor(xx1)); + } + } + } + std::sort(allInter, allInter + allInterLen, cmpIntersectFunctor()); + + // build the list of y pointers + inter = (int *)gmallocn(yMax - yMin + 2, sizeof(int)); + i = 0; + for (y = yMin; y <= yMax; ++y) { + inter[y - yMin] = i; + while (i < allInterLen && allInter[i].y <= y) { + ++i; + } + } + inter[yMax - yMin + 1] = i; +} + +void SplashXPathScanner::addIntersection(double segYMin, double segYMax, + Guint segFlags, + int y, int x0, int x1) { + if (allInterLen == allInterSize) { + allInterSize *= 2; + allInter = (SplashIntersect *)greallocn(allInter, allInterSize, + sizeof(SplashIntersect)); + } + allInter[allInterLen].y = y; + if (x0 < x1) { + allInter[allInterLen].x0 = x0; + allInter[allInterLen].x1 = x1; + } else { + allInter[allInterLen].x0 = x1; + allInter[allInterLen].x1 = x0; + } + if (segYMin <= y && + (SplashCoord)y < segYMax && + !(segFlags & splashXPathHoriz)) { + allInter[allInterLen].count = eo ? 1 + : (segFlags & splashXPathFlip) ? 1 : -1; + } else { + allInter[allInterLen].count = 0; + } + ++allInterLen; +} + +void SplashXPathScanner::renderAALine(SplashBitmap *aaBuf, + int *x0, int *x1, int y, GBool adjustVertLine) { + int xx0, xx1, xx, xxMin, xxMax, yy, interEnd; + Guchar mask; + SplashColorPtr p; + + memset(aaBuf->getDataPtr(), 0, aaBuf->getRowSize() * aaBuf->getHeight()); + xxMin = aaBuf->getWidth(); + xxMax = -1; + if (yMin <= yMax) { + if (splashAASize * y < yMin) { + interIdx = inter[0]; + } else if (splashAASize * y > yMax) { + interIdx = inter[yMax - yMin + 1]; + } else { + interIdx = inter[splashAASize * y - yMin]; + } + for (yy = 0; yy < splashAASize; ++yy) { + if (splashAASize * y + yy < yMin) { + interEnd = inter[0]; + } else if (splashAASize * y + yy > yMax) { + interEnd = inter[yMax - yMin + 1]; + } else { + interEnd = inter[splashAASize * y + yy - yMin + 1]; + } + interCount = 0; + while (interIdx < interEnd) { + xx0 = allInter[interIdx].x0; + xx1 = allInter[interIdx].x1; + interCount += allInter[interIdx].count; + ++interIdx; + while (interIdx < interEnd && + (allInter[interIdx].x0 <= xx1 || + (eo ? (interCount & 1) : (interCount != 0)))) { + if (allInter[interIdx].x1 > xx1) { + xx1 = allInter[interIdx].x1; + } + interCount += allInter[interIdx].count; + ++interIdx; + } + if (xx0 < 0) { + xx0 = 0; + } + ++xx1; + if (xx1 > aaBuf->getWidth()) { + xx1 = aaBuf->getWidth(); + } + // set [xx0, xx1) to 1 + if (xx0 < xx1) { + xx = xx0; + p = aaBuf->getDataPtr() + yy * aaBuf->getRowSize() + (xx >> 3); + if (xx & 7) { + mask = adjustVertLine ? 0xff : 0xff >> (xx & 7); + if (!adjustVertLine && (xx & ~7) == (xx1 & ~7)) { + mask &= (Guchar)(0xff00 >> (xx1 & 7)); + } + *p++ |= mask; + xx = (xx & ~7) + 8; + } + for (; xx + 7 < xx1; xx += 8) { + *p++ |= 0xff; + } + if (xx < xx1) { + *p |= adjustVertLine ? 0xff : (Guchar)(0xff00 >> (xx1 & 7)); + } + } + if (xx0 < xxMin) { + xxMin = xx0; + } + if (xx1 > xxMax) { + xxMax = xx1; + } + } + } + } + if (xxMin > xxMax) { + xxMin = xxMax; + } + *x0 = xxMin / splashAASize; + *x1 = (xxMax - 1) / splashAASize; +} + +void SplashXPathScanner::clipAALine(SplashBitmap *aaBuf, + int *x0, int *x1, int y) { + int xx0, xx1, xx, yy, interEnd; + Guchar mask; + SplashColorPtr p; + + for (yy = 0; yy < splashAASize; ++yy) { + xx = *x0 * splashAASize; + if (yMin <= yMax) { + if (splashAASize * y + yy < yMin) { + interIdx = interEnd = inter[0]; + } else if (splashAASize * y + yy > yMax) { + interIdx = interEnd = inter[yMax - yMin + 1]; + } else { + interIdx = inter[splashAASize * y + yy - yMin]; + if (splashAASize * y + yy > yMax) { + interEnd = inter[yMax - yMin + 1]; + } else { + interEnd = inter[splashAASize * y + yy - yMin + 1]; + } + } + interCount = 0; + while (interIdx < interEnd && xx < (*x1 + 1) * splashAASize) { + xx0 = allInter[interIdx].x0; + xx1 = allInter[interIdx].x1; + interCount += allInter[interIdx].count; + ++interIdx; + while (interIdx < interEnd && + (allInter[interIdx].x0 <= xx1 || + (eo ? (interCount & 1) : (interCount != 0)))) { + if (allInter[interIdx].x1 > xx1) { + xx1 = allInter[interIdx].x1; + } + interCount += allInter[interIdx].count; + ++interIdx; + } + if (xx0 > aaBuf->getWidth()) { + xx0 = aaBuf->getWidth(); + } + // set [xx, xx0) to 0 + if (xx < xx0) { + p = aaBuf->getDataPtr() + yy * aaBuf->getRowSize() + (xx >> 3); + if (xx & 7) { + mask = (Guchar)(0xff00 >> (xx & 7)); + if ((xx & ~7) == (xx0 & ~7)) { + mask |= 0xff >> (xx0 & 7); + } + *p++ &= mask; + xx = (xx & ~7) + 8; + } + for (; xx + 7 < xx0; xx += 8) { + *p++ = 0x00; + } + if (xx < xx0) { + *p &= 0xff >> (xx0 & 7); + } + } + if (xx1 >= xx) { + xx = xx1 + 1; + } + } + } + xx0 = (*x1 + 1) * splashAASize; + if (xx0 > aaBuf->getWidth()) xx0 = aaBuf->getWidth(); + // set [xx, xx0) to 0 + if (xx < xx0) { + p = aaBuf->getDataPtr() + yy * aaBuf->getRowSize() + (xx >> 3); + if (xx & 7) { + mask = (Guchar)(0xff00 >> (xx & 7)); + if ((xx & ~7) == (xx0 & ~7)) { + mask &= 0xff >> (xx0 & 7); + } + *p++ &= mask; + xx = (xx & ~7) + 8; + } + for (; xx + 7 < xx0; xx += 8) { + *p++ = 0x00; + } + if (xx < xx0) { + *p &= 0xff >> (xx0 & 7); + } + } + } +} diff --git a/Build/source/libs/poppler/poppler-0.25.0/splash/SplashXPathScanner.h b/Build/source/libs/poppler/poppler-0.25.0/splash/SplashXPathScanner.h new file mode 100644 index 00000000000..b59e3068093 --- /dev/null +++ b/Build/source/libs/poppler/poppler-0.25.0/splash/SplashXPathScanner.h @@ -0,0 +1,108 @@ +//======================================================================== +// +// SplashXPathScanner.h +// +//======================================================================== + +//======================================================================== +// +// Modified under the Poppler project - http://poppler.freedesktop.org +// +// All changes made under the Poppler project to this file are licensed +// under GPL version 2 or later +// +// Copyright (C) 2013 Thomas Freitag <Thomas.Freitag@alfa.de> +// +// To see a description of the changes please see the Changelog file that +// came with your tarball or type make ChangeLog if you are building from git +// +//======================================================================== + +#ifndef SPLASHXPATHSCANNER_H +#define SPLASHXPATHSCANNER_H + +#ifdef USE_GCC_PRAGMAS +#pragma interface +#endif + +#include "SplashTypes.h" + +class SplashXPath; +class SplashBitmap; +struct SplashIntersect; + +//------------------------------------------------------------------------ +// SplashXPathScanner +//------------------------------------------------------------------------ + +class SplashXPathScanner { +public: + + // Create a new SplashXPathScanner object. <xPathA> must be sorted. + SplashXPathScanner(SplashXPath *xPathA, GBool eoA, + int clipYMin, int clipYMax); + + ~SplashXPathScanner(); + + // Return the path's bounding box. + void getBBox(int *xMinA, int *yMinA, int *xMaxA, int *yMaxA) + { *xMinA = xMin; *yMinA = yMin; *xMaxA = xMax; *yMaxA = yMax; } + + // Return the path's bounding box. + void getBBoxAA(int *xMinA, int *yMinA, int *xMaxA, int *yMaxA); + + // Returns true if at least part of the path was outside the + // clipYMin/clipYMax bounds passed to the constructor. + GBool hasPartialClip() { return partialClip; } + + // Return the min/max x values for the span at <y>. + void getSpanBounds(int y, int *spanXMin, int *spanXMax); + + // Returns true if (<x>,<y>) is inside the path. + GBool test(int x, int y); + + // Returns true if the entire span ([<x0>,<x1>], <y>) is inside the + // path. + GBool testSpan(int x0, int x1, int y); + + // Returns the next span inside the path at <y>. If <y> is + // different than the previous call to getNextSpan, this returns the + // first span at <y>; otherwise it returns the next span (relative + // to the previous call to getNextSpan). Returns false if there are + // no more spans at <y>. + GBool getNextSpan(int y, int *x0, int *x1); + + // Renders one anti-aliased line into <aaBuf>. Returns the min and + // max x coordinates with non-zero pixels in <x0> and <x1>. + void renderAALine(SplashBitmap *aaBuf, int *x0, int *x1, int y, + GBool adjustVertLine = gFalse); + + // Clips an anti-aliased line by setting pixels to zero. On entry, + // all non-zero pixels are between <x0> and <x1>. This function + // will update <x0> and <x1>. + void clipAALine(SplashBitmap *aaBuf, int *x0, int *x1, int y); + +private: + + void computeIntersections(); + void addIntersection(double segYMin, double segYMax, + Guint segFlags, + int y, int x0, int x1); + + SplashXPath *xPath; + GBool eo; + int xMin, yMin, xMax, yMax; + GBool partialClip; + + SplashIntersect *allInter; // array of intersections + int allInterLen; // number of intersections in <allInter> + int allInterSize; // size of the <allInter> array + int *inter; // indexes into <allInter> for each y value + int interY; // current y value - used by getNextSpan + int interIdx; // current index into <inter> - used by + // getNextSpan + int interCount; // current EO/NZWN counter - used by + // getNextSpan +}; + +#endif diff --git a/Build/source/libs/poppler/version.ac b/Build/source/libs/poppler/version.ac index e702ac73739..8410de17413 100644 --- a/Build/source/libs/poppler/version.ac +++ b/Build/source/libs/poppler/version.ac @@ -8,4 +8,4 @@ dnl dnl -------------------------------------------------------- dnl dnl m4-include this file to define the current poppler version -m4_define([poppler_version], [0.24.4]) +m4_define([poppler_version], [0.25.0]) |