RHEL 9.0.0 Alpha bootstrap

The content of this branch was automatically imported from Fedora ELN
with the following as its source:
https://src.fedoraproject.org/rpms/poppler#f56209451f08744ff1ac5204dbd50e639598cd31
This commit is contained in:
Troy Dawson 2020-10-14 16:25:42 -07:00
parent d62e83eea8
commit 07a311c4f6
10 changed files with 28891 additions and 0 deletions

9
.gitignore vendored
View File

@ -0,0 +1,9 @@
/poppler-test-2009-05-13_0d2bfd4af4c76a3bac27ccaff793d9129df7b57a.tar.xz
/poppler-0.61.1.tar.xz
/poppler-0.62.0.tar.xz
/poppler-0.63.0.tar.xz
/poppler-0.67.0.tar.xz
/poppler-0.73.0.tar.xz
/poppler-test-2018-12-18-45f55f1e03b9bf3fbd334c31776b6f5e472889ec.tar.xz
/poppler-0.84.0.tar.xz
/poppler-0.90.0.tar.xz

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,285 @@
From 0ab1f29d4ce315b0fca260c0e0f3007024d00342 Mon Sep 17 00:00:00 2001
From: Marek Kasik <mkasik@redhat.com>
Date: Tue, 28 Jan 2014 15:13:24 +0100
Subject: [PATCH] TextOutputDev: Respect orientation when selecting words
Take rotation into account when visiting selection.
This doesn't fix all problems (there are still problems
on line and block levels).
https://bugs.freedesktop.org/show_bug.cgi?id=16619
---
poppler/TextOutputDev.cc | 193 ++++++++++++++++++++++++++++++++++++-----------
1 file changed, 150 insertions(+), 43 deletions(-)
diff --git a/poppler/TextOutputDev.cc b/poppler/TextOutputDev.cc
index 7c2ca78..e93908c 100644
--- a/poppler/TextOutputDev.cc
+++ b/poppler/TextOutputDev.cc
@@ -178,6 +178,12 @@
// (Or 1/tan(angle) for 90/270 degrees.)
#define diagonalThreshold 0.1
+// Returns whether x is between a and b or equal to a or b.
+// a and b don't need to be sorted.
+#define XBetweenAB(x,a,b) (!(((x) > (a) && (x) > (b)) || \
+ ((x) < (a) && (x) < (b))) ? \
+ true : false)
+
namespace {
inline bool isAscii7 (Unicode uchar) {
@@ -4411,11 +4417,37 @@ void TextSelectionSizer::visitLine (TextLine *line,
PDFRectangle *rect;
double x1, y1, x2, y2, margin;
- margin = (line->yMax - line->yMin) / 8;
- x1 = line->edge[edge_begin];
- y1 = line->yMin - margin;
- x2 = line->edge[edge_end];
- y2 = line->yMax + margin;
+ switch (line->rot) {
+ default:
+ case 0:
+ margin = (line->yMax - line->yMin) / 8;
+ x1 = line->edge[edge_begin];
+ x2 = line->edge[edge_end];
+ y1 = line->yMin - margin;
+ y2 = line->yMax + margin;
+ break;
+ case 1:
+ margin = (line->xMax - line->xMin) / 8;
+ x1 = line->xMin - margin;
+ x2 = line->xMax + margin;
+ y1 = line->edge[edge_begin];
+ y2 = line->edge[edge_end];
+ break;
+ case 2:
+ margin = (line->yMax - line->yMin) / 8;
+ x1 = line->edge[edge_end];
+ x2 = line->edge[edge_begin];
+ y1 = line->yMin - margin;
+ y2 = line->yMax + margin;
+ break;
+ case 3:
+ margin = (line->xMax - line->xMin) / 8;
+ x1 = line->xMin - margin;
+ x2 = line->xMax + margin;
+ y1 = line->edge[edge_end];
+ y2 = line->edge[edge_begin];
+ break;
+ }
rect = new PDFRectangle (floor (x1 * scale),
floor (y1 * scale),
@@ -4499,19 +4531,56 @@ void TextSelectionPainter::visitLine (TextLine *line,
{
double x1, y1, x2, y2, margin;
- margin = (line->yMax - line->yMin) / 8;
- x1 = floor (line->edge[edge_begin]);
- y1 = floor (line->yMin - margin);
- x2 = ceil (line->edge[edge_end]);
- y2 = ceil (line->yMax + margin);
+ switch (line->rot) {
+ default:
+ case 0:
+ margin = (line->yMax - line->yMin) / 8;
+ x1 = line->edge[edge_begin];
+ x2 = line->edge[edge_end];
+ y1 = line->yMin - margin;
+ y2 = line->yMax + margin;
+ break;
+ case 1:
+ margin = (line->xMax - line->xMin) / 8;
+ x1 = line->xMin - margin;
+ x2 = line->xMax + margin;
+ y1 = line->edge[edge_begin];
+ y2 = line->edge[edge_end];
+ break;
+ case 2:
+ margin = (line->yMax - line->yMin) / 8;
+ x1 = line->edge[edge_end];
+ x2 = line->edge[edge_begin];
+ y1 = line->yMin - margin;
+ y2 = line->yMax + margin;
+ break;
+ case 3:
+ margin = (line->xMax - line->xMin) / 8;
+ x1 = line->xMin - margin;
+ x2 = line->xMax + margin;
+ y1 = line->edge[edge_end];
+ y2 = line->edge[edge_begin];
+ break;
+ }
+
+ ctm.transform(x1, y1, &x1, &y1);
+ ctm.transform(x2, y2, &x2, &y2);
- ctm.transform(line->edge[edge_begin], line->yMin - margin, &x1, &y1);
- ctm.transform(line->edge[edge_end], line->yMax + margin, &x2, &y2);
+ if (x1 < x2) {
+ x1 = floor (x1);
+ x2 = ceil (x2);
+ } else {
+ x1 = ceil (x1);
+ x2 = floor (x2);
+ }
- x1 = floor (x1);
- y1 = floor (y1);
- x2 = ceil (x2);
- y2 = ceil (y2);
+ if (y1 < y2) {
+ y1 = floor (y1);
+ y2 = ceil (y2);
+ } else {
+ y1 = ceil (y1);
+ y2 = floor (y2);
+ }
ictm.transform(x1, y1, &x1, &y1);
ictm.transform(x2, y2, &x2, &y2);
@@ -4589,17 +4658,27 @@ void TextWord::visitSelection(TextSelectionVisitor *visitor,
SelectionStyle style)
{
int i, begin, end;
- double mid;
+ double mid, s1, s2;
+
+ if (rot == 0 || rot == 2) {
+ s1 = selection->x1;
+ s2 = selection->x2;
+ } else {
+ s1 = selection->y1;
+ s2 = selection->y2;
+ }
begin = len;
end = 0;
for (i = 0; i < len; i++) {
mid = (edge[i] + edge[i + 1]) / 2;
- if (selection->x1 < mid || selection->x2 < mid)
- if (i < begin)
- begin = i;
- if (mid < selection->x1 || mid < selection->x2)
- end = i + 1;
+ if (XBetweenAB (mid, s1, s2))
+ {
+ if (i < begin)
+ begin = i;
+
+ end = i + 1;
+ }
}
/* Skip empty selection. */
@@ -4615,30 +4694,41 @@ void TextLine::visitSelection(TextSelectionVisitor *visitor,
TextWord *p, *begin, *end, *current;
int i, edge_begin, edge_end;
PDFRectangle child_selection;
+ double s1, s2, p_min, p_max;
+
+ if (rot == 0 || rot == 2) {
+ s1 = selection->x1;
+ s2 = selection->x2;
+ } else {
+ s1 = selection->y1;
+ s2 = selection->y2;
+ }
begin = nullptr;
end = nullptr;
current = nullptr;
for (p = words; p != nullptr; p = p->next) {
+ if (rot == 0 || rot == 2) {
+ p_min = p->xMin;
+ p_max = p->xMax;
+ } else {
+ p_min = p->yMin;
+ p_max = p->yMax;
+ }
+
if (blk->page->primaryLR) {
- if ((selection->x1 < p->xMax) ||
- (selection->x2 < p->xMax))
- if (begin == nullptr)
- begin = p;
+ if (((s1 < p_max) || (s2 < p_max)) && begin == nullptr)
+ begin = p;
- if (((selection->x1 > p->xMin) ||
- (selection->x2 > p->xMin)) && (begin != nullptr)) {
+ if (((s1 > p_min) || (s2 > p_min)) && begin != nullptr) {
end = p->next;
current = p;
}
} else {
- if ((selection->x1 > p->xMin) ||
- (selection->x2 > p->xMin))
- if (begin == nullptr)
- begin = p;
+ if (((s1 > p_min) || (s2 > p_min)) && begin == nullptr)
+ begin = p;
- if (((selection->x1 < p->xMax) ||
- (selection->x2 < p->xMax)) && (begin != nullptr)) {
+ if (((s1 < p_max) || (s2 < p_max)) && begin != nullptr) {
end = p->next;
current = p;
}
@@ -4650,23 +4740,42 @@ void TextLine::visitSelection(TextSelectionVisitor *visitor,
child_selection = *selection;
if (style == selectionStyleWord) {
- child_selection.x1 = begin ? begin->xMin : xMin;
- if (end && end->xMax != -1) {
- child_selection.x2 = current->xMax;
+ if (rot == 0 || rot == 2) {
+ child_selection.x1 = begin ? begin->xMin : xMin;
+ if (end && end->xMax != -1) {
+ child_selection.x2 = current->xMax;
+ } else {
+ child_selection.x2 = xMax;
+ }
} else {
- child_selection.x2 = xMax;
+ child_selection.y1 = begin ? begin->yMin : yMin;
+ if (end && end->yMax != -1) {
+ child_selection.y2 = current->yMax;
+ } else {
+ child_selection.y2 = yMax;
+ }
}
}
+ if (rot == 0 || rot == 2) {
+ s1 = child_selection.x1;
+ s2 = child_selection.x2;
+ } else {
+ s1 = child_selection.y1;
+ s2 = child_selection.y2;
+ }
+
edge_begin = len;
edge_end = 0;
for (i = 0; i < len; i++) {
double mid = (edge[i] + edge[i + 1]) / 2;
- if (child_selection.x1 < mid || child_selection.x2 < mid)
- if (i < edge_begin)
- edge_begin = i;
- if (mid < child_selection.x2 || mid < child_selection.x1)
- edge_end = i + 1;
+ if (XBetweenAB (mid, s1, s2))
+ {
+ if (i < edge_begin)
+ edge_begin = i;
+
+ edge_end = i + 1;
+ }
}
/* Skip empty selection. */
--
1.8.4.2

View File

@ -0,0 +1,150 @@
--- poppler-0.67.0/qt4/src/poppler-document.cc.orig 2018-08-08 10:13:17.130028069 +0200
+++ poppler-0.67.0/qt4/src/poppler-document.cc 2018-08-08 11:14:58.301690615 +0200
@@ -799,7 +799,7 @@ namespace Poppler {
return Document::NoForm; // make gcc happy
}
- QDateTime convertDate( char *dateString )
+ QDateTime convertDate( const char *dateString )
{
int year, mon, day, hour, min, sec, tzHours, tzMins;
char tz;
@@ -830,6 +830,12 @@ namespace Poppler {
return QDateTime();
}
+ QDateTime convertDate( char *dateString )
+ {
+ return convertDate( (const char *) dateString );
+ }
+
+
bool isCmsAvailable()
{
#if defined(USE_CMS)
--- poppler-0.67.0/qt4/src/poppler-embeddedfile.cc.orig 2018-08-08 10:13:17.130028069 +0200
+++ poppler-0.67.0/qt4/src/poppler-embeddedfile.cc 2018-08-08 10:50:42.645723179 +0200
@@ -68,13 +68,13 @@ EmbeddedFile::~EmbeddedFile()
QString EmbeddedFile::name() const
{
- GooString *goo = m_embeddedFile->filespec->getFileName();
+ const GooString *goo = m_embeddedFile->filespec->getFileName();
return goo ? UnicodeParsedString(goo) : QString();
}
QString EmbeddedFile::description() const
{
- GooString *goo = m_embeddedFile->filespec->getDescription();
+ const GooString *goo = m_embeddedFile->filespec->getDescription();
return goo ? UnicodeParsedString(goo) : QString();
}
@@ -85,25 +85,25 @@ int EmbeddedFile::size() const
QDateTime EmbeddedFile::modDate() const
{
- GooString *goo = m_embeddedFile->embFile() ? m_embeddedFile->embFile()->modDate() : NULL;
+ const GooString *goo = m_embeddedFile->embFile() ? m_embeddedFile->embFile()->modDate() : NULL;
return goo ? convertDate(goo->c_str()) : QDateTime();
}
QDateTime EmbeddedFile::createDate() const
{
- GooString *goo = m_embeddedFile->embFile() ? m_embeddedFile->embFile()->createDate() : NULL;
+ const GooString *goo = m_embeddedFile->embFile() ? m_embeddedFile->embFile()->createDate() : NULL;
return goo ? convertDate(goo->c_str()) : QDateTime();
}
QByteArray EmbeddedFile::checksum() const
{
- GooString *goo = m_embeddedFile->embFile() ? m_embeddedFile->embFile()->checksum() : NULL;
+ const GooString *goo = m_embeddedFile->embFile() ? m_embeddedFile->embFile()->checksum() : NULL;
return goo ? QByteArray::fromRawData(goo->c_str(), goo->getLength()) : QByteArray();
}
QString EmbeddedFile::mimeType() const
{
- GooString *goo = m_embeddedFile->embFile() ? m_embeddedFile->embFile()->mimeType() : NULL;
+ const GooString *goo = m_embeddedFile->embFile() ? m_embeddedFile->embFile()->mimeType() : NULL;
return goo ? QString(goo->c_str()) : QString();
}
--- poppler-0.67.0/qt4/src/poppler-movie.cc.orig 2018-08-08 10:13:17.131028077 +0200
+++ poppler-0.67.0/qt4/src/poppler-movie.cc 2018-08-08 10:52:41.284914743 +0200
@@ -57,7 +57,7 @@ MovieObject::MovieObject( AnnotMovie *an
m_movieData->m_movieObj = ann->getMovie()->copy();
//TODO: copy poster image
- MovieActivationParameters *mp = m_movieData->m_movieObj->getActivationParameters();
+ const MovieActivationParameters *mp = m_movieData->m_movieObj->getActivationParameters();
int width, height;
m_movieData->m_movieObj->getFloatingWindowSize(&width, &height);
m_movieData->m_size = QSize(width, height);
@@ -73,7 +73,7 @@ MovieObject::~MovieObject()
QString MovieObject::url() const
{
- GooString * goo = m_movieData->m_movieObj->getFileName();
+ const GooString * goo = m_movieData->m_movieObj->getFileName();
return goo ? QString( goo->c_str() ) : QString();
}
--- poppler-0.67.0/qt4/src/poppler-private.h.orig 2018-08-08 10:13:17.132028085 +0200
+++ poppler-0.67.0/qt4/src/poppler-private.h 2018-08-08 11:00:30.836672893 +0200
@@ -54,9 +54,9 @@ class FormWidget;
namespace Poppler {
/* borrowed from kpdf */
- QString unicodeToQString(Unicode* u, int len);
+ QString unicodeToQString(const Unicode* u, int len);
- QString UnicodeParsedString(GooString *s1);
+ QString UnicodeParsedString(const GooString *s1);
GooString *QStringToUnicodeGooString(const QString &s);
@@ -69,13 +69,13 @@ namespace Poppler {
class LinkDestinationData
{
public:
- LinkDestinationData( LinkDest *l, GooString *nd, Poppler::DocumentData *pdfdoc, bool external )
+ LinkDestinationData( const LinkDest *l, const GooString *nd, Poppler::DocumentData *pdfdoc, bool external )
: ld(l), namedDest(nd), doc(pdfdoc), externalDest(external)
{
}
- LinkDest *ld;
- GooString *namedDest;
+ const LinkDest *ld;
+ const GooString *namedDest;
Poppler::DocumentData *doc;
bool externalDest;
};
--- poppler-0.67.0/qt4/src/poppler-qt4.h.orig 2018-08-08 10:13:17.133028093 +0200
+++ poppler-0.67.0/qt4/src/poppler-qt4.h 2018-08-08 10:29:23.807858790 +0200
@@ -1816,7 +1816,12 @@ height = dummy.height();
/**
Conversion from PDF date string format to QDateTime
*/
- POPPLER_QT4_EXPORT QDateTime convertDate( char *dateString );
+ POPPLER_QT4_EXPORT Q_DECL_DEPRECATED QDateTime convertDate( char *dateString );
+
+ /**
+ Conversion from PDF date string format to QDateTime
+ */
+ POPPLER_QT4_EXPORT QDateTime convertDate( const char *dateString );
/**
Whether the color management functions are available.
--- poppler-0.67.0/qt4/src/poppler-sound.cc.orig 2018-08-08 10:13:17.133028093 +0200
+++ poppler-0.67.0/qt4/src/poppler-sound.cc 2018-08-08 11:10:31.644004477 +0200
@@ -75,7 +75,7 @@ QString SoundObject::url() const
if ( m_soundData->m_type != SoundObject::External )
return QString();
- GooString * goo = m_soundData->m_soundObj->getFileName();
+ const GooString * goo = m_soundData->m_soundObj->getFileName();
return goo ? QString( goo->c_str() ) : QString();
}

View File

@ -0,0 +1,289 @@
From 9bcc9d0a164dbd1f24aae8f900c28feafd0cb3f2 Mon Sep 17 00:00:00 2001
From: Marek Kasik <mkasik@redhat.com>
Date: Tue, 30 Apr 2019 18:47:44 +0200
Subject: [PATCH] PSOutputDev: Don't read outside of image buffer
Check whether input image is RGB or BGR to not treat
it as CMYK in those cases in PSOutputDev::checkPageSlice().
Fixes #751
---
poppler/PSOutputDev.cc | 248 ++++++++++++++++++++++++++++++++---------
1 file changed, 196 insertions(+), 52 deletions(-)
diff --git a/poppler/PSOutputDev.cc b/poppler/PSOutputDev.cc
index 0d201835..155a8cbe 100644
--- a/poppler/PSOutputDev.cc
+++ b/poppler/PSOutputDev.cc
@@ -3374,6 +3374,14 @@ bool PSOutputDev::checkPageSlice(Page *page, double /*hDPI*/, double /*vDPI*/,
}
break;
case psLevel1Sep:
+ GfxColor inputColor;
+ GfxCMYK cmyk;
+ unsigned char cmykColor[4];
+ GfxDeviceRGBColorSpace *rgbCS;
+ SplashColorMode colorMode;
+
+ colorMode = bitmap->getMode();
+
p = bitmap->getDataPtr();
// Check for an all gray image
if (getOptimizeColorSpace()) {
@@ -3448,65 +3456,201 @@ bool PSOutputDev::checkPageSlice(Page *page, double /*hDPI*/, double /*vDPI*/,
}
} else if (((psProcessCyan | psProcessMagenta | psProcessYellow | psProcessBlack) & ~processColors) != 0) {
// Color image, need to check color flags for each dot
- for (y = 0; y < h; ++y) {
- for (comp = 0; comp < 4; ++comp) {
- if (useBinary) {
- // Binary color image
- for (x = 0; x < w; ++x) {
- col[comp] |= p[4*x + comp];
- hexBuf[i++] = p[4*x + comp];
- if (i >= 64) {
- writePSBuf(hexBuf, i);
- i = 0;
+ switch (colorMode) {
+ case splashModeRGB8:
+ case splashModeBGR8:
+ rgbCS = new GfxDeviceRGBColorSpace();
+ for (y = 0; y < h; ++y) {
+ for (comp = 0; comp < 4; ++comp) {
+ if (useBinary) {
+ // Binary color image
+ for (x = 0; x < w; ++x) {
+ if (likely(colorMode == splashModeRGB8)) {
+ inputColor.c[0] = byteToCol(p[3*x + 0]);
+ inputColor.c[1] = byteToCol(p[3*x + 1]);
+ inputColor.c[2] = byteToCol(p[3*x + 2]);
+ } else {
+ inputColor.c[0] = byteToCol(p[3*x + 2]);
+ inputColor.c[1] = byteToCol(p[3*x + 1]);
+ inputColor.c[2] = byteToCol(p[3*x + 0]);
+ }
+ rgbCS->getCMYK(&inputColor, &cmyk);
+ cmykColor[0] = colToByte(cmyk.c);
+ cmykColor[1] = colToByte(cmyk.m);
+ cmykColor[2] = colToByte(cmyk.y);
+ cmykColor[3] = colToByte(cmyk.k);
+
+ col[comp] |= cmykColor[comp];
+ hexBuf[i++] = cmykColor[comp];
+ if (i >= 64) {
+ writePSBuf(hexBuf, i);
+ i = 0;
+ }
+ }
+ } else {
+ // Gray color image
+ for (x = 0; x < w; ++x) {
+ if (likely(colorMode == splashModeRGB8)) {
+ inputColor.c[0] = byteToCol(p[3*x + 0]);
+ inputColor.c[1] = byteToCol(p[3*x + 1]);
+ inputColor.c[2] = byteToCol(p[3*x + 2]);
+ } else {
+ inputColor.c[0] = byteToCol(p[3*x + 2]);
+ inputColor.c[1] = byteToCol(p[3*x + 1]);
+ inputColor.c[2] = byteToCol(p[3*x + 0]);
+ }
+ rgbCS->getCMYK(&inputColor, &cmyk);
+ cmykColor[0] = colToByte(cmyk.c);
+ cmykColor[1] = colToByte(cmyk.m);
+ cmykColor[2] = colToByte(cmyk.y);
+ cmykColor[3] = colToByte(cmyk.k);
+
+ col[comp] |= cmykColor[comp];
+ digit = cmykColor[comp] / 16;
+ hexBuf[i++] = digit + ((digit >= 10)? 'a' - 10: '0');
+ digit = cmykColor[comp] % 16;
+ hexBuf[i++] = digit + ((digit >= 10)? 'a' - 10: '0');
+ if (i >= 64) {
+ hexBuf[i++] = '\n';
+ writePSBuf(hexBuf, i);
+ i = 0;
+ }
+ }
}
- }
- } else {
- // Gray color image
- for (x = 0; x < w; ++x) {
- col[comp] |= p[4*x + comp];
- digit = p[4*x + comp] / 16;
- hexBuf[i++] = digit + ((digit >= 10)? 'a' - 10: '0');
- digit = p[4*x + comp] % 16;
- hexBuf[i++] = digit + ((digit >= 10)? 'a' - 10: '0');
- if (i >= 64) {
- hexBuf[i++] = '\n';
- writePSBuf(hexBuf, i);
- i = 0;
+ }
+ p -= bitmap->getRowSize();
+ }
+ delete rgbCS;
+ break;
+ default:
+ for (y = 0; y < h; ++y) {
+ for (comp = 0; comp < 4; ++comp) {
+ if (useBinary) {
+ // Binary color image
+ for (x = 0; x < w; ++x) {
+ col[comp] |= p[4*x + comp];
+ hexBuf[i++] = p[4*x + comp];
+ if (i >= 64) {
+ writePSBuf(hexBuf, i);
+ i = 0;
+ }
+ }
+ } else {
+ // Gray color image
+ for (x = 0; x < w; ++x) {
+ col[comp] |= p[4*x + comp];
+ digit = p[4*x + comp] / 16;
+ hexBuf[i++] = digit + ((digit >= 10)? 'a' - 10: '0');
+ digit = p[4*x + comp] % 16;
+ hexBuf[i++] = digit + ((digit >= 10)? 'a' - 10: '0');
+ if (i >= 64) {
+ hexBuf[i++] = '\n';
+ writePSBuf(hexBuf, i);
+ i = 0;
+ }
+ }
}
- }
- }
- }
- p -= bitmap->getRowSize();
+ }
+ p -= bitmap->getRowSize();
+ }
+ break;
}
} else {
// Color image, do not need to check color flags
- for (y = 0; y < h; ++y) {
- for (comp = 0; comp < 4; ++comp) {
- if (useBinary) {
- // Binary color image
- for (x = 0; x < w; ++x) {
- hexBuf[i++] = p[4*x + comp];
- if (i >= 64) {
- writePSBuf(hexBuf, i);
- i = 0;
+ switch (colorMode) {
+ case splashModeRGB8:
+ case splashModeBGR8:
+ rgbCS = new GfxDeviceRGBColorSpace();
+ for (y = 0; y < h; ++y) {
+ for (comp = 0; comp < 4; ++comp) {
+ if (useBinary) {
+ // Binary color image
+ for (x = 0; x < w; ++x) {
+ if (likely(colorMode == splashModeRGB8)) {
+ inputColor.c[0] = byteToCol(p[3*x + 0]);
+ inputColor.c[1] = byteToCol(p[3*x + 1]);
+ inputColor.c[2] = byteToCol(p[3*x + 2]);
+ } else {
+ inputColor.c[0] = byteToCol(p[3*x + 2]);
+ inputColor.c[1] = byteToCol(p[3*x + 1]);
+ inputColor.c[2] = byteToCol(p[3*x + 0]);
+ }
+ rgbCS->getCMYK(&inputColor, &cmyk);
+ cmykColor[0] = colToByte(cmyk.c);
+ cmykColor[1] = colToByte(cmyk.m);
+ cmykColor[2] = colToByte(cmyk.y);
+ cmykColor[3] = colToByte(cmyk.k);
+
+ hexBuf[i++] = cmykColor[comp];
+ if (i >= 64) {
+ writePSBuf(hexBuf, i);
+ i = 0;
+ }
+ }
+ } else {
+ // Hex color image
+ for (x = 0; x < w; ++x) {
+ if (likely(colorMode == splashModeRGB8)) {
+ inputColor.c[0] = byteToCol(p[3*x + 0]);
+ inputColor.c[1] = byteToCol(p[3*x + 1]);
+ inputColor.c[2] = byteToCol(p[3*x + 2]);
+ } else {
+ inputColor.c[0] = byteToCol(p[3*x + 2]);
+ inputColor.c[1] = byteToCol(p[3*x + 1]);
+ inputColor.c[2] = byteToCol(p[3*x + 0]);
+ }
+ rgbCS->getCMYK(&inputColor, &cmyk);
+ cmykColor[0] = colToByte(cmyk.c);
+ cmykColor[1] = colToByte(cmyk.m);
+ cmykColor[2] = colToByte(cmyk.y);
+ cmykColor[3] = colToByte(cmyk.k);
+
+ digit = cmykColor[comp] / 16;
+ hexBuf[i++] = digit + ((digit >= 10)? 'a' - 10: '0');
+ digit = cmykColor[comp] % 16;
+ hexBuf[i++] = digit + ((digit >= 10)? 'a' - 10: '0');
+ if (i >= 64) {
+ hexBuf[i++] = '\n';
+ writePSBuf(hexBuf, i);
+ i = 0;
+ }
+ }
}
- }
- } else {
- // Hex color image
- for (x = 0; x < w; ++x) {
- digit = p[4*x + comp] / 16;
- hexBuf[i++] = digit + ((digit >= 10)? 'a' - 10: '0');
- digit = p[4*x + comp] % 16;
- hexBuf[i++] = digit + ((digit >= 10)? 'a' - 10: '0');
- if (i >= 64) {
- hexBuf[i++] = '\n';
- writePSBuf(hexBuf, i);
- i = 0;
+ }
+ p -= bitmap->getRowSize();
+ }
+ delete rgbCS;
+ break;
+ default:
+ for (y = 0; y < h; ++y) {
+ for (comp = 0; comp < 4; ++comp) {
+ if (useBinary) {
+ // Binary color image
+ for (x = 0; x < w; ++x) {
+ hexBuf[i++] = p[4*x + comp];
+ if (i >= 64) {
+ writePSBuf(hexBuf, i);
+ i = 0;
+ }
+ }
+ } else {
+ // Hex color image
+ for (x = 0; x < w; ++x) {
+ digit = p[4*x + comp] / 16;
+ hexBuf[i++] = digit + ((digit >= 10)? 'a' - 10: '0');
+ digit = p[4*x + comp] % 16;
+ hexBuf[i++] = digit + ((digit >= 10)? 'a' - 10: '0');
+ if (i >= 64) {
+ hexBuf[i++] = '\n';
+ writePSBuf(hexBuf, i);
+ i = 0;
+ }
+ }
}
- }
- }
- }
- p -= bitmap->getRowSize();
+ }
+ p -= bitmap->getRowSize();
+ }
+ break;
}
}
if (i != 0) {
--
2.21.0

View File

@ -0,0 +1,66 @@
From 25feab2736d35ca707bde173b4a7d548da342211 Mon Sep 17 00:00:00 2001
From: Marek Kasik <mkasik@redhat.com>
Date: Thu, 2 Jan 2020 13:40:40 +0100
Subject: [PATCH] Revert Remove unused MacroPushRequiredVars.cmake
This is needed by the QT4 removal revert.
---
cmake/modules/MacroPushRequiredVars.cmake | 46 +++++++++++++++++++++++
1 file changed, 46 insertions(+)
create mode 100644 cmake/modules/MacroPushRequiredVars.cmake
diff --git a/cmake/modules/MacroPushRequiredVars.cmake b/cmake/modules/MacroPushRequiredVars.cmake
new file mode 100644
index 00000000..35a6df5e
--- /dev/null
+++ b/cmake/modules/MacroPushRequiredVars.cmake
@@ -0,0 +1,46 @@
+# this module defines two macros:
+# MACRO_PUSH_REQUIRED_VARS()
+# and
+# MACRO_POP_REQUIRED_VARS()
+# use these if you call cmake macros which use
+# any of the CMAKE_REQUIRED_XXX variables
+#
+# Usage:
+# MACRO_PUSH_REQUIRED_VARS()
+# SET(CMAKE_REQUIRED_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS} -DSOME_MORE_DEF)
+# CHECK_FUNCTION_EXISTS(...)
+# MACRO_POP_REQUIRED_VARS()
+
+# Copyright (c) 2006, Alexander Neundorf, <neundorf@kde.org>
+#
+# Redistribution and use is allowed according to the terms of the BSD license.
+# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
+
+MACRO(MACRO_PUSH_REQUIRED_VARS)
+
+ IF(NOT DEFINED _PUSH_REQUIRED_VARS_COUNTER)
+ SET(_PUSH_REQUIRED_VARS_COUNTER 0)
+ ENDIF(NOT DEFINED _PUSH_REQUIRED_VARS_COUNTER)
+
+ MATH(EXPR _PUSH_REQUIRED_VARS_COUNTER "${_PUSH_REQUIRED_VARS_COUNTER}+1")
+
+ SET(_CMAKE_REQUIRED_INCLUDES_SAVE_${_PUSH_REQUIRED_VARS_COUNTER} ${CMAKE_REQUIRED_INCLUDES})
+ SET(_CMAKE_REQUIRED_DEFINITIONS_SAVE_${_PUSH_REQUIRED_VARS_COUNTER} ${CMAKE_REQUIRED_DEFINITIONS})
+ SET(_CMAKE_REQUIRED_LIBRARIES_SAVE_${_PUSH_REQUIRED_VARS_COUNTER} ${CMAKE_REQUIRED_LIBRARIES})
+ SET(_CMAKE_REQUIRED_FLAGS_SAVE_${_PUSH_REQUIRED_VARS_COUNTER} ${CMAKE_REQUIRED_FLAGS})
+ENDMACRO(MACRO_PUSH_REQUIRED_VARS)
+
+MACRO(MACRO_POP_REQUIRED_VARS)
+
+# don't pop more than we pushed
+ IF("${_PUSH_REQUIRED_VARS_COUNTER}" GREATER "0")
+
+ SET(CMAKE_REQUIRED_INCLUDES ${_CMAKE_REQUIRED_INCLUDES_SAVE_${_PUSH_REQUIRED_VARS_COUNTER}})
+ SET(CMAKE_REQUIRED_DEFINITIONS ${_CMAKE_REQUIRED_DEFINITIONS_SAVE_${_PUSH_REQUIRED_VARS_COUNTER}})
+ SET(CMAKE_REQUIRED_LIBRARIES ${_CMAKE_REQUIRED_LIBRARIES_SAVE_${_PUSH_REQUIRED_VARS_COUNTER}})
+ SET(CMAKE_REQUIRED_FLAGS ${_CMAKE_REQUIRED_FLAGS_SAVE_${_PUSH_REQUIRED_VARS_COUNTER}})
+
+ MATH(EXPR _PUSH_REQUIRED_VARS_COUNTER "${_PUSH_REQUIRED_VARS_COUNTER}-1")
+ ENDIF("${_PUSH_REQUIRED_VARS_COUNTER}" GREATER "0")
+
+ENDMACRO(MACRO_POP_REQUIRED_VARS)
--
2.24.1

View File

@ -0,0 +1,12 @@
--- poppler-0.90.0/CMakeLists.txt
+++ poppler-0.90.0/CMakeLists.txt
@@ -17,6 +17,9 @@ else()
set(THREADS_PREFER_PTHREAD_FLAG TRUE)
find_package(Threads)
endif()
+
+set(CMAKE_POSITION_INDEPENDENT_CODE ON)
+
include(TestBigEndian)
test_big_endian(WORDS_BIGENDIAN)
include(CheckFileOffsetBits)

View File

@ -0,0 +1,383 @@
--- poppler-0.90.0/qt4/src/poppler-annotation.cc
+++ poppler-0.90.0/qt4/src/poppler-annotation.cc
@@ -789,7 +789,7 @@ Link* AnnotationPrivate::additionalActio
case Annotation::PageInvisibleAction: actionType = Annot::actionPageInvisible; break;
}
- ::LinkAction *linkAction = nullptr;
+ std::unique_ptr<::LinkAction> linkAction = nullptr;
if ( pdfAnnot->getType() == Annot::typeScreen )
linkAction = static_cast<AnnotScreen*>( pdfAnnot )->getAdditionalAction( actionType );
else
@@ -798,7 +798,7 @@ Link* AnnotationPrivate::additionalActio
Link *link = nullptr;
if ( linkAction )
- link = PageData::convertLinkActionToLink( linkAction, parentDoc, QRectF() );
+ link = PageData::convertLinkActionToLink( linkAction.get(), parentDoc, QRectF() );
return link;
}
--- poppler-0.90.0/qt4/src/poppler-document.cc
+++ poppler-0.90.0/qt4/src/poppler-document.cc
@@ -57,8 +57,6 @@
namespace Poppler {
- int DocumentData::count = 0;
-
Document *Document::load(const QString &filePath, const QByteArray &ownerPassword,
const QByteArray &userPassword)
{
@@ -633,7 +631,16 @@ namespace Poppler {
void Document::setColorDisplayProfile(void* outputProfileA)
{
#if defined(USE_CMS)
- GfxColorSpace::setDisplayProfile((cmsHPROFILE)outputProfileA);
+ if (m_doc->m_sRGBProfile && m_doc->m_sRGBProfile.get() == outputProfileA) {
+ // Catch the special case that the user passes the sRGB profile
+ m_doc->m_displayProfile = m_doc->m_sRGBProfile;
+ return;
+ }
+ if (m_doc->m_displayProfile && m_doc->m_displayProfile.get() == outputProfileA) {
+ // Catch the special case that the user passes the display profile
+ return;
+ }
+ m_doc->m_displayProfile = make_GfxLCMSProfilePtr(outputProfileA);
#else
Q_UNUSED(outputProfileA);
#endif
@@ -642,9 +649,8 @@ namespace Poppler {
void Document::setColorDisplayProfileName(const QString &name)
{
#if defined(USE_CMS)
- GooString *profileName = QStringToGooString( name );
- GfxColorSpace::setDisplayProfileName(profileName);
- delete profileName;
+ void* rawprofile = cmsOpenProfileFromFile(name.toLocal8Bit().constData(),"r");
+ m_doc->m_displayProfile = make_GfxLCMSProfilePtr(rawprofile);
#else
Q_UNUSED(name);
#endif
@@ -653,7 +659,10 @@ namespace Poppler {
void* Document::colorRgbProfile() const
{
#if defined(USE_CMS)
- return (void*)GfxColorSpace::getRGBProfile();
+ if (!m_doc->m_sRGBProfile) {
+ m_doc->m_sRGBProfile = make_GfxLCMSProfilePtr(cmsCreate_sRGBProfile());
+ }
+ return m_doc->m_sRGBProfile.get();
#else
return NULL;
#endif
@@ -662,7 +671,7 @@ namespace Poppler {
void* Document::colorDisplayProfile() const
{
#if defined(USE_CMS)
- return (void*)GfxColorSpace::getDisplayProfile();
+ return m_doc->m_displayProfile.get();
#else
return NULL;
#endif
--- poppler-0.90.0/qt4/src/poppler-link.cc
+++ poppler-0.90.0/qt4/src/poppler-link.cc
@@ -232,7 +232,7 @@ class LinkMoviePrivate : public LinkPriv
if ( data.namedDest && !ld && !data.externalDest )
{
deleteDest = true;
- ld = data.doc->doc->findDest( data.namedDest );
+ ld = data.doc->doc->findDest( data.namedDest ).release();
}
// in case this destination was named one, and it was not resolved
if ( data.namedDest && !ld )
--- poppler-0.90.0/qt4/src/poppler-page.cc
+++ poppler-0.90.0/qt4/src/poppler-page.cc
@@ -110,30 +110,30 @@ Link* PageData::convertLinkActionToLink(
case actionNamed:
{
- const char * name = ((LinkNamed *)a)->getName()->c_str();
- if ( !strcmp( name, "NextPage" ) )
+ const std::string& name = ((LinkNamed *)a)->getName();
+ if ( name == "NextPage" )
popplerLink = new LinkAction( linkArea, LinkAction::PageNext );
- else if ( !strcmp( name, "PrevPage" ) )
+ else if ( name == "PrevPage" )
popplerLink = new LinkAction( linkArea, LinkAction::PagePrev );
- else if ( !strcmp( name, "FirstPage" ) )
+ else if ( name == "FirstPage" )
popplerLink = new LinkAction( linkArea, LinkAction::PageFirst );
- else if ( !strcmp( name, "LastPage" ) )
+ else if ( name == "LastPage" )
popplerLink = new LinkAction( linkArea, LinkAction::PageLast );
- else if ( !strcmp( name, "GoBack" ) )
+ else if ( name == "GoBack" )
popplerLink = new LinkAction( linkArea, LinkAction::HistoryBack );
- else if ( !strcmp( name, "GoForward" ) )
+ else if ( name == "GoForward" )
popplerLink = new LinkAction( linkArea, LinkAction::HistoryForward );
- else if ( !strcmp( name, "Quit" ) )
+ else if ( name == "Quit" )
popplerLink = new LinkAction( linkArea, LinkAction::Quit );
- else if ( !strcmp( name, "GoToPage" ) )
+ else if ( name == "GoToPage" )
popplerLink = new LinkAction( linkArea, LinkAction::GoToPage );
- else if ( !strcmp( name, "Find" ) )
+ else if ( name == "Find" )
popplerLink = new LinkAction( linkArea, LinkAction::Find );
- else if ( !strcmp( name, "FullScreen" ) )
+ else if ( name == "FullScreen" )
popplerLink = new LinkAction( linkArea, LinkAction::Presentation );
- else if ( !strcmp( name, "Print" ) )
+ else if ( name == "Print" )
popplerLink = new LinkAction( linkArea, LinkAction::Print );
- else if ( !strcmp( name, "Close" ) )
+ else if ( name == "Close" )
{
// acroread closes the document always, doesnt care whether
// its presentation mode or not
@@ -149,7 +149,7 @@ Link* PageData::convertLinkActionToLink(
case actionURI:
{
- popplerLink = new LinkBrowse( linkArea, ((LinkURI *)a)->getURI()->c_str() );
+ popplerLink = new LinkBrowse( linkArea, ((LinkURI *)a)->getURI().c_str() );
}
break;
@@ -362,6 +362,10 @@ QImage Page::renderToImage(double xres,
splash_output.setFreeTypeHinting(m_page->parentDoc->m_hints & Document::TextHinting ? true : false,
m_page->parentDoc->m_hints & Document::TextSlightHinting ? true : false);
+#ifdef USE_CMS
+ splash_output.setDisplayProfile(m_page->parentDoc->m_displayProfile);
+#endif
+
splash_output.startDoc(m_page->parentDoc->doc);
m_page->parentDoc->doc->displayPageSlice(&splash_output, m_page->index + 1, xres, yres,
@@ -442,6 +447,11 @@ bool Page::renderToPainter(QPainter* pai
painter->translate(x == -1 ? 0 : -x, y == -1 ? 0 : -y);
ArthurOutputDev arthur_output(painter);
arthur_output.startDoc(m_page->parentDoc->doc->getXRef());
+
+#ifdef USE_CMS
+ arthur_output.setDisplayProfile(m_page->parentDoc->m_displayProfile);
+#endif
+
m_page->parentDoc->doc->displayPageSlice(&arthur_output,
m_page->index + 1,
xres,
@@ -671,12 +681,11 @@ Link *Page::action( PageAction act ) con
Dict *dict = o.getDict();
const char *key = act == Page::Opening ? "O" : "C";
Object o2 = dict->lookup((char*)key);
- ::LinkAction *lact = ::LinkAction::parseAction(&o2, m_page->parentDoc->doc->getCatalog()->getBaseURI() );
+ std::unique_ptr<::LinkAction> lact = ::LinkAction::parseAction(&o2, m_page->parentDoc->doc->getCatalog()->getBaseURI() );
Link *popplerLink = NULL;
if (lact != NULL)
{
- popplerLink = m_page->convertLinkActionToLink(lact, QRectF());
- delete lact;
+ popplerLink = m_page->convertLinkActionToLink(lact.get(), QRectF());
}
return popplerLink;
}
--- poppler-0.90.0/qt4/src/poppler-private.cc
+++ poppler-0.90.0/qt4/src/poppler-private.cc
@@ -49,15 +49,13 @@ namespace Debug {
}
- static UnicodeMap *utf8Map = 0;
-
void setDebugErrorFunction(PopplerDebugFunc function, const QVariant &closure)
{
Debug::debugFunction = function ? function : Debug::qDebugDebugFunction;
Debug::debugClosure = closure;
}
- static void qt4ErrorFunction(void * /*data*/, ErrorCategory /*category*/, Goffset pos, const char *msg)
+ void qt4ErrorFunction(ErrorCategory /*category*/, Goffset pos, const char *msg)
{
QString emsg;
@@ -74,12 +72,7 @@ namespace Debug {
}
QString unicodeToQString(const Unicode* u, int len) {
- if (!utf8Map)
- {
- GooString enc("UTF-8");
- utf8Map = globalParams->getUnicodeMap(&enc);
- utf8Map->incRefCnt();
- }
+ const UnicodeMap *utf8Map = globalParams->getUtf8Map();
// ignore the last character if it is 0x0
if ((len > 0) && (u[len - 1] == 0))
@@ -99,34 +92,25 @@ namespace Debug {
}
QString UnicodeParsedString(const GooString *s1) {
- if ( !s1 || s1->getLength() == 0 )
+ return (s1) ? UnicodeParsedString(s1->toStr()) : QString();
+ }
+
+ QString UnicodeParsedString(const std::string& s1) {
+ if ( s1.empty() )
return QString();
- const char *cString;
- int stringLength;
- bool deleteCString;
- if ( ( s1->getChar(0) & 0xff ) == 0xfe && ( s1->getLength() > 1 && ( s1->getChar(1) & 0xff ) == 0xff ) )
- {
- cString = s1->c_str();
- stringLength = s1->getLength();
- deleteCString = false;
- }
- else
+ if ( GooString::hasUnicodeMarker(s1) || GooString::hasUnicodeMarkerLE(s1) )
{
- cString = pdfDocEncodingToUTF16(s1, &stringLength);
- deleteCString = true;
+ return QString::fromUtf16(reinterpret_cast<const ushort *>(s1.c_str()), s1.size() / 2);
}
-
- QString result;
- // i = 2 to skip the unicode marker
- for ( int i = 2; i < stringLength; i += 2 )
+ else
{
- const Unicode u = ( ( cString[i] & 0xff ) << 8 ) | ( cString[i+1] & 0xff );
- result += QChar( u );
- }
- if (deleteCString)
+ int stringLength;
+ const char *cString = pdfDocEncodingToUTF16(s1, &stringLength);
+ auto result = QString::fromUtf16(reinterpret_cast<const ushort *>(cString), stringLength / 2);
delete[] cString;
- return result;
+ return result;
+ }
}
GooString *QStringToUnicodeGooString(const QString &s) {
@@ -221,7 +205,7 @@ namespace Debug {
case actionURI:
{
const LinkURI * u = static_cast< const LinkURI * >( a );
- e->setAttribute( "DestinationURI", u->getURI()->c_str() );
+ e->setAttribute( "DestinationURI", u->getURI().c_str() );
}
default: ;
}
@@ -233,13 +217,6 @@ namespace Debug {
delete (OptContentModel *)m_optContentModel;
delete doc;
delete m_fontInfoIterator;
-
- count --;
- if ( count == 0 )
- {
- utf8Map = nullptr;
- globalParams.reset();
- }
}
void DocumentData::init()
@@ -249,14 +226,6 @@ namespace Debug {
paperColor = Qt::white;
m_hints = 0;
m_optContentModel = 0;
-
- if ( count == 0 )
- {
- utf8Map = nullptr;
- globalParams = std::make_unique<GlobalParams>();
- setErrorCallback(qt4ErrorFunction, nullptr);
- }
- count ++;
}
--- poppler-0.90.0/qt4/src/poppler-private.h
+++ poppler-0.90.0/qt4/src/poppler-private.h
@@ -55,6 +55,8 @@ class FormWidget;
QString unicodeToQString(const Unicode* u, int len);
QString UnicodeParsedString(const GooString *s1);
+
+ QString UnicodeParsedString(const std::string& s1);
GooString *QStringToUnicodeGooString(const QString &s);
@@ -65,7 +67,7 @@ namespace Poppler {
GooString *QDateTimeToUnicodeGooString(const QDateTime &dt);
- void qt4ErrorFunction(int pos, char *msg, va_list args);
+ void qt4ErrorFunction(ErrorCategory /*category*/, Goffset pos, const char *msg);
class LinkDestinationData
{
@@ -65,9 +67,10 @@ namespace Poppler {
bool externalDest;
};
- class DocumentData {
+ class DocumentData : private GlobalParamsIniter {
public:
- DocumentData(const QString &filePath, GooString *ownerPassword, GooString *userPassword)
+ DocumentData(const QString &filePath, GooString *ownerPassword, GooString *userPassword) :
+ GlobalParamsIniter(qt4ErrorFunction)
{
init();
m_filePath = filePath;
@@ -102,7 +105,8 @@ namespace Poppler {
delete userPassword;
}
- DocumentData(const QByteArray &data, GooString *ownerPassword, GooString *userPassword)
+ DocumentData(const QByteArray &data, GooString *ownerPassword, GooString *userPassword) :
+ GlobalParamsIniter(qt4ErrorFunction)
{
fileContents = data;
MemStream *str = new MemStream((char*)fileContents.data(), 0, fileContents.length(), Object(objNull));
@@ -148,7 +152,10 @@ namespace Poppler {
QPointer<OptContentModel> m_optContentModel;
QColor paperColor;
int m_hints;
- static int count;
+#ifdef USE_CMS
+ GfxLCMSProfilePtr m_sRGBProfile;
+ GfxLCMSProfilePtr m_displayProfile;
+#endif
};
class FontInfoData
--- poppler-0.90.0/qt4/src/poppler-ps-converter.cc
+++ poppler-0.90.0/qt4/src/poppler-ps-converter.cc
@@ -235,7 +235,7 @@ bool PSConverter::convert()
d->marginBottom,
d->paperWidth - d->marginRight,
d->paperHeight - d->marginTop,
- (d->opts & ForceRasterization));
+ (d->opts & ForceRasterization) ? psAlwaysRasterize : psRasterizeWhenNeeded);
if (d->opts & StrictMargins)
{
--- poppler-0.90.0/qt4/src/poppler-sound.cc
+++ poppler-0.90.0/qt4/src/poppler-sound.cc
@@ -75,8 +75,7 @@ QString SoundObject::url() const
if ( m_soundData->m_type != SoundObject::External )
return QString();
- const GooString * goo = m_soundData->m_soundObj->getFileName();
- return goo ? QString( goo->c_str() ) : QString();
+ return QString( m_soundData->m_soundObj->getFileName().c_str() );
}
QByteArray SoundObject::data() const

1125
poppler.spec Normal file

File diff suppressed because it is too large Load Diff

2
sources Normal file
View File

@ -0,0 +1,2 @@
SHA512 (poppler-0.90.0.tar.xz) = 3b2a45c7fcdc41b0dad80b6454cd8bb50a6625537edbc537898790ef4b6425bb62e1934fd2aaa8565be9c045ab1ac40a8de2e939c5b5abf0254d8e6c833b4450
SHA512 (poppler-test-2018-12-18-45f55f1e03b9bf3fbd334c31776b6f5e472889ec.tar.xz) = fa1d8c92ca5bc9ebd7453dfb78f34fb44d014621fe698aa4a3fa9bd17bd0d302ca6ba36f4dd46a1ef030c0b7a30729d4bacb6d01c5c67d429c897e4f5ab331e8