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