From 09db2c7c5be0ba1db10d3778c4451dcfff8f1acb Mon Sep 17 00:00:00 2001 From: Ivailo Monev Date: Thu, 9 Apr 2020 07:14:37 +0000 Subject: [PATCH] store QImage::bytesPerLine() result outside loop in QImage::createMaskFromColor() Signed-off-by: Ivailo Monev --- src/gui/image/qimage.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/gui/image/qimage.cpp b/src/gui/image/qimage.cpp index 15b871930..760c190d6 100644 --- a/src/gui/image/qimage.cpp +++ b/src/gui/image/qimage.cpp @@ -3782,6 +3782,7 @@ QImage QImage::createMaskFromColor(QRgb color, Qt::MaskMode mode) const QIMAGE_SANITYCHECK_MEMORY(maskImage); maskImage.fill(0); uchar *s = maskImage.bits(); + const int bpl = maskImage.bytesPerLine(); if (depth() == 32) { for (int h = 0; h < d->height; h++) { @@ -3790,7 +3791,7 @@ QImage QImage::createMaskFromColor(QRgb color, Qt::MaskMode mode) const if (sl[w] == color) *(s + (w >> 3)) |= (1 << (w & 7)); } - s += maskImage.bytesPerLine(); + s += bpl; } } else { for (int h = 0; h < d->height; h++) { @@ -3798,7 +3799,7 @@ QImage QImage::createMaskFromColor(QRgb color, Qt::MaskMode mode) const if ((uint) pixel(w, h) == color) *(s + (w >> 3)) |= (1 << (w & 7)); } - s += maskImage.bytesPerLine(); + s += bpl; } } if (mode == Qt::MaskOutColor) -- 2.11.0