Rev 109 | Go to most recent revision | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 109 | Rev 552 | ||
---|---|---|---|
1 | ; GIF LITE v2.0 by Willow |
1 | ; GIF LITE v3.0 by Willow |
2 | ; Written in pure assembler by Ivushkin Andrey aka Willow |
2 | ; Written in pure assembler by Ivushkin Andrey aka Willow |
- | 3 | ; Modified by Diamond |
|
3 | ; |
4 | ; |
4 | ; This include file will contain functions to handle GIF image format |
5 | ; This include file will contain functions to handle GIF image format |
5 | ; |
6 | ; |
6 | ; Created: August 15, 2004 |
7 | ; Created: August 15, 2004 |
7 | ; Last changed: September 9, 2004 |
8 | ; Last changed: June 24, 2007 |
- | 9 | ||
- | 10 | ; Requires kglobals.inc (iglobal/uglobal macro) |
|
- | 11 | ; (program must 'include "kglobals.inc"' and say 'IncludeUGlobal' |
|
- | 12 | ; somewhere in uninitialized data area). |
|
- | 13 | ||
8 | 14 | ; Configuration: [changed from program which includes this file] |
|
- | 15 | ; 1. The constant COLOR_ORDER: must be one of |
|
- | 16 | ; PALETTE - for 8-bit image with palette (sysfunction 65) |
|
9 | ; Change COLOR_ORDER in your program |
17 | ; MENUETOS - for MenuetOS and KolibriOS color order (sysfunction 7) |
- | 18 | ; OTHER - for standard color order |
|
- | 19 | ; 2. Define constant GIF_SUPPORT_INTERLACED if you want to support interlaced |
|
- | 20 | ; GIFs. |
|
- | 21 | ; 3. Single image mode vs multiple image mode: |
|
- | 22 | ; if the program defines the variable 'gif_img_count' of type dword |
|
- | 23 | ; somewhere, ReadGIF will enter multiple image mode: gif_img_count |
|
- | 24 | ; will be initialized with image count, output format is GIF_list, |
|
- | 25 | ; the function GetGIFinfo retrieves Nth image info. Otherwise, ReadGIF |
|
- | 26 | ; uses single image mode: exit after end of first image, output is |
|
10 | ; if colors are displayed improperly |
27 | ; |
11 | 28 | ||
12 | if ~ (COLOR_ORDER in |
29 | if ~ (COLOR_ORDER in |
13 | ; This message may not appear under MenuetOS, so watch... |
30 | ; This message may not appear under MenuetOS, so watch... |
- | 31 | display 'Please define COLOR_ORDER: PALETTE, MENUETOS or OTHER',13,10 |
|
14 | display 'Please define COLOR_ORDER: MENUETOS or OTHER',13,10 |
32 | end if |
15 | end if |
33 | |
16 | - | ||
17 | ; virtual structure, used internally |
34 | if defined gif_img_count |
18 | 35 | ; virtual structure, used internally |
|
19 | struc GIF_list |
36 | |
20 | { |
37 | struct GIF_list |
21 | .NextImg rd 1 |
38 | NextImg rd 1 |
22 | .Left rw 1 |
- | |
23 | .Top rw 1 |
- | |
24 | .Width rw 1 |
- | |
25 | .Height rw 1 |
- | |
26 | } |
39 | Left rw 1 |
27 | 40 | Top rw 1 |
|
- | 41 | Width rw 1 |
|
- | 42 | Height rw 1 |
|
- | 43 | Delay rd 1 |
|
28 | struc GIF_info |
44 | Displacement rd 1 ; 0 = not specified |
29 | { |
45 | ; 1 = do not dispose |
- | 46 | ; 2 = restore to background color |
|
30 | .Left rw 1 |
47 | ; 3 = restore to previous |
- | 48 | if COLOR_ORDER eq PALETTE |
|
31 | .Top rw 1 |
49 | Image rd 1 |
- | 50 | end if |
|
- | 51 | ends |
|
- | 52 | ||
- | 53 | struct GIF_info |
|
- | 54 | Left rw 1 |
|
- | 55 | Top rw 1 |
|
- | 56 | Width rw 1 |
|
- | 57 | Height rw 1 |
|
- | 58 | Delay rd 1 |
|
32 | .Width rw 1 |
59 | Displacement rd 1 |
33 | .Height rw 1 |
60 | if COLOR_ORDER eq PALETTE |
34 | } |
61 | Palette rd 1 |
35 | 62 | end if |
|
36 | _null fix 0x1000 |
63 | ends |
37 | 64 | ||
38 | ; **************************************** |
65 | ; **************************************** |
39 | ; FUNCTION GetGIFinfo - retrieve Nth image info |
66 | ; FUNCTION GetGIFinfo - retrieve Nth image info |
40 | ; **************************************** |
67 | ; **************************************** |
41 | ; in: |
68 | ; in: |
42 | ; esi - pointer to image list header |
69 | ; esi - pointer to image list header |
43 | ; ecx - image_index (0...img_count-1) |
70 | ; ecx - image_index (0...img_count-1) |
44 | ; edi - pointer to GIF_info structure to be filled |
71 | ; edi - pointer to GIF_info structure to be filled |
45 | 72 | ||
46 | ; out: |
73 | ; out: |
47 | ; eax - pointer to RAW data, or 0, if error |
74 | ; eax - pointer to RAW data, or 0, if error |
48 | 75 | ||
49 | GetGIFinfo: |
76 | GetGIFinfo: |
50 | push esi ecx edi |
77 | push esi ecx edi |
51 | xor eax,eax |
78 | xor eax,eax |
52 | jecxz .eloop |
79 | jecxz .eloop |
53 | .lp: |
80 | .lp: |
54 | mov esi,[esi] |
81 | mov esi,[esi] |
55 | test esi,esi |
82 | test esi,esi |
56 | jz .error |
83 | jz .error |
57 | loop .lp |
84 | loop .lp |
58 | .eloop: |
85 | .eloop: |
59 | add esi,4 |
86 | lodsd |
60 | movsd |
87 | movsd |
61 | movsd |
88 | movsd |
- | 89 | movsd |
|
- | 90 | movsd |
|
- | 91 | if COLOR_ORDER eq PALETTE |
|
- | 92 | lodsd |
|
- | 93 | mov [edi],esi |
|
- | 94 | else |
|
62 | mov eax,esi |
95 | mov eax,esi |
- | 96 | end if |
|
63 | .error: |
97 | .error: |
64 | pop edi ecx esi |
98 | pop edi ecx esi |
65 | ret |
99 | ret |
- | 100 | ||
- | 101 | end if |
|
- | 102 | ||
- | 103 | _null fix 0x1000 |
|
66 | 104 | ||
67 | ; **************************************** |
105 | ; **************************************** |
68 | ; FUNCTION ReadGIF - unpacks GIF image |
106 | ; FUNCTION ReadGIF - unpacks GIF image |
69 | ; **************************************** |
107 | ; **************************************** |
70 | ; in: |
108 | ; in: |
71 | ; esi - pointer to GIF file in memory |
109 | ; esi - pointer to GIF file in memory |
72 | ; edi - pointer to output image list |
110 | ; edi - pointer to output image list |
73 | ; eax - pointer to work area (MIN 16 KB!) |
- | |
74 | 111 | ||
75 | ; out: |
112 | ; out: |
76 | ; eax - 0, all OK; |
113 | ; eax - 0, all OK; |
77 | ; eax - 1, invalid signature; |
114 | ; eax - 1, invalid signature; |
78 | ; eax >=8, unsupported image attributes |
115 | ; eax >=8, unsupported image attributes |
79 | ; |
116 | ; |
80 | ; ecx - number of images |
- | |
81 | 117 | ||
82 | ReadGIF: |
118 | ReadGIF: |
83 | push esi edi |
119 | push esi edi |
84 | mov [.table_ptr],eax |
- | |
85 | mov [.cur_info],edi |
120 | mov [.cur_info],edi |
86 | xor eax,eax |
121 | xor eax,eax |
87 | mov [.globalColor],eax |
122 | mov [.globalColor],eax |
- | 123 | if defined gif_img_count |
|
88 | mov [.img_count],eax |
124 | mov [gif_img_count],eax |
- | 125 | mov [.anim_delay],eax |
|
- | 126 | mov [.anim_disp],eax |
|
- | 127 | end if |
|
89 | inc eax |
128 | inc eax |
90 | cmp dword[esi],'GIF8' |
129 | cmp dword[esi],'GIF8' |
91 | jne .er ; signature |
130 | jne .ex ; signature |
92 | mov ecx,[esi+0xa] |
131 | mov ecx,[esi+0xa] |
93 | inc eax |
- | |
94 | add esi,0xd |
132 | add esi,0xd |
95 | mov edi,esi |
133 | mov edi,esi |
96 | bt ecx,7 |
134 | test cl,cl |
97 | jnc .nextblock |
135 | jns .nextblock |
98 | mov [.globalColor],esi |
136 | mov [.globalColor],esi |
99 | call .Gif_skipmap |
137 | call .Gif_skipmap |
100 | .nextblock: |
138 | .nextblock: |
101 | cmp byte[edi],0x21 |
139 | cmp byte[edi],0x21 |
102 | jne .noextblock |
140 | jne .noextblock |
103 | inc edi |
141 | inc edi |
- | 142 | if defined gif_img_count |
|
104 | cmp byte[edi],0xf9 ; Graphic Control Ext |
143 | cmp byte[edi],0xf9 ; Graphic Control Ext |
105 | jne .no_gc |
144 | jne .no_gc |
- | 145 | movzx eax,word [edi+3] |
|
- | 146 | mov [.anim_delay],eax |
|
- | 147 | mov al,[edi+2] |
|
- | 148 | shr al,2 |
|
- | 149 | and eax,7 |
|
- | 150 | mov [.anim_disp],eax |
|
106 | add edi,7 |
151 | add edi,7 |
107 | jmp .nextblock |
152 | jmp .nextblock |
108 | .no_gc: |
153 | .no_gc: |
109 | cmp byte[edi],0xfe ; Comment Ext |
- | |
110 | jne .no_comm |
154 | end if |
111 | inc edi |
155 | inc edi |
112 | .block_skip: |
156 | .block_skip: |
113 | movzx eax,byte[edi] |
157 | movzx eax,byte[edi] |
114 | lea edi,[edi+eax+1] |
158 | lea edi,[edi+eax+1] |
115 | cmp byte[edi],0 |
159 | test eax,eax |
116 | jnz .block_skip |
160 | jnz .block_skip |
117 | inc edi |
- | |
118 | jmp .nextblock |
161 | jmp .nextblock |
119 | .no_comm: |
- | |
120 | cmp byte[edi],0xff ; Application Ext |
- | |
121 | jne .nextblock |
- | |
122 | add edi,13 |
- | |
123 | jmp .block_skip |
- | |
124 | .noextblock: |
162 | .noextblock: |
- | 163 | mov al,8 |
|
125 | cmp byte[edi],0x2c ; image beginning |
164 | cmp byte[edi],0x2c ; image beginning |
126 | jne .er |
165 | jne .ex |
- | 166 | if defined gif_img_count |
|
127 | inc [.img_count] |
167 | inc [gif_img_count] |
- | 168 | end if |
|
128 | inc edi |
169 | inc edi |
129 | mov esi,[.cur_info] |
170 | mov esi,[.cur_info] |
- | 171 | if defined gif_img_count |
|
130 | add esi,4 |
172 | add esi,4 |
- | 173 | end if |
|
131 | xchg esi,edi |
174 | xchg esi,edi |
- | 175 | if defined GIF_SUPPORT_INTERLACED |
|
- | 176 | movzx ecx,word[esi+4] |
|
- | 177 | mov [.width],ecx |
|
- | 178 | movzx eax,word[esi+6] |
|
- | 179 | imul eax,ecx |
|
- | 180 | if ~(COLOR_ORDER eq PALETTE) |
|
- | 181 | lea eax,[eax*3] |
|
- | 182 | end if |
|
- | 183 | mov [.img_end],eax |
|
- | 184 | inc eax |
|
- | 185 | mov [.row_end],eax |
|
- | 186 | and [.pass],0 |
|
- | 187 | test byte[esi+8],40h |
|
- | 188 | jz @f |
|
- | 189 | if ~(COLOR_ORDER eq PALETTE) |
|
- | 190 | lea ecx,[ecx*3] |
|
- | 191 | end if |
|
- | 192 | mov [.row_end],ecx |
|
- | 193 | @@: |
|
- | 194 | end if |
|
- | 195 | if defined gif_img_count |
|
132 | movsd |
196 | movsd |
133 | movsd |
197 | movsd |
- | 198 | mov eax,[.anim_delay] |
|
- | 199 | stosd |
|
- | 200 | mov eax,[.anim_disp] |
|
- | 201 | stosd |
|
- | 202 | else |
|
- | 203 | movzx eax,word[esi+4] |
|
- | 204 | stosd |
|
- | 205 | movzx eax,word[esi+6] |
|
- | 206 | stosd |
|
- | 207 | add esi,8 |
|
- | 208 | end if |
|
134 | push edi |
209 | push edi |
135 | movzx ecx,word[esi] |
210 | mov ecx,[esi] |
136 | inc esi |
211 | inc esi |
137 | bt ecx,7 |
212 | test cl,cl |
138 | jc .uselocal |
213 | js .uselocal |
139 | push [.globalColor] |
214 | push [.globalColor] |
140 | mov edi,esi |
215 | mov edi,esi |
141 | jmp .setPal |
216 | jmp .setPal |
142 | .uselocal: |
217 | .uselocal: |
143 | call .Gif_skipmap |
218 | call .Gif_skipmap |
144 | push esi |
219 | push esi |
145 | .setPal: |
220 | .setPal: |
146 | movzx ecx,byte[edi] |
221 | movzx ecx,byte[edi] |
147 | inc ecx |
222 | inc ecx |
148 | mov [.codesize],ecx |
223 | mov [.codesize],ecx |
149 | dec ecx |
224 | dec ecx |
- | 225 | if ~(COLOR_ORDER eq PALETTE) |
|
150 | pop [.Palette] |
226 | pop [.Palette] |
- | 227 | end if |
|
151 | lea esi,[edi+1] |
228 | lea esi,[edi+1] |
152 | mov edi,[.table_ptr] |
229 | mov edi,.gif_workarea |
153 | xor eax,eax |
230 | xor eax,eax |
154 | cld |
- | |
155 | lodsb ; eax - block_count |
231 | lodsb ; eax - block_count |
156 | add eax,esi |
232 | add eax,esi |
157 | mov [.block_ofs],eax |
233 | mov [.block_ofs],eax |
158 | mov [.bit_count],8 |
234 | mov [.bit_count],8 |
159 | mov eax,1 |
235 | mov eax,1 |
160 | shl eax,cl |
236 | shl eax,cl |
161 | mov [.CC],eax |
237 | mov [.CC],eax |
- | 238 | mov ecx,eax |
|
162 | inc eax |
239 | inc eax |
163 | mov [.EOI],eax |
240 | mov [.EOI],eax |
164 | lea ecx,[eax-1] |
- | |
165 | mov eax, _null shl 16 |
241 | mov eax, _null shl 16 |
166 | .filltable: |
242 | .filltable: |
167 | stosd |
243 | stosd |
168 | inc eax |
244 | inc eax |
169 | loop .filltable |
245 | loop .filltable |
- | 246 | if COLOR_ORDER eq PALETTE |
|
- | 247 | pop eax |
|
- | 248 | pop edi |
|
- | 249 | push edi |
|
- | 250 | scasd |
|
- | 251 | push esi |
|
- | 252 | mov esi,eax |
|
- | 253 | mov ecx,[.CC] |
|
- | 254 | @@: |
|
- | 255 | lodsd |
|
- | 256 | dec esi |
|
- | 257 | bswap eax |
|
- | 258 | shr eax,8 |
|
- | 259 | stosd |
|
- | 260 | loop @b |
|
- | 261 | pop esi |
|
- | 262 | pop eax |
|
- | 263 | mov [eax],edi |
|
- | 264 | else |
|
170 | pop edi |
265 | pop edi |
- | 266 | end if |
|
- | 267 | if defined GIF_SUPPORT_INTERLACED |
|
171 | mov [.img_start],edi |
268 | mov [.img_start],edi |
- | 269 | add [.img_end],edi |
|
- | 270 | add [.row_end],edi |
|
- | 271 | end if |
|
172 | .reinit: |
272 | .reinit: |
173 | mov edx,[.EOI] |
273 | mov edx,[.EOI] |
174 | inc edx |
274 | inc edx |
175 | push [.codesize] |
275 | push [.codesize] |
176 | pop [.compsize] |
276 | pop [.compsize] |
177 | call .Gif_get_sym |
277 | call .Gif_get_sym |
178 | cmp eax,[.CC] |
278 | cmp eax,[.CC] |
179 | je .reinit |
279 | je .reinit |
180 | call .Gif_output |
280 | call .Gif_output |
181 | .cycle: |
281 | .cycle: |
182 | movzx ebx,ax |
282 | movzx ebx,ax |
183 | call .Gif_get_sym |
283 | call .Gif_get_sym |
184 | cmp eax,edx |
284 | cmp eax,edx |
185 | jae .notintable |
285 | jae .notintable |
186 | cmp eax,[.CC] |
286 | cmp eax,[.CC] |
187 | je .reinit |
287 | je .reinit |
188 | cmp eax,[.EOI] |
288 | cmp eax,[.EOI] |
189 | je .end |
289 | je .end |
190 | call .Gif_output |
290 | call .Gif_output |
191 | .add: |
291 | .add: |
192 | push eax |
- | |
193 | mov eax,[.table_ptr] |
- | |
194 | mov [eax+edx*4],ebx |
292 | mov dword [.gif_workarea+edx*4],ebx |
195 | pop eax |
- | |
196 | cmp edx,0xFFF |
293 | cmp edx,0xFFF |
197 | jae .cycle |
294 | jae .cycle |
198 | inc edx |
295 | inc edx |
199 | bsr ebx,edx |
296 | bsr ebx,edx |
200 | cmp ebx,[.compsize] |
297 | cmp ebx,[.compsize] |
201 | jne .noinc |
298 | jne .noinc |
202 | inc [.compsize] |
299 | inc [.compsize] |
203 | .noinc: |
300 | .noinc: |
204 | jmp .cycle |
301 | jmp .cycle |
205 | .notintable: |
302 | .notintable: |
206 | push eax |
303 | push eax |
207 | mov eax,ebx |
304 | mov eax,ebx |
208 | call .Gif_output |
305 | call .Gif_output |
209 | push ebx |
306 | push ebx |
210 | movzx eax,bx |
307 | movzx eax,bx |
211 | call .Gif_output |
308 | call .Gif_output |
212 | pop ebx eax |
309 | pop ebx eax |
213 | jmp .add |
310 | jmp .add |
214 | .er: |
- | |
215 | pop edi |
- | |
216 | jmp .ex |
- | |
217 | .end: |
311 | .end: |
- | 312 | if defined GIF_SUPPORT_INTERLACED |
|
- | 313 | mov edi,[.img_end] |
|
- | 314 | end if |
|
- | 315 | if defined gif_img_count |
|
218 | mov eax,[.cur_info] |
316 | mov eax,[.cur_info] |
219 | mov [eax],edi |
317 | mov [eax],edi |
220 | mov [.cur_info],edi |
318 | mov [.cur_info],edi |
221 | add esi,2 |
319 | add esi,2 |
222 | xchg esi,edi |
320 | xchg esi,edi |
223 | .nxt: |
321 | .nxt: |
224 | cmp byte[edi],0 |
322 | cmp byte[edi],0 |
225 | jnz .continue |
323 | jnz .continue |
226 | inc edi |
324 | inc edi |
227 | jmp .nxt |
325 | jmp .nxt |
228 | .continue: |
326 | .continue: |
229 | cmp byte[edi],0x3b |
327 | cmp byte[edi],0x3b |
230 | jne .nextblock |
328 | jne .nextblock |
- | 329 | xchg esi,edi |
|
- | 330 | and dword [eax],0 |
|
- | 331 | end if |
|
231 | xor eax,eax |
332 | xor eax,eax |
232 | stosd |
- | |
233 | mov ecx,[.img_count] |
- | |
234 | .ex: |
333 | .ex: |
235 | pop edi esi |
334 | pop edi esi |
236 | ret |
335 | ret |
237 | 336 | ||
238 | .Gif_skipmap: |
337 | .Gif_skipmap: |
239 | ; in: ecx - image descriptor, esi - pointer to colormap |
338 | ; in: ecx - image descriptor, esi - pointer to colormap |
240 | ; out: edi - pointer to area after colormap |
339 | ; out: edi - pointer to area after colormap |
241 | 340 | ||
242 | and ecx,111b |
341 | and ecx,111b |
243 | inc ecx ; color map size |
342 | inc ecx ; color map size |
244 | mov ebx,1 |
343 | mov ebx,1 |
245 | shl ebx,cl |
344 | shl ebx,cl |
246 | lea ebx,[ebx*2+ebx] |
345 | lea ebx,[ebx*2+ebx] |
247 | lea edi,[esi+ebx] |
346 | lea edi,[esi+ebx] |
248 | ret |
347 | ret |
249 | 348 | ||
250 | .Gif_get_sym: |
349 | .Gif_get_sym: |
251 | mov ecx,[.compsize] |
350 | mov ecx,[.compsize] |
252 | push ecx |
351 | push ecx |
253 | xor eax,eax |
352 | xor eax,eax |
254 | .shift: |
353 | .shift: |
255 | ror byte[esi],1 |
354 | ror byte[esi],1 |
256 | rcr eax,1 |
355 | rcr eax,1 |
257 | dec [.bit_count] |
356 | dec [.bit_count] |
258 | jnz .loop1 |
357 | jnz .loop1 |
259 | inc esi |
358 | inc esi |
260 | cmp esi,[.block_ofs] |
359 | cmp esi,[.block_ofs] |
261 | jb .noblock |
360 | jb .noblock |
262 | push eax |
361 | push eax |
263 | xor eax,eax |
362 | xor eax,eax |
264 | lodsb |
363 | lodsb |
265 | test eax,eax |
364 | test eax,eax |
266 | jnz .nextbl |
365 | jnz .nextbl |
267 | mov eax,[.EOI] |
366 | mov eax,[.EOI] |
268 | sub esi,2 |
367 | sub esi,2 |
269 | add esp,8 |
368 | add esp,8 |
270 | jmp .exx |
369 | jmp .exx |
271 | .nextbl: |
370 | .nextbl: |
272 | add eax,esi |
371 | add eax,esi |
273 | mov [.block_ofs],eax |
372 | mov [.block_ofs],eax |
274 | pop eax |
373 | pop eax |
275 | .noblock: |
374 | .noblock: |
276 | mov [.bit_count],8 |
375 | mov [.bit_count],8 |
277 | .loop1: |
376 | .loop1: |
278 | loop .shift |
377 | loop .shift |
279 | pop ecx |
378 | pop ecx |
280 | rol eax,cl |
379 | rol eax,cl |
281 | .exx: |
380 | .exx: |
282 | xor ecx,ecx |
381 | xor ecx,ecx |
283 | ret |
382 | ret |
284 | 383 | ||
285 | .Gif_output: |
384 | .Gif_output: |
286 | push esi eax edx |
385 | push esi eax edx |
287 | mov edx,[.table_ptr] |
386 | mov edx,.gif_workarea |
288 | .next: |
387 | .next: |
289 | push word[edx+eax*4] |
388 | push word[edx+eax*4] |
290 | mov ax,word[edx+eax*4+2] |
389 | mov ax,word[edx+eax*4+2] |
291 | inc ecx |
390 | inc ecx |
292 | cmp ax,_null |
391 | cmp ax,_null |
293 | jnz .next |
392 | jnz .next |
294 | shl ebx,16 |
393 | shl ebx,16 |
295 | mov bx,[esp] |
394 | mov bx,[esp] |
296 | .loop2: |
395 | .loop2: |
297 | pop ax |
396 | pop ax |
- | 397 | ||
- | 398 | if COLOR_ORDER eq PALETTE |
|
- | 399 | stosb |
|
298 | 400 | else |
|
299 | lea esi,[eax+eax*2] |
401 | lea esi,[eax+eax*2] |
300 | add esi,[.Palette] |
402 | add esi,[.Palette] |
301 | 403 | ||
302 | if COLOR_ORDER eq MENUETOS |
404 | if COLOR_ORDER eq MENUETOS |
303 | mov esi,[esi] |
405 | mov esi,[esi] |
304 | bswap esi |
406 | bswap esi |
305 | shr esi,8 |
407 | shr esi,8 |
306 | mov [edi],esi |
408 | mov [edi],esi |
307 | add edi,3 |
409 | add edi,3 |
308 | else |
410 | else |
309 | movsw |
- | |
310 | movsb |
411 | movsb |
- | 412 | movsb |
|
- | 413 | movsb |
|
- | 414 | end if |
|
- | 415 | end if |
|
- | 416 | ||
- | 417 | if defined GIF_SUPPORT_INTERLACED |
|
- | 418 | cmp edi,[.row_end] |
|
- | 419 | jb .norowend |
|
- | 420 | mov eax,[.width] |
|
- | 421 | if ~(COLOR_ORDER eq PALETTE) |
|
- | 422 | lea eax,[eax*3] |
|
- | 423 | end if |
|
- | 424 | push eax |
|
- | 425 | sub edi,eax |
|
- | 426 | add eax,eax |
|
- | 427 | cmp [.pass],3 |
|
- | 428 | jz @f |
|
- | 429 | add eax,eax |
|
- | 430 | cmp [.pass],2 |
|
- | 431 | jz @f |
|
- | 432 | add eax,eax |
|
- | 433 | @@: |
|
- | 434 | add edi,eax |
|
- | 435 | pop eax |
|
- | 436 | cmp edi,[.img_end] |
|
- | 437 | jb .nextrow |
|
- | 438 | mov edi,[.img_start] |
|
- | 439 | inc [.pass] |
|
- | 440 | add edi,eax |
|
- | 441 | cmp [.pass],3 |
|
- | 442 | jz @f |
|
- | 443 | add edi,eax |
|
- | 444 | cmp [.pass],2 |
|
- | 445 | jz @f |
|
- | 446 | add edi,eax |
|
- | 447 | add edi,eax |
|
- | 448 | @@: |
|
- | 449 | .nextrow: |
|
- | 450 | add eax,edi |
|
- | 451 | mov [.row_end],eax |
|
- | 452 | xor eax,eax |
|
- | 453 | .norowend: |
|
311 | end if |
454 | end if |
312 | 455 | ||
313 | loop .loop2 |
456 | loop .loop2 |
314 | pop edx eax esi |
457 | pop edx eax esi |
315 | ret |
458 | ret |
316 | 459 | ||
- | 460 | uglobal |
|
317 | .globalColor rd 1 |
461 | align 4 |
318 | .img_count rd 1 |
462 | ReadGIF.globalColor rd 1 |
319 | .cur_info rd 1 ; image table pointer |
- | |
320 | .img_start rd 1 |
463 | ReadGIF.cur_info rd 1 ; image table pointer |
321 | .codesize rd 1 |
464 | ReadGIF.codesize rd 1 |
322 | .compsize rd 1 |
465 | ReadGIF.compsize rd 1 |
323 | .bit_count rd 1 |
466 | ReadGIF.bit_count rd 1 |
324 | .CC rd 1 |
467 | ReadGIF.CC rd 1 |
- | 468 | ReadGIF.EOI rd 1 |
|
325 | .EOI rd 1 |
469 | if ~(COLOR_ORDER eq PALETTE) |
- | 470 | ReadGIF.Palette rd 1 |
|
326 | .Palette rd 1 |
471 | end if |
- | 472 | ReadGIF.block_ofs rd 1 |
|
- | 473 | if defined GIF_SUPPORT_INTERLACED |
|
- | 474 | ReadGIF.row_end rd 1 |
|
- | 475 | ReadGIF.img_end rd 1 |
|
327 | .block_ofs rd 1 |
476 | ReadGIF.img_start rd 1 |
- | 477 | ReadGIF.pass rd 1 |
|
- | 478 | ReadGIF.width rd 1 |
|
- | 479 | end if |
|
- | 480 | if defined gif_img_count |
|
- | 481 | ReadGIF.anim_delay rd 1 |
|
- | 482 | ReadGIF.anim_disp rd 1 |
|
- | 483 | end if |
|
- | 484 | ReadGIF.gif_workarea rb 16*1024 |
|
328 | .table_ptr rd 1 |
485 | endg |