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().

Task-number: QTBUG-103923
Change-Id: I3472fdb19a73a22f04df53a13f809d899613adf5
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 70575264bd1d3caef6c3c6e7b19cffa6d94f804b)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
Marc Mutz 2022-05-31 21:10:06 +02:00 committed by Qt Cherry-pick Bot
parent 9f69247af1
commit 6c95114b6d

View File

@ -2294,6 +2294,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())) {