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