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