Fix a rounding bug that effected screenshots and resolutions.
Previously, you may have gotten values like 639x480 (4:3) or 853x480 (16:9). These are due to rounding errors caused by lrintf; ceilf does what we really want. [RageDisplay.cpp] modified screenshot function [ScreenDimensions] modified SCREEN_WIDTH and SCREEN_HEIGHT algorithms (no longer do you need to SCREEN_WIDTH+1 for 16:9 support) [StepMania.cpp] modified windowed mode width calculation
This commit is contained in:
@@ -25,6 +25,9 @@ float ScreenDimensions::GetThemeAspectRatio()
|
||||
return THEME_NATIVE_ASPECT;
|
||||
}
|
||||
|
||||
// ceilf was originally lrintf. However, lrintf causes odd resolutions like
|
||||
// 639x480 (4:3) and 853x480 (16:9). ceilf gives the correct values of 640x480
|
||||
// and 854x480 respectively. -aj
|
||||
float ScreenDimensions::GetScreenWidth()
|
||||
{
|
||||
float fAspect = PREFSMAN->m_fDisplayAspectRatio;
|
||||
@@ -32,7 +35,7 @@ float ScreenDimensions::GetScreenWidth()
|
||||
if( fAspect > THEME_NATIVE_ASPECT )
|
||||
fScale = fAspect / THEME_NATIVE_ASPECT;
|
||||
ASSERT( fScale >= 1 );
|
||||
return (float) lrintf(THEME_SCREEN_WIDTH * fScale);
|
||||
return (float) ceilf(THEME_SCREEN_WIDTH * fScale);
|
||||
}
|
||||
|
||||
float ScreenDimensions::GetScreenHeight()
|
||||
@@ -42,7 +45,7 @@ float ScreenDimensions::GetScreenHeight()
|
||||
if( fAspect < THEME_NATIVE_ASPECT )
|
||||
fScale = THEME_NATIVE_ASPECT / fAspect;
|
||||
ASSERT( fScale >= 1 );
|
||||
return (float) lrintf(THEME_SCREEN_HEIGHT * fScale);
|
||||
return (float) ceilf(THEME_SCREEN_HEIGHT * fScale);
|
||||
}
|
||||
|
||||
void ScreenDimensions::ReloadScreenDimensions()
|
||||
|
||||
Reference in New Issue
Block a user