DOSBox-X
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Defines
src/gui/render_templates.h
00001 /*
00002  *  Copyright (C) 2002-2015  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
00015  *  along with this program; if not, write to the Free Software
00016  *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
00017  */
00018 
00019 #include "config.h"
00020 #include "SDL_endian.h"
00021 
00022 #if DBPP == 8
00023 #define PSIZE 1
00024 #define PTYPE Bit8u
00025 #define WC scalerWriteCache.b8
00026 //#define FC scalerFrameCache.b8
00027 #define FC (*(scalerFrameCache_t*)(&scalerSourceCache.b32[400][0])).b8
00028 #define redMask         0
00029 #define greenMask       0
00030 #define blueMask        0
00031 #define redBits         0
00032 #define greenBits       0
00033 #define blueBits        0
00034 #define redShift        0
00035 #define greenShift      0
00036 #define blueShift       0
00037 #elif DBPP == 15 || DBPP == 16
00038 #define PSIZE 2
00039 #define PTYPE Bit16u
00040 #define WC scalerWriteCache.b16
00041 //#define FC scalerFrameCache.b16
00042 #define FC (*(scalerFrameCache_t*)(&scalerSourceCache.b32[400][0])).b16
00043 #if DBPP == 15
00044 #define redMask         0x7C00
00045 #define greenMask       0x03E0
00046 #define blueMask        0x001F
00047 #define redBits         5
00048 #define greenBits       5
00049 #define blueBits        5
00050 #define redShift        10
00051 #define greenShift      5
00052 #define blueShift       0
00053 #elif DBPP == 16
00054 #define redMask         0xF800
00055 #define greenMask       0x07E0
00056 #define blueMask        0x001F
00057 #define redBits         5
00058 #define greenBits       6
00059 #define blueBits        5
00060 #define redShift        11
00061 #define greenShift      5
00062 #define blueShift       0
00063 #endif
00064 #elif DBPP == 32
00065 #define PSIZE 4
00066 #define PTYPE Bit32u
00067 #define WC scalerWriteCache.b32
00068 //#define FC scalerFrameCache.b32
00069 #define FC (*(scalerFrameCache_t*)(&scalerSourceCache.b32[400][0])).b32
00070 #define redMask         0xff0000
00071 #define greenMask       0x00ff00
00072 #define blueMask        0x0000ff
00073 #define redBits         8
00074 #define greenBits       8
00075 #define blueBits        8
00076 #define redShift        16
00077 #define greenShift      8
00078 #define blueShift       0
00079 #endif
00080 
00081 #define redblueMask (redMask | blueMask)
00082 
00083 
00084 #if SBPP == 8 || SBPP == 9
00085 #define SC scalerSourceCache.b8
00086 #if DBPP == 8
00087 #define PMAKE(_VAL) (_VAL)
00088 #elif DBPP == 15
00089 #define PMAKE(_VAL) render.pal.lut.b16[_VAL]
00090 #elif DBPP == 16
00091 #define PMAKE(_VAL) render.pal.lut.b16[_VAL]
00092 #elif DBPP == 32
00093 #define PMAKE(_VAL) render.pal.lut.b32[_VAL]
00094 #endif
00095 #define SRCTYPE Bit8u
00096 #endif
00097 
00098 #if SBPP == 15
00099 #define SC scalerSourceCache.b16
00100 #if DBPP == 15
00101 #define PMAKE(_VAL) (_VAL)
00102 #elif DBPP == 16
00103 #define PMAKE(_VAL) (((_VAL) & 31) | ((_VAL) & ~31) << 1)
00104 #elif DBPP == 32
00105 # if SDL_BYTEORDER == SDL_LIL_ENDIAN && defined(MACOSX) /* Mac OS X Intel builds use a weird RGBA order (alpha in the low 8 bits) */
00106 #  define PMAKE(_VAL)  (((_VAL&(31u<<10u))<<1u)|((_VAL&(31u<<5u))<<14u)|((_VAL&31u)<<27u))
00107 # else
00108 #  define PMAKE(_VAL)  (((_VAL&(31u<<10u))<<9u)|((_VAL&(31u<<5u))<<6u)|((_VAL&31u)<<3u))
00109 # endif
00110 #endif
00111 #define SRCTYPE Bit16u
00112 #endif
00113 
00114 #if SBPP == 16
00115 #define SC scalerSourceCache.b16
00116 #if DBPP == 15
00117 #define PMAKE(_VAL) (((_VAL&~31u)>>1u)|(_VAL&31u))
00118 #elif DBPP == 16
00119 #define PMAKE(_VAL) (_VAL)
00120 #elif DBPP == 32
00121 # if SDL_BYTEORDER == SDL_LIL_ENDIAN && defined(MACOSX) /* Mac OS X Intel builds use a weird RGBA order (alpha in the low 8 bits) */
00122 #  define PMAKE(_VAL)  (((_VAL&(31u<<11u))<<0u)|((_VAL&(63u<<5u))<<13u)|((_VAL&31u)<<27u))
00123 # else
00124 #  define PMAKE(_VAL)  (((_VAL&(31u<<11u))<<8u)|((_VAL&(63u<<5u))<<5u)|((_VAL&31u)<<3u))
00125 # endif
00126 #endif
00127 #define SRCTYPE Bit16u
00128 #endif
00129 
00130 #if SBPP == 32
00131 #define SC scalerSourceCache.b32
00132 #if DBPP == 15
00133 #define PMAKE(_VAL) (PTYPE)(((_VAL&(31u<<19u))>>9u)|((_VAL&(31u<<11u))>>6u)|((_VAL&(31u<<3u))>>3u))
00134 #elif DBPP == 16
00135 #define PMAKE(_VAL) (PTYPE)(((_VAL&(31u<<19u))>>8u)|((_VAL&(63u<<10u))>>5u)|((_VAL&(31u<<3u))>>3u))
00136 #elif DBPP == 32
00137 #define PMAKE(_VAL) (_VAL)
00138 #endif
00139 #define SRCTYPE Bit32u
00140 #endif
00141 
00142 //  C0 C1 C2 D3
00143 //  C3 C4 C5 D4
00144 //  C6 C7 C8 D5
00145 //  D0 D1 D2 D6
00146 
00147 #define C0 fc[-1 - SCALER_COMPLEXWIDTH]
00148 #define C1 fc[+0 - SCALER_COMPLEXWIDTH]
00149 #define C2 fc[+1 - SCALER_COMPLEXWIDTH]
00150 #define C3 fc[-1 ]
00151 #define C4 fc[+0 ]
00152 #define C5 fc[+1 ]
00153 #define C6 fc[-1 + SCALER_COMPLEXWIDTH]
00154 #define C7 fc[+0 + SCALER_COMPLEXWIDTH]
00155 #define C8 fc[+1 + SCALER_COMPLEXWIDTH]
00156 
00157 #define D0 fc[-1 + 2*SCALER_COMPLEXWIDTH]
00158 #define D1 fc[+0 + 2*SCALER_COMPLEXWIDTH]
00159 #define D2 fc[+1 + 2*SCALER_COMPLEXWIDTH]
00160 #define D3 fc[+2 - SCALER_COMPLEXWIDTH]
00161 #define D4 fc[+2]
00162 #define D5 fc[+2 + SCALER_COMPLEXWIDTH]
00163 #define D6 fc[+2 + 2*SCALER_COMPLEXWIDTH]
00164 
00165 
00166 #if RENDER_USE_ADVANCED_SCALERS>1
00167 static inline void conc3d(Cache,SBPP,DBPP) (const void * s) {
00168 # if !defined(_MSC_VER) /* Microsoft C++ thinks this is a failed attempt at a function call---it's not */
00169         (void)conc3d(Cache,SBPP,DBPP);
00170 # endif
00171 #ifdef RENDER_NULL_INPUT
00172         if (!s) {
00173                 render.scale.cacheRead += render.scale.cachePitch;
00174                 render.scale.inLine++;
00175                 render.scale.complexHandler();
00176                 return;
00177         }
00178 #endif
00179         const SRCTYPE * src = (SRCTYPE*)s;
00180         PTYPE *fc= &FC[render.scale.inLine+1][1];
00181         SRCTYPE *sc = (SRCTYPE*)(render.scale.cacheRead);
00182         render.scale.cacheRead += render.scale.cachePitch;
00183         Bitu b;
00184         bool hadChange = false;
00185         /* This should also copy the surrounding pixels but it looks nice enough without */
00186         for (b=0;b<render.scale.blocks;b++) {
00187 #if (SBPP == 9)
00188                 for (Bitu x=0;x<SCALER_BLOCKSIZE;x++) {
00189                         PTYPE pixel = PMAKE(src[x]);
00190                         if (pixel != fc[x]) {
00191 #else 
00192                 for (Bitu x=0;x<SCALER_BLOCKSIZE;x+=sizeof(Bitu)/sizeof(SRCTYPE)) {
00193                         if (*(Bitu const*)&src[x] != *(Bitu*)&sc[x]) {
00194 #endif
00195                                 do {
00196                                         fc[x] = PMAKE(src[x]);
00197                                         sc[x] = src[x];
00198                                         x++;
00199                                 } while (x<SCALER_BLOCKSIZE);
00200                                 hadChange = true;
00201                                 /* Change the surrounding blocks */
00202                                 CC[render.scale.inLine+0][1+b-1] |= SCALE_RIGHT;
00203                                 CC[render.scale.inLine+0][1+b+0] |= SCALE_FULL;
00204                                 CC[render.scale.inLine+0][1+b+1] |= SCALE_LEFT;
00205                                 CC[render.scale.inLine+1][1+b-1] |= SCALE_RIGHT;
00206                                 CC[render.scale.inLine+1][1+b+0] |= SCALE_FULL;
00207                                 CC[render.scale.inLine+1][1+b+1] |= SCALE_LEFT;
00208                                 CC[render.scale.inLine+2][1+b-1] |= SCALE_RIGHT;
00209                                 CC[render.scale.inLine+2][1+b+0] |= SCALE_FULL;
00210                                 CC[render.scale.inLine+2][1+b+1] |= SCALE_LEFT;
00211                                 continue;
00212                         }
00213                 }
00214                 fc += SCALER_BLOCKSIZE;
00215                 sc += SCALER_BLOCKSIZE;
00216                 src += SCALER_BLOCKSIZE;
00217         }
00218         if (hadChange) {
00219                 CC[render.scale.inLine+0][0] = 1;
00220                 CC[render.scale.inLine+1][0] = 1;
00221                 CC[render.scale.inLine+2][0] = 1;
00222         }
00223         render.scale.inLine++;
00224         render.scale.complexHandler();
00225 }
00226 #endif
00227 
00228 
00229 /* Simple scalers */
00230 #define SCALERNAME              Normal1x
00231 #define SCALERWIDTH             1
00232 #define SCALERHEIGHT    1
00233 #define SCALERFUNC                                                              \
00234         line0[0] = P;
00235 #include "render_simple.h"
00236 #undef SCALERNAME
00237 #undef SCALERWIDTH
00238 #undef SCALERHEIGHT
00239 #undef SCALERFUNC
00240 
00241 #define SCALERNAME              Normal2x
00242 #define SCALERWIDTH             2
00243 #define SCALERHEIGHT    2
00244 #define SCALERFUNC                                                              \
00245         line0[0] = P;                                                           \
00246         line0[1] = P;                                                           \
00247         line1[0] = P;                                                           \
00248         line1[1] = P;
00249 #include "render_simple.h"
00250 #undef SCALERNAME
00251 #undef SCALERWIDTH
00252 #undef SCALERHEIGHT
00253 #undef SCALERFUNC
00254 
00255 #define SCALERNAME              Normal3x
00256 #define SCALERWIDTH             3
00257 #define SCALERHEIGHT    3
00258 #define SCALERFUNC                                                              \
00259         line0[0] = P;                                                           \
00260         line0[1] = P;                                                           \
00261         line0[2] = P;                                                           \
00262         line1[0] = P;                                                           \
00263         line1[1] = P;                                                           \
00264         line1[2] = P;                                                           \
00265         line2[0] = P;                                                           \
00266         line2[1] = P;                                                           \
00267         line2[2] = P;
00268 #include "render_simple.h"
00269 #undef SCALERNAME
00270 #undef SCALERWIDTH
00271 #undef SCALERHEIGHT
00272 #undef SCALERFUNC
00273 
00274 #define SCALERNAME              Normal4x
00275 #define SCALERWIDTH             4
00276 #define SCALERHEIGHT    4
00277 #define SCALERFUNC                                                         \
00278         line0[0] = P;                                                           \
00279         line0[1] = P;                                                           \
00280         line0[2] = P;                                                           \
00281         line0[3] = P;                                                           \
00282         line1[0] = P;                                                           \
00283         line1[1] = P;                                                           \
00284         line1[2] = P;                                                           \
00285         line1[3] = P;                                                           \
00286         line2[0] = P;                                                           \
00287         line2[1] = P;                                                           \
00288         line2[2] = P;                                                           \
00289         line2[3] = P;                                                           \
00290         line3[0] = P;                                                           \
00291         line3[1] = P;                                                           \
00292         line3[2] = P;                                                           \
00293         line3[3] = P; 
00294 #include "render_simple.h"
00295 #undef SCALERNAME
00296 #undef SCALERWIDTH
00297 #undef SCALERHEIGHT
00298 #undef SCALERFUNC
00299 
00300 #define SCALERNAME              Normal5x
00301 #define SCALERWIDTH             5
00302 #define SCALERHEIGHT    5
00303 #define SCALERFUNC                                                         \
00304         line0[0] = P;                                                           \
00305         line0[1] = P;                                                           \
00306         line0[2] = P;                                                           \
00307         line0[3] = P;                                                           \
00308         line0[4] = P;                                                           \
00309         line1[0] = P;                                                           \
00310         line1[1] = P;                                                           \
00311         line1[2] = P;                                                           \
00312         line1[3] = P;                                                           \
00313         line1[4] = P;                                                           \
00314         line2[0] = P;                                                           \
00315         line2[1] = P;                                                           \
00316         line2[2] = P;                                                           \
00317         line2[3] = P;                                                           \
00318         line2[4] = P;                                                           \
00319         line3[0] = P;                                                           \
00320         line3[1] = P;                                                           \
00321         line3[2] = P;                                                           \
00322         line3[3] = P;                                                            \
00323         line3[4] = P;                                                           \
00324         line4[0] = P;                                                           \
00325         line4[1] = P;                                                           \
00326         line4[2] = P;                                                           \
00327         line4[3] = P;                                                            \
00328         line4[4] = P;                                                           
00329 #include "render_simple.h"
00330 #undef SCALERNAME
00331 #undef SCALERWIDTH
00332 #undef SCALERHEIGHT
00333 #undef SCALERFUNC
00334 /*
00335 #define SCALERNAME              Normal6x
00336 #define SCALERWIDTH             6
00337 #define SCALERHEIGHT    6
00338 #define SCALERFUNC                                                         \
00339         line0[0] = P;                                                           \
00340         line0[1] = P;                                                           \
00341         line0[2] = P;                                                           \
00342         line0[3] = P;                                                           \
00343         line0[4] = P;                                                           \
00344         line0[5] = P;                                                           \
00345         line1[0] = P;                                                           \
00346         line1[1] = P;                                                           \
00347         line1[2] = P;                                                           \
00348         line1[3] = P;                                                           \
00349         line1[4] = P;                                                           \
00350         line1[5] = P;                                                           \
00351         line2[0] = P;                                                           \
00352         line2[1] = P;                                                           \
00353         line2[2] = P;                                                           \
00354         line2[3] = P;                                                           \
00355         line2[4] = P;                                                           \
00356         line2[5] = P;                                                           \
00357         line3[0] = P;                                                           \
00358         line3[1] = P;                                                           \
00359         line3[2] = P;                                                           \
00360         line3[3] = P;                                                            \
00361         line3[4] = P;                                                           \
00362         line3[5] = P;                                                           \
00363         line4[0] = P;                                                           \
00364         line4[1] = P;                                                           \
00365         line4[2] = P;                                                           \
00366         line4[3] = P;                                                            \
00367         line4[4] = P;                                                           \
00368         line4[5] = P;                                                           \
00369         line5[0] = P;                                                           \
00370         line5[1] = P;                                                           \
00371         line5[2] = P;                                                           \
00372         line5[3] = P;                                                            \
00373         line5[4] = P;                                                           \
00374         line5[5] = P;                                                           
00375 #include "render_simple.h"
00376 #undef SCALERNAME
00377 #undef SCALERWIDTH
00378 #undef SCALERHEIGHT
00379 #undef SCALERFUNC
00380 */
00381 #define SCALERNAME              NormalDw
00382 #define SCALERWIDTH             2
00383 #define SCALERHEIGHT    1
00384 #define SCALERFUNC                                                              \
00385         line0[0] = P;                                                           \
00386         line0[1] = P;
00387 #include "render_simple.h"
00388 #undef SCALERNAME
00389 #undef SCALERWIDTH
00390 #undef SCALERHEIGHT
00391 #undef SCALERFUNC
00392 
00393 #define SCALERNAME              NormalDh
00394 #define SCALERWIDTH             1
00395 #define SCALERHEIGHT    2
00396 #define SCALERFUNC                                                              \
00397         line0[0] = P;                                                           \
00398         line1[0] = P;
00399 #include "render_simple.h"
00400 #undef SCALERNAME
00401 #undef SCALERWIDTH
00402 #undef SCALERHEIGHT
00403 #undef SCALERFUNC
00404 
00405 #if (DBPP > 8)
00406 
00407 #if RENDER_USE_ADVANCED_SCALERS>0
00408 
00409 #define SCALERNAME              TV2x
00410 #define SCALERWIDTH             2
00411 #define SCALERHEIGHT    2
00412 #define SCALERFUNC                                                                      \
00413 {                                                                                                       \
00414         Bitu halfpixel=(((P & redblueMask) * 5) >> 3) & redblueMask;    \
00415         halfpixel|=(((P & greenMask) * 5) >> 3) & greenMask;                    \
00416         line0[0]=halfpixel;                                                     \
00417         line0[1]=halfpixel;                                                     \
00418         line1[0]=P;                                             \
00419         line1[1]=P;                                             \
00420 }
00421 #include "render_simple.h"
00422 #undef SCALERNAME
00423 #undef SCALERWIDTH
00424 #undef SCALERHEIGHT
00425 #undef SCALERFUNC
00426 
00427 #define SCALERNAME              TV3x
00428 #define SCALERWIDTH             3
00429 #define SCALERHEIGHT    3
00430 #define SCALERFUNC                                                      \
00431 {                                                                                       \
00432         Bitu halfpixel=(((P & redblueMask) * 5) >> 3) & redblueMask;    \
00433         halfpixel|=(((P & greenMask) * 5) >> 3) & greenMask;                    \
00434         line0[0]=P;                                                             \
00435         line0[1]=P;                                                             \
00436         line0[2]=P;                                                             \
00437         line1[0]=halfpixel;                                             \
00438         line1[1]=halfpixel;                                             \
00439         line1[2]=halfpixel;                                             \
00440         halfpixel=(((P & redblueMask) * 5) >> 4) & redblueMask; \
00441         halfpixel|=(((P & greenMask) * 5) >> 4) & greenMask;                    \
00442         line2[0]=halfpixel;                                             \
00443         line2[1]=halfpixel;                                             \
00444         line2[2]=halfpixel;                                             \
00445 }
00446 #include "render_simple.h"
00447 #undef SCALERNAME
00448 #undef SCALERWIDTH
00449 #undef SCALERHEIGHT
00450 #undef SCALERFUNC
00451 
00452 #define SCALERNAME              RGB2x
00453 #define SCALERWIDTH             2
00454 #define SCALERHEIGHT    2
00455 #define SCALERFUNC                                              \
00456         line0[0]=P & redMask;                           \
00457         line0[1]=P & greenMask;                 \
00458         line1[0]=P & blueMask;                          \
00459         line1[1]=P;
00460 #include "render_simple.h"
00461 #undef SCALERNAME
00462 #undef SCALERWIDTH
00463 #undef SCALERHEIGHT
00464 #undef SCALERFUNC
00465 
00466 #define SCALERNAME              RGB3x
00467 #define SCALERWIDTH             3
00468 #define SCALERHEIGHT    3
00469 #define SCALERFUNC                                              \
00470         line0[0]=P;                                                     \
00471         line0[1]=P & greenMask;                         \
00472         line0[2]=P & blueMask;                          \
00473         line1[0]=P & greenMask;                         \
00474         line1[1]=P & redMask;                                           \
00475         line1[2]=P;                             \
00476         line2[0]=P;                             \
00477         line2[1]=P & blueMask;                          \
00478         line2[2]=P & redMask;
00479 #include "render_simple.h"
00480 #undef SCALERNAME
00481 #undef SCALERWIDTH
00482 #undef SCALERHEIGHT
00483 #undef SCALERFUNC
00484 
00485 #define SCALERNAME              Scan2x
00486 #define SCALERWIDTH             2
00487 #define SCALERHEIGHT    2
00488 #define SCALERFUNC                                              \
00489         line0[0]=P;                                                     \
00490         line0[1]=P;                                                     \
00491         line1[0]=0;                                                     \
00492         line1[1]=0;
00493 #include "render_simple.h"
00494 #undef SCALERNAME
00495 #undef SCALERWIDTH
00496 #undef SCALERHEIGHT
00497 #undef SCALERFUNC
00498 
00499 #define SCALERNAME              Scan3x
00500 #define SCALERWIDTH             3
00501 #define SCALERHEIGHT    3
00502 #define SCALERFUNC                      \
00503         line0[0]=P;                             \
00504         line0[1]=P;                             \
00505         line0[2]=P;                             \
00506         line1[0]=0;                             \
00507         line1[1]=0;                             \
00508         line1[2]=0;                             \
00509         line2[0]=0;                             \
00510         line2[1]=0;                             \
00511         line2[2]=0;
00512 #include "render_simple.h"
00513 #undef SCALERNAME
00514 #undef SCALERWIDTH
00515 #undef SCALERHEIGHT
00516 #undef SCALERFUNC
00517 
00518 #endif          //#if RENDER_USE_ADVANCED_SCALERS>0
00519 
00520 #endif          //#if (DBPP > 8)
00521 
00522 /* Complex scalers */
00523 
00524 #if RENDER_USE_ADVANCED_SCALERS>2
00525 
00526 #if (SBPP == DBPP) 
00527 
00528 
00529 #if (DBPP > 8)
00530 
00531 #include "render_templates_hq.h"
00532 
00533 #define SCALERNAME              HQ2x
00534 #define SCALERWIDTH             2
00535 #define SCALERHEIGHT    2
00536 #include "render_templates_hq2x.h"
00537 #define SCALERFUNC              conc2d(Hq2x,SBPP)(line0, line1, fc)
00538 #include "render_loops.h"
00539 #undef SCALERNAME
00540 #undef SCALERWIDTH
00541 #undef SCALERHEIGHT
00542 #undef SCALERFUNC
00543 
00544 #define SCALERNAME              HQ3x
00545 #define SCALERWIDTH             3
00546 #define SCALERHEIGHT    3
00547 #include "render_templates_hq3x.h"
00548 #define SCALERFUNC              conc2d(Hq3x,SBPP)(line0, line1, line2, fc)
00549 #include "render_loops.h"
00550 #undef SCALERNAME
00551 #undef SCALERWIDTH
00552 #undef SCALERHEIGHT
00553 #undef SCALERFUNC
00554 
00555 #include "render_templates_sai.h"
00556 
00557 #define SCALERNAME              Super2xSaI
00558 #define SCALERWIDTH             2
00559 #define SCALERHEIGHT    2
00560 #define SCALERFUNC              conc2d(Super2xSaI,SBPP)(line0, line1, fc)
00561 #include "render_loops.h"
00562 #undef SCALERNAME
00563 #undef SCALERWIDTH
00564 #undef SCALERHEIGHT
00565 #undef SCALERFUNC
00566 
00567 #define SCALERNAME              SuperEagle
00568 #define SCALERWIDTH             2
00569 #define SCALERHEIGHT    2
00570 #define SCALERFUNC              conc2d(SuperEagle,SBPP)(line0, line1, fc)
00571 #include "render_loops.h"
00572 #undef SCALERNAME
00573 #undef SCALERWIDTH
00574 #undef SCALERHEIGHT
00575 #undef SCALERFUNC
00576 
00577 #define SCALERNAME              _2xSaI
00578 #define SCALERWIDTH             2
00579 #define SCALERHEIGHT    2
00580 #define SCALERFUNC              conc2d(_2xSaI,SBPP)(line0, line1, fc)
00581 #include "render_loops.h"
00582 #undef SCALERNAME
00583 #undef SCALERWIDTH
00584 #undef SCALERHEIGHT
00585 #undef SCALERFUNC
00586 
00587 #define SCALERNAME              AdvInterp2x
00588 #define SCALERWIDTH             2
00589 #define SCALERHEIGHT    2
00590 #define SCALERFUNC                                                                                              \
00591         if (C1 != C7 && C3 != C5) {                                                                     \
00592                 line0[0] = C3 == C1 ? interp_w2(C3,C4,5U,3U) : C4;              \
00593                 line0[1] = C1 == C5 ? interp_w2(C5,C4,5U,3U) : C4;              \
00594                 line1[0] = C3 == C7 ? interp_w2(C3,C4,5U,3U) : C4;              \
00595                 line1[1] = C7 == C5 ? interp_w2(C5,C4,5U,3U) : C4;              \
00596         } else {                                                                                                        \
00597                 line0[0] = line0[1] = C4;                                                               \
00598                 line1[0] = line1[1] = C4;                                                               \
00599         }
00600 #include "render_loops.h"
00601 #undef SCALERNAME
00602 #undef SCALERWIDTH
00603 #undef SCALERHEIGHT
00604 #undef SCALERFUNC
00605 
00606 //TODO, come up with something better for this one
00607 #define SCALERNAME              AdvInterp3x
00608 #define SCALERWIDTH             3
00609 #define SCALERHEIGHT    3
00610 #define SCALERFUNC                                                                                              \
00611         if ((C1 != C7) && (C3 != C5)) {                                                                                                 \
00612                 line0[0] = C3 == C1 ?  interp_w2(C3,C4,5U,3U) : C4;                                                                                             \
00613                 line0[1] = (C3 == C1 && C4 != C2) || (C5 == C1 && C4 != C0) ? C1 : C4;          \
00614                 line0[2] = C5 == C1 ?  interp_w2(C5,C4,5U,3U) : C4;                                                                                             \
00615                 line1[0] = (C3 == C1 && C4 != C6) || (C3 == C7 && C4 != C0) ? C3 : C4;          \
00616                 line1[1] = C4;                                                                                                                          \
00617                 line1[2] = (C5 == C1 && C4 != C8) || (C5 == C7 && C4 != C2) ? C5 : C4;          \
00618                 line2[0] = C3 == C7 ?  interp_w2(C3,C4,5U,3U) : C4;                                                                                             \
00619                 line2[1] = (C3 == C7 && C4 != C8) || (C5 == C7 && C4 != C6) ? C7 : C4;          \
00620                 line2[2] = C5 == C7 ?  interp_w2(C5,C4,5U,3U) : C4;                                                                                             \
00621         } else {                                                                                                                                                \
00622                 line0[0] = line0[1] = line0[2] = C4;                                                                            \
00623                 line1[0] = line1[1] = line1[2] = C4;                                                                            \
00624                 line2[0] = line2[1] = line2[2] = C4;                                                                            \
00625         }
00626 #include "render_loops.h"
00627 #undef SCALERNAME
00628 #undef SCALERWIDTH
00629 #undef SCALERHEIGHT
00630 #undef SCALERFUNC
00631 
00632 #endif // #if (DBPP > 8)
00633 
00634 #define SCALERNAME              AdvMame2x
00635 #define SCALERWIDTH             2
00636 #define SCALERHEIGHT    2
00637 #define SCALERFUNC                                                                                              \
00638         if (C1 != C7 && C3 != C5) {                                                                     \
00639                 line0[0] = C3 == C1 ? C3 : C4;                                                  \
00640                 line0[1] = C1 == C5 ? C5 : C4;                                                  \
00641                 line1[0] = C3 == C7 ? C3 : C4;                                                  \
00642                 line1[1] = C7 == C5 ? C5 : C4;                                                  \
00643         } else {                                                                                                        \
00644                 line0[0] = line0[1] = C4;                                                               \
00645                 line1[0] = line1[1] = C4;                                                               \
00646         }
00647 #include "render_loops.h"
00648 #undef SCALERNAME
00649 #undef SCALERWIDTH
00650 #undef SCALERHEIGHT
00651 #undef SCALERFUNC
00652 
00653 #define SCALERNAME              AdvMame3x
00654 #define SCALERWIDTH             3
00655 #define SCALERHEIGHT    3
00656 #define SCALERFUNC                                                                                                                                      \
00657         if ((C1 != C7) && (C3 != C5)) {                                                                                                 \
00658                 line0[0] = C3 == C1 ?  C3 : C4;                                                                                         \
00659                 line0[1] = (C3 == C1 && C4 != C2) || (C5 == C1 && C4 != C0) ? C1 : C4;          \
00660                 line0[2] = C5 == C1 ?  C5 : C4;                                                                                         \
00661                 line1[0] = (C3 == C1 && C4 != C6) || (C3 == C7 && C4 != C0) ? C3 : C4;          \
00662                 line1[1] = C4;                                                                                                                          \
00663                 line1[2] = (C5 == C1 && C4 != C8) || (C5 == C7 && C4 != C2) ? C5 : C4;          \
00664                 line2[0] = C3 == C7 ?  C3 : C4;                                                                                         \
00665                 line2[1] = (C3 == C7 && C4 != C8) || (C5 == C7 && C4 != C6) ? C7 : C4;          \
00666                 line2[2] = C5 == C7 ?  C5 : C4;                                                                                         \
00667         } else {                                                                                                                                                \
00668                 line0[0] = line0[1] = line0[2] = C4;                                                                            \
00669                 line1[0] = line1[1] = line1[2] = C4;                                                                            \
00670                 line2[0] = line2[1] = line2[2] = C4;                                                                            \
00671         }
00672 
00673 #include "render_loops.h"
00674 #undef SCALERNAME
00675 #undef SCALERWIDTH
00676 #undef SCALERHEIGHT
00677 #undef SCALERFUNC
00678 
00679 
00680 #endif // (SBPP == DBPP) && !defined (CACHEWITHPAL)
00681 
00682 #endif // #if RENDER_USE_ADVANCED_SCALERS>2
00683 
00684 #undef PSIZE
00685 #undef PTYPE
00686 #undef PMAKE
00687 #undef WC
00688 #undef LC
00689 #undef FC
00690 #undef SC
00691 #undef redMask
00692 #undef greenMask
00693 #undef blueMask
00694 #undef redblueMask
00695 #undef redBits
00696 #undef greenBits
00697 #undef blueBits
00698 #undef redShift
00699 #undef greenShift
00700 #undef blueShift
00701 #undef SRCTYPE