summaryrefslogtreecommitdiffstats
path: root/src/gui/painting
diff options
context:
space:
mode:
authorMarc Mutz <marc.mutz@qt.io>2022-05-31 21:10:06 +0200
committerMarc Mutz <marc.mutz@qt.io>2022-06-01 02:36:28 +0200
commit70575264bd1d3caef6c3c6e7b19cffa6d94f804b (patch)
tree1756b88ba38a217980e53ca31ebf01f1ba9efc5f /src/gui/painting
parent663b375373d18c2a10e88223c4a16ea64aec3524 (diff)
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>
Diffstat (limited to 'src/gui/painting')
-rw-r--r--src/gui/painting/qpaintengine_raster.cpp1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/gui/painting/qpaintengine_raster.cpp b/src/gui/painting/qpaintengine_raster.cpp
index 4192a0fa07..52ee689188 100644
--- a/src/gui/painting/qpaintengine_raster.cpp
+++ b/src/gui/painting/qpaintengine_raster.cpp
@@ -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())) {