Annotation of previous/src/convert/high640x8.c, revision 1.1

1.1     ! root        1: /*
        !             2:   Hatari - high640x8.c
        !             3: 
        !             4:   This file is distributed under the GNU Public License, version 2 or at your
        !             5:   option any later version. Read the file gpl.txt for details.
        !             6: 
        !             7:   Screen Conversion, High Res to 640x8Bit
        !             8: */
        !             9: 
        !            10: static inline void putpixel(SDL_Surface * surface, Uint16 x, Uint16 y, Uint32 col)
        !            11: 
        !            12: {
        !            13: 
        !            14:     /* Nombre de bits par pixels de la surface d'écran */
        !            15:     Uint8 bpp = surface->format->BytesPerPixel;
        !            16:     /* Pointeur vers le pixel à remplacer (pitch correspond à la taille
        !            17:        d'une ligne d'écran, c'est à dire (longueur * bitsParPixel)
        !            18:        pour la plupart des cas) */
        !            19: 
        !            20:     Uint8 * p1 = ((Uint8 *)surface->pixels) + y * surface->pitch + x * bpp;
        !            21: 
        !            22: 
        !            23:        Uint32 color = colors[col];
        !            24: 
        !            25:        switch(bpp) {
        !            26:                case 1:
        !            27: 
        !            28:                        *p1 = color;
        !            29: 
        !            30:                        break;
        !            31: 
        !            32:                case 2:
        !            33: 
        !            34:                        *(Uint16 *)p1 = color;
        !            35: 
        !            36:                        break;
        !            37: 
        !            38:                case 3:
        !            39:                        if(SDL_BYTEORDER == SDL_BIG_ENDIAN) {
        !            40: 
        !            41:                                p1[0] = (color >> 16) & 0xff;
        !            42:                                p1[1] = (color >> 8) & 0xff;
        !            43:                                p1[2] = color & 0xff;
        !            44: 
        !            45:                        } else {
        !            46: 
        !            47:                                p1[0] = color & 0xff;
        !            48:                                p1[1] = (color >> 8) & 0xff;
        !            49:                                p1[2] = (color >> 16) & 0xff;
        !            50: 
        !            51:                        }
        !            52:                        break;
        !            53: 
        !            54:                case 4:
        !            55: 
        !            56:                        *(Uint32 *)p1 = color;
        !            57:                        break;
        !            58:                }
        !            59: 
        !            60: }
        !            61: 
        !            62: 
        !            63: static void ConvertHighRes_640x8Bit(void)
        !            64: {
        !            65:        int y, x;
        !            66:        int     col;
        !            67:        static int first=1;
        !            68:        
        !            69:        if (first) {
        !            70:                first=0;
        !            71:                for (x=0;x<4;x++)
        !            72:                        colors[x] = SDL_MapRGB(sdlscrn->format, sdlColors[x].r, sdlColors[x].g, sdlColors[x].b);
        !            73:        }
        !            74: 
        !            75:        for (y = 0; y < 832; y++)
        !            76:        {
        !            77: 
        !            78:                for (x = 0; x < 1120; x++)
        !            79:                {
        !            80:                        switch (x&0x3)
        !            81:                        {
        !            82:                        case 0x0:
        !            83:                                col=(NEXTVideo[(x/4)+y*288]&0xC0)>>6;
        !            84: //                             col=(NEXTVideo[(x/4)+y*280]&0xC0)>>6;
        !            85:                                break;
        !            86:                        case 0x1:
        !            87:                                col=(NEXTVideo[(x/4)+y*288]&0x30)>>4;
        !            88: //                             col=(NEXTVideo[(x/4)+y*280]&0x30)>>4;
        !            89:                                break;
        !            90:                        case 0x2:
        !            91:                                col=(NEXTVideo[(x/4)+y*288]&0x0C)>>2;
        !            92: //                             col=(NEXTVideo[(x/4)+y*280]&0x0C)>>2;
        !            93:                                break;
        !            94:                        case 0x3:
        !            95:                                col=(NEXTVideo[(x/4)+y*288]&0x03);
        !            96: //                             col=(NEXTVideo[(x/4)+y*280]&0x03);
        !            97:                                break;
        !            98:                        }
        !            99:                        putpixel(sdlscrn,x,y,col);
        !           100:                }
        !           101:        }
        !           102: }

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.