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>
bb10
Eirik Aavitsland 2020-05-05 15:25:54 +02:00
parent 56c203fc09
commit f116221ab9
1 changed files with 2 additions and 2 deletions

View File

@ -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;
}