From 4c8bf4552aa24c57c72619f252d1915b957cbcda Mon Sep 17 00:00:00 2001 From: Randy Heit Date: Tue, 18 Dec 2007 02:15:32 +0000 Subject: [PATCH] - Fixed: Clean scaling at 720x480 looked borked. SVN r602 (trunk) --- docs/rh-log.txt | 5 ++++- src/v_video.cpp | 26 ++++++++++++++++++++++++-- 2 files changed, 28 insertions(+), 3 deletions(-) diff --git a/docs/rh-log.txt b/docs/rh-log.txt index 97104f9c8..feff8b35c 100644 --- a/docs/rh-log.txt +++ b/docs/rh-log.txt @@ -1,7 +1,10 @@ December 17, 2007 +- Fixed: Clean scaling at 720x480 looked borked. - New: When using the D3D9 framebuffer, palette blending is now applied only to the 3D area of the screen. This means the console and (the primary - rectangular area of) the status bar are no longer blended. + rectangular area of) the status bar are no longer blended. Maybe somedays + when I'm feeling adventurous, I'll exclude all the 2D graphics from the + blending. December 17, 2007 (Changes by Graf Zahl) - Fixed: When a skybox viewpoint is destroyed it should clear all diff --git a/src/v_video.cpp b/src/v_video.cpp index 42579c41b..92b7143d9 100644 --- a/src/v_video.cpp +++ b/src/v_video.cpp @@ -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;