Show backdrops with correct aspect ratio.

git-svn-id: https://warzone2100.svn.sourceforge.net/svnroot/warzone2100/branches/qt-trunk@10937 4a71c877-e1ca-e34f-864e-861f7616d084
master
Christian Ohm 2010-06-07 15:11:08 +00:00 committed by Git SVN Gateway
parent e8deaceca6
commit 87ac6bba6b
1 changed files with 14 additions and 0 deletions

View File

@ -264,6 +264,20 @@ void screen_Upload(const char *newBackDropBmp, BOOL preview)
static bool processed = false;
int x1 = 0, x2 = screenWidth, y1 = 0, y2 = screenHeight, i, scale = 0, w = 0, h = 0;
float tx = 1, ty = 1;
const float aspect = screenWidth / (float)screenHeight, backdropAspect = 4 / (float)3;
if (aspect > backdropAspect)
{
int offset = (screenWidth - screenHeight * backdropAspect) / 2;
x1 += offset;
x2 -= offset;
}
else
{
int offset = (screenHeight - screenWidth / backdropAspect) / 2;
y1 += offset;
y2 -= offset;
}
if(newBackDropBmp != NULL)
{