summaryrefslogtreecommitdiffstats
path: root/src/gui/painting/qpdf.cpp
diff options
context:
space:
mode:
authorLiang Qi <liang.qi@qt.io>2016-10-22 11:08:32 +0200
committerLiang Qi <liang.qi@qt.io>2016-10-22 21:19:57 +0200
commit28628a5d5e6c55512759ceafc644aa31e444b781 (patch)
tree221d1ab0995afe0d441f1ddb433aee985f6d41ea /src/gui/painting/qpdf.cpp
parentcbb2ba23e203374132e4b134b1c8f1a3626d2378 (diff)
parent686c44a69b13f6e884dd2b6d9991f4cd94597c5a (diff)
Merge remote-tracking branch 'origin/5.6' into 5.7
Conflicts: src/plugins/platforms/eglfs/qeglfshooks.cpp Change-Id: I483f0dbd876943b184803f0fe65a0c686ad75db2
Diffstat (limited to 'src/gui/painting/qpdf.cpp')
-rw-r--r--src/gui/painting/qpdf.cpp13
1 files changed, 9 insertions, 4 deletions
diff --git a/src/gui/painting/qpdf.cpp b/src/gui/painting/qpdf.cpp
index d568dca6b9..13dc7f7dd9 100644
--- a/src/gui/painting/qpdf.cpp
+++ b/src/gui/painting/qpdf.cpp
@@ -1925,7 +1925,7 @@ int QPdfEnginePrivate::writeCompressed(const char *src, int len)
}
int QPdfEnginePrivate::writeImage(const QByteArray &data, int width, int height, int depth,
- int maskObject, int softMaskObject, bool dct)
+ int maskObject, int softMaskObject, bool dct, bool isMono)
{
int image = addXrefEntry(-1);
xprintf("<<\n"
@@ -1935,8 +1935,13 @@ int QPdfEnginePrivate::writeImage(const QByteArray &data, int width, int height,
"/Height %d\n", width, height);
if (depth == 1) {
- xprintf("/ImageMask true\n"
- "/Decode [1 0]\n");
+ if (!isMono) {
+ xprintf("/ImageMask true\n"
+ "/Decode [1 0]\n");
+ } else {
+ xprintf("/BitsPerComponent 1\n"
+ "/ColorSpace /DeviceGray\n");
+ }
} else {
xprintf("/BitsPerComponent 8\n"
"/ColorSpace %s\n", (depth == 32) ? "/DeviceRGB" : "/DeviceGray");
@@ -2454,7 +2459,7 @@ int QPdfEnginePrivate::addImage(const QImage &img, bool *bitmap, qint64 serial_n
memcpy(rawdata, image.constScanLine(y), bytesPerLine);
rawdata += bytesPerLine;
}
- object = writeImage(data, w, h, d, 0, 0);
+ object = writeImage(data, w, h, d, 0, 0, false, is_monochrome(img.colorTable()));
} else {
QByteArray softMaskData;
bool dct = false;