DOSBox-X
|
00001 /* 00002 * Copyright (C) 2002-2020 The DOSBox Team 00003 * 00004 * This program is free software; you can redistribute it and/or modify 00005 * it under the terms of the GNU General Public License as published by 00006 * the Free Software Foundation; either version 2 of the License, or 00007 * (at your option) any later version. 00008 * 00009 * This program is distributed in the hope that it will be useful, 00010 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00012 * GNU General Public License for more details. 00013 * 00014 * You should have received a copy of the GNU General Public License along 00015 * with this program; if not, write to the Free Software Foundation, Inc., 00016 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 00017 */ 00018 00019 #if defined (SCALERLINEAR) 00020 static inline void conc3d(SCALERNAME,SBPP,L)(void) { 00021 # if !defined(_MSC_VER) /* Microsoft C++ thinks this is a failed attempt at a function call---it's not */ 00022 (void)conc3d(SCALERNAME,SBPP,L); 00023 # endif 00024 #else 00025 static inline void conc3d(SCALERNAME,SBPP,R)(void) { 00026 # if !defined(_MSC_VER) /* Microsoft C++ thinks this is a failed attempt at a function call---it's not */ 00027 (void)conc3d(SCALERNAME,SBPP,R); 00028 # endif 00029 #endif 00030 //Skip the first one for multiline input scalers 00031 if (!render.scale.outLine) { 00032 render.scale.outLine++; 00033 return; 00034 } 00035 lastagain: 00036 if (!CC[render.scale.outLine][0]) { 00037 #if defined(SCALERLINEAR) 00038 Bitu scaleLines = SCALERHEIGHT; 00039 #else 00040 Bitu scaleLines = Scaler_Aspect[ render.scale.outLine ]; 00041 #endif 00042 ScalerAddLines( 0, scaleLines ); 00043 if (++render.scale.outLine == render.scale.inHeight) 00044 goto lastagain; 00045 return; 00046 } 00047 /* Clear the complete line marker */ 00048 CC[render.scale.outLine][0] = 0; 00049 const PTYPE * fc = &FC[render.scale.outLine][1]; 00050 PTYPE * line0=(PTYPE *)(render.scale.outWrite); 00051 Bit8u * changed = &CC[render.scale.outLine][1]; 00052 Bitu b; 00053 for (b=0;b<render.scale.blocks;b++) { 00054 #if (SCALERHEIGHT > 1) 00055 PTYPE * line1; 00056 #endif 00057 #if (SCALERHEIGHT > 2) 00058 PTYPE * line2; 00059 #endif 00060 /* Clear this block being dirty marker */ 00061 const Bitu changeType = changed[b]; 00062 changed[b] = 0; 00063 switch (changeType) { 00064 case 0: 00065 line0 += SCALERWIDTH * SCALER_BLOCKSIZE; 00066 fc += SCALER_BLOCKSIZE; 00067 continue; 00068 case SCALE_LEFT: 00069 #if (SCALERHEIGHT > 1) 00070 line1 = (PTYPE *)(((Bit8u*)line0)+ render.scale.outPitch); 00071 #endif 00072 #if (SCALERHEIGHT > 2) 00073 line2 = (PTYPE *)(((Bit8u*)line0)+ render.scale.outPitch * 2); 00074 #endif 00075 SCALERFUNC; 00076 line0 += SCALERWIDTH * SCALER_BLOCKSIZE; 00077 fc += SCALER_BLOCKSIZE; 00078 break; 00079 case SCALE_LEFT | SCALE_RIGHT: 00080 #if (SCALERHEIGHT > 1) 00081 line1 = (PTYPE *)(((Bit8u*)line0)+ render.scale.outPitch); 00082 #endif 00083 #if (SCALERHEIGHT > 2) 00084 line2 = (PTYPE *)(((Bit8u*)line0)+ render.scale.outPitch * 2); 00085 #endif 00086 SCALERFUNC; 00087 case SCALE_RIGHT: 00088 #if (SCALERHEIGHT > 1) 00089 line1 = (PTYPE *)(((Bit8u*)line0)+ render.scale.outPitch); 00090 #endif 00091 #if (SCALERHEIGHT > 2) 00092 line2 = (PTYPE *)(((Bit8u*)line0)+ render.scale.outPitch * 2); 00093 #endif 00094 line0 += SCALERWIDTH * (SCALER_BLOCKSIZE -1); 00095 #if (SCALERHEIGHT > 1) 00096 line1 += SCALERWIDTH * (SCALER_BLOCKSIZE -1); 00097 #endif 00098 #if (SCALERHEIGHT > 2) 00099 line2 += SCALERWIDTH * (SCALER_BLOCKSIZE -1); 00100 #endif 00101 fc += SCALER_BLOCKSIZE -1; 00102 SCALERFUNC; 00103 line0 += SCALERWIDTH; 00104 fc++; 00105 break; 00106 default: 00107 #if defined(SCALERLINEAR) 00108 #if (SCALERHEIGHT > 1) 00109 line1 = WC[0]; 00110 #endif 00111 #if (SCALERHEIGHT > 2) 00112 line2 = WC[1]; 00113 #endif 00114 #else 00115 #if (SCALERHEIGHT > 1) 00116 line1 = (PTYPE *)(((Bit8u*)line0)+ render.scale.outPitch); 00117 #endif 00118 #if (SCALERHEIGHT > 2) 00119 line2 = (PTYPE *)(((Bit8u*)line0)+ render.scale.outPitch * 2); 00120 #endif 00121 #endif //defined(SCALERLINEAR) 00122 for (Bitu i = 0; i<SCALER_BLOCKSIZE;i++) { 00123 SCALERFUNC; 00124 line0 += SCALERWIDTH; 00125 #if (SCALERHEIGHT > 1) 00126 line1 += SCALERWIDTH; 00127 #endif 00128 #if (SCALERHEIGHT > 2) 00129 line2 += SCALERWIDTH; 00130 #endif 00131 fc++; 00132 } 00133 #if defined(SCALERLINEAR) 00134 #if (SCALERHEIGHT > 1) 00135 BituMove((Bit8u*)(&line0[-SCALER_BLOCKSIZE*SCALERWIDTH])+render.scale.outPitch ,WC[0], SCALER_BLOCKSIZE *SCALERWIDTH*PSIZE); 00136 #endif 00137 #if (SCALERHEIGHT > 2) 00138 BituMove((Bit8u*)(&line0[-SCALER_BLOCKSIZE*SCALERWIDTH])+render.scale.outPitch*2,WC[1], SCALER_BLOCKSIZE *SCALERWIDTH*PSIZE); 00139 #endif 00140 #endif //defined(SCALERLINEAR) 00141 break; 00142 } 00143 } 00144 #if defined(SCALERLINEAR) 00145 Bitu scaleLines = SCALERHEIGHT; 00146 #else 00147 Bitu scaleLines = Scaler_Aspect[ render.scale.outLine ]; 00148 if ( ((Bits)(scaleLines - SCALERHEIGHT)) > 0 ) { 00149 BituMove( render.scale.outWrite + render.scale.outPitch * SCALERHEIGHT, 00150 render.scale.outWrite + render.scale.outPitch * (SCALERHEIGHT-1), 00151 render.src.width * SCALERWIDTH * PSIZE); 00152 } 00153 #endif 00154 ScalerAddLines( 1, scaleLines ); 00155 if (++render.scale.outLine == render.scale.inHeight) 00156 goto lastagain; 00157 } 00158 00159 #if !defined(SCALERLINEAR) 00160 #define SCALERLINEAR 1 00161 #include "render_loops.h" 00162 #undef SCALERLINEAR 00163 #endif