summaryrefslogtreecommitdiffstats
path: root/src/gui/rhi/qrhi_p_p.h
diff options
context:
space:
mode:
authorEirik Aavitsland <eirik.aavitsland@qt.io>2020-05-05 15:25:54 +0200
committerEirik Aavitsland <eirik.aavitsland@qt.io>2020-05-07 08:56:24 +0000
commitf116221ab92a6273eb9cb589877a7177eafa2f1f (patch)
treef62c2007f91244661b97771346eb5ac676bbc174 /src/gui/rhi/qrhi_p_p.h
parent56c203fc09e6e7aeb6ce474e30fe4a93c8d412b4 (diff)
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 <jonas.karlsson@qt.io> Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
Diffstat (limited to 'src/gui/rhi/qrhi_p_p.h')
-rw-r--r--src/gui/rhi/qrhi_p_p.h4
1 files 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<T,
*h = qMax<T>(0, inputHeight - heightOffset);
if (*x + *w > outputWidth)
- *w = qMax<T>(0, outputWidth - *x - 1);
+ *w = qMax<T>(0, outputWidth - *x);
if (*y + *h > outputHeight)
- *h = qMax<T>(0, outputHeight - *y - 1);
+ *h = qMax<T>(0, outputHeight - *y);
return true;
}