[poppler] 3 commits - poppler/PDFDoc.cc poppler/PSOutputDev.cc
Albert Astals Cid
aacid at kemper.freedesktop.org
Mon Jul 25 15:11:30 PDT 2011
poppler/PDFDoc.cc | 7 +++--
poppler/PSOutputDev.cc | 63 ++++++++++++++++++++++++++++++++++++++++++++++---
2 files changed, 64 insertions(+), 6 deletions(-)
New commits:
commit e78aff6796a5d5a0a4f2fe8c7ceb33c506e2c8f5
Author: William Bader <williambader at hotmail.com>
Date: Tue Jul 26 00:10:34 2011 +0200
make -level1sep write gray instead of cmyk
If it is a gray only image
Bug 39012
diff --git a/poppler/PSOutputDev.cc b/poppler/PSOutputDev.cc
index 501cff0..0a3df51 100644
--- a/poppler/PSOutputDev.cc
+++ b/poppler/PSOutputDev.cc
@@ -506,7 +506,6 @@ static char *prolog[] = {
" /pdfTextClipPath [] def } def",
"~1ns",
"% Level 1 image operators",
- "~1n",
"/pdfIm1 {",
" /pdfImBuf1 4 index string def",
" { currentfile pdfImBuf1 readhexstring pop } image",
@@ -3141,13 +3140,71 @@ GBool PSOutputDev::checkPageSlice(Page *page, double /*hDPI*/, double /*vDPI*/,
break;
case psLevel1Sep:
useBinary = globalParams->getPSBinary();
- writePSFmt("{0:d} {1:d} 8 [{2:d} 0 0 {3:d} 0 {4:d}] pdfIm1Sep{5:s}\n",
+ p = bitmap->getDataPtr();
+ isGray = gTrue;
+ for (y = 0; y < h; ++y) {
+ for (x = 0; x < w; ++x) {
+ if (p[4*x] != p[4*x + 1] || p[4*x] != p[4*x + 2]) {
+ isGray = gFalse;
+ y = h;
+ break;
+ }
+ }
+ p += bitmap->getRowSize();
+ }
+ writePSFmt("{0:d} {1:d} 8 [{2:d} 0 0 {3:d} 0 {4:d}] pdfIm1{5:s}{6:s}\n",
w, h, w, -h, h,
+ isGray ? "" : "Sep",
useBinary ? "Bin" : "");
p = bitmap->getDataPtr();
i = 0;
col[0] = col[1] = col[2] = col[3] = 0;
- if (((psProcessCyan | psProcessMagenta | psProcessYellow | psProcessBlack) & ~processColors) != 0) {
+ if (isGray) {
+ int g;
+ if ((psProcessBlack & processColors) == 0) {
+ for (y = 0; y < h; ++y) {
+ for (x = 0; x < w; ++x) {
+ if (p[4*x] > 0 || p[4*x + 3] > 0) {
+ col[3] = 1;
+ y = h;
+ break;
+ }
+ }
+ p += bitmap->getRowSize();
+ }
+ p = bitmap->getDataPtr();
+ }
+ for (y = 0; y < h; ++y) {
+ if (useBinary) {
+ for (x = 0; x < w; ++x) {
+ g = p[4*x] + p[4*x + 3];
+ g = 255 - g;
+ if (g < 0) g = 0;
+ hexBuf[i++] = (Guchar) g;
+ if (i >= 64) {
+ writePSBuf(hexBuf, i);
+ i = 0;
+ }
+ }
+ } else {
+ for (x = 0; x < w; ++x) {
+ g = p[4*x] + p[4*x + 3];
+ g = 255 - g;
+ if (g < 0) g = 0;
+ digit = g / 16;
+ hexBuf[i++] = digit + ((digit >= 10)? 'a' - 10: '0');
+ digit = g % 16;
+ hexBuf[i++] = digit + ((digit >= 10)? 'a' - 10: '0');
+ if (i >= 64) {
+ hexBuf[i++] = '\n';
+ writePSBuf(hexBuf, i);
+ i = 0;
+ }
+ }
+ }
+ p += bitmap->getRowSize();
+ }
+ } else if (((psProcessCyan | psProcessMagenta | psProcessYellow | psProcessBlack) & ~processColors) != 0) {
for (y = 0; y < h; ++y) {
for (comp = 0; comp < 4; ++comp) {
if (useBinary) {
commit ea31309487aab6ed407a086dff1f350b6e4bdbc9
Author: Albert Astals Cid <aacid at kde.org>
Date: Tue Jul 26 00:09:27 2011 +0200
Update (C)
diff --git a/poppler/PDFDoc.cc b/poppler/PDFDoc.cc
index 17d780b..aa52140 100644
--- a/poppler/PDFDoc.cc
+++ b/poppler/PDFDoc.cc
@@ -21,7 +21,7 @@
// Copyright (C) 2009 Eric Toombs <ewtoombs at uwaterloo.ca>
// Copyright (C) 2009 Kovid Goyal <kovid at kovidgoyal.net>
// Copyright (C) 2009, 2011 Axel Struebing <axel.struebing at freenet.de>
-// Copyright (C) 2010 Hib Eris <hib at hiberis.nl>
+// Copyright (C) 2010, 2011 Hib Eris <hib at hiberis.nl>
// Copyright (C) 2010 Jakub Wilk <ubanus at users.sf.net>
// Copyright (C) 2010 Ilya Gorenbein <igorenbein at finjan.com>
// Copyright (C) 2010 Srinivas Adicherla <srinivas.adicherla at geodesic.com>
commit a945641497946a825dc880f94200ea1d5409332b
Author: Hib Eris <hib at hiberis.nl>
Date: Sat Jul 23 08:44:06 2011 +0200
Handle missing startxref properly
Bug 38209
diff --git a/poppler/PDFDoc.cc b/poppler/PDFDoc.cc
index b861c5d..17d780b 100644
--- a/poppler/PDFDoc.cc
+++ b/poppler/PDFDoc.cc
@@ -1118,9 +1118,10 @@ Guint PDFDoc::getStartXRef()
}
if (i < 0) {
startXRefPos = 0;
+ } else {
+ for (p = &buf[i+9]; isspace(*p); ++p) ;
+ startXRefPos = strToUnsigned(p);
}
- for (p = &buf[i+9]; isspace(*p); ++p) ;
- startXRefPos = strToUnsigned(p);
}
}
More information about the poppler
mailing list