summaryrefslogtreecommitdiffstats
path: root/src/gui
diff options
context:
space:
mode:
authorMartin Pley <qt@pley.org>2014-06-10 10:53:59 (GMT)
committerFelix Geyer <debfx@fobos.de>2014-09-11 08:58:56 (GMT)
commit5f0f5dd371cb5fbd1ae1cb8f7b6f03c0109d2d6c (patch)
tree64b91882e68c7ed8d1775ebb797975bfe4dbf199 /src/gui
parentba3ca7585ea0bef493e4aa492cbe5b738e65f6aa (diff)
downloadQt-5f0f5dd371cb5fbd1ae1cb8f7b6f03c0109d2d6c.zip
Qt-5f0f5dd371cb5fbd1ae1cb8f7b6f03c0109d2d6c.tar.gz
Qt-5f0f5dd371cb5fbd1ae1cb8f7b6f03c0109d2d6c.tar.bz2
QPdf::addImage(): avoid a QImage detach when it's in an acceptable Format
Don't detach QImage, when it's in Format_Mono or Format_ARG32. Use QImage::constScanLine() instead of QImage::scanLine(). Change-Id: I30fcafb576aea3189637a40fd75f77c70017ba46 Reviewed-by: John Layt <jlayt@kde.org> Reviewed-by: Gunnar Sletta <gunnar.sletta@jollamobile.com> (cherry picked from qtbase/1a32cc0ae42a4a49f2d45b8ad8251ec40a30bf76) Reviewed-by: Gunnar Sletta <gunnar@sletta.org>
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/painting/qprintengine_pdf.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/gui/painting/qprintengine_pdf.cpp b/src/gui/painting/qprintengine_pdf.cpp
index b622611..57dc162 100644
--- a/src/gui/painting/qprintengine_pdf.cpp
+++ b/src/gui/painting/qprintengine_pdf.cpp
@@ -559,7 +559,7 @@ int QPdfEnginePrivate::addImage(const QImage &img, bool *bitmap, qint64 serial_n
data.resize(bytesPerLine * h);
char *rawdata = data.data();
for (int y = 0; y < h; ++y) {
- memcpy(rawdata, image.scanLine(y), bytesPerLine);
+ memcpy(rawdata, image.constScanLine(y), bytesPerLine);
rawdata += bytesPerLine;
}
object = writeImage(data, w, h, d, 0, 0);
@@ -581,7 +581,7 @@ int QPdfEnginePrivate::addImage(const QImage &img, bool *bitmap, qint64 serial_n
softMaskData.resize(w * h);
uchar *sdata = (uchar *)softMaskData.data();
for (int y = 0; y < h; ++y) {
- const QRgb *rgb = (const QRgb *)image.scanLine(y);
+ const QRgb *rgb = (const QRgb *)image.constScanLine(y);
for (int x = 0; x < w; ++x) {
uchar alpha = qAlpha(*rgb);
*sdata++ = alpha;
@@ -597,7 +597,7 @@ int QPdfEnginePrivate::addImage(const QImage &img, bool *bitmap, qint64 serial_n
softMaskData.resize(w * h);
uchar *sdata = (uchar *)softMaskData.data();
for (int y = 0; y < h; ++y) {
- const QRgb *rgb = (const QRgb *)image.scanLine(y);
+ const QRgb *rgb = (const QRgb *)image.constScanLine(y);
if (colorMode == QPrinter::GrayScale) {
for (int x = 0; x < w; ++x) {
*(data++) = qGray(*rgb);