- Fixed: Clean scaling at 720x480 looked borked.

SVN r602 (trunk)
This commit is contained in:
Randy Heit 2007-12-18 02:15:32 +00:00
commit 4c8bf4552a
2 changed files with 28 additions and 3 deletions

View file

@ -772,6 +772,11 @@ void DFrameBuffer::SetVSync (bool vsync)
{
}
CCMD(clean)
{
Printf ("CleanXfac: %d\nCleanYfac: %d\n", CleanXfac, CleanYfac);
}
//
// V_SetResolution
//
@ -792,6 +797,7 @@ bool V_DoModeSetup (int width, int height, int bits)
int ratio;
int cwidth;
int cheight;
int cx1, cy1, cx2, cy2;
ratio = CheckRatio (width, height);
if (ratio & 4)
@ -804,8 +810,22 @@ bool V_DoModeSetup (int width, int height, int bits)
cwidth = width * BaseRatioSizes[ratio][3] / 48;
cheight = height;
}
CleanXfac = MAX (cwidth / 320, 1);
CleanYfac = MAX (cheight / 200, 1);
// Use whichever pair of cwidth/cheight or width/height that produces less difference
// between CleanXfac and CleanYfac.
cx1 = MAX(cwidth / 320, 1);
cy1 = MAX(cheight / 200, 1);
cx2 = MAX(width / 320, 1);
cy2 = MAX(height / 200, 1);
if (abs(cx1 - cy1) <= abs(cx2 - cy2))
{ // e.g. 640x360 looks better with this.
CleanXfac = cx1;
CleanYfac = cy1;
}
else
{ // e.g. 720x480 looks better with this.
CleanXfac = cx2;
CleanYfac = cy2;
}
}
if (CleanXfac > 1 && CleanYfac > 1 && CleanXfac != CleanYfac)
@ -818,6 +838,8 @@ bool V_DoModeSetup (int width, int height, int bits)
CleanWidth = width / CleanXfac;
CleanHeight = height / CleanYfac;
assert(CleanWidth >= 320);
assert(CleanHeight >= 200);
DisplayWidth = width;
DisplayHeight = height;