From f116221ab92a6273eb9cb589877a7177eafa2f1f Mon Sep 17 00:00:00 2001 From: Eirik Aavitsland Date: Tue, 5 May 2020 15:25:54 +0200 Subject: [PATCH] RHI: fix off-by-one clipping In cases where qrhi_toTopLeftRenderTargetRect() would clip the width or height to the available space, it would subtract 1 from the result, leading to painting errors. Fixes: QTBUG-83928 Change-Id: I65d23151d838386b516ded0588702bc0bf4c0d93 Reviewed-by: Jonas Karlsson Reviewed-by: Laszlo Agocs --- src/gui/rhi/qrhi_p_p.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/gui/rhi/qrhi_p_p.h b/src/gui/rhi/qrhi_p_p.h index 95f04fbd1b..729b85c4d5 100644 --- a/src/gui/rhi/qrhi_p_p.h +++ b/src/gui/rhi/qrhi_p_p.h @@ -267,9 +267,9 @@ bool qrhi_toTopLeftRenderTargetRect(const QSize &outputSize, const std::array(0, inputHeight - heightOffset); if (*x + *w > outputWidth) - *w = qMax(0, outputWidth - *x - 1); + *w = qMax(0, outputWidth - *x); if (*y + *h > outputHeight) - *h = qMax(0, outputHeight - *y - 1); + *h = qMax(0, outputHeight - *y); return true; }