Ticket #8342: scale4x.patch

File scale4x.patch, 7.1 KB (added by SF/madm00se, 20 years ago)

4x blocky scaler, 3nd try

  • scummvm/README

    RCS file: /cvsroot/scummvm/scummvm/README,v
    retrieving revision 1.268
    diff -u -r1.268 README
     
    435435        normal     - No filtering, no scaling. Fastest.
    436436        2x         - No filtering, factor 2x (default for non 640x480 games).
    437437        3x         - No filtering, factor 3x.
     438        4x         - No filtering, factor 4x.
    438439        2xsai      - 2xsai filter, factor 2x.
    439440        super2xsai - Enhanced 2xsai filtering, factor 2x.
    440441        supereagle - Less blurry than 2xsai, but slower. Factor 2x.
     
    935936
    936937        fullscreen      bool     Fullscreen mode
    937938        aspect_ratio    bool     Enable aspect ratio correction
    938         gfx_mode        string   Graphics mode (normal, 2x, 3x, 2xsai,
     939        gfx_mode        string   Graphics mode (normal, 2x, 3x, 4x, 2xsai,
    939940                                 super2xsai, supereagle, advmame2x, advmame3x,
    940941                                 hq2x, hq3x, tv2x, dotmatrix)
    941942
  • scummvm/backends/sdl/events.cpp

    RCS file: /cvsroot/scummvm/scummvm/backends/sdl/events.cpp,v
    retrieving revision 1.4
    diff -u -r1.4 events.cpp
     
    3939#define JOY_BUT_F5 5
    4040
    4141
    42 static const int s_gfxModeSwitchTable[][4] = {
    43                 { GFX_NORMAL, GFX_DOUBLESIZE, GFX_TRIPLESIZE, -1 },
    44                 { GFX_NORMAL, GFX_ADVMAME2X, GFX_ADVMAME3X, -1 },
    45                 { GFX_NORMAL, GFX_HQ2X, GFX_HQ3X, -1 },
    46                 { GFX_NORMAL, GFX_2XSAI, -1, -1 },
    47                 { GFX_NORMAL, GFX_SUPER2XSAI, -1, -1 },
    48                 { GFX_NORMAL, GFX_SUPEREAGLE, -1, -1 },
    49                 { GFX_NORMAL, GFX_TV2X, -1, -1 },
    50                 { GFX_NORMAL, GFX_DOTMATRIX, -1, -1 }
     42static const int s_gfxModeSwitchTable[][5] = {
     43                { GFX_NORMAL, GFX_DOUBLESIZE, GFX_TRIPLESIZE, GFX_QUADRUPLESIZE, -1 },
     44                { GFX_NORMAL, GFX_ADVMAME2X, GFX_ADVMAME3X, -1, -1 },
     45                { GFX_NORMAL, GFX_HQ2X, GFX_HQ3X, -1, -1 },
     46                { GFX_NORMAL, GFX_2XSAI, -1, -1, -1 },
     47                { GFX_NORMAL, GFX_SUPER2XSAI, -1, -1, -1 },
     48                { GFX_NORMAL, GFX_SUPEREAGLE, -1, -1, -1 },
     49                { GFX_NORMAL, GFX_TV2X, -1, -1, -1 },
     50                { GFX_NORMAL, GFX_DOTMATRIX, -1, -1, -1 }
    5151        };
    5252
    5353
  • scummvm/backends/sdl/graphics.cpp

    RCS file: /cvsroot/scummvm/scummvm/backends/sdl/graphics.cpp,v
    retrieving revision 1.10
    diff -u -r1.10 graphics.cpp
     
    2929        {"1x", "Normal (no scaling)", GFX_NORMAL},
    3030        {"2x", "2x", GFX_DOUBLESIZE},
    3131        {"3x", "3x", GFX_TRIPLESIZE},
     32        {"4x", "4x", GFX_QUADRUPLESIZE},
    3233        {"2xsai", "2xSAI", GFX_2XSAI},
    3334        {"super2xsai", "Super2xSAI", GFX_SUPER2XSAI},
    3435        {"supereagle", "SuperEagle", GFX_SUPEREAGLE},
     
    6869                newScaleFactor = 3;
    6970                newScalerProc = Normal3x;
    7071                break;
     72        case GFX_QUADRUPLESIZE:
     73                newScaleFactor = 4;
     74                newScalerProc = Normal4x;
     75                break;
    7176
    7277        case GFX_2XSAI:
    7378                newScaleFactor = 2;
  • scummvm/common/scaler.cpp

    RCS file: /cvsroot/scummvm/scummvm/common/scaler.cpp,v
    retrieving revision 1.57
    diff -u -r1.57 scaler.cpp
     
    167167}
    168168
    169169/**
     170 * Trivial nearest-neighbour 4x scaler.
     171 */
     172void Normal4x(const uint8 *srcPtr, uint32 srcPitch, uint8 *dstPtr, uint32 dstPitch,
     173                                                        int width, int height) {
     174        uint8 *r;
     175        uint32 dstPitch2 = dstPitch * 2;
     176        uint32 dstPitch3 = dstPitch * 3;
     177        uint32 dstPitch4 = dstPitch * 4;
     178
     179        while (height--) {
     180                r = dstPtr;
     181                for (int i = 0; i < width; ++i, r += 8) {
     182                        uint16 color = *(((const uint16 *)srcPtr) + i);
     183
     184                        *(uint16 *)(r + 0) = color;
     185                        *(uint16 *)(r + 2) = color;
     186                        *(uint16 *)(r + 4) = color;
     187                        *(uint16 *)(r + 6) = color;
     188                        *(uint16 *)(r + 0 + dstPitch) = color;
     189                        *(uint16 *)(r + 2 + dstPitch) = color;
     190                        *(uint16 *)(r + 4 + dstPitch) = color;
     191                        *(uint16 *)(r + 6 + dstPitch) = color;
     192                        *(uint16 *)(r + 0 + dstPitch2) = color;
     193                        *(uint16 *)(r + 2 + dstPitch2) = color;
     194                        *(uint16 *)(r + 4 + dstPitch2) = color;
     195                        *(uint16 *)(r + 6 + dstPitch2) = color;
     196                        *(uint16 *)(r + 0 + dstPitch3) = color;
     197                        *(uint16 *)(r + 2 + dstPitch3) = color;
     198                        *(uint16 *)(r + 4 + dstPitch3) = color;
     199                        *(uint16 *)(r + 6 + dstPitch3) = color;
     200                }
     201                srcPtr += srcPitch;
     202                dstPtr += dstPitch4;
     203        }
     204}
     205
     206/**
    170207 * The Scale2x filter, also known as AdvMame2x.
    171208 * See also http://scale2x.sourceforge.net
    172209 */
  • scummvm/common/scaler.h

    RCS file: /cvsroot/scummvm/scummvm/common/scaler.h,v
    retrieving revision 1.25
    diff -u -r1.25 scaler.h
     
    4141DECLARE_SCALER(Normal1x);
    4242DECLARE_SCALER(Normal2x);
    4343DECLARE_SCALER(Normal3x);
     44DECLARE_SCALER(Normal4x);
    4445DECLARE_SCALER(TV2x);
    4546DECLARE_SCALER(DotMatrix);
    4647DECLARE_SCALER(HQ2x);
     
    6263        GFX_NORMAL = 0,
    6364        GFX_DOUBLESIZE = 1,
    6465        GFX_TRIPLESIZE = 2,
    65         GFX_2XSAI = 3,
    66         GFX_SUPER2XSAI = 4,
    67         GFX_SUPEREAGLE = 5,
    68         GFX_ADVMAME2X = 6,
    69         GFX_ADVMAME3X = 7,
    70         GFX_HQ2X = 8,
    71         GFX_HQ3X = 9,
    72         GFX_TV2X = 10,
    73         GFX_DOTMATRIX = 11,
     66        GFX_QUADRUPLESIZE = 3,
     67        GFX_2XSAI = 4,
     68        GFX_SUPER2XSAI = 5,
     69        GFX_SUPEREAGLE = 6,
     70        GFX_ADVMAME2X = 7,
     71        GFX_ADVMAME3X = 8,
     72        GFX_HQ2X = 9,
     73        GFX_HQ3X = 10,
     74        GFX_TV2X = 11,
     75        GFX_DOTMATRIX = 12,
    7476
    7577        GFX_FLIPPING = 100,     // Palmos
    7678        GFX_BUFFERED = 101,     // Palmos
  • scummvm/doc/05_03.tex

    RCS file: /cvsroot/scummvm/scummvm/doc/05_03.tex,v
    retrieving revision 1.3
    diff -u -r1.3 05_03.tex
     
    1919  normal     & No filtering, no scaling. Fastest.\\
    2020  2x         & No filtering, factor 2x (default for non 640x480 games).\\
    2121  3x         & No filtering, factor 3x.\\
     22  4x         & No filtering, factor 4x.\\
    2223  2xsai      & 2xsai filter, factor 2x.\\
    2324  super2xsai & Enhanced 2xsai filtering, factor 2x.\\
    2425  supereagle & Less blurry than 2xsai, but slower. Factor 2x.\\
  • scummvm/doc/08.tex

    RCS file: /cvsroot/scummvm/scummvm/doc/08.tex,v
    retrieving revision 1.7
    diff -u -r1.7 08.tex
     
    8383\\
    8484        fullscreen     &bool     Fullscreen mode\\
    8585        aspect\_ratio  &bool     Enable aspect ratio correction\\
    86         gfx\_mode      &string   Graphics mode (normal, 2x, 3x, 2xsai,\\
     86        gfx\_mode      &string   Graphics mode (normal, 2x, 3x, 4x, 2xsai,\\
    8787                       &         super2xsai, supereagle, advmame2x, advmame3x,\\
    8888                       &         hq2x, hq3x, tv2x, dotmatrix)\\
    8989\\