[poppler] 48 commits - CMakeLists.txt configure.ac cpp/Doxyfile NEWS poppler/JBIG2Stream.cc poppler/Makefile.am qt4/src
Albert Astals Cid
aacid at kemper.freedesktop.org
Sat Sep 8 09:15:55 PDT 2012
CMakeLists.txt | 4 +--
NEWS | 52 +++++++++++++++++++++++++++++++++++++++++++++++++
configure.ac | 2 -
cpp/Doxyfile | 2 -
poppler/JBIG2Stream.cc | 2 -
poppler/Makefile.am | 2 -
qt4/src/Doxyfile | 2 -
7 files changed, 59 insertions(+), 7 deletions(-)
New commits:
commit e0118be3ba38bd00fa2a9c20c5b4cd82e820ba0b
Merge: 2c41430... ccd3db5...
Author: Albert Astals Cid <aacid at kde.org>
Date: Sat Sep 8 18:15:43 2012 +0200
Merge remote-tracking branch 'origin/poppler-0.20'
Conflicts:
glib/poppler-document.cc
poppler/PDFDoc.cc
poppler/XRef.h
utils/HtmlFonts.cc
commit ccd3db5a7723ddb692f6dc85ed9d0f5e3dde189f
Author: Albert Astals Cid <aacid at kde.org>
Date: Sat Sep 8 18:10:14 2012 +0200
Only complain when the malloc really failed
diff --git a/poppler/JBIG2Stream.cc b/poppler/JBIG2Stream.cc
index 7ddcc81..a8486a3 100644
--- a/poppler/JBIG2Stream.cc
+++ b/poppler/JBIG2Stream.cc
@@ -1636,7 +1636,7 @@ GBool JBIG2Stream::readSymbolDictSeg(Guint segNum, Guint length,
// get the input symbol bitmaps
bitmaps = (JBIG2Bitmap **)gmallocn_checkoverflow(numInputSyms + numNewSyms,
sizeof(JBIG2Bitmap *));
- if (!bitmaps) {
+ if (!bitmaps && (numInputSyms + numNewSyms > 0)) {
error(errSyntaxError, curStr->getPos(), "Too many input symbols in JBIG2 symbol dictionary");
delete codeTables;
goto eofError;
commit 6356c0bbae47db291a3585d31c7727bc3f8d97a4
Author: Albert Astals Cid <aacid at kde.org>
Date: Thu Aug 30 00:57:51 2012 +0200
qt4: unbreak spacing
diff --git a/qt4/src/poppler-embeddedfile.cc b/qt4/src/poppler-embeddedfile.cc
index cebd3e7..5b3f7d3 100644
--- a/qt4/src/poppler-embeddedfile.cc
+++ b/qt4/src/poppler-embeddedfile.cc
@@ -91,19 +91,19 @@ QDateTime EmbeddedFile::modDate() const
QDateTime EmbeddedFile::createDate() const
{
- GooString *goo = m_embeddedFile->embFile() ? m_embeddedFile->embFile()->createDate() : NULL;
+ GooString *goo = m_embeddedFile->embFile() ? m_embeddedFile->embFile()->createDate() : NULL;
return goo ? convertDate(goo->getCString()) : QDateTime();
}
QByteArray EmbeddedFile::checksum() const
{
- GooString *goo = m_embeddedFile->embFile() ? m_embeddedFile->embFile()->checksum() : NULL;
+ GooString *goo = m_embeddedFile->embFile() ? m_embeddedFile->embFile()->checksum() : NULL;
return goo ? QByteArray::fromRawData(goo->getCString(), goo->getLength()) : QByteArray();
}
QString EmbeddedFile::mimeType() const
{
- GooString *goo = m_embeddedFile->embFile() ? m_embeddedFile->embFile()->mimeType() : NULL;
+ GooString *goo = m_embeddedFile->embFile() ? m_embeddedFile->embFile()->mimeType() : NULL;
return goo ? QString(goo->getCString()) : QString();
}
commit 46948868dee6d4e68b658c68d7df482590e34da3
Author: Albert Astals Cid <aacid at kde.org>
Date: Thu Aug 30 00:43:45 2012 +0200
Accept FileSpec as Dict too and not only as Ref
File to try in KDE bug #306008
diff --git a/poppler/Catalog.cc b/poppler/Catalog.cc
index 664c421..0f42356 100644
--- a/poppler/Catalog.cc
+++ b/poppler/Catalog.cc
@@ -14,7 +14,7 @@
// under GPL version 2 or later
//
// Copyright (C) 2005 Kristian Høgsberg <krh at redhat.com>
-// Copyright (C) 2005-2011 Albert Astals Cid <aacid at kde.org>
+// Copyright (C) 2005-2012 Albert Astals Cid <aacid at kde.org>
// Copyright (C) 2005 Jeff Muizelaar <jrmuizel at nit.ca>
// Copyright (C) 2005 Jonathan Blandford <jrb at redhat.com>
// Copyright (C) 2005 Marco Pesenti Gritti <mpg at redhat.com>
@@ -462,6 +462,8 @@ FileSpec *Catalog::embeddedFile(int i)
Object fsDict;
embeddedFile = new FileSpec(obj.fetch(xref, &fsDict));
fsDict.free();
+ } else if (obj.isDict()) {
+ embeddedFile = new FileSpec(&obj);
} else {
Object null;
embeddedFile = new FileSpec(&null);
commit debc8fb497bc22c0f9f34d785852981a87475c30
Author: Albert Astals Cid <aacid at kde.org>
Date: Thu Aug 30 00:35:40 2012 +0200
Take into account the embFile returned by the core may be NULL
diff --git a/qt4/src/poppler-embeddedfile-private.h b/qt4/src/poppler-embeddedfile-private.h
index f109d36..83549da 100644
--- a/qt4/src/poppler-embeddedfile-private.h
+++ b/qt4/src/poppler-embeddedfile-private.h
@@ -1,5 +1,5 @@
/* poppler-embeddedfile-private.h: Qt4 interface to poppler
- * Copyright (C) 2005, 2008, 2009, Albert Astals Cid <aacid at kde.org>
+ * Copyright (C) 2005, 2008, 2009, 2012, Albert Astals Cid <aacid at kde.org>
* Copyright (C) 2005, Brad Hards <bradh at frogmouth.net>
* Copyright (C) 2008, 2011, Pino Toscano <pino at kde.org>
*
@@ -31,6 +31,8 @@ class EmbeddedFileData
public:
EmbeddedFileData(FileSpec *fs);
~EmbeddedFileData();
+
+ EmbFile *embFile() const;
FileSpec *filespec;
};
diff --git a/qt4/src/poppler-embeddedfile.cc b/qt4/src/poppler-embeddedfile.cc
index 1052fd1..cebd3e7 100644
--- a/qt4/src/poppler-embeddedfile.cc
+++ b/qt4/src/poppler-embeddedfile.cc
@@ -1,5 +1,5 @@
/* poppler-document.cc: qt interface to poppler
- * Copyright (C) 2005, 2008, 2009, Albert Astals Cid <aacid at kde.org>
+ * Copyright (C) 2005, 2008, 2009, 2012, Albert Astals Cid <aacid at kde.org>
* Copyright (C) 2005, Brad Hards <bradh at frogmouth.net>
* Copyright (C) 2008, 2011, Pino Toscano <pino at kde.org>
*
@@ -44,6 +44,11 @@ EmbeddedFileData::~EmbeddedFileData()
delete filespec;
}
+EmbFile *EmbeddedFileData::embFile() const
+{
+ return filespec->isOk() ? filespec->getEmbeddedFile() : NULL;
+}
+
EmbeddedFile::EmbeddedFile(EmbFile *embfile)
: m_embeddedFile(0)
@@ -75,30 +80,30 @@ QString EmbeddedFile::description() const
int EmbeddedFile::size() const
{
- return m_embeddedFile->filespec->getEmbeddedFile()->size();
+ return m_embeddedFile->embFile() ? m_embeddedFile->embFile()->size() : -1;
}
QDateTime EmbeddedFile::modDate() const
{
- GooString *goo = m_embeddedFile->filespec->getEmbeddedFile()->modDate();
+ GooString *goo = m_embeddedFile->embFile() ? m_embeddedFile->embFile()->modDate() : NULL;
return goo ? convertDate(goo->getCString()) : QDateTime();
}
QDateTime EmbeddedFile::createDate() const
{
- GooString *goo = m_embeddedFile->filespec->getEmbeddedFile()->createDate();
+ GooString *goo = m_embeddedFile->embFile() ? m_embeddedFile->embFile()->createDate() : NULL;
return goo ? convertDate(goo->getCString()) : QDateTime();
}
QByteArray EmbeddedFile::checksum() const
{
- GooString *goo = m_embeddedFile->filespec->getEmbeddedFile()->checksum();
+ GooString *goo = m_embeddedFile->embFile() ? m_embeddedFile->embFile()->checksum() : NULL;
return goo ? QByteArray::fromRawData(goo->getCString(), goo->getLength()) : QByteArray();
}
QString EmbeddedFile::mimeType() const
{
- GooString *goo = m_embeddedFile->filespec->getEmbeddedFile()->mimeType();
+ GooString *goo = m_embeddedFile->embFile() ? m_embeddedFile->embFile()->mimeType() : NULL;
return goo ? QString(goo->getCString()) : QString();
}
@@ -106,7 +111,7 @@ QByteArray EmbeddedFile::data()
{
if (!isValid())
return QByteArray();
- Stream *stream = m_embeddedFile->filespec->getEmbeddedFile()->stream();
+ Stream *stream = m_embeddedFile->embFile() ? m_embeddedFile->embFile()->stream() : NULL;
if (!stream)
return QByteArray();
commit 3ca67a59fc15782abb1e479eb2b8916de5b1b6ed
Author: Albert Astals Cid <aacid at kde.org>
Date: Thu Aug 30 00:34:06 2012 +0200
Return NULL EmbFile if the FileSpec is not ok
Otherwise we might end up asserting
diff --git a/poppler/FileSpec.cc b/poppler/FileSpec.cc
index 1360608..1adcf5b 100644
--- a/poppler/FileSpec.cc
+++ b/poppler/FileSpec.cc
@@ -7,6 +7,7 @@
//
// Copyright (C) 2008-2009 Carlos Garcia Campos <carlosgc at gnome.org>
// Copyright (C) 2009 Kovid Goyal <kovid at kovidgoyal.net>
+// Copyright (C) 2012 Albert Astals Cid <aacid at 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
@@ -151,6 +152,9 @@ FileSpec::~FileSpec()
EmbFile *FileSpec::getEmbeddedFile()
{
+ if(!ok)
+ return NULL;
+
if (embFile)
return embFile;
commit 686ec0cc92e25f74eaa9e09a328724cbdf939bca
Author: Albert Astals Cid <aacid at kde.org>
Date: Wed Aug 15 20:02:05 2012 +0200
Remove declared but not implemented function
diff --git a/poppler/XRef.h b/poppler/XRef.h
index 148a5ce..76621ad 100644
--- a/poppler/XRef.h
+++ b/poppler/XRef.h
@@ -175,7 +175,6 @@ private:
void init();
int reserve(int newSize);
int resize(int newSize);
- Guint getStartXref();
GBool readXRef(Guint *pos, std::vector<Guint> *followedXRefStm);
GBool readXRefTable(Parser *parser, Guint *pos, std::vector<Guint> *followedXRefStm);
GBool readXRefStreamSection(Stream *xrefStr, int *w, int first, int n);
commit e83568065f77ba722b147b3b10faed1ff66f22dc
Author: Pino Toscano <pino at kde.org>
Date: Sat Aug 11 01:38:08 2012 +0200
remove extra execution permissions
(cherry picked from commit 9a5a19ee2f9cd536c3527b30c0256ca9dce3638c)
diff --git a/goo/GooTimer.h b/goo/GooTimer.h
old mode 100755
new mode 100644
commit 1b2903c104012fdd3c982d57898910945dff9a15
Author: Albert Astals Cid <aacid at kde.org>
Date: Sat Aug 11 00:05:10 2012 +0200
0.20.3
diff --git a/CMakeLists.txt b/CMakeLists.txt
index c427064..8830968 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -16,7 +16,7 @@ test_big_endian(WORDS_BIGENDIAN)
set(POPPLER_MAJOR_VERSION "0")
set(POPPLER_MINOR_VERSION "20")
-set(POPPLER_MICRO_VERSION "2")
+set(POPPLER_MICRO_VERSION "3")
set(POPPLER_VERSION "${POPPLER_MAJOR_VERSION}.${POPPLER_MINOR_VERSION}.${POPPLER_MICRO_VERSION}")
# command line switches
@@ -386,7 +386,7 @@ add_library(poppler STATIC ${poppler_SRCS})
else(MSVC)
add_library(poppler SHARED ${poppler_SRCS})
endif(MSVC)
-set_target_properties(poppler PROPERTIES VERSION 26.0.0 SOVERSION 26)
+set_target_properties(poppler PROPERTIES VERSION 27.0.0 SOVERSION 27)
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})
diff --git a/NEWS b/NEWS
index df7dca7..c4270dd 100644
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,19 @@
+Release 0.20.3
+ core:
+ * If NULL, NULL fails as password try EMPTY, EMPTY before failing (Bug #3498)
+ * SplashOutputDev: Fix bogus memory allocation size in Splash::arbitraryTransformImage (Bug #49523)
+ * SplashOutputDev: Fix segfault when scaleImage returns NULL (Bug #52488)
+ * SplashOutputDev: Blend mode enhancements for CMYK
+ * PSOutputDev: Fix conversion when creating multiple strips (Bug #51982)
+ * PSOutputDev: Fix Bitmaps in level2sep or level3sep (Bug #52384)
+ * PSOutputDev: Fix DeviceN images with alternate Lab colorspace in level 3 PostScript (Bug #51822)
+ * PSOutputDev: Make sure xScale and yScale are always initialized (Bug #52215)
+ * Unify poppler-config.h includes in core "installed" headers (Bug #52193)
+ * Replace c++ style includes with c style ones (Bug #52426)
+
+ utils:
+ * pdfseparate: Return 0 on success
+
Release 0.20.2
core:
* Fix compilation on Windows
diff --git a/configure.ac b/configure.ac
index 3626028..477597c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,6 +1,6 @@
m4_define([poppler_version_major],[0])
m4_define([poppler_version_minor],[20])
-m4_define([poppler_version_micro],[2])
+m4_define([poppler_version_micro],[3])
m4_define([poppler_version],[poppler_version_major.poppler_version_minor.poppler_version_micro])
AC_PREREQ(2.59)
diff --git a/cpp/Doxyfile b/cpp/Doxyfile
index 1643e53..242b04d 100644
--- a/cpp/Doxyfile
+++ b/cpp/Doxyfile
@@ -31,7 +31,7 @@ PROJECT_NAME = "Poppler CPP"
# This could be handy for archiving the generated documentation or
# if some version control system is used.
-PROJECT_NUMBER = 0.20.2
+PROJECT_NUMBER = 0.20.3
# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute)
# base path where the generated documentation will be put.
diff --git a/poppler/Makefile.am b/poppler/Makefile.am
index c5785d6..b53729f 100644
--- a/poppler/Makefile.am
+++ b/poppler/Makefile.am
@@ -177,7 +177,7 @@ libpoppler_la_LIBADD = \
$(PTHREAD_LIBS) \
$(win32_libs)
-libpoppler_la_LDFLAGS = -version-info 26:0:0 @create_shared_lib@ @auto_import_flags@
+libpoppler_la_LDFLAGS = -version-info 27:0:0 @create_shared_lib@ @auto_import_flags@
if ENABLE_XPDF_HEADERS
diff --git a/qt4/src/Doxyfile b/qt4/src/Doxyfile
index 0920827..4ea5139 100644
--- a/qt4/src/Doxyfile
+++ b/qt4/src/Doxyfile
@@ -31,7 +31,7 @@ PROJECT_NAME = "Poppler Qt4 "
# This could be handy for archiving the generated documentation or
# if some version control system is used.
-PROJECT_NUMBER = 0.20.2
+PROJECT_NUMBER = 0.20.3
# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute)
# base path where the generated documentation will be put.
commit 40e7b744d32152ab4c6201b8bda7fb7caf6bfd4e
Author: Albert Astals Cid <aacid at kde.org>
Date: Sun Aug 5 15:07:16 2012 +0200
If NULL, NULL fails as password try EMPTY, EMPTY before failing
Reviewed by Jose Aliste
Bug #3498
diff --git a/poppler/SecurityHandler.cc b/poppler/SecurityHandler.cc
index 00c4ae1..a48449a 100644
--- a/poppler/SecurityHandler.cc
+++ b/poppler/SecurityHandler.cc
@@ -105,7 +105,12 @@ GBool SecurityHandler::checkEncryption(GooString *ownerPassword,
}
}
if (!ok) {
- error(errCommandLine, -1, "Incorrect password");
+ if (!ownerPassword && !userPassword) {
+ GooString dummy;
+ return checkEncryption(&dummy, &dummy);
+ } else {
+ error(errCommandLine, -1, "Incorrect password");
+ }
}
return ok;
}
commit 3ca2bc0d3abdf92741b7921ea402c9de09e531f6
Author: Markus Trippelsdorf <markus at trippelsdorf.de>
Date: Fri Aug 3 00:48:12 2012 +0200
Fix segfault when scaleImage returns NULL
Bug 52488
diff --git a/splash/Splash.cc b/splash/Splash.cc
index d2d965a..e6559f4 100644
--- a/splash/Splash.cc
+++ b/splash/Splash.cc
@@ -16,6 +16,7 @@
// Copyright (C) 2010-2012 Thomas Freitag <Thomas.Freitag at alfa.de>
// Copyright (C) 2010 Christian Feuersänger <cfeuersaenger at googlemail.com>
// Copyright (C) 2011, 2012 William Bader <williambader at hotmail.com>
+// Copyright (C) 2012 Markus Trippelsdorf <markus at trippelsdorf.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
@@ -3435,6 +3436,9 @@ SplashError Splash::drawImage(SplashImageSource src, void *srcData,
}
scaledImg = scaleImage(src, srcData, srcMode, nComps, srcAlpha, w, h,
scaledWidth, scaledHeight);
+ if (scaledImg == NULL) {
+ return splashErrBadArg;
+ }
blitImage(scaledImg, srcAlpha, x0, y0, clipRes);
delete scaledImg;
}
@@ -3470,6 +3474,9 @@ SplashError Splash::drawImage(SplashImageSource src, void *srcData,
}
scaledImg = scaleImage(src, srcData, srcMode, nComps, srcAlpha, w, h,
scaledWidth, scaledHeight);
+ if (scaledImg == NULL) {
+ return splashErrBadArg;
+ }
vertFlipImage(scaledImg, scaledWidth, scaledHeight, nComps);
blitImage(scaledImg, srcAlpha, x0, y0, clipRes);
delete scaledImg;
commit 768cf5877f48f8cee80fe96e2ee52f42f230dfdf
Author: Thomas Freitag <Thomas.Freitag at alfa.de>
Date: Thu Aug 2 00:22:19 2012 +0200
PSOutputDev: Fix Bitmaps in level2sep or level3sep
Bug #52384
diff --git a/poppler/PSOutputDev.cc b/poppler/PSOutputDev.cc
index e15c2e9..f414897 100644
--- a/poppler/PSOutputDev.cc
+++ b/poppler/PSOutputDev.cc
@@ -5839,7 +5839,7 @@ void PSOutputDev::doImageL2(Object *ref, GfxImageColorMap *colorMap,
}
#endif
if ((level == psLevel2Sep || level == psLevel3Sep) && colorMap &&
- colorMap->getColorSpace()->getMode() == csSeparation) {
+ colorMap->getColorSpace()->getMode() == csSeparation && colorMap->getBits() == 8) {
color.c[0] = gfxColorComp1;
sepCS = (GfxSeparationColorSpace *)colorMap->getColorSpace();
sepCS->getCMYK(&color, &cmyk);
@@ -6198,7 +6198,7 @@ void PSOutputDev::doImageL3(Object *ref, GfxImageColorMap *colorMap,
} else {
if ((level == psLevel2Sep || level == psLevel3Sep) && colorMap &&
- colorMap->getColorSpace()->getMode() == csSeparation) {
+ colorMap->getColorSpace()->getMode() == csSeparation && colorMap->getBits() == 8) {
color.c[0] = gfxColorComp1;
sepCS = (GfxSeparationColorSpace *)colorMap->getColorSpace();
sepCS->getCMYK(&color, &cmyk);
commit 315447843a368556a8536bc30e579c9bf338682e
Author: Thomas Freitag <Thomas.Freitag at alfa.de>
Date: Wed Aug 1 22:56:49 2012 +0200
Splash: Blend mode enhancements for CMYK
diff --git a/poppler/SplashOutputDev.cc b/poppler/SplashOutputDev.cc
index abdcea4..9e07060 100644
--- a/poppler/SplashOutputDev.cc
+++ b/poppler/SplashOutputDev.cc
@@ -661,11 +661,6 @@ static void splashOutBlendSoftLight(SplashColorPtr src, SplashColorPtr dest,
SplashColor rgbSrc;
SplashColor rgbDest;
SplashColor rgbBlend;
- for (i = 0; i < 4; i++) {
- // convert back to subtractive (s. Splash.cc)
- src[i] = 0xff - src[i];
- dest[i] = 0xff - dest[i];
- }
cmykToRGB(src, rgbSrc);
cmykToRGB(dest, rgbDest);
for (i = 0; i < 3; ++i) {
@@ -681,10 +676,6 @@ static void splashOutBlendSoftLight(SplashColorPtr src, SplashColorPtr dest,
}
}
rgbToCMYK(rgbBlend, blend);
- for (i = 0; i < 4; i++) {
- // convert back to additive (s. Splash.cc)
- blend[i] = 0xff - blend[i];
- }
} else
#endif
{
@@ -848,6 +839,8 @@ static void splashOutBlendHue(SplashColorPtr src, SplashColorPtr dest,
Guchar r0, g0, b0;
#ifdef SPLASH_CMYK
Guchar r1, g1, b1;
+ int i;
+ SplashColor src2, dest2;
#endif
switch (cm) {
@@ -866,15 +859,24 @@ static void splashOutBlendHue(SplashColorPtr src, SplashColorPtr dest,
break;
#if SPLASH_CMYK
case splashModeCMYK8:
+ for (i = 0; i < 4; i++) {
+ // convert to additive
+ src2[i] = 0xff - src[i];
+ dest2[i] = 0xff - dest[i];
+ }
// NB: inputs have already been converted to additive mode
- setSat(src[0], src[1], src[2], getSat(dest[0], dest[1], dest[2]),
+ setSat(src2[0], src2[1], src2[2], getSat(dest2[0], dest2[1], dest2[2]),
&r0, &g0, &b0);
- setLum(r0, g0, b0, getLum(dest[0], dest[1], dest[2]),
+ setLum(r0, g0, b0, getLum(dest2[0], dest2[1], dest2[2]),
&r1, &g1, &b1);
blend[0] = r1;
blend[1] = g1;
blend[2] = b1;
- blend[3] = dest[3];
+ blend[3] = dest2[3];
+ for (i = 0; i < 4; i++) {
+ // convert back to subtractive
+ blend[i] = 0xff - blend[i];
+ }
break;
#endif
}
@@ -886,6 +888,8 @@ static void splashOutBlendSaturation(SplashColorPtr src, SplashColorPtr dest,
Guchar r0, g0, b0;
#ifdef SPLASH_CMYK
Guchar r1, g1, b1;
+ int i;
+ SplashColor src2, dest2;
#endif
switch (cm) {
@@ -904,15 +908,23 @@ static void splashOutBlendSaturation(SplashColorPtr src, SplashColorPtr dest,
break;
#if SPLASH_CMYK
case splashModeCMYK8:
- // NB: inputs have already been converted to additive mode
- setSat(dest[0], dest[1], dest[2], getSat(src[0], src[1], src[2]),
+ for (i = 0; i < 4; i++) {
+ // convert to additive
+ src2[i] = 0xff - src[i];
+ dest2[i] = 0xff - dest[i];
+ }
+ setSat(dest2[0], dest2[1], dest2[2], getSat(src2[0], src2[1], src2[2]),
&r0, &g0, &b0);
- setLum(r0, g0, b0, getLum(dest[0], dest[1], dest[2]),
+ setLum(r0, g0, b0, getLum(dest2[0], dest2[1], dest2[2]),
&r1, &g1, &b1);
blend[0] = r1;
blend[1] = g1;
blend[2] = b1;
- blend[3] = dest[3];
+ blend[3] = dest2[3];
+ for (i = 0; i < 4; i++) {
+ // convert back to subtractive
+ blend[i] = 0xff - blend[i];
+ }
break;
#endif
}
@@ -922,6 +934,8 @@ static void splashOutBlendColor(SplashColorPtr src, SplashColorPtr dest,
SplashColorPtr blend, SplashColorMode cm) {
#if SPLASH_CMYK
Guchar r, g, b;
+ int i;
+ SplashColor src2, dest2;
#endif
switch (cm) {
@@ -938,13 +952,21 @@ static void splashOutBlendColor(SplashColorPtr src, SplashColorPtr dest,
break;
#if SPLASH_CMYK
case splashModeCMYK8:
- // NB: inputs have already been converted to additive mode
- setLum(src[0], src[1], src[2], getLum(dest[0], dest[1], dest[2]),
+ for (i = 0; i < 4; i++) {
+ // convert to additive
+ src2[i] = 0xff - src[i];
+ dest2[i] = 0xff - dest[i];
+ }
+ setLum(src2[0], src2[1], src2[2], getLum(dest2[0], dest2[1], dest2[2]),
&r, &g, &b);
blend[0] = r;
blend[1] = g;
blend[2] = b;
- blend[3] = dest[3];
+ blend[3] = dest2[3];
+ for (i = 0; i < 4; i++) {
+ // convert back to subtractive
+ blend[i] = 0xff - blend[i];
+ }
break;
#endif
}
@@ -955,6 +977,8 @@ static void splashOutBlendLuminosity(SplashColorPtr src, SplashColorPtr dest,
SplashColorMode cm) {
#if SPLASH_CMYK
Guchar r, g, b;
+ int i;
+ SplashColor src2, dest2;
#endif
switch (cm) {
@@ -971,13 +995,21 @@ static void splashOutBlendLuminosity(SplashColorPtr src, SplashColorPtr dest,
break;
#if SPLASH_CMYK
case splashModeCMYK8:
- // NB: inputs have already been converted to additive mode
- setLum(dest[0], dest[1], dest[2], getLum(src[0], src[1], src[2]),
+ for (i = 0; i < 4; i++) {
+ // convert to additive
+ src2[i] = 0xff - src[i];
+ dest2[i] = 0xff - dest[i];
+ }
+ setLum(dest2[0], dest2[1], dest2[2], getLum(src2[0], src2[1], src2[2]),
&r, &g, &b);
blend[0] = r;
blend[1] = g;
blend[2] = b;
- blend[3] = src[3];
+ blend[3] = src2[3];
+ for (i = 0; i < 4; i++) {
+ // convert back to subtractive
+ blend[i] = 0xff - blend[i];
+ }
break;
#endif
}
diff --git a/splash/Splash.cc b/splash/Splash.cc
index b927e5e..d2d965a 100644
--- a/splash/Splash.cc
+++ b/splash/Splash.cc
@@ -337,9 +337,6 @@ void Splash::pipeRun(SplashPipe *pipe) {
SplashColorPtr cSrc;
Guchar cResult0, cResult1, cResult2, cResult3;
int t;
-#if SPLASH_CMYK
- SplashColor cSrc2, cDest2;
-#endif
//----- source color
@@ -521,25 +518,6 @@ void Splash::pipeRun(SplashPipe *pipe) {
//----- blend function
if (state->blendFunc) {
-#if SPLASH_CMYK
- if (bitmap->mode == splashModeCMYK8) {
- // convert colors to additive
- cSrc2[0] = 0xff - cSrc[0];
- cSrc2[1] = 0xff - cSrc[1];
- cSrc2[2] = 0xff - cSrc[2];
- cSrc2[3] = 0xff - cSrc[3];
- cDest2[0] = 0xff - cDest[0];
- cDest2[1] = 0xff - cDest[1];
- cDest2[2] = 0xff - cDest[2];
- cDest2[3] = 0xff - cDest[3];
- (*state->blendFunc)(cSrc2, cDest2, cBlend, bitmap->mode);
- // convert result back to subtractive
- cBlend[0] = 0xff - cBlend[0];
- cBlend[1] = 0xff - cBlend[1];
- cBlend[2] = 0xff - cBlend[2];
- cBlend[3] = 0xff - cBlend[3];
- } else
-#endif
(*state->blendFunc)(cSrc, cDest, cBlend, bitmap->mode);
}
commit c0c88b3707fc7337e814ae4252d80002641a19ee
Author: Albert Astals Cid <aacid at kde.org>
Date: Tue Jul 31 23:32:19 2012 +0200
Replace c++ style includes with c style ones
Fixes build in Solaris 10
Bug #52426
diff --git a/goo/gstrtod.cc b/goo/gstrtod.cc
index e6c3a00..cd1d5b5 100644
--- a/goo/gstrtod.cc
+++ b/goo/gstrtod.cc
@@ -1,6 +1,6 @@
/* This file is part of Libspectre.
*
- * Copyright (C) 2007 Albert Astals Cid <aacid at kde.org>
+ * Copyright (C) 2007, 2012 Albert Astals Cid <aacid at kde.org>
* Copyright (C) 2007 Carlos Garcia Campos <carlosgc at gnome.org>
*
* Libspectre is free software; you can redistribute it and/or modify
@@ -22,10 +22,10 @@
#include "gstrtod.h"
-#include <clocale>
-#include <cerrno>
-#include <cstdlib>
-#include <cstring>
+#include <locale.h>
+#include <errno.h>
+#include <stdlib.h>
+#include <string.h>
#define ascii_isspace(c) \
(c == ' ' || c == '\f' || c == '\n' || c == '\r' || c == '\t' || c == '\v')
commit dcbc923bd3592a81876f84005fbaddcea18641cc
Author: Thomas Freitag <Thomas.Freitag at alfa.de>
Date: Sun Jul 22 18:40:46 2012 +0200
Make sure xScale and yScale are always initialized
Bug #52215
diff --git a/poppler/PSOutputDev.cc b/poppler/PSOutputDev.cc
index a01a4b3..e15c2e9 100644
--- a/poppler/PSOutputDev.cc
+++ b/poppler/PSOutputDev.cc
@@ -3521,6 +3521,7 @@ void PSOutputDev::startPage(int pageNum, GfxState *state) {
saveState(NULL);
}
+ xScale = yScale = 1;
switch (mode) {
case psModePSOrigPageSizes:
@@ -3631,8 +3632,6 @@ void PSOutputDev::startPage(int pageNum, GfxState *state) {
} else {
yScale = xScale;
}
- } else {
- xScale = yScale = 1;
}
// deal with odd bounding boxes or clipping
if (clipLLX0 < clipURX0 && clipLLY0 < clipURY0) {
@@ -3694,7 +3693,6 @@ void PSOutputDev::startPage(int pageNum, GfxState *state) {
if (tx != 0 || ty != 0) {
writePSFmt("{0:.6g} {1:.6g} translate\n", tx, ty);
}
- xScale = yScale = 1;
break;
case psModeForm:
@@ -3702,7 +3700,6 @@ void PSOutputDev::startPage(int pageNum, GfxState *state) {
writePS("begin xpdf begin\n");
writePS("pdfStartPage\n");
tx = ty = 0;
- xScale = yScale = 1;
rotate = 0;
break;
}
commit ef7c2418e12d3e6a79f1d89a0051b005fadbc344
Author: Thomas Freitag <Thomas.Freitag at alfa.de>
Date: Sat Jul 21 00:01:49 2012 +0200
Fix conversion to ps when having multiple strips
Bug 51982
diff --git a/poppler/PSOutputDev.cc b/poppler/PSOutputDev.cc
index 540f74b..a01a4b3 100644
--- a/poppler/PSOutputDev.cc
+++ b/poppler/PSOutputDev.cc
@@ -3049,7 +3049,7 @@ GBool PSOutputDev::checkPageSlice(Page *page, double /*hDPI*/, double /*vDPI*/,
double m0, m1, m2, m3, m4, m5;
int nStripes, stripeH, stripeY;
int c, w, h, x, y, comp, i;
- int numComps;
+ int numComps, initialNumComps;
#endif
char hexBuf[32*2 + 2]; // 32 values X 2 chars/value + line ending + null
Guchar digit;
@@ -3132,6 +3132,7 @@ GBool PSOutputDev::checkPageSlice(Page *page, double /*hDPI*/, double /*vDPI*/,
stripeH = (sliceH + nStripes - 1) / nStripes;
// render the stripes
+ initialNumComps = numComps;
for (stripeY = sliceY; stripeY < sliceH; stripeY += stripeH) {
// rasterize a stripe
@@ -3151,6 +3152,7 @@ GBool PSOutputDev::checkPageSlice(Page *page, double /*hDPI*/, double /*vDPI*/,
// draw the rasterized image
bitmap = splashOut->getBitmap();
+ numComps = initialNumComps;
w = bitmap->getWidth();
h = bitmap->getHeight();
writePS("gsave\n");
commit 349b21acc249c130fb053bc4a0c75019f75bd35b
Author: Torsten Kasch <tk at CeBiTec.Uni-Bielefeld.DE>
Date: Thu Jul 19 00:18:14 2012 +0200
Unify poppler-config.h includes in core "installed" headers
Bug 52193
diff --git a/goo/FixedPoint.h b/goo/FixedPoint.h
index afe21d9..9974980 100644
--- a/goo/FixedPoint.h
+++ b/goo/FixedPoint.h
@@ -11,7 +11,7 @@
#ifndef FIXEDPOINT_H
#define FIXEDPOINT_H
-#include "poppler/poppler-config.h"
+#include "poppler-config.h"
#if USE_FIXEDPOINT
diff --git a/goo/GooTimer.h b/goo/GooTimer.h
index d700e50..d77373e 100755
--- a/goo/GooTimer.h
+++ b/goo/GooTimer.h
@@ -19,7 +19,7 @@
#pragma interface
#endif
-#include "poppler/poppler-config.h"
+#include "poppler-config.h"
#include "gtypes.h"
#ifdef HAVE_GETTIMEOFDAY
#include <sys/time.h>
diff --git a/goo/JpegWriter.h b/goo/JpegWriter.h
index 7af6870..d076224 100644
--- a/goo/JpegWriter.h
+++ b/goo/JpegWriter.h
@@ -17,7 +17,7 @@
#ifndef JPEGWRITER_H
#define JPEGWRITER_H
-#include "poppler/poppler-config.h"
+#include "poppler-config.h"
#ifdef ENABLE_LIBJPEG
diff --git a/goo/PNGWriter.h b/goo/PNGWriter.h
index f22495d..9e412b4 100644
--- a/goo/PNGWriter.h
+++ b/goo/PNGWriter.h
@@ -15,7 +15,7 @@
#ifndef PNGWRITER_H
#define PNGWRITER_H
-#include "poppler/poppler-config.h"
+#include "poppler-config.h"
#ifdef ENABLE_LIBPNG
diff --git a/goo/TiffWriter.h b/goo/TiffWriter.h
index b2b0ea9..1f4b5eb 100644
--- a/goo/TiffWriter.h
+++ b/goo/TiffWriter.h
@@ -12,7 +12,7 @@
#ifndef TIFFWRITER_H
#define TIFFWRITER_H
-#include "poppler/poppler-config.h"
+#include "poppler-config.h"
#ifdef ENABLE_LIBTIFF
diff --git a/goo/gfile.h b/goo/gfile.h
index d4b9082..46b8958 100644
--- a/goo/gfile.h
+++ b/goo/gfile.h
@@ -27,7 +27,7 @@
#ifndef GFILE_H
#define GFILE_H
-#include "poppler/poppler-config.h"
+#include "poppler-config.h"
#include <stdio.h>
#include <stdlib.h>
#include <stddef.h>
diff --git a/goo/gmem.h b/goo/gmem.h
index d5bb2ae..898f339 100644
--- a/goo/gmem.h
+++ b/goo/gmem.h
@@ -26,7 +26,7 @@
#define GMEM_H
#include <stdio.h>
-#include "poppler/poppler-config.h"
+#include "poppler-config.h"
#ifdef __cplusplus
extern "C" {
diff --git a/splash/SplashFTFont.h b/splash/SplashFTFont.h
index f49d7b1..98cb29d 100644
--- a/splash/SplashFTFont.h
+++ b/splash/SplashFTFont.h
@@ -23,7 +23,7 @@
#ifndef SPLASHFTFONT_H
#define SPLASHFTFONT_H
-#include "poppler/poppler-config.h"
+#include "poppler-config.h"
#if HAVE_FREETYPE_FREETYPE_H || HAVE_FREETYPE_H
diff --git a/splash/SplashMath.h b/splash/SplashMath.h
index 1886dec..ca73c2b 100644
--- a/splash/SplashMath.h
+++ b/splash/SplashMath.h
@@ -21,7 +21,7 @@
#ifndef SPLASHMATH_H
#define SPLASHMATH_H
-#include "poppler/poppler-config.h"
+#include "poppler-config.h"
#if USE_FIXEDPOINT
#include "goo/FixedPoint.h"
commit 15c6ae699f083ea6c9716c1098ae9833a56eeb3e
Author: Torsten Kasch <tk at CeBiTec.Uni-Bielefeld.DE>
Date: Thu Jul 19 00:06:45 2012 +0200
autoconf: Do not assume the shell is bash compatible
Bug 52197
diff --git a/configure.ac b/configure.ac
index 0facfdb..3626028 100644
--- a/configure.ac
+++ b/configure.ac
@@ -752,7 +752,7 @@ case "$enable_compile_warnings" in
-fno-common $CXXFLAGS" ;;
esac
-case $($PKG_CONFIG --version) in
+case `$PKG_CONFIG --version` in
0.?|0.1[0-7])
PC_REQUIRES_PRIVATE="";
PC_REQUIRES="poppler = $VERSION";;
commit f5311da76ec7cd7c1e6cdfc4e18df6dd56e8398b
Author: Albert Astals Cid <aacid at kde.org>
Date: Thu Jul 19 00:01:49 2012 +0200
pdfseparate: Return 0 on success
diff --git a/utils/pdfseparate.cc b/utils/pdfseparate.cc
index 9fbbc3a..25fac5a 100644
--- a/utils/pdfseparate.cc
+++ b/utils/pdfseparate.cc
@@ -5,6 +5,7 @@
// This file is licensed under the GPLv2 or later
//
// Copyright (C) 2011, 2012 Thomas Freitag <Thomas.Freitag at alfa.de>
+// Copyright (C) 2012 Albert Astals Cid <aacid at kde.org>
//
//========================================================================
#include "config.h"
@@ -109,7 +110,10 @@ main (int argc, char *argv[])
goto err0;
}
globalParams = new GlobalParams();
- extractPages (argv[1], argv[2]);
+ ok = extractPages (argv[1], argv[2]);
+ if (ok) {
+ exitCode = 0;
+ }
delete globalParams;
err0:
commit 51f22ca0badfc41c19cba66cabd63184244f81c7
Author: Thomas Freitag <Thomas.Freitag at alfa.de>
Date: Mon Jul 16 23:32:23 2012 +0200
PSOutputDev: Fix DeviceN images with alternate Lab colorspace in level 3 PostScript
Bug #51822
diff --git a/poppler/PSOutputDev.cc b/poppler/PSOutputDev.cc
index 5df506f..540f74b 100644
--- a/poppler/PSOutputDev.cc
+++ b/poppler/PSOutputDev.cc
@@ -6514,9 +6514,9 @@ void PSOutputDev::dumpColorSpaceL2(GfxColorSpace *colorSpace,
writePS(" ");
}
writePS("]\n");
- dumpColorSpaceL2(deviceNCS->getAlt(), gFalse, updateColors, map01);
+ dumpColorSpaceL2(deviceNCS->getAlt(), gFalse, updateColors, gFalse);
writePS("\n");
- cvtFunction(deviceNCS->getTintTransformFunc());
+ cvtFunction(deviceNCS->getTintTransformFunc(), map01 && deviceNCS->getAlt()->getMode() == csLab);
writePS("]\n");
if (genXform) {
writePS(" {}");
@@ -6979,7 +6979,7 @@ void PSOutputDev::psXObject(Stream *psStream, Stream *level1Stream) {
//~ can nextFunc be reset to 0 -- maybe at the start of each page?
//~ or maybe at the start of each color space / pattern?
-void PSOutputDev::cvtFunction(Function *func) {
+void PSOutputDev::cvtFunction(Function *func, GBool invertPSFunction) {
SampledFunction *func0;
ExponentialFunction *func2;
StitchingFunction *func3;
@@ -7069,7 +7069,14 @@ void PSOutputDev::cvtFunction(Function *func) {
// [e01] [efrac] y(0) ... y(i-1) y(i)
}
// [e01] [efrac] y(0) ... y(n-1)
- writePSFmt("{0:d} {1:d} roll pop pop }}\n", n+2, n);
+ writePSFmt("{0:d} {1:d} roll pop pop \n", n+2, n);
+ if (invertPSFunction) {
+ for (i = 0; i < n; ++i) {
+ writePSFmt("{0:d} -1 roll ", n);
+ writePSFmt("{0:.6g} sub {1:.6g} div ", func0->getRangeMin(i), func0->getRangeMax(i) - func0->getRangeMin(i));
+ }
+ }
+ writePS("}\n");
break;
case 2: // exponential
@@ -7091,7 +7098,14 @@ void PSOutputDev::cvtFunction(Function *func) {
}
}
// x y(0) .. y(n-1)
- writePSFmt("{0:d} {1:d} roll pop }}\n", n+1, n);
+ writePSFmt("{0:d} {1:d} roll pop \n", n+1, n);
+ if (invertPSFunction && func2->getHasRange()) {
+ for (i = 0; i < n; ++i) {
+ writePSFmt("{0:d} -1 roll ", n);
+ writePSFmt("{0:.6g} sub {1:.6g} div ", func2->getRangeMin(i), func2->getRangeMax(i) - func2->getRangeMin(i));
+ }
+ }
+ writePS("}\n");
break;
case 3: // stitching
@@ -7120,13 +7134,39 @@ void PSOutputDev::cvtFunction(Function *func) {
for (i = 0; i < func3->getNumFuncs() - 1; ++i) {
writePS("} ifelse\n");
}
+ if (invertPSFunction && func3->getHasRange()) {
+ n = func3->getOutputSize();
+ for (i = 0; i < n; ++i) {
+ writePSFmt("{0:d} -1 roll ", n);
+ writePSFmt("{0:.6g} sub {1:.6g} div ", func3->getRangeMin(i), func3->getRangeMax(i) - func3->getRangeMin(i));
+ }
+ }
writePS("}\n");
break;
case 4: // PostScript
func4 = (PostScriptFunction *)func;
- writePS(func4->getCodeString()->getCString());
- writePS("\n");
+ if (invertPSFunction) {
+ GooString *codeString = new GooString(func4->getCodeString());
+ for (i = codeString->getLength() -1; i > 0; i--) {
+ if (codeString->getChar(i) == '}') {
+ codeString->del(i);
+ break;
+ }
+ }
+ writePS(codeString->getCString());
+ writePS("\n");
+ delete codeString;
+ n = func4->getOutputSize();
+ for (i = 0; i < n; ++i) {
+ writePSFmt("{0:d} -1 roll ", n);
+ writePSFmt("{0:.6g} sub {1:.6g} div ", func4->getRangeMin(i), func4->getRangeMax(i) - func4->getRangeMin(i));
+ }
+ writePS("}\n");
+ } else {
+ writePS(func4->getCodeString()->getCString());
+ writePS("\n");
+ }
break;
}
}
diff --git a/poppler/PSOutputDev.h b/poppler/PSOutputDev.h
index 70aef9f..809f058 100644
--- a/poppler/PSOutputDev.h
+++ b/poppler/PSOutputDev.h
@@ -378,7 +378,7 @@ private:
void opiTransform(GfxState *state, double x0, double y0,
double *x1, double *y1);
#endif
- void cvtFunction(Function *func);
+ void cvtFunction(Function *func, GBool invertPSFunction = gFalse);
GooString *filterPSName(GooString *name);
// Write the document-level setup.
commit 950d5f3dec4bff5d3c523d55689d7b70215dc110
Author: Thomas Freitag <Thomas.Freitag at alfa.de>
Date: Fri Jul 13 00:56:48 2012 +0200
Fix Splash::arbitraryTransformImage causes bogus memory allocation size
Bug #49523
diff --git a/poppler/SplashOutputDev.cc b/poppler/SplashOutputDev.cc
index be35c25..abdcea4 100644
--- a/poppler/SplashOutputDev.cc
+++ b/poppler/SplashOutputDev.cc
@@ -4059,7 +4059,7 @@ GBool SplashOutputDev::tilingPatternFill(GfxState *state, Gfx *gfx1, Catalog *ca
matc[1] = ctm[1];
matc[2] = ctm[2];
matc[3] = ctm[3];
- splash->drawImage(&tilingBitmapSrc, &imgData, colorMode, gTrue, result_width, result_height, matc);
+ splash->drawImage(&tilingBitmapSrc, &imgData, colorMode, gTrue, result_width, result_height, matc, gTrue);
delete tBitmap;
delete gfx;
return gTrue;
diff --git a/splash/Splash.cc b/splash/Splash.cc
index 0e07c70..b927e5e 100644
--- a/splash/Splash.cc
+++ b/splash/Splash.cc
@@ -3375,7 +3375,8 @@ void Splash::blitMask(SplashBitmap *src, int xDest, int yDest,
SplashError Splash::drawImage(SplashImageSource src, void *srcData,
SplashColorMode srcMode, GBool srcAlpha,
- int w, int h, SplashCoord *mat) {
+ int w, int h, SplashCoord *mat,
+ GBool tilingPattern) {
GBool ok;
SplashBitmap *scaledImg;
SplashClipResult clipRes;
@@ -3499,7 +3500,7 @@ SplashError Splash::drawImage(SplashImageSource src, void *srcData,
// all other cases
} else {
return arbitraryTransformImage(src, srcData, srcMode, nComps, srcAlpha,
- w, h, mat);
+ w, h, mat, tilingPattern);
}
return splashOk;
@@ -3509,7 +3510,8 @@ SplashError Splash::arbitraryTransformImage(SplashImageSource src, void *srcData
SplashColorMode srcMode, int nComps,
GBool srcAlpha,
int srcWidth, int srcHeight,
- SplashCoord *mat) {
+ SplashCoord *mat,
+ GBool tilingPattern) {
SplashBitmap *scaledImg;
SplashClipResult clipRes, clipRes2;
SplashPipe pipe;
@@ -3558,44 +3560,53 @@ SplashError Splash::arbitraryTransformImage(SplashImageSource src, void *srcData
}
// compute the scale factors
- if (mat[0] >= 0) {
- t0 = imgCoordMungeUpper(mat[0] + mat[4]) - imgCoordMungeLower(mat[4]);
+ if (splashAbs(mat[0]) >= splashAbs(mat[1])) {
+ scaledWidth = xMax - xMin;
+ scaledHeight = yMax - yMin;
} else {
- t0 = imgCoordMungeUpper(mat[4]) - imgCoordMungeLower(mat[0] + mat[4]);
+ scaledWidth = yMax - yMin;
+ scaledHeight = xMax - xMin;
}
- 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;
+ 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]);
}
- } 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[1] >= 0) {
+ t1 = imgCoordMungeUpper(mat[1] + mat[5]) - imgCoordMungeLower(mat[5]);
+ } else {
+ t1 = imgCoordMungeUpper(mat[5]) - imgCoordMungeLower(mat[1] + mat[5]);
}
- }
- 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;
+ 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;
+ }
}
- } 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;
+ 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;
}
- scaledHeight = t0 > t1 ? t0 : t1;
if (scaledWidth == 0) {
scaledWidth = 1;
}
diff --git a/splash/Splash.h b/splash/Splash.h
index bc82faa..f4fb542 100644
--- a/splash/Splash.h
+++ b/splash/Splash.h
@@ -209,7 +209,7 @@ public:
// The matrix behaves as for fillImageMask.
SplashError drawImage(SplashImageSource src, void *srcData,
SplashColorMode srcMode, GBool srcAlpha,
- int w, int h, SplashCoord *mat);
+ int w, int h, SplashCoord *mat, GBool tilingPattern = gFalse);
// Composite a rectangular region from <src> onto this Splash
// object.
@@ -348,7 +348,7 @@ private:
SplashColorMode srcMode, int nComps,
GBool srcAlpha,
int srcWidth, int srcHeight,
- SplashCoord *mat);
+ SplashCoord *mat, GBool tilingPattern = gFalse);
SplashBitmap *scaleImage(SplashImageSource src, void *srcData,
SplashColorMode srcMode, int nComps,
GBool srcAlpha, int srcWidth, int srcHeight,
commit e09be3bc6ba1290fd31bde0c3d19c4ffcbadbf00
Author: Albert Astals Cid <aacid at kde.org>
Date: Tue Jul 10 23:06:53 2012 +0200
0.20.2
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 6b9efdc..c427064 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -16,7 +16,7 @@ test_big_endian(WORDS_BIGENDIAN)
set(POPPLER_MAJOR_VERSION "0")
set(POPPLER_MINOR_VERSION "20")
-set(POPPLER_MICRO_VERSION "1")
+set(POPPLER_MICRO_VERSION "2")
set(POPPLER_VERSION "${POPPLER_MAJOR_VERSION}.${POPPLER_MINOR_VERSION}.${POPPLER_MICRO_VERSION}")
# command line switches
diff --git a/NEWS b/NEWS
index 4ebae4f..df7dca7 100644
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,14 @@
+Release 0.20.2
+ core:
+ * Fix compilation on Windows
+ * Copy resources content defined in the pages dict on save (Bug #51369)
+ * PSOutputDev: Correct %%DocumentCustomColors (Bug #51479)
+ * PSOutputDev: Fix handling of DeviceN images in level 3 PostScript (Bug #51548)
+ * Fix crash in malformed documents
+
+ qt4:
+ * Do not hang on malformed /Annots objects (Bug #51361)
+
Release 0.20.1
core:
* Remove unnecesary transparency group handling in splash (Bug #13487)
diff --git a/configure.ac b/configure.ac
index 553f2e5..0facfdb 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,6 +1,6 @@
m4_define([poppler_version_major],[0])
m4_define([poppler_version_minor],[20])
-m4_define([poppler_version_micro],[1])
+m4_define([poppler_version_micro],[2])
m4_define([poppler_version],[poppler_version_major.poppler_version_minor.poppler_version_micro])
AC_PREREQ(2.59)
diff --git a/cpp/Doxyfile b/cpp/Doxyfile
index 03f4dd3..1643e53 100644
--- a/cpp/Doxyfile
+++ b/cpp/Doxyfile
@@ -31,7 +31,7 @@ PROJECT_NAME = "Poppler CPP"
# This could be handy for archiving the generated documentation or
# if some version control system is used.
-PROJECT_NUMBER = 0.20.1
+PROJECT_NUMBER = 0.20.2
# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute)
# base path where the generated documentation will be put.
diff --git a/qt4/src/Doxyfile b/qt4/src/Doxyfile
index 35b2819..0920827 100644
--- a/qt4/src/Doxyfile
+++ b/qt4/src/Doxyfile
@@ -31,7 +31,7 @@ PROJECT_NAME = "Poppler Qt4 "
# This could be handy for archiving the generated documentation or
# if some version control system is used.
-PROJECT_NUMBER = 0.20.1
+PROJECT_NUMBER = 0.20.2
# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute)
# base path where the generated documentation will be put.
commit e15fe0e1e6accf779caeb1179a8d62161c0aa650
Author: Thomas Freitag <Thomas.Freitag at alfa.de>
Date: Thu Jul 5 17:44:02 2012 +0200
Fix handling of DeviceN images in level 3 PostScript
bug #51548
diff --git a/poppler/PSOutputDev.cc b/poppler/PSOutputDev.cc
index 8f8107b..5df506f 100644
--- a/poppler/PSOutputDev.cc
+++ b/poppler/PSOutputDev.cc
@@ -6099,15 +6099,6 @@ void PSOutputDev::doImageL3(Object *ref, GfxImageColorMap *colorMap,
n = (1 << colorMap->getBits()) - 1;
writePSFmt("{0:.4g} {1:.4g}", colorMap->getDecodeLow(0) * n,
colorMap->getDecodeHigh(0) * n);
- } else if (colorMap->getColorSpace()->getMode() == csDeviceN) {
- numComps = ((GfxDeviceNColorSpace *)colorMap->getColorSpace())->
- getAlt()->getNComps();
- for (i = 0; i < numComps; ++i) {
- if (i > 0) {
- writePS(" ");
- }
- writePS("0 1");
- }
} else {
numComps = colorMap->getNumPixelComps();
for (i = 0; i < numComps; ++i) {
@@ -6237,11 +6228,6 @@ void PSOutputDev::doImageL3(Object *ref, GfxImageColorMap *colorMap,
str = str->getUndecodedStream();
}
- // recode DeviceN data
- if (colorMap && colorMap->getColorSpace()->getMode() == csDeviceN) {
- str = new DeviceNRecoder(str, width, height, colorMap);
- }
-
// add RunLengthEncode and ASCIIHex/85 encode filters
if (useRLE) {
str = new RunLengthEncoder(str);
commit 02c4e6bf4cc0f5535946fe31815081a40b1de986
Author: Albert Astals Cid <aacid at kde.org>
Date: Fri Jun 29 01:56:55 2012 +0200
PSOutputDev: Correct %%DocumentCustomColors
Bug 51479
diff --git a/poppler/PSOutputDev.cc b/poppler/PSOutputDev.cc
index c655652..8f8107b 100644
--- a/poppler/PSOutputDev.cc
+++ b/poppler/PSOutputDev.cc
@@ -3984,6 +3984,26 @@ void PSOutputDev::addCustomColor(GfxSeparationColorSpace *sepCS) {
GfxColor color;
GfxCMYK cmyk;
+ if (!sepCS->getName()->cmp("Black")) {
+ processColors |= psProcessBlack;
+ return;
+ }
+ if (!sepCS->getName()->cmp("Cyan")) {
+ processColors |= psProcessCyan;
+ return;
+ }
+ if (!sepCS->getName()->cmp("Yellow")) {
+ processColors |= psProcessYellow;
+ return;
+ }
+ if (!sepCS->getName()->cmp("Magenta")) {
+ processColors |= psProcessMagenta;
+ return;
+ }
+ if (!sepCS->getName()->cmp("All"))
+ return;
+ if (!sepCS->getName()->cmp("None"))
+ return;
for (cc = customColors; cc; cc = cc->next) {
if (!cc->name->cmp(sepCS->getName())) {
return;
commit f7990386d268a444c297958e9c50ed27a0825a00
Author: Albert Astals Cid <aacid at kde.org>
Date: Thu Jun 28 00:18:07 2012 +0200
Add some security checks to JPXStream decoding
Fixes crash in broken/fuzzed pdf sent by Mateusz "j00ru" Jurczyk and Gynvael Coldwind
diff --git a/poppler/JPXStream.cc b/poppler/JPXStream.cc
index 54bee6f..2cf616d 100644
--- a/poppler/JPXStream.cc
+++ b/poppler/JPXStream.cc
@@ -13,7 +13,7 @@
// All changes made under the Poppler project to this file are licensed
// under GPL version 2 or later
//
-// Copyright (C) 2008 Albert Astals Cid <aacid at kde.org>
+// Copyright (C) 2008, 2012 Albert Astals Cid <aacid at 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
@@ -416,6 +416,10 @@ void JPXStream::fillReadBuf() {
#endif
tx = jpxCeilDiv((curX - img.xTileOffset) % img.xTileSize, tileComp->hSep);
ty = jpxCeilDiv((curY - img.yTileOffset) % img.yTileSize, tileComp->vSep);
+ if (unlikely(ty >= (tileComp->y1 - tileComp->y0))) {
+ error(errSyntaxError, getPos(), "Unexpected ty in fillReadBuf in JPX stream");
+ return;
+ }
pix = (int)tileComp->data[ty * (tileComp->x1 - tileComp->x0) + tx];
pixBits = tileComp->prec;
#if 1 //~ ignore the palette, assume the PDF ColorSpace object is valid
@@ -2846,7 +2850,13 @@ void JPXStream::inverseTransformLevel(JPXTileComp *tileComp,
cover(102);
++shift;
}
- t = tileComp->quantSteps[qStyle == 1 ? 0 : (3*r - 2 + sb)];
+ const Guint stepIndex = qStyle == 1 ? 0 : (3*r - 2 + sb);
+ if (unlikely(stepIndex >= tileComp->nQuantSteps)) {
+ error(errSyntaxError, getPos(),
+ "Wrong index for quantSteps in inverseTransformLevel in JPX stream");
+ break;
+ }
+ t = tileComp->quantSteps[stepIndex];
mu = (double)(0x800 + (t & 0x7ff)) / 2048.0;
}
if (tileComp->transform == 0) {
commit c5c6eed1623506e1206e89cee0b7c887d815ba62
Author: Albert Astals Cid <aacid at kde.org>
Date: Sun Jun 24 23:43:03 2012 +0200
Change SplashBitmap gmallocn to gmallocn_checkoverflow
Fixes abort in KDE bug #302372
diff --git a/splash/Splash.cc b/splash/Splash.cc
index e5f7667..0e07c70 100644
--- a/splash/Splash.cc
+++ b/splash/Splash.cc
@@ -11,7 +11,7 @@
// All changes made under the Poppler project to this file are licensed
// under GPL version 2 or later
//
-// Copyright (C) 2005-2011 Albert Astals Cid <aacid at kde.org>
+// Copyright (C) 2005-2012 Albert Astals Cid <aacid at kde.org>
// Copyright (C) 2005 Marco Pesenti Gritti <mpg at redhat.com>
// Copyright (C) 2010-2012 Thomas Freitag <Thomas.Freitag at alfa.de>
// Copyright (C) 2010 Christian Feuersänger <cfeuersaenger at googlemail.com>
@@ -3625,6 +3625,10 @@ SplashError Splash::arbitraryTransformImage(SplashImageSource src, void *srcData
}
scaledImg = scaleImage(src, srcData, srcMode, nComps, srcAlpha,
srcWidth, srcHeight, scaledWidth, scaledHeight);
+
+ if (scaledImg == NULL) {
+ return splashErrBadArg;
+ }
// construct the three sections
i = 0;
@@ -3803,22 +3807,27 @@ SplashBitmap *Splash::scaleImage(SplashImageSource src, void *srcData,
SplashBitmap *dest;
dest = new SplashBitmap(scaledWidth, scaledHeight, 1, srcMode, srcAlpha);
- if (scaledHeight < srcHeight) {
- if (scaledWidth < srcWidth) {
- scaleImageYdXd(src, srcData, srcMode, nComps, srcAlpha,
- srcWidth, srcHeight, scaledWidth, scaledHeight, dest);
+ 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 {
- scaleImageYdXu(src, srcData, srcMode, nComps, srcAlpha,
- srcWidth, srcHeight, scaledWidth, scaledHeight, dest);
+ if (scaledWidth < srcWidth) {
+ scaleImageYuXd(src, srcData, srcMode, nComps, srcAlpha,
+ srcWidth, srcHeight, scaledWidth, scaledHeight, dest);
+ } else {
+ scaleImageYuXu(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 {
- scaleImageYuXu(src, srcData, srcMode, nComps, srcAlpha,
- srcWidth, srcHeight, scaledWidth, scaledHeight, dest);
- }
+ delete dest;
+ dest = NULL;
}
return dest;
}
diff --git a/splash/SplashBitmap.cc b/splash/SplashBitmap.cc
index e4f27fc..cd85543 100644
--- a/splash/SplashBitmap.cc
+++ b/splash/SplashBitmap.cc
@@ -101,13 +101,17 @@ SplashBitmap::SplashBitmap(int widthA, int heightA, int rowPadA,
rowSize += rowPad - 1;
rowSize -= rowSize % rowPad;
}
- data = (SplashColorPtr)gmallocn(rowSize, height);
- if (!topDown) {
- data += (height - 1) * rowSize;
- rowSize = -rowSize;
- }
- if (alphaA) {
- alpha = (Guchar *)gmallocn(width, height);
+ 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;
}
commit c87738ee234aafc6eda5a263ad789205037020e1
Author: Thomas Freitag <Thomas.Freitag at alfa.de>
Date: Sun Jun 24 20:20:38 2012 +0200
copy resources content defined in the pages dict
Fixes bug #51369
diff --git a/poppler/PDFDoc.cc b/poppler/PDFDoc.cc
index 2dc1ac8..ce01ca3 100644
--- a/poppler/PDFDoc.cc
+++ b/poppler/PDFDoc.cc
@@ -661,9 +661,14 @@ int PDFDoc::savePageAs(GooString *name, int pageNo)
infoObj.free();
// get and mark output intents etc.
- Object catObj;
+ Object catObj, pagesObj, resourcesObj;
getXRef()->getCatalog(&catObj);
Dict *catDict = catObj.getDict();
+ catDict->lookup("Pages", &pagesObj);
+ Dict *pagesDict = pagesObj.getDict();
+ pagesDict->lookup("Resources", &resourcesObj);
+ if (resourcesObj.isDict())
+ markPageObjects(resourcesObj.getDict(), yRef, countRef, 0);
markPageObjects(catDict, yRef, countRef, 0);
Dict *pageDict = page.getDict();
@@ -687,12 +692,19 @@ int PDFDoc::savePageAs(GooString *name, int pageNo)
}
}
catObj.free();
+ pagesObj.free();
outStr->printf(">>\nendobj\n");
objectsCount++;
yRef->add(rootNum + 1,0,outStr->getPos(),gTrue);
outStr->printf("%d 0 obj\n", rootNum + 1);
- outStr->printf("<< /Type /Pages /Kids [ %d 0 R ] /Count 1 >>\n", rootNum + 2);
+ outStr->printf("<< /Type /Pages /Kids [ %d 0 R ] /Count 1 ", rootNum + 2);
+ if (resourcesObj.isDict()) {
+ outStr->printf("/Resources ");
+ writeObject(&resourcesObj, NULL, outStr, getXRef(), 0);
+ resourcesObj.free();
+ }
+ outStr->printf(">>\n");
outStr->printf("endobj\n");
objectsCount++;
commit 6cdf879e389f05abba30b3fad8083b7fff23056e
Author: Fabio D'Urso <fabiodurso at hotmail.it>
Date: Sun Jun 24 11:48:04 2012 +0200
qt4: Do not hang on malformed /Annots objects
Don't recurse infinitely if the /Annots object contains annotation
dictionaries (according to specs, /Annots must contain *references*
to annotation dictionaries).
Fixes bug #51361
diff --git a/qt4/src/poppler-annotation.cc b/qt4/src/poppler-annotation.cc
index 77bbf90..67dbbae 100644
--- a/qt4/src/poppler-annotation.cc
+++ b/qt4/src/poppler-annotation.cc
@@ -1512,6 +1512,11 @@ QList<Annotation*> Annotation::revisions() const
return res;
}
+ /* If the annotation doesn't live in a object on its own (eg bug51361), it
+ * has no ref, therefore it can't have revisions */
+ if ( !d->pdfAnnot->getHasRef() )
+ return QList<Annotation*>();
+
return AnnotationPrivate::findAnnotations( d->pdfPage, d->parentDoc, d->pdfAnnot->getId() );
}
commit 3575becd60585324bcefc0631b1bac47c1db3c5c
Author: Mark Brand <mabrand at mabrand.nl>
Date: Thu Jun 14 20:31:26 2012 +0200
fix typo to compile in Windows
diff --git a/poppler/GlobalParamsWin.cc b/poppler/GlobalParamsWin.cc
index b77ac4f..527f08e 100644
--- a/poppler/GlobalParamsWin.cc
+++ b/poppler/GlobalParamsWin.cc
@@ -5,6 +5,7 @@
// Copyright (C) 2012 Thomas Freitag <Thomas.Freitag at alfa.de>
// Copyright (C) 2012 Suzuki Toshiya <mpsuzuki at hiroshima-u.ac.jp>
// Copyright (C) 2012 Adrian Johnson <ajohnson at redneon.com>
+ // Copyright (C) 2012 Mark Brand <mabrand at mabrand.nl>
TODO: instead of a fixed mapping defined in displayFontTab, it could
scan the whole fonts directory, parse TTF files and build font
@@ -573,7 +574,7 @@ GooString *GlobalParams::findSystemFontFile(GfxFont *font,
*type = fi->type;
*fontNum = fi->fontNum;
if (substituteFontName)
- substituteFontName.Set(fi->substituteName->getCString());
+ substituteFontName->Set(fi->substituteName->getCString());
} else {
GooString *substFontName = new GooString(findSubstituteName(font, fontFiles,
substFiles,
commit 06618065c8a97a5bec125560546b98edfc1210f3
Author: Albert Astals Cid <aacid at kde.org>
Date: Mon Jun 11 15:17:59 2012 +0200
Add some security checks to JBIG2Stream decoding
Fixes crash in broken/fuzzed pdf sent by Mateusz "j00ru" Jurczyk and Gynvael Coldwind
diff --git a/poppler/JBIG2Stream.cc b/poppler/JBIG2Stream.cc
index a65746e..7ddcc81 100644
--- a/poppler/JBIG2Stream.cc
+++ b/poppler/JBIG2Stream.cc
@@ -1860,13 +1860,18 @@ GBool JBIG2Stream::readSymbolDictSeg(Guint segNum, Guint length,
0, gFalse, gFalse, NULL, NULL, NULL,
bmSize);
}
- x = 0;
- for (; j < i; ++j) {
- bitmaps[numInputSyms + j] =
- collBitmap->getSlice(x, 0, symWidths[j], symHeight);
- x += symWidths[j];
+ if (likely(collBitmap != NULL)) {
+ x = 0;
+ for (; j < i; ++j) {
+ bitmaps[numInputSyms + j] =
+ collBitmap->getSlice(x, 0, symWidths[j], symHeight);
+ x += symWidths[j];
+ }
+ delete collBitmap;
+ } else {
+ error(errSyntaxError, curStr->getPos(), "collBitmap was null");
+ goto syntaxError;
}
- delete collBitmap;
}
}
@@ -2858,6 +2863,7 @@ JBIG2Bitmap *JBIG2Stream::readGenericBitmap(GBool mmr, int w, int h,
// ---> max refLine size = w + 2
codingLine = (int *)gmallocn(w + 1, sizeof(int));
refLine = (int *)gmallocn(w + 2, sizeof(int));
+ memset(refLine, 0, (w + 2) * sizeof(int));
for (i = 0; i < w + 1; ++i) codingLine[i] = w;
for (y = 0; y < h; ++y) {
@@ -2884,6 +2890,9 @@ JBIG2Bitmap *JBIG2Stream::readGenericBitmap(GBool mmr, int w, int h,
code1 = mmrDecoder->get2DCode();
switch (code1) {
case twoDimPass:
+ if (unlikely(b1i + 1 >= w + 2)) {
+ break;
+ }
mmrAddPixels(refLine[b1i + 1], blackPixels, codingLine, &a0i, w);
if (refLine[b1i + 1] < w) {
b1i += 2;
@@ -2912,51 +2921,66 @@ JBIG2Bitmap *JBIG2Stream::readGenericBitmap(GBool mmr, int w, int h,
mmrAddPixels(codingLine[a0i] + code2, blackPixels ^ 1,
codingLine, &a0i, w);
}
- while (refLine[b1i] <= codingLine[a0i] && refLine[b1i] < w) {
+ while (likely(b1i < w + 2) && refLine[b1i] <= codingLine[a0i] && refLine[b1i] < w) {
b1i += 2;
}
break;
case twoDimVertR3:
+ if (unlikely(b1i >= w + 2)) {
+ break;
+ }
mmrAddPixels(refLine[b1i] + 3, blackPixels, codingLine, &a0i, w);
blackPixels ^= 1;
if (codingLine[a0i] < w) {
++b1i;
- while (refLine[b1i] <= codingLine[a0i] && refLine[b1i] < w) {
+ while (likely(b1i < w + 2) && refLine[b1i] <= codingLine[a0i] && refLine[b1i] < w) {
b1i += 2;
}
}
break;
case twoDimVertR2:
+ if (unlikely(b1i >= w + 2)) {
+ break;
+ }
mmrAddPixels(refLine[b1i] + 2, blackPixels, codingLine, &a0i, w);
blackPixels ^= 1;
if (codingLine[a0i] < w) {
++b1i;
- while (refLine[b1i] <= codingLine[a0i] && refLine[b1i] < w) {
+ while (likely(b1i < w + 2) && refLine[b1i] <= codingLine[a0i] && refLine[b1i] < w) {
b1i += 2;
}
}
break;
case twoDimVertR1:
+ if (unlikely(b1i >= w + 2)) {
+ break;
+ }
mmrAddPixels(refLine[b1i] + 1, blackPixels, codingLine, &a0i, w);
blackPixels ^= 1;
if (codingLine[a0i] < w) {
++b1i;
- while (refLine[b1i] <= codingLine[a0i] && refLine[b1i] < w) {
+ while (likely(b1i < w + 2) && refLine[b1i] <= codingLine[a0i] && refLine[b1i] < w) {
b1i += 2;
}
}
break;
case twoDimVert0:
+ if (unlikely(b1i >= w + 2)) {
+ break;
+ }
mmrAddPixels(refLine[b1i], blackPixels, codingLine, &a0i, w);
blackPixels ^= 1;
if (codingLine[a0i] < w) {
++b1i;
- while (refLine[b1i] <= codingLine[a0i] && refLine[b1i] < w) {
+ while (likely(b1i < w + 2) && refLine[b1i] <= codingLine[a0i] && refLine[b1i] < w) {
b1i += 2;
}
}
break;
case twoDimVertL3:
+ if (unlikely(b1i >= w + 2)) {
+ break;
+ }
mmrAddPixelsNeg(refLine[b1i] - 3, blackPixels, codingLine, &a0i, w);
blackPixels ^= 1;
if (codingLine[a0i] < w) {
@@ -2965,12 +2989,15 @@ JBIG2Bitmap *JBIG2Stream::readGenericBitmap(GBool mmr, int w, int h,
} else {
++b1i;
}
- while (refLine[b1i] <= codingLine[a0i] && refLine[b1i] < w) {
+ while (likely(b1i < w + 2) && refLine[b1i] <= codingLine[a0i] && refLine[b1i] < w) {
b1i += 2;
}
}
break;
case twoDimVertL2:
+ if (unlikely(b1i >= w + 2)) {
+ break;
+ }
mmrAddPixelsNeg(refLine[b1i] - 2, blackPixels, codingLine, &a0i, w);
blackPixels ^= 1;
if (codingLine[a0i] < w) {
@@ -2979,12 +3006,15 @@ JBIG2Bitmap *JBIG2Stream::readGenericBitmap(GBool mmr, int w, int h,
} else {
++b1i;
}
- while (refLine[b1i] <= codingLine[a0i] && refLine[b1i] < w) {
+ while (likely(b1i < w + 2) && refLine[b1i] <= codingLine[a0i] && refLine[b1i] < w) {
b1i += 2;
}
}
break;
case twoDimVertL1:
+ if (unlikely(b1i >= w + 2)) {
+ break;
+ }
mmrAddPixelsNeg(refLine[b1i] - 1, blackPixels, codingLine, &a0i, w);
blackPixels ^= 1;
if (codingLine[a0i] < w) {
@@ -2993,7 +3023,7 @@ JBIG2Bitmap *JBIG2Stream::readGenericBitmap(GBool mmr, int w, int h,
} else {
++b1i;
}
- while (refLine[b1i] <= codingLine[a0i] && refLine[b1i] < w) {
+ while (likely(b1i < w + 2) && refLine[b1i] <= codingLine[a0i] && refLine[b1i] < w) {
b1i += 2;
}
}
commit e3fe88df3646a80945210ba426eb4681a98b55e9
Author: Hib Eris <hib at hiberis.nl>
Date: Sun Jun 10 19:44:18 2012 +0200
Check value of first page in linearization table
Fixes crash in broken/fuzzed pdf sent by Mateusz "j00ru" Jurczyk and Gynvael Coldwind
diff --git a/poppler/Linearization.cc b/poppler/Linearization.cc
index 7b8f1e0..33331d1 100644
--- a/poppler/Linearization.cc
+++ b/poppler/Linearization.cc
@@ -4,7 +4,7 @@
//
// This file is licensed under the GPLv2 or later
//
-// Copyright 2010 Hib Eris <hib at hiberis.nl>
+// Copyright 2010, 2012 Hib Eris <hib at hiberis.nl>
//
//========================================================================
@@ -211,7 +211,7 @@ int Linearization::getPageFirst()
linDict.getDict()->lookupInt("P", NULL, &pageFirst);
}
- if (pageFirst < 0) {
+ if ((pageFirst < 0) || (pageFirst > getNumPages())) {
error(errSyntaxWarning, -1, "First page in linearization table is invalid");
return 0;
}
commit 1240eee8c0d0d01113443e0fda87721775a76da9
Author: Albert Astals Cid <aacid at kde.org>
Date: Sun Jun 10 20:42:55 2012 +0200
0.20.1
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 9f4830b..6b9efdc 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -16,7 +16,7 @@ test_big_endian(WORDS_BIGENDIAN)
set(POPPLER_MAJOR_VERSION "0")
set(POPPLER_MINOR_VERSION "20")
-set(POPPLER_MICRO_VERSION "0")
+set(POPPLER_MICRO_VERSION "1")
set(POPPLER_VERSION "${POPPLER_MAJOR_VERSION}.${POPPLER_MINOR_VERSION}.${POPPLER_MICRO_VERSION}")
# command line switches
@@ -386,7 +386,7 @@ add_library(poppler STATIC ${poppler_SRCS})
else(MSVC)
add_library(poppler SHARED ${poppler_SRCS})
endif(MSVC)
-set_target_properties(poppler PROPERTIES VERSION 25.0.0 SOVERSION 25)
+set_target_properties(poppler PROPERTIES VERSION 26.0.0 SOVERSION 26)
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})
diff --git a/NEWS b/NEWS
index 308edc9..4ebae4f 100644
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,28 @@
+Release 0.20.1
+ core:
+ * Remove unnecesary transparency group handling in splash (Bug #13487)
+ * Include substitute font name in system font cache (Bug #49826)
+ * Fix logic on SplashBitmap::writeImgFile
+ * PSOutputDev: use setoverprintmode only if rip knows it
+ * Fix crash in malformed documents
+
+ qt4:
+ * Make TextAnnotation constructor public
+ * Fix saving of default TextAnnotation to xml
+ * Keep page rotation into account when normalizing annotation coords
+
+ glib:
+ * Fix memory leak when document fails to load
+ * Make sure password is always converted to latin1
+ * Fix typo in documentation
+
+ build system:
+ * Distribute cmake/modules/FindLCMS2.cmake (Bug #49818)
+
+ utils:
+ * pdftohtml: Determine if font is bold or italic based on FontDescriptor (Bug #49758)
+ * pdfseparate: Syntax fixes in the man page
+
Release 0.20.0
core:
* Reconstruct xref table if xref needed but missing (Bug #40719)
diff --git a/configure.ac b/configure.ac
index 1eaa809..553f2e5 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,6 +1,6 @@
m4_define([poppler_version_major],[0])
m4_define([poppler_version_minor],[20])
-m4_define([poppler_version_micro],[0])
+m4_define([poppler_version_micro],[1])
m4_define([poppler_version],[poppler_version_major.poppler_version_minor.poppler_version_micro])
AC_PREREQ(2.59)
diff --git a/cpp/Doxyfile b/cpp/Doxyfile
index e24d208..03f4dd3 100644
--- a/cpp/Doxyfile
+++ b/cpp/Doxyfile
@@ -31,7 +31,7 @@ PROJECT_NAME = "Poppler CPP"
# This could be handy for archiving the generated documentation or
# if some version control system is used.
-PROJECT_NUMBER = 0.20.0
+PROJECT_NUMBER = 0.20.1
# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute)
# base path where the generated documentation will be put.
diff --git a/poppler/Makefile.am b/poppler/Makefile.am
index 8920f8e..c5785d6 100644
--- a/poppler/Makefile.am
+++ b/poppler/Makefile.am
@@ -177,7 +177,7 @@ libpoppler_la_LIBADD = \
$(PTHREAD_LIBS) \
$(win32_libs)
-libpoppler_la_LDFLAGS = -version-info 25:0:0 @create_shared_lib@ @auto_import_flags@
+libpoppler_la_LDFLAGS = -version-info 26:0:0 @create_shared_lib@ @auto_import_flags@
if ENABLE_XPDF_HEADERS
diff --git a/qt4/src/Doxyfile b/qt4/src/Doxyfile
index 18e0831..35b2819 100644
--- a/qt4/src/Doxyfile
+++ b/qt4/src/Doxyfile
@@ -31,7 +31,7 @@ PROJECT_NAME = "Poppler Qt4 "
# This could be handy for archiving the generated documentation or
# if some version control system is used.
-PROJECT_NUMBER = 0.20.0
+PROJECT_NUMBER = 0.20.1
# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute)
# base path where the generated documentation will be put.
commit c783037619e2b4c101e8ecd7e61c94ee077b4be2
Author: Albert Astals Cid <aacid at kde.org>
Date: Sun Jun 10 20:15:01 2012 +0200
Update copyrights
diff --git a/poppler/GlobalParamsWin.cc b/poppler/GlobalParamsWin.cc
index b8c3d0c..b77ac4f 100644
--- a/poppler/GlobalParamsWin.cc
+++ b/poppler/GlobalParamsWin.cc
@@ -4,6 +4,7 @@
// Copyright (C) 2010 Hib Eris <hib at hiberis.nl>
// Copyright (C) 2012 Thomas Freitag <Thomas.Freitag at alfa.de>
// Copyright (C) 2012 Suzuki Toshiya <mpsuzuki at hiroshima-u.ac.jp>
+ // Copyright (C) 2012 Adrian Johnson <ajohnson at redneon.com>
TODO: instead of a fixed mapping defined in displayFontTab, it could
scan the whole fonts directory, parse TTF files and build font
commit f3f9d8f28a97338da92c842d5668b0ef3495ef13
Author: Albert Astals Cid <aacid at kde.org>
Date: Sun Jun 10 19:09:17 2012 +0200
Do use NULL function
Fixes crash in broken/fuzzed pdf sent by Mateusz "j00ru" Jurczyk and Gynvael Coldwind
diff --git a/poppler/Gfx.cc b/poppler/Gfx.cc
index 5c788fb..d7684d6 100644
--- a/poppler/Gfx.cc
+++ b/poppler/Gfx.cc
@@ -1158,8 +1158,9 @@ void Gfx::opSetExtGState(Object args[], int numArgs) {
funcs[0] = NULL;
} else {
funcs[0] = Function::parse(&obj3);
- if (funcs[0]->getInputSize() != 1 ||
- funcs[0]->getOutputSize() != 1) {
+ if (funcs[0] == NULL ||
+ funcs[0]->getInputSize() != 1 ||
+ funcs[0]->getOutputSize() != 1) {
error(errSyntaxError, getPos(),
"Invalid transfer function in soft mask in ExtGState");
delete funcs[0];
commit 92ef16e3699da949c80716c3fd4b438fe79c134d
Author: Thomas Freitag <Thomas.Freitag at alfa.de>
Date: Sun Jun 10 16:58:54 2012 +0200
use setoverprintmode only if rip knows it
diff --git a/poppler/PSOutputDev.cc b/poppler/PSOutputDev.cc
index dac10d0..c655652 100644
--- a/poppler/PSOutputDev.cc
+++ b/poppler/PSOutputDev.cc
@@ -258,7 +258,7 @@ static const char *prolog[] = {
"} def",
"~3n",
"/opm { dup /pdfOPM exch def",
- " setoverprintmode } def",
+ " /setoverprintmode where{pop setoverprintmode}{pop}ifelse } def",
"~23n",
"/cs { /pdfFillXform exch def dup /pdfFillCS exch def",
" setcolorspace } def",
@@ -292,7 +292,7 @@ static const char *prolog[] = {
"} def",
"~3s",
"/opm { dup /pdfOPM exch def",
- " setoverprintmode } def",
+ " /setoverprintmode where{pop setoverprintmode}{pop}ifelse } def",
"~23s",
"/k { 4 copy 4 array astore /pdfFill exch def setcmykcolor",
" /pdfLastFill true def /pdfLastStroke false def } def",
@@ -390,7 +390,7 @@ static const char *prolog[] = {
"~3sn",
" /pdfOPM where {",
" pop",
- " pdfOPM setoverprintmode",
+ " pdfOPM /setoverprintmode where{pop setoverprintmode}{pop}ifelse ",
" } if",
"~23sn",
"} def",
commit 99aa734ae2d3ba51f840d4c8ef450488fb702a31
Author: Fabio D'Urso <fabiodurso at hotmail.it>
Date: Thu May 24 23:17:27 2012 +0200
qt4: Keep page rotation into account when normalizing annotation coords
If the page is rotated by 90 or 270 degrees, width and height need to be swapped
diff --git a/qt4/src/poppler-annotation.cc b/qt4/src/poppler-annotation.cc
index 0edb4af..77bbf90 100644
--- a/qt4/src/poppler-annotation.cc
+++ b/qt4/src/poppler-annotation.cc
@@ -203,10 +203,22 @@ void AnnotationPrivate::fillMTX(double MTX[6]) const
// build a normalized transform matrix for this page at 100% scale
GfxState * gfxState = new GfxState( 72.0, 72.0, pdfPage->getCropBox(), pdfPage->getRotate(), gTrue );
double * gfxCTM = gfxState->getCTM();
+
+ double w = pdfPage->getCropWidth();
+ double h = pdfPage->getCropHeight();
+
+ // Swap width and height if the page is rotated landscape or seascape
+ if ( pdfPage->getRotate() == 90 || pdfPage->getRotate() == 270 )
+ {
+ double t = w;
+ w = h;
+ h = t;
+ }
+
for ( int i = 0; i < 6; i+=2 )
{
- MTX[i] = gfxCTM[i] / pdfPage->getCropWidth();
- MTX[i+1] = gfxCTM[i+1] / pdfPage->getCropHeight();
+ MTX[i] = gfxCTM[i] / w;
+ MTX[i+1] = gfxCTM[i+1] / h;
}
delete gfxState;
}
commit bde31ce7b223abc86d25e06f3d73668b792c70df
Author: Fabio D'Urso <fabiodurso at hotmail.it>
Date: Sat Jun 9 01:31:29 2012 +0200
Fix saving to xml
The default icon is Note not comment
diff --git a/qt4/src/poppler-annotation.cc b/qt4/src/poppler-annotation.cc
index 4d7cd84..0edb4af 100644
--- a/qt4/src/poppler-annotation.cc
+++ b/qt4/src/poppler-annotation.cc
@@ -1662,7 +1662,7 @@ void TextAnnotation::store( QDomNode & node, QDomDocument & document ) const
// store the optional attributes
if ( textType() != Linked )
textElement.setAttribute( "type", (int)textType() );
- if ( textIcon() != "Comment" )
+ if ( textIcon() != "Note" )
textElement.setAttribute( "icon", textIcon() );
if ( inplaceAlign() )
textElement.setAttribute( "align", inplaceAlign() );
commit 9904b8f10abf068a7816bd90976ccbb320387645
Author: Adrian Johnson <ajohnson at redneon.com>
Date: Thu May 24 18:24:48 2012 +0930
glib docs: fix typo
diff --git a/glib/poppler-document.cc b/glib/poppler-document.cc
index 2b01c29..24badd9 100644
--- a/glib/poppler-document.cc
+++ b/glib/poppler-document.cc
@@ -1721,7 +1721,7 @@ poppler_fonts_iter_get_name (PopplerFontsIter *iter)
* The name of the substitute font of the font associated with @iter or %NULL if
* the font is embedded
*
- * Returns: the name of the substitute font or %NULL y font is emebedded
+ * Returns: the name of the substitute font or %NULL if font is embedded
*
* Since: 0.20
*/
@@ -1748,7 +1748,7 @@ poppler_fonts_iter_get_substitute_name (PopplerFontsIter *iter)
* The filename of the font associated with @iter or %NULL if
* the font is embedded
*
- * Returns: the filename of the font or %NULL y font is emebedded
+ * Returns: the filename of the font or %NULL if font is embedded
*/
const char *
poppler_fonts_iter_get_file_name (PopplerFontsIter *iter)
commit 028f580056f99719cfb8af7bbe8184ceac02cb16
Author: Adrian Johnson <ajohnson at redneon.com>
Date: Sun May 13 21:36:36 2012 +0930
add sustitute font name to GlobalParamsWin32 to fix compilation
diff --git a/poppler/GlobalParamsWin.cc b/poppler/GlobalParamsWin.cc
index d8065e0..b8c3d0c 100644
--- a/poppler/GlobalParamsWin.cc
+++ b/poppler/GlobalParamsWin.cc
@@ -313,6 +313,7 @@ SysFontInfo *SysFontList::makeWindowsFont(char *name, int fontNum,
char c;
int i;
SysFontType type;
+ GooString substituteName;
n = strlen(name);
bold = italic = oblique = fixedWidth = gFalse;
@@ -380,7 +381,7 @@ SysFontInfo *SysFontList::makeWindowsFont(char *name, int fontNum,
}
return new SysFontInfo(s, bold, italic, oblique, fixedWidth,
- new GooString(path), type, fontNum);
+ new GooString(path), type, fontNum, substituteName.copy());
}
static GooString* replaceSuffix(GooString *path,
@@ -570,6 +571,8 @@ GooString *GlobalParams::findSystemFontFile(GfxFont *font,
path = fi->path->copy();
*type = fi->type;
*fontNum = fi->fontNum;
+ if (substituteFontName)
+ substituteFontName.Set(fi->substituteName->getCString());
} else {
GooString *substFontName = new GooString(findSubstituteName(font, fontFiles,
substFiles,
commit 1916d000a86336213ffd6e9bd44ce873e8955895
Author: Adrian Johnson <ajohnson at redneon.com>
Date: Sat May 12 16:31:38 2012 +0930
Include substitute font name in system font cache
Bug 49826
diff --git a/poppler/FontInfo.cc b/poppler/FontInfo.cc
index 4f30f05..35d5f5f 100644
--- a/poppler/FontInfo.cc
+++ b/poppler/FontInfo.cc
@@ -224,6 +224,7 @@ FontInfo::FontInfo(FontInfo& f) {
name = f.name ? f.name->copy() : NULL;
file = f.file ? f.file->copy() : NULL;
encoding = f.encoding ? f.encoding->copy() : NULL;
+ substituteName = f.substituteName ? f.substituteName->copy() : NULL;
type = f.type;
emb = f.emb;
subset = f.subset;
diff --git a/poppler/GlobalParams.cc b/poppler/GlobalParams.cc
index 64d6133..76394ca 100644
--- a/poppler/GlobalParams.cc
+++ b/poppler/GlobalParams.cc
@@ -214,9 +214,10 @@ public:
GooString *path;
SysFontType type;
int fontNum; // for TrueType collections
+ GooString *substituteName;
SysFontInfo(GooString *nameA, GBool boldA, GBool italicA, GBool obliqueA, GBool fixedWidthA,
- GooString *pathA, SysFontType typeA, int fontNumA);
+ GooString *pathA, SysFontType typeA, int fontNumA, GooString *substituteNameA);
~SysFontInfo();
GBool match(SysFontInfo *fi);
GBool match(GooString *nameA, GBool boldA, GBool italicA, GBool obliqueA, GBool fixedWidthA);
@@ -224,7 +225,7 @@ public:
};
SysFontInfo::SysFontInfo(GooString *nameA, GBool boldA, GBool italicA, GBool obliqueA, GBool fixedWidthA,
- GooString *pathA, SysFontType typeA, int fontNumA) {
+ GooString *pathA, SysFontType typeA, int fontNumA, GooString *substituteNameA) {
name = nameA;
bold = boldA;
italic = italicA;
@@ -233,11 +234,13 @@ SysFontInfo::SysFontInfo(GooString *nameA, GBool boldA, GBool italicA, GBool obl
path = pathA;
type = typeA;
fontNum = fontNumA;
+ substituteName = substituteNameA;
}
SysFontInfo::~SysFontInfo() {
delete name;
delete path;
+ delete substituteName;
}
GBool SysFontInfo::match(SysFontInfo *fi) {
@@ -1184,6 +1187,7 @@ GooString *GlobalParams::findSystemFontFile(GfxFont *font,
FcPattern *p=0;
GooString *path = NULL;
GooString *fontName = font->getName();
+ GooString substituteName;
if (!fontName) return NULL;
lockGlobalParams;
@@ -1191,6 +1195,7 @@ GooString *GlobalParams::findSystemFontFile(GfxFont *font,
path = fi->path->copy();
*type = fi->type;
*fontNum = fi->fontNum;
+ substituteName.Set(fi->substituteName->getCString());
} else {
FcChar8* s;
char * ext;
@@ -1235,28 +1240,26 @@ GooString *GlobalParams::findSystemFontFile(GfxFont *font,
}
}
FcChar8* s2;
- if (substituteFontName) {
- res = FcPatternGetString(set->fonts[i], FC_FULLNAME, 0, &s2);
- if (res == FcResultMatch && s2) {
- substituteFontName->Set((char*)s2);
- } else {
- // fontconfig does not extract fullname for some fonts
- // create the fullname from family and style
- res = FcPatternGetString(set->fonts[i], FC_FAMILY, 0, &s2);
- if (res == FcResultMatch && s2) {
- substituteFontName->Set((char*)s2);
- res = FcPatternGetString(set->fonts[i], FC_STYLE, 0, &s2);
- if (res == FcResultMatch && s2) {
- GooString *style = new GooString((char*)s2);
- if (style->cmp("Regular") != 0) {
- substituteFontName->append(" ");
- substituteFontName->append(style);
- }
- delete style;
- }
- }
- }
- }
+ res = FcPatternGetString(set->fonts[i], FC_FULLNAME, 0, &s2);
+ if (res == FcResultMatch && s2) {
+ substituteName.Set((char*)s2);
+ } else {
+ // fontconfig does not extract fullname for some fonts
+ // create the fullname from family and style
+ res = FcPatternGetString(set->fonts[i], FC_FAMILY, 0, &s2);
+ if (res == FcResultMatch && s2) {
+ substituteName.Set((char*)s2);
+ res = FcPatternGetString(set->fonts[i], FC_STYLE, 0, &s2);
+ if (res == FcResultMatch && s2) {
+ GooString *style = new GooString((char*)s2);
+ if (style->cmp("Regular") != 0) {
+ substituteName.append(" ");
+ substituteName.append(style);
+ }
+ delete style;
+ }
+ }
+ }
ext = strrchr((char*)s,'.');
if (!ext)
continue;
@@ -1281,7 +1284,7 @@ GooString *GlobalParams::findSystemFontFile(GfxFont *font,
*type = (!strncasecmp(ext,".ttc",4)) ? sysFontTTC : sysFontTTF;
FcPatternGetInteger(set->fonts[i], FC_INDEX, 0, fontNum);
fi = new SysFontInfo(fontName->copy(), bold, italic, oblique, font->isFixedWidth(),
- new GooString((char*)s), *type, *fontNum);
+ new GooString((char*)s), *type, *fontNum, substituteName.copy());
sysFonts->addFcFont(fi);
path = new GooString((char*)s);
}
@@ -1306,7 +1309,7 @@ GooString *GlobalParams::findSystemFontFile(GfxFont *font,
*type = (!strncasecmp(ext,".pfa",4)) ? sysFontPFA : sysFontPFB;
FcPatternGetInteger(set->fonts[i], FC_INDEX, 0, fontNum);
fi = new SysFontInfo(fontName->copy(), bold, italic, oblique, font->isFixedWidth(),
- new GooString((char*)s), *type, *fontNum);
+ new GooString((char*)s), *type, *fontNum, substituteName.copy());
sysFonts->addFcFont(fi);
path = new GooString((char*)s);
}
@@ -1329,6 +1332,9 @@ GooString *GlobalParams::findSystemFontFile(GfxFont *font,
*type = fi->type;
*fontNum = fi->fontNum;
}
+ if (substituteFontName) {
+ substituteFontName->Set(substituteName.getCString());
+ }
fin:
if (p)
FcPatternDestroy(p);
commit 1c6e84555572a6bf3a2e3fbe9a54b40f11c122ad
Author: Fabio D'Urso <fabiodurso at hotmail.it>
Date: Fri May 18 16:22:46 2012 +0200
qt4: Make TextAnnotation ctor public
diff --git a/qt4/src/poppler-annotation.h b/qt4/src/poppler-annotation.h
index b897603..e511ec0 100644
--- a/qt4/src/poppler-annotation.h
+++ b/qt4/src/poppler-annotation.h
@@ -302,6 +302,7 @@ class POPPLER_QT4_EXPORT TextAnnotation : public Annotation
enum TextType { Linked, InPlace };
enum InplaceIntent { Unknown, Callout, TypeWriter };
+ TextAnnotation( TextType type );
virtual ~TextAnnotation();
virtual SubType subType() const;
@@ -360,7 +361,6 @@ class POPPLER_QT4_EXPORT TextAnnotation : public Annotation
void setInplaceIntent( InplaceIntent intent );
private:
- TextAnnotation( TextType type );
TextAnnotation( const QDomNode &node );
TextAnnotation( TextAnnotationPrivate &dd );
virtual void store( QDomNode &parentNode, QDomDocument &document ) const;
commit 8e504bf2543621973fdaddbd29055ce435540146
Author: Ville Skyttä <ville.skytta at iki.fi>
Date: Wed May 16 23:49:01 2012 +0300
pdfseparate.1: Syntax fixes.
diff --git a/utils/pdfseparate.1 b/utils/pdfseparate.1
index 1eca9d2..077faec 100644
--- a/utils/pdfseparate.1
+++ b/utils/pdfseparate.1
@@ -13,10 +13,10 @@ extract single pages from a Portable Document Format (PDF).
pdfseparate reads the PDF file
.IR PDF-file ,
extracts one or more pages, and writes one PDF file for each page to
-.IR PDF-page-pattern,
+.IR PDF-page-pattern ,
PDF-page-pattern should contain
-.B %d
-. %d is replaced by the page number.
+.BR %d .
+%d is replaced by the page number.
.TP
The PDF-file should not be encrypted.
.SH OPTIONS
commit 9f7d919e68a26bb7dd809986d8394fe20b750bd0
Author: Anthony Wesley <awesley at smartnetworks.com.au>
Date: Thu May 17 19:54:47 2012 +0200
Fix logic on SplashBitmap::writeImgFile
diff --git a/splash/SplashBitmap.cc b/splash/SplashBitmap.cc
index f252318..e4f27fc 100644
--- a/splash/SplashBitmap.cc
+++ b/splash/SplashBitmap.cc
@@ -20,6 +20,7 @@
// Copyright (C) 2010 Christian Feuersänger <cfeuersaenger at googlemail.com>
// Copyright (C) 2010 William Bader <williambader at hotmail.com>
// Copyright (C) 2011, 2012 Thomas Freitag <Thomas.Freitag at alfa.de>
+// Copyright (C) 2012 Anthony Wesley <awesley at 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
@@ -519,7 +520,7 @@ SplashError SplashBitmap::writeImgFile(ImgWriter *writer, FILE *f, int hDPI, int
break;
}
- if (writer->close()) {
+ if (!writer->close()) {
return splashErrGeneric;
}
commit 7e7997e12faccf4c0513811b324a2fd0fa960a96
Author: Igor Slepchin <igor.slepchin at gmail.com>
Date: Tue May 15 23:16:27 2012 +0200
Determine if font is bold or italic based on FontDescriptor.
Bug #49758
diff --git a/utils/HtmlFonts.cc b/utils/HtmlFonts.cc
index 7205a1d..be02c5f 100644
--- a/utils/HtmlFonts.cc
+++ b/utils/HtmlFonts.cc
@@ -23,6 +23,7 @@
// Copyright (C) 2010 OSSD CDAC Mumbai by Leena Chourey (leenac at cdacmumbai.in) and Onkar Potdar (onkar at cdacmumbai.in)
// Copyright (C) 2011 Joshua Richardson <jric at chegg.com>
// Copyright (C) 2011 Stephen Reichling <sreichling at chegg.com>
+// Copyright (C) 2012 Igor Slepchin <igor.slepchin at 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
@@ -33,6 +34,7 @@
#include "HtmlUtils.h"
#include "GlobalParams.h"
#include "UnicodeMap.h"
+#include "GfxFont.h"
#include <stdio.h>
struct Fonts{
@@ -101,10 +103,12 @@ GooString *HtmlFontColor::toString() const{
return tmp;
}
-HtmlFont::HtmlFont(GooString* ftname,int _size, GfxRGB rgb){
+HtmlFont::HtmlFont(GfxFont *font, int _size, GfxRGB rgb){
//if (col) color=HtmlFontColor(col);
//else color=HtmlFontColor();
color=HtmlFontColor(rgb);
+ GooString* ftname=font->getName();
+ if (!ftname) ftname = getDefaultFont();
GooString *fontname = NULL;
@@ -124,12 +128,20 @@ HtmlFont::HtmlFont(GooString* ftname,int _size, GfxRGB rgb){
bold = gFalse;
rotOrSkewed = gFalse;
+ if (font->isBold() || font->getWeight() >= GfxFont::W700) bold=gTrue;
+ if (font->isItalic()) italic=gTrue;
+
if (fontname){
- if (strstr(fontname->lowerCase()->getCString(),"bold")) bold=gTrue;
-
- if (strstr(fontname->lowerCase()->getCString(),"italic")||
- strstr(fontname->lowerCase()->getCString(),"oblique")) italic=gTrue;
-
+ if (!bold && strstr(fontname->lowerCase()->getCString(),"bold")) {
+ bold=gTrue;
+ }
+
+ if (!italic &&
+ (strstr(fontname->lowerCase()->getCString(),"italic")||
+ strstr(fontname->lowerCase()->getCString(),"oblique"))) {
+ italic=gTrue;
+ }
+
int i=0;
while (strcmp(ftname->getCString(),fonts[i].Fontname)&&(i<font_num))
{
diff --git a/utils/HtmlFonts.h b/utils/HtmlFonts.h
index 3e3b028..22368b2 100644
--- a/utils/HtmlFonts.h
+++ b/utils/HtmlFonts.h
@@ -21,6 +21,7 @@
// Copyright (C) 2010 Albert Astals Cid <aacid at kde.org>
// Copyright (C) 2011 Steven Murdoch <Steven.Murdoch at cl.cam.ac.uk>
// Copyright (C) 2011 Joshua Richardson <jric at chegg.com>
+// Copyright (C) 2012 Igor Slepchin <igor.slepchin at 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
@@ -72,7 +73,7 @@ class HtmlFont{
public:
HtmlFont(){FontName=NULL; rotOrSkewed = gFalse;}
- HtmlFont(GooString* fontname,int _size, GfxRGB rgb);
+ HtmlFont(GfxFont *font,int _size, GfxRGB rgb);
HtmlFont(const HtmlFont& x);
HtmlFont& operator=(const HtmlFont& x);
HtmlFontColor getColor() const {return color;}
diff --git a/utils/HtmlOutputDev.cc b/utils/HtmlOutputDev.cc
index 2f07988..1d1b628 100644
--- a/utils/HtmlOutputDev.cc
+++ b/utils/HtmlOutputDev.cc
@@ -174,9 +174,7 @@ HtmlString::HtmlString(GfxState *state, double fontSize, HtmlFontAccu* _fonts) :
yMax = y - descent * fontSize;
GfxRGB rgb;
state->getFillRGB(&rgb);
- GooString *name = state->getFont()->getName();
- if (!name) name = HtmlFont::getDefaultFont(); //new GooString("default");
- HtmlFont hfont=HtmlFont(name, static_cast<int>(fontSize-1), rgb);
+ HtmlFont hfont=HtmlFont(font, static_cast<int>(fontSize-1), rgb);
if (isMatRotOrSkew(state->getTextMat())) {
double normalizedMatrix[4];
memcpy(normalizedMatrix, state->getTextMat(), sizeof(normalizedMatrix));
commit 329bb1e2b4f4b58832847bcf805d19ac0fd5ef02
Author: Carlos Garcia Campos <carlosgc at gnome.org>
Date: Sun May 13 19:45:55 2012 +0200
glib: Make sure password is always converted to latin1
Remove the utf8 validation since glib API is supposed to always receive
utf8 strings.
diff --git a/glib/poppler-document.cc b/glib/poppler-document.cc
index 21cace8..2b01c29 100644
--- a/glib/poppler-document.cc
+++ b/glib/poppler-document.cc
@@ -132,6 +132,23 @@ _poppler_document_new_from_pdfdoc (PDFDoc *newDoc,
return document;
}
+static GooString *
+poppler_password_to_latin1 (const gchar *password)
+{
+ gchar *password_latin;
+ GooString *password_g;
+
+ if (!password)
+ return NULL;
+
+ password_latin = g_convert(password, -1, "ISO-8859-1", "UTF-8",
+ NULL, NULL, NULL);
+ password_g = new GooString (password_latin);
+ g_free (password_latin);
+
+ return password_g;
+}
+
/**
* poppler_document_new_from_file:
* @uri: uri of the file to load
@@ -162,21 +179,7 @@ poppler_document_new_from_file (const char *uri,
if (!filename)
return NULL;
- password_g = NULL;
- if (password != NULL) {
- if (g_utf8_validate (password, -1, NULL)) {
- gchar *password_latin;
-
- password_latin = g_convert (password, -1,
- "ISO-8859-1",
- "UTF-8",
- NULL, NULL, NULL);
- password_g = new GooString (password_latin);
- g_free (password_latin);
- } else {
- password_g = new GooString (password);
- }
- }
+ password_g = poppler_password_to_latin1(password);
#ifdef G_OS_WIN32
wchar_t *filenameW;
@@ -235,10 +238,7 @@ poppler_document_new_from_data (char *data,
obj.initNull();
str = new MemStream(data, 0, length, &obj);
- password_g = NULL;
- if (password != NULL)
- password_g = new GooString (password);
-
+ password_g = poppler_password_to_latin1(password);
newDoc = new PDFDoc(str, password_g, password_g);
delete password_g;
commit 7714b4e319c48ee915061a172208245ae7c4141b
Author: Carlos Garcia Campos <carlosgc at gnome.org>
Date: Sun May 13 19:30:17 2012 +0200
glib: Fix memory leak when document fails to load
diff --git a/glib/poppler-document.cc b/glib/poppler-document.cc
index a78b5ec..21cace8 100644
--- a/glib/poppler-document.cc
+++ b/glib/poppler-document.cc
@@ -84,8 +84,6 @@ _poppler_document_new_from_pdfdoc (PDFDoc *newDoc,
{
PopplerDocument *document;
- document = (PopplerDocument *) g_object_new (POPPLER_TYPE_DOCUMENT, NULL, NULL);
-
if (!newDoc->isOk()) {
int fopen_errno;
switch (newDoc->getErrorCode())
@@ -125,6 +123,7 @@ _poppler_document_new_from_pdfdoc (PDFDoc *newDoc,
return NULL;
}
+ document = (PopplerDocument *) g_object_new (POPPLER_TYPE_DOCUMENT, NULL);
document->doc = newDoc;
document->output_dev = new CairoOutputDev ();
commit 13d2aa303eb1fd900f1045efec14af8002477b02
Author: Thomas Freitag <Thomas.Freitag at alfa.de>
Date: Sun May 13 17:25:15 2012 +0200
remove unnecesary transparency group handling in splash
Bug #13487
diff --git a/poppler/Gfx.cc b/poppler/Gfx.cc
index 9c2a9d8..5c788fb 100644
--- a/poppler/Gfx.cc
+++ b/poppler/Gfx.cc
@@ -4580,6 +4580,68 @@ void Gfx::doImage(Object *ref, Stream *str, GBool inlineImg) {
error(errSyntaxError, getPos(), "Bad image parameters");
}
+GBool Gfx::checkTransparencyGroup(Dict *resDict) {
+ // check the effect of compositing objects as a group:
+ // look for ExtGState entries with ca != 1 or CA != 1 or BM != normal
+ Object extGStates;
+ GBool transpGroup = gFalse;
+ double opac;
+
+ if (resDict == NULL)
+ return gFalse;
+ pushResources(resDict);
+ resDict->lookup("ExtGState", &extGStates);
+ if (extGStates.isDict()) {
+ Dict *dict = extGStates.getDict();
+ for (int i = 0; i < dict->getLength() && !transpGroup; i++) {
+ Object obj1, obj2;
+ GfxBlendMode mode;
+
+ if (res->lookupGState(dict->getKey(i), &obj1)) {
+ if (!obj1.dictLookup("BM", &obj2)->isNull()) {
+ if (state->parseBlendMode(&obj2, &mode)) {
+ if (mode != gfxBlendNormal)
+ transpGroup = gTrue;
+ } else {
+ error(errSyntaxError, getPos(), "Invalid blend mode in ExtGState");
+ }
+ }
+ obj2.free();
+ if (obj1.dictLookup("ca", &obj2)->isNum()) {
+ opac = obj2.getNum();
+ opac = opac < 0 ? 0 : opac > 1 ? 1 : opac;
+ if (opac != 1)
+ transpGroup = gTrue;
+ }
+ obj2.free();
+ if (obj1.dictLookup("CA", &obj2)->isNum()) {
+ opac = obj2.getNum();
+ opac = opac < 0 ? 0 : opac > 1 ? 1 : opac;
+ if (opac != 1)
+ transpGroup = gTrue;
+ }
+ obj2.free();
+ // alpha is shape
+ if (!transpGroup && obj1.dictLookup("AIS", &obj2)->isBool()) {
+ transpGroup = obj2.getBool();
+ }
+ obj2.free();
+ // soft mask
+ if (!transpGroup && !obj1.dictLookup("SMask", &obj2)->isNull()) {
+ if (!obj2.isName("None")) {
+ transpGroup = gTrue;
+ }
+ }
+ obj2.free();
+ }
+ obj1.free();
+ }
+ }
+ extGStates.free();
+ popResources();
+ return transpGroup;
+}
+
void Gfx::doForm(Object *str) {
Dict *dict;
GBool transpGroup, isolated, knockout;
@@ -4666,7 +4728,6 @@ void Gfx::doForm(Object *str) {
blendingColorSpace = NULL;
if (dict->lookup("Group", &obj1)->isDict()) {
if (obj1.dictLookup("S", &obj2)->isName("Transparency")) {
- transpGroup = gTrue;
if (!obj1.dictLookup("CS", &obj3)->isNull()) {
blendingColorSpace = GfxColorSpace::parse(&obj3, this);
}
@@ -4679,6 +4740,7 @@ void Gfx::doForm(Object *str) {
knockout = obj3.getBool();
}
obj3.free();
+ transpGroup = isolated || out->checkTransparencyGroup(state, knockout) || checkTransparencyGroup(resDict);
}
obj2.free();
}
diff --git a/poppler/Gfx.h b/poppler/Gfx.h
index 689d362..37022e0 100644
--- a/poppler/Gfx.h
+++ b/poppler/Gfx.h
@@ -18,7 +18,7 @@
// Copyright (C) 2008 Brad Hards <bradh at kde.org>
// Copyright (C) 2008, 2010 Carlos Garcia Campos <carlosgc at gnome.org>
// Copyright (C) 2009-2011 Albert Astals Cid <aacid at kde.org>
-// Copyright (C) 2009, 2010 Thomas Freitag <Thomas.Freitag at alfa.de>
+// Copyright (C) 2009, 2010, 2012 Thomas Freitag <Thomas.Freitag at alfa.de>
// Copyright (C) 2010 David Benjamin <davidben at mit.edu>
// Copyright (C) 2010 Christian Feuersänger <cfeuersaenger at googlemail.com>
//
@@ -181,6 +181,8 @@ public:
// Get the current graphics state object.
GfxState *getState() { return state; }
+ GBool checkTransparencyGroup(Dict *resDict);
+
void drawForm(Object *str, Dict *resDict, double *matrix, double *bbox,
GBool transpGroup = gFalse, GBool softMask = gFalse,
GfxColorSpace *blendingColorSpace = NULL,
diff --git a/poppler/GfxState.cc b/poppler/GfxState.cc
index 5962fcb..252e88d 100644
--- a/poppler/GfxState.cc
+++ b/poppler/GfxState.cc
@@ -18,7 +18,7 @@
// Copyright (C) 2006, 2010 Carlos Garcia Campos <carlosgc at gnome.org>
// Copyright (C) 2006-2012 Albert Astals Cid <aacid at kde.org>
// Copyright (C) 2009, 2012 Koji Otani <sho at bbr.jp>
-// Copyright (C) 2009, 2011 Thomas Freitag <Thomas.Freitag at alfa.de>
+// Copyright (C) 2009, 2011, 2012 Thomas Freitag <Thomas.Freitag at alfa.de>
// Copyright (C) 2009 Christian Persch <chpe at gnome.org>
// Copyright (C) 2010 PaweÅ Wiejacha <pawel.wiejacha at gmail.com>
// Copyright (C) 2010 Christian Feuersänger <cfeuersaenger at googlemail.com>
@@ -5609,6 +5609,8 @@ GfxState::GfxState(double hDPIA, double vDPIA, PDFRectangle *pageBox,
lineCap = 0;
miterLimit = 10;
strokeAdjust = gFalse;
+ alphaIsShape = gFalse;
+ textKnockout = gFalse;
font = NULL;
fontSize = 0;
diff --git a/poppler/OutputDev.h b/poppler/OutputDev.h
index 855dbaf..15af90a 100644
--- a/poppler/OutputDev.h
+++ b/poppler/OutputDev.h
@@ -302,6 +302,7 @@ public:
virtual GooHash *endProfile();
//----- transparency groups and soft masks
+ virtual GBool checkTransparencyGroup(GfxState * /*state*/, GBool /*knockout*/) { return gTrue; }
virtual void beginTransparencyGroup(GfxState * /*state*/, double * /*bbox*/,
GfxColorSpace * /*blendingColorSpace*/,
GBool /*isolated*/, GBool /*knockout*/,
diff --git a/poppler/SplashOutputDev.cc b/poppler/SplashOutputDev.cc
index ce666b9..be35c25 100644
--- a/poppler/SplashOutputDev.cc
+++ b/poppler/SplashOutputDev.cc
@@ -3517,6 +3517,17 @@ void SplashOutputDev::drawSoftMaskedImage(GfxState *state, Object *ref,
str->close();
}
+GBool SplashOutputDev::checkTransparencyGroup(GfxState *state, GBool knockout) {
+ if (state->getFillOpacity() != 1 ||
+ state->getStrokeOpacity() != 1 ||
+ state->getAlphaIsShape() ||
+ state->getBlendMode() != gfxBlendNormal ||
+ splash->getSoftMask() != NULL ||
+ knockout)
+ return gTrue;
+ return transpGroupStack != NULL && transpGroupStack->shape != NULL;
+}
+
void SplashOutputDev::beginTransparencyGroup(GfxState *state, double *bbox,
GfxColorSpace *blendingColorSpace,
GBool isolated, GBool knockout,
diff --git a/poppler/SplashOutputDev.h b/poppler/SplashOutputDev.h
index b70ec38..f1c87ec 100644
--- a/poppler/SplashOutputDev.h
+++ b/poppler/SplashOutputDev.h
@@ -292,6 +292,7 @@ public:
double llx, double lly, double urx, double ury);
//----- transparency groups and soft masks
+ virtual GBool checkTransparencyGroup(GfxState *state, GBool knockout);
virtual void beginTransparencyGroup(GfxState *state, double *bbox,
GfxColorSpace *blendingColorSpace,
GBool isolated, GBool knockout,
commit a76867003a7bff5ab03016156c75b4c928788d50
Author: Albert Astals Cid <aacid at kde.org>
Date: Sun May 13 13:10:40 2012 +0200
Distribute cmake/modules/FindLCMS2.cmake
Bug #49818
diff --git a/Makefile.am b/Makefile.am
index 5023be9..a9f5db1 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -76,6 +76,7 @@ EXTRA_DIST += \
cmake/modules/FindGTK.cmake \
cmake/modules/FindIconv.cmake \
cmake/modules/FindLCMS.cmake \
+ cmake/modules/FindLCMS2.cmake \
cmake/modules/FindQt4.cmake \
cmake/modules/GObjectIntrospectionMacros.cmake \
cmake/modules/MacroBoolTo01.cmake \
More information about the poppler
mailing list