steamcompmgr: fixed unsigned math in screen magnifier

Offsets would wrap around and go nuts past the center, only top-left would
work.
This commit is contained in:
Pierre-Loup A. Griffais 2020-04-06 12:55:13 -07:00
parent 29eaa16785
commit db062a47cd

View file

@ -896,13 +896,13 @@ paint_window (Display *dpy, win *w, struct Composite_t *pComposite,
currentScaleRatio = (XRatio < YRatio) ? XRatio : YRatio;
currentScaleRatio *= globalScaleRatio;
drawXOffset = (currentOutputWidth - sourceWidth * currentScaleRatio) / 2.0f;
drawYOffset = (currentOutputHeight - sourceHeight * currentScaleRatio) / 2.0f;
drawXOffset = ((int)currentOutputWidth - (int)sourceWidth * currentScaleRatio) / 2.0f;
drawYOffset = ((int)currentOutputHeight - (int)sourceHeight * currentScaleRatio) / 2.0f;
if ( zoomScaleRatio != 1.0 )
{
drawXOffset += ((sourceWidth / 2) - cursor->x()) * currentScaleRatio;
drawYOffset += ((sourceHeight / 2) - cursor->y()) * currentScaleRatio;
drawXOffset += (((int)sourceWidth / 2) - cursor->x()) * currentScaleRatio;
drawYOffset += (((int)sourceHeight / 2) - cursor->y()) * currentScaleRatio;
}
}