|
|
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:
1.1.1.2 ! root 7: NeXT mono, memory to SDL_Surface
1.1 root 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: break;
85: case 0x1:
86: col=(NEXTVideo[(x/4)+y*288]&0x30)>>4;
87: break;
88: case 0x2:
89: col=(NEXTVideo[(x/4)+y*288]&0x0C)>>2;
90: break;
91: case 0x3:
92: col=(NEXTVideo[(x/4)+y*288]&0x03);
93: break;
94: }
1.1.1.2 ! root 95: /* Hack to provide video output on color systems to *
! 96: * do memory configuration experiments. Remove later */
! 97: if (ConfigureParams.System.bColor) {
! 98: col = (NEXTColorVideo[(x*2)+(y*288*8)]&0x30)>>4;
! 99: }
! 100: /* --------------------------------------------------*/
1.1 root 101: putpixel(sdlscrn,x,y,col);
102: }
103: }
104: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.