From 0d4e187cdc5549ac3d0e8ba58c4153563a849697 Mon Sep 17 00:00:00 2001 From: Ivailo Monev Date: Tue, 2 Jul 2019 12:01:26 +0000 Subject: [PATCH] use QImage::constBits() where apropriate Signed-off-by: Ivailo Monev --- src/gui/image/qimage.cpp | 18 +++++++++--------- src/gui/painting/qpaintengine_raster.cpp | 4 ++-- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/gui/image/qimage.cpp b/src/gui/image/qimage.cpp index 271275b5c..9aa9445dc 100644 --- a/src/gui/image/qimage.cpp +++ b/src/gui/image/qimage.cpp @@ -4391,7 +4391,7 @@ bool QImage::operator==(const QImage & i) const if (d->format >= Format_ARGB32) { // all bits defined const int n = d->width * d->depth / 8; if (n == d->bytes_per_line && n == i.d->bytes_per_line) { - if (memcmp(bits(), i.bits(), d->nbytes)) + if (memcmp(bits(), i.constBits(), d->nbytes)) return false; } else { for (int y = 0; y < d->height; ++y) { @@ -5136,7 +5136,7 @@ static QImage rotated90(const QImage &image) { case QImage::Format_RGB32: case QImage::Format_ARGB32: case QImage::Format_ARGB32_Premultiplied: - qt_memrotate270(reinterpret_cast(image.bits()), + qt_memrotate270(reinterpret_cast(image.constBits()), w, h, image.bytesPerLine(), reinterpret_cast(out.bits()), out.bytesPerLine()); @@ -5146,7 +5146,7 @@ static QImage rotated90(const QImage &image) { case QImage::Format_ARGB8565_Premultiplied: case QImage::Format_ARGB8555_Premultiplied: case QImage::Format_RGB888: - qt_memrotate270(reinterpret_cast(image.bits()), + qt_memrotate270(reinterpret_cast(image.constBits()), w, h, image.bytesPerLine(), reinterpret_cast(out.bits()), out.bytesPerLine()); @@ -5154,13 +5154,13 @@ static QImage rotated90(const QImage &image) { case QImage::Format_RGB555: case QImage::Format_RGB16: case QImage::Format_ARGB4444_Premultiplied: - qt_memrotate270(reinterpret_cast(image.bits()), + qt_memrotate270(reinterpret_cast(image.constBits()), w, h, image.bytesPerLine(), reinterpret_cast(out.bits()), out.bytesPerLine()); break; case QImage::Format_Indexed8: - qt_memrotate270(reinterpret_cast(image.bits()), + qt_memrotate270(reinterpret_cast(image.constBits()), w, h, image.bytesPerLine(), reinterpret_cast(out.bits()), out.bytesPerLine()); @@ -5196,7 +5196,7 @@ static QImage rotated270(const QImage &image) { case QImage::Format_RGB32: case QImage::Format_ARGB32: case QImage::Format_ARGB32_Premultiplied: - qt_memrotate90(reinterpret_cast(image.bits()), + qt_memrotate90(reinterpret_cast(image.constBits()), w, h, image.bytesPerLine(), reinterpret_cast(out.bits()), out.bytesPerLine()); @@ -5206,7 +5206,7 @@ static QImage rotated270(const QImage &image) { case QImage::Format_ARGB8565_Premultiplied: case QImage::Format_ARGB8555_Premultiplied: case QImage::Format_RGB888: - qt_memrotate90(reinterpret_cast(image.bits()), + qt_memrotate90(reinterpret_cast(image.constBits()), w, h, image.bytesPerLine(), reinterpret_cast(out.bits()), out.bytesPerLine()); @@ -5214,13 +5214,13 @@ static QImage rotated270(const QImage &image) { case QImage::Format_RGB555: case QImage::Format_RGB16: case QImage::Format_ARGB4444_Premultiplied: - qt_memrotate90(reinterpret_cast(image.bits()), + qt_memrotate90(reinterpret_cast(image.constBits()), w, h, image.bytesPerLine(), reinterpret_cast(out.bits()), out.bytesPerLine()); break; case QImage::Format_Indexed8: - qt_memrotate90(reinterpret_cast(image.bits()), + qt_memrotate90(reinterpret_cast(image.constBits()), w, h, image.bytesPerLine(), reinterpret_cast(out.bits()), out.bytesPerLine()); diff --git a/src/gui/painting/qpaintengine_raster.cpp b/src/gui/painting/qpaintengine_raster.cpp index ff34afa55..1a1c1867b 100644 --- a/src/gui/painting/qpaintengine_raster.cpp +++ b/src/gui/painting/qpaintengine_raster.cpp @@ -762,7 +762,7 @@ void QRasterPaintEnginePrivate::drawImage(const QPointF &pt, Q_ASSERT(img.depth() >= 8); const int srcBPL = img.bytesPerLine(); - const uchar *srcBits = img.bits(); + const uchar *srcBits = img.constBits(); const int srcSize = img.depth() >> 3; // This is the part that is incompatible with lower than 8-bit.. int iw = img.width(); int ih = img.height(); @@ -2384,7 +2384,7 @@ bool QRasterPaintEngine::drawCachedGlyphs(int numGlyphs, const glyph_t *glyphs, rightShift = 3; // divide by 8 int margin = cache->glyphMargin(); - const uchar *bits = image.bits(); + const uchar *bits = image.constBits(); for (int i=0; isubPixelPositionForX(positions[i].x);