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)
This commit is contained in:
Matthew Cattell 2011-05-02 11:26:05 +02:00 committed by Olivier Goffart
parent 42452a32bf
commit c500291e42

View File

@ -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;