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 #undef conc4d_func 00020 #undef conc4d_sub_func 00021 #if defined (SCALERLINEAR) 00022 # define conc4d_func conc4d(SCALERNAME,SBPP,DBPP,L) 00023 # define conc4d_sub_func conc4d(SCALERNAME,SBPP,DBPP,Lsub) 00024 #else 00025 # define conc4d_func conc4d(SCALERNAME,SBPP,DBPP,R) 00026 # define conc4d_sub_func conc4d(SCALERNAME,SBPP,DBPP,Rsub) 00027 #endif 00028 00029 static inline void conc4d_sub_func(const SRCTYPE* &src, SRCTYPE* &cache, PTYPE* &line0, const unsigned int block_proc, Bitu &hadChange) { 00030 #if !defined(C_SCALER_FULL_LINE) 00031 if (memcmp(src,cache,block_proc * sizeof(SRCTYPE)) == 0 00032 # if (SBPP == 9) 00033 && !( 00034 render.pal.modified[src[0]] | 00035 render.pal.modified[src[1]] | 00036 render.pal.modified[src[2]] | 00037 render.pal.modified[src[3]] | 00038 render.pal.modified[src[4]] | 00039 render.pal.modified[src[5]] | 00040 render.pal.modified[src[6]] | 00041 render.pal.modified[src[7]]) 00042 # endif 00043 ) { 00044 src += block_proc; 00045 cache += block_proc; 00046 line0 += block_proc*SCALERWIDTH; 00047 } 00048 else 00049 #endif 00050 { 00051 #if defined(SCALERLINEAR) 00052 #if (SCALERHEIGHT > 1) 00053 PTYPE *line1 = WC[0]; 00054 #endif 00055 #if (SCALERHEIGHT > 2) 00056 PTYPE *line2 = WC[1]; 00057 #endif 00058 #if (SCALERHEIGHT > 3) 00059 PTYPE *line3 = WC[2]; 00060 #endif 00061 #if (SCALERHEIGHT > 4) 00062 PTYPE *line4 = WC[3]; 00063 #endif 00064 #if (SCALERHEIGHT > 5) 00065 PTYPE *line5 = WC[4]; 00066 #endif 00067 #else 00068 #if (SCALERHEIGHT > 1) 00069 PTYPE *line1 = (PTYPE *)(((Bit8u*)line0)+ render.scale.outPitch); 00070 #endif 00071 #if (SCALERHEIGHT > 2) 00072 PTYPE *line2 = (PTYPE *)(((Bit8u*)line0)+ render.scale.outPitch * 2); 00073 #endif 00074 #if (SCALERHEIGHT > 3) 00075 PTYPE *line3 = (PTYPE *)(((Bit8u*)line0)+ render.scale.outPitch * 3); 00076 #endif 00077 #if (SCALERHEIGHT > 4) 00078 PTYPE *line4 = (PTYPE *)(((Bit8u*)line0)+ render.scale.outPitch * 4); 00079 #endif 00080 #if (SCALERHEIGHT > 5) 00081 PTYPE *line5 = (PTYPE *)(((Bit8u*)line0)+ render.scale.outPitch * 5); 00082 #endif 00083 #endif //defined(SCALERLINEAR) 00084 hadChange = 1; 00085 unsigned int i = block_proc; /* WARNING: assume block_proc != 0 */ 00086 do { 00087 const SRCTYPE S = *src++; 00088 *cache++ = S; 00089 const PTYPE P = PMAKE(S); 00090 SCALERFUNC; 00091 line0 += SCALERWIDTH; 00092 #if (SCALERHEIGHT > 1) 00093 line1 += SCALERWIDTH; 00094 #endif 00095 #if (SCALERHEIGHT > 2) 00096 line2 += SCALERWIDTH; 00097 #endif 00098 #if (SCALERHEIGHT > 3) 00099 line3 += SCALERWIDTH; 00100 #endif 00101 #if (SCALERHEIGHT > 4) 00102 line4 += SCALERWIDTH; 00103 #endif 00104 #if (SCALERHEIGHT > 5) 00105 line5 += SCALERWIDTH; 00106 #endif 00107 } while (--i != 0u); 00108 #if defined(SCALERLINEAR) 00109 #if (SCALERHEIGHT > 1) 00110 Bitu copyLen = (Bitu)((Bit8u*)line1 - (Bit8u*)WC[0]); 00111 BituMove(((Bit8u*)line0)-copyLen+render.scale.outPitch ,WC[0], copyLen ); 00112 #endif 00113 #if (SCALERHEIGHT > 2) 00114 BituMove(((Bit8u*)line0)-copyLen+render.scale.outPitch*2,WC[1], copyLen ); 00115 #endif 00116 #if (SCALERHEIGHT > 3) 00117 BituMove(((Bit8u*)line0)-copyLen+render.scale.outPitch*3,WC[2], copyLen ); 00118 #endif 00119 #if (SCALERHEIGHT > 4) 00120 BituMove(((Bit8u*)line0)-copyLen+render.scale.outPitch*4,WC[3], copyLen ); 00121 #endif 00122 #if (SCALERHEIGHT > 5) 00123 BituMove(((Bit8u*)line0)-copyLen+render.scale.outPitch*5,WC[4], copyLen ); 00124 #endif 00125 #endif //defined(SCALERLINEAR) 00126 } 00127 } 00128 00129 static inline void conc4d_func(const void *s) { 00130 #ifdef RENDER_NULL_INPUT 00131 if (!s) { 00132 render.scale.cacheRead += render.scale.cachePitch; 00133 #if defined(SCALERLINEAR) 00134 Bitu skipLines = SCALERHEIGHT; 00135 #else 00136 Bitu skipLines = Scaler_Aspect[ render.scale.outLine++ ]; 00137 #endif 00138 ScalerAddLines( 0, skipLines ); 00139 return; 00140 } 00141 #endif 00142 /* Clear the complete line marker */ 00143 Bitu hadChange = 0; 00144 const SRCTYPE *src = (SRCTYPE*)s; 00145 00146 SRCTYPE *cache = (SRCTYPE*)(render.scale.cacheRead); 00147 render.scale.cacheRead += render.scale.cachePitch; 00148 PTYPE * line0=(PTYPE *)(render.scale.outWrite); 00149 00150 #if defined(C_SCALER_FULL_LINE) 00151 conc4d_sub_func(src,cache,line0,(unsigned int)render.src.width,hadChange); 00152 #else 00153 # if (SBPP == 9) 00154 // the pal change code above limits this to 8 pixels only, see function above 00155 const unsigned int block_size = 8; 00156 # else 00157 // larger blocks encourage memcmp() to optimize, scaler loop to process before coming back to check again. 00158 const unsigned int block_size = 128; 00159 # endif 00160 00161 Bitu x = (Bitu)render.src.width; 00162 while (x >= block_size) { 00163 x -= block_size; 00164 conc4d_sub_func(src,cache,line0,block_size,hadChange); 00165 } 00166 if (x > 0) { 00167 conc4d_sub_func(src,cache,line0,(unsigned int)x,hadChange); 00168 } 00169 #endif 00170 00171 #if defined(SCALERLINEAR) 00172 Bitu scaleLines = SCALERHEIGHT; 00173 #else 00174 Bitu scaleLines = Scaler_Aspect[ render.scale.outLine++ ]; 00175 if ( scaleLines - SCALERHEIGHT && hadChange ) { 00176 BituMove( render.scale.outWrite + render.scale.outPitch * SCALERHEIGHT, 00177 render.scale.outWrite + render.scale.outPitch * (SCALERHEIGHT-1), 00178 render.src.width * SCALERWIDTH * PSIZE); 00179 } 00180 #endif 00181 ScalerAddLines( hadChange, scaleLines ); 00182 } 00183 00184 #if !defined(SCALERLINEAR) 00185 #define SCALERLINEAR 1 00186 #include "render_simple.h" 00187 #undef SCALERLINEAR 00188 #endif