From 69550d3db5794843aab8691b19e0413ddf0370bd Mon Sep 17 00:00:00 2001 From: Sjoerd van der Berg Date: Wed, 1 Feb 2006 07:22:45 +0000 Subject: [PATCH] Fix some issues with 1024x768 resolutions Add the adveinterp3x scaler, although not really doing much interpolating Imported-from: https://svn.code.sf.net/p/dosbox/code-0/dosbox/trunk@2469 --- src/gui/render.cpp | 7 +++++-- src/gui/render_scalers.cpp | 11 +++++++++-- src/gui/render_scalers.h | 5 ++++- src/gui/render_templates.h | 31 +++++++++++++++++++------------ 4 files changed, 37 insertions(+), 17 deletions(-) diff --git a/src/gui/render.cpp b/src/gui/render.cpp index 3e1bc29b..5f89554d 100644 --- a/src/gui/render.cpp +++ b/src/gui/render.cpp @@ -16,7 +16,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* $Id: render.cpp,v 1.38 2006-01-30 19:05:05 harekiet Exp $ */ +/* $Id: render.cpp,v 1.39 2006-02-01 07:22:45 harekiet Exp $ */ #include #include @@ -274,6 +274,8 @@ void RENDER_ReInit( bool stopIt ) { case scalerOpAdvInterp: if (render.scale.size == 2) lineBlock = &ScaleAdvInterp2x; + else if (render.scale.size == 3) + lineBlock = &ScaleAdvInterp3x; break; case scalerOpAdvMame: if (render.scale.size == 2) @@ -375,7 +377,7 @@ forcenormal: } void RENDER_SetSize(Bitu width,Bitu height,Bitu bpp,float fps,double ratio,bool dblw,bool dblh) { - if (!width || !height) { + if (!width || !height || width > SCALER_MAXWIDTH || height > SCALER_MAXHEIGHT) { render.active=false; return; } @@ -429,6 +431,7 @@ void RENDER_Init(Section * sec) { else if (!strcasecmp(scaler,"advmame2x")) { render.scale.op = scalerOpAdvMame;render.scale.size = 2; } else if (!strcasecmp(scaler,"advmame3x")) { render.scale.op = scalerOpAdvMame;render.scale.size = 3; } else if (!strcasecmp(scaler,"advinterp2x")) { render.scale.op = scalerOpAdvMame;render.scale.size = 2; } + else if (!strcasecmp(scaler,"advinterp3x")) { render.scale.op = scalerOpAdvMame;render.scale.size = 3; } else if (!strcasecmp(scaler,"tv2x")) { render.scale.op = scalerOpTV;render.scale.size = 2; } else if (!strcasecmp(scaler,"tv3x")) { render.scale.op = scalerOpTV;render.scale.size = 3; } else if (!strcasecmp(scaler,"rgb2x")){ render.scale.op = scalerOpRGB;render.scale.size = 2; } diff --git a/src/gui/render_scalers.cpp b/src/gui/render_scalers.cpp index 04fdb071..874f856e 100644 --- a/src/gui/render_scalers.cpp +++ b/src/gui/render_scalers.cpp @@ -36,8 +36,7 @@ union { } scalerWriteCache; scalerFrameCache_t scalerFrameCache; scalerSourceCache_t scalerSourceCache; - -Bit8u scalerChangeCache [SCALER_MAXHEIGHT][SCALER_MAXWIDTH / SCALER_BLOCKSIZE]; +scalerChangeCache_t scalerChangeCache; #define _conc2(A,B) A ## B #define _conc3(A,B,C) A ## B ## C @@ -220,6 +219,14 @@ ScalerLineBlock_t ScaleAdvInterp2x = { 0,AdvInterp2x_15_R,AdvInterp2x_16_R,AdvInterp2x_32_R }; +ScalerLineBlock_t ScaleAdvInterp3x = { + GFX_CAN_15|GFX_CAN_16|GFX_CAN_32|GFX_LOVE_32|GFX_RGBONLY, + 0, + 3,3, + 0,AdvInterp3x_15_L,AdvInterp3x_16_L,AdvInterp3x_32_L, + 0,AdvInterp3x_15_R,AdvInterp3x_16_R,AdvInterp3x_32_R +}; + ScalerLineBlock_t ScaleTV2x = { GFX_CAN_15|GFX_CAN_16|GFX_CAN_32|GFX_LOVE_32|GFX_RGBONLY, ScaleFlagSimple, diff --git a/src/gui/render_scalers.h b/src/gui/render_scalers.h index 8ea118fa..33d72b00 100644 --- a/src/gui/render_scalers.h +++ b/src/gui/render_scalers.h @@ -46,7 +46,8 @@ extern Bit8u Scaler_Aspect[]; extern Bit8u diff_table[]; extern Bitu Scaler_ChangedLineIndex; extern Bit16u Scaler_ChangedLines[]; -extern Bit8u scalerChangeCache [SCALER_MAXHEIGHT][SCALER_MAXWIDTH / SCALER_BLOCKSIZE]; +/* Not entirely happy about those +2's since they make a non power of 2, with muls instead of shift */ +typedef Bit8u scalerChangeCache_t [SCALER_MAXHEIGHT+2][2+(SCALER_MAXWIDTH / SCALER_BLOCKSIZE)] ; typedef union { Bit32u b32 [(SCALER_MAXHEIGHT+2)] [(SCALER_MAXWIDTH+2)]; Bit16u b16 [(SCALER_MAXHEIGHT+2)] [(SCALER_MAXWIDTH+2)]; @@ -60,6 +61,7 @@ typedef union { extern scalerFrameCache_t scalerFrameCache; extern scalerSourceCache_t scalerSourceCache; +extern scalerChangeCache_t scalerChangeCache; #define ScaleFlagSimple 0x001 @@ -98,6 +100,7 @@ extern ScalerLineBlock_t ScaleNormal3x; extern ScalerLineBlock_t ScaleAdvMame2x; extern ScalerLineBlock_t ScaleAdvMame3x; extern ScalerLineBlock_t ScaleAdvInterp2x; +extern ScalerLineBlock_t ScaleAdvInterp3x; extern ScalerLineBlock_t ScaleTV2x; extern ScalerLineBlock_t ScaleTV3x; diff --git a/src/gui/render_templates.h b/src/gui/render_templates.h index 9c7b8de8..ad00d285 100644 --- a/src/gui/render_templates.h +++ b/src/gui/render_templates.h @@ -417,10 +417,10 @@ static void conc3d(CacheSimple,SBPP,DBPP) (const void * s) { #define SCALERHEIGHT 2 #define SCALERFUNC \ if (C1 != C7 && C3 != C5) { \ - line0[0] = C3 == C1 ? interp_w2(C3,C4,5,3) : C4; \ - line0[1] = C1 == C5 ? interp_w2(C5,C4,5,3) : C4; \ - line1[0] = C3 == C7 ? interp_w2(C3,C4,5,3) : C4; \ - line1[1] = C7 == C5 ? interp_w2(C5,C4,5,3) : C4; \ + line0[0] = C3 == C1 ? interp_w2(C3,C4,5U,3U) : C4; \ + line0[1] = C1 == C5 ? interp_w2(C5,C4,5U,3U) : C4; \ + line1[0] = C3 == C7 ? interp_w2(C3,C4,5U,3U) : C4; \ + line1[1] = C7 == C5 ? interp_w2(C5,C4,5U,3U) : C4; \ } else { \ line0[0] = line0[1] = C4; \ line1[0] = line1[1] = C4; \ @@ -431,18 +431,25 @@ static void conc3d(CacheSimple,SBPP,DBPP) (const void * s) { #undef SCALERHEIGHT #undef SCALERFUNC +//TODO, come up with something better for this one #define SCALERNAME AdvInterp3x #define SCALERWIDTH 3 #define SCALERHEIGHT 3 #define SCALERFUNC \ - if (C1 != C7 && C3 != C5) { \ - line0[0] = C3 == C1 ? interp_w2(C3,C4,5,3) : C4; \ - line0[1] = C1 == C5 ? interp_w2(C5,C4,5,3) : C4; \ - line1[0] = C3 == C7 ? interp_w2(C3,C4,5,3) : C4; \ - line1[1] = C7 == C5 ? interp_w2(C5,C4,5,3) : C4; \ - } else { \ - line0[0] = line0[1] = C4; \ - line1[0] = line1[1] = C4; \ + if ((C1 != C7) && (C3 != C5)) { \ + line0[0] = C3 == C1 ? interp_w2(C3,C4,5U,3U) : C4; \ + line0[1] = (C3 == C1 && C4 != C2) || (C5 == C1 && C4 != C0) ? C1 : C4; \ + line0[2] = C5 == C1 ? interp_w2(C5,C4,5U,3U) : C4; \ + line1[0] = (C3 == C1 && C4 != C6) || (C3 == C7 && C4 != C0) ? C3 : C4; \ + line1[1] = C4; \ + line1[2] = (C5 == C1 && C4 != C8) || (C5 == C7 && C4 != C2) ? C5 : C4; \ + line2[0] = C3 == C7 ? interp_w2(C3,C4,5U,3U) : C4; \ + line2[1] = (C3 == C7 && C4 != C8) || (C5 == C7 && C4 != C6) ? C7 : C4; \ + line2[2] = C5 == C7 ? interp_w2(C5,C4,5U,3U) : C4; \ + } else { \ + line0[0] = line0[1] = line0[2] = C4; \ + line1[0] = line1[1] = line1[2] = C4; \ + line2[0] = line2[1] = line2[2] = C4; \ } #include "render_loops.h" #undef SCALERNAME