From: Ivailo Monev Date: Thu, 9 Apr 2020 07:14:37 +0000 (+0000) Subject: store QImage::bytesPerLine() result outside loop in QImage::createMaskFromColor() X-Git-Tag: 4.12.0~3826 X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=09db2c7c5be0ba1db10d3778c4451dcfff8f1acb;p=kde%2FKatie.git store QImage::bytesPerLine() result outside loop in QImage::createMaskFromColor() Signed-off-by: Ivailo Monev --- 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)