]> Shamusworld >> Repos - virtualjaguar/blob - src/include/fbmpop8p.h
4fff5416ec3ac2c316187875bb44fd6d4c1a05b9
[virtualjaguar] / src / include / fbmpop8p.h
1                 int count=0;
2                 uint32 c;
3                 paletteRam+=(idx&0x01)*256*2;
4                 if (flags&FLAGS_READMODIFY)
5                 {
6                         if (flags&FLAGS_HFLIP)
7                         {
8                                 while (iwidth)
9                                 {
10                                         c=jaguar_byte_read(ptr++);
11                                         c<<=1;
12                                         if (flags&FLAGS_TRANSPARENT)
13                                         {                                       
14                                                 if (c)
15                                                 {
16                                                         *current_line_buffer--=BLEND_Y(*current_line_buffer,paletteRam[c+0]);
17                                                         *current_line_buffer--=BLEND_CC(*current_line_buffer,paletteRam[c+1]);
18                                                 }
19                                                 else
20                                                         current_line_buffer-=2;
21                                         }
22                                         else
23                                         {
24                                                 *current_line_buffer--=BLEND_Y(*current_line_buffer,paletteRam[c+0]);
25                                                 *current_line_buffer--=BLEND_CC(*current_line_buffer,paletteRam[c+1]);
26                                         }
27                                         count+=1;
28                                         if (count==8) // 8 bytes = a phrase (64 bits)
29                                         {
30                                                 ptr-=8*(pitch-1);
31                                                 count=0;
32                                         }
33                                         iwidth--;
34                                 }
35                         }
36                         else
37                         {
38                                 while (iwidth)
39                                 {
40                                         c=jaguar_byte_read(ptr++);
41                                         c<<=1;
42                                         if (flags&FLAGS_TRANSPARENT)
43                                         {                                       
44                                                 if (c)
45                                                 {
46                                                         *current_line_buffer++=BLEND_Y(*current_line_buffer,paletteRam[c+0]);
47                                                         *current_line_buffer++=BLEND_CC(*current_line_buffer,paletteRam[c+1]);
48                                                 }
49                                                 else
50                                                         current_line_buffer+=2;
51                                         }
52                                         else
53                                         {
54                                                 *current_line_buffer++=BLEND_Y(*current_line_buffer,paletteRam[c+0]);
55                                                 *current_line_buffer++=BLEND_CC(*current_line_buffer,paletteRam[c+1]);
56                                         }
57                                         count+=1;
58                                         if (count==8) // 8 bytes = a phrase (64 bits)
59                                         {
60                                                 ptr+=8*(pitch-1);
61                                                 count=0;
62                                         }
63                                         iwidth--;
64                                 }
65                         }
66                 }
67                 else
68                 {
69                         if (flags&FLAGS_HFLIP)
70                         {
71                                 while (iwidth)
72                                 {
73                                         c=jaguar_byte_read(ptr++);
74                                         c<<=1;
75                                         if (flags&FLAGS_TRANSPARENT)
76                                         {                                       
77                                                 if (c)
78                                                 {
79                                                         *current_line_buffer--=paletteRam[c+0];
80                                                         *current_line_buffer--=paletteRam[c+1];
81                                                 }
82                                                 else
83                                                         current_line_buffer-=2;
84                                         }
85                                         else
86                                         {
87                                                 *current_line_buffer--=paletteRam[c+0];
88                                                 *current_line_buffer--=paletteRam[c+1];
89                                         }
90                                         count+=1;
91                                         if (count==8) // 8 bytes = a phrase (64 bits)
92                                         {
93                                                 ptr-=8*(pitch-1);
94                                                 count=0;
95                                         }
96                                         iwidth--;
97                                 }
98                         }
99                         else
100                         {
101                                 while (iwidth)
102                                 {
103                                         c=jaguar_byte_read(ptr++);
104                                         c<<=1;
105                                         if (flags&FLAGS_TRANSPARENT)
106                                         {                                       
107                                                 if (c)
108                                                 {
109                                                         *current_line_buffer++=paletteRam[c+0];
110                                                         *current_line_buffer++=paletteRam[c+1];
111                                                 }
112                                                 else
113                                                         current_line_buffer+=2;
114                                         }
115                                         else
116                                         {
117                                                 *current_line_buffer++=paletteRam[c+0];
118                                                 *current_line_buffer++=paletteRam[c+1];
119                                         }
120                                         count+=1;
121                                         if (count==8) // 8 bytes = a phrase (64 bits)
122                                         {
123                                                 ptr+=8*(pitch-1);
124                                                 count=0;
125                                         }
126                                         iwidth--;
127                                 }
128                         }
129                 }