QRasterPaintEngine: fix GCC 12 -Werror=array-bounds

An enum variable can legally have values larger than the largest
enumerator, so GCC isn't wrong in warning about accesses out of
bounds. But we know that we don't OR enumerators of this enum
together, so tell GCC, too, by using a Q_ASSUME().

Pick-to: 6.3 6.2
Task-number: QTBUG-103923
Change-Id: I3472fdb19a73a22f04df53a13f809d899613adf5
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
Marc Mutz 2022-05-31 21:10:06 +02:00
parent 663b375373
commit 70575264bd

View File

@ -2277,6 +2277,7 @@ void QRasterPaintEngine::drawImage(const QRectF &r, const QImage &img, const QRe
|| d->rasterBuffer->compositionMode == QPainter::CompositionMode_Source))
{
RotationType rotationType = qRotationType(s->matrix);
Q_ASSUME(d->rasterBuffer->format < QImage::NImageFormats);
const QPixelLayout::BPP plBpp = qPixelLayouts[d->rasterBuffer->format].bpp;
if (rotationType != NoRotation && qMemRotateFunctions[plBpp][rotationType] && img.rect().contains(sr.toAlignedRect())) {