mirror of
https://github.com/gnif/LookingGlass.git
synced 2025-01-10 14:23:57 +00:00
[client] fixed strange resize effect due to loss of precision
This commit is contained in:
parent
49bf115c84
commit
127113a59b
2 changed files with 18 additions and 7 deletions
2
VERSION
2
VERSION
|
@ -1 +1 @@
|
|||
B1-49-g2196516e2b+1
|
||||
B1-50-g49bf115c84+1
|
|
@ -75,6 +75,17 @@ static void updatePositionInfo()
|
|||
{
|
||||
const float srcAspect = (float)state.srcSize.y / (float)state.srcSize.x;
|
||||
const float wndAspect = (float)state.windowH / (float)state.windowW;
|
||||
bool force = true;
|
||||
|
||||
if ((int)(wndAspect * 1000) == (int)(srcAspect * 1000))
|
||||
{
|
||||
force = false;
|
||||
state.dstRect.w = state.windowW;
|
||||
state.dstRect.h = state.windowH;
|
||||
state.dstRect.x = 0;
|
||||
state.dstRect.y = 0;
|
||||
}
|
||||
else
|
||||
if (wndAspect < srcAspect)
|
||||
{
|
||||
state.dstRect.w = (float)state.windowH / srcAspect;
|
||||
|
@ -89,6 +100,12 @@ static void updatePositionInfo()
|
|||
state.dstRect.x = 0;
|
||||
state.dstRect.y = (state.windowH >> 1) - (state.dstRect.h >> 1);
|
||||
}
|
||||
|
||||
if (force && params.forceAspect)
|
||||
{
|
||||
state.resizeTimeout = getMicrotime() + RESIZE_TIMEOUT;
|
||||
state.resizeDone = false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -101,12 +118,6 @@ static void updatePositionInfo()
|
|||
|
||||
state.scaleX = (float)state.srcSize.y / (float)state.dstRect.h;
|
||||
state.scaleY = (float)state.srcSize.x / (float)state.dstRect.w;
|
||||
|
||||
if (params.forceAspect)
|
||||
{
|
||||
state.resizeTimeout = getMicrotime() + RESIZE_TIMEOUT;
|
||||
state.resizeDone = false;
|
||||
}
|
||||
}
|
||||
|
||||
state.lgrResize = true;
|
||||
|
|
Loading…
Reference in a new issue