Skip to content

Commit

Permalink
Add 3x scale modes
Browse files Browse the repository at this point in the history
  • Loading branch information
cxong committed Jul 20, 2013
1 parent c8f5413 commit 3839bc9
Showing 1 changed file with 15 additions and 10 deletions.
25 changes: 15 additions & 10 deletions src/cdogs/grafx.c
Original file line number Diff line number Diff line change
Expand Up @@ -208,23 +208,28 @@ void AddSupportedModesForBPP(GraphicsDevice *device, int bpp)

for (i = 0; modes[i]; i++)
{
int w = modes[i]->w;
int h = modes[i]->h;
int scaleFactor = 1;
for (;;)
int validScaleFactors[] = { 1, 2, 3, 4 };
int j;
for (j = 0; j < 4; j++)
{
if (w % 4 || h % 4)
int scaleFactor = validScaleFactors[j];
int w, h;
if (modes[i]->w % scaleFactor || modes[i]->h % scaleFactor)
{
break;
continue;
}
AddGraphicsMode(device, w, h, scaleFactor);
w /= 2;
h /= 2;
scaleFactor *= 2;
if (modes[i]->w % 4)
{
// TODO: why does width have to be divisible by 4? 1366x768 doesn't work
continue;
}
w = modes[i]->w / scaleFactor;
h = modes[i]->h / scaleFactor;
if (w < 320 || h < 240)
{
break;
}
AddGraphicsMode(device, w, h, scaleFactor);
}
}
}
Expand Down

0 comments on commit 3839bc9

Please sign in to comment.