Win32Display::SizeChanged() BUG
There are missing parentheses in line 1018 1019 in the Win32Display::SizeChanged() method. It causes the window to change its size if it is far enough from the top left corner.
Here is the fixed code:
Here is the fixed code:
Code: Select all
void Win32Display::SizeChanged()
{
// SizeChanged callback is not invoked in the middle of a resize operation to avoid unnecessary
// render target recreations. This avoids massive memory spikes and even driver crashes
if (!mInsideSizeMove)
{
RECT r;
BOOL ret = GetWindowRect(mWindowHandle, &r);
NS_ASSERT(ret != 0);
float scale = GetScale();
uint32_t width = Round((r.right - r.left) / scale); // here was the bug
uint32_t height = Round((r.bottom - r.top) / scale); // here was the bug
if (IsWindowVisible(mWindowHandle) && !IsIconic(mWindowHandle))
{
if (width != mWidth || height != mHeight)
{
mSizeChanged(this, width, height);
mWidth = width;
mHeight = height;
}
}
}
}
-
sfernandez
Site Admin
- Posts: 2983
- Joined:
Re: Win32Display::SizeChanged() BUG
Thanks a lot for pointing this out, we just commit the fix for the next release.
Who is online
Users browsing this forum: Google [Bot], vinick and 63 guests