From c500291e42ea3f0237418b629d4a0bf9c0f23ff8 Mon Sep 17 00:00:00 2001 From: Matthew Cattell Date: Mon, 2 May 2011 11:26:05 +0200 Subject: [PATCH] Fixed bug in QPdfEngine::addImage causing mono images to be made 32 bit Regression from 4.5 causing performance and size degradation. Task-number: QTBUG-18997 Reviewed-by: Samuel (cherry picked from commit 18122b473ecbd85ba953f70743b1756358bf7c0c) --- src/gui/painting/qprintengine_pdf.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/gui/painting/qprintengine_pdf.cpp b/src/gui/painting/qprintengine_pdf.cpp index b7f5160..353869f 100644 --- a/src/gui/painting/qprintengine_pdf.cpp +++ b/src/gui/painting/qprintengine_pdf.cpp @@ -534,7 +534,10 @@ int QPdfEnginePrivate::addImage(const QImage &img, bool *bitmap, qint64 serial_n QImage image = img; QImage::Format format = image.format(); - if (image.depth() == 1 && *bitmap && img.colorTable().size() == 0) { + if (image.depth() == 1 && *bitmap && img.colorTable().size() == 2 + && img.colorTable().at(0) == QColor(Qt::black).rgba() + && img.colorTable().at(1) == QColor(Qt::white).rgba()) + { if (format == QImage::Format_MonoLSB) image = image.convertToFormat(QImage::Format_Mono); format = QImage::Format_Mono; -- 2.7.4