Rev 6797 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 6797 | Rev 6891 | ||
---|---|---|---|
Line 18... | Line 18... | ||
18 | proc png_set_bgr uses edi, png_ptr:dword |
18 | proc png_set_bgr uses edi, png_ptr:dword |
19 | png_debug 1, 'in png_set_bgr' |
19 | png_debug 1, 'in png_set_bgr' |
20 | 20 | ||
Line 21... | Line 21... | ||
21 | mov edi,[png_ptr] |
21 | mov edi,[png_ptr] |
22 | cmp edi,0 |
22 | test edi,edi |
23 | je @f ;if (..==0) return |
23 | jz @f ;if (..==0) return |
24 | or dword[edi+png_struct.transformations], PNG_BGR |
24 | or dword[edi+png_struct.transformations], PNG_BGR |
25 | @@: |
25 | @@: |
26 | ret |
26 | ret |
27 | endp |
27 | endp |
Line 32... | Line 32... | ||
32 | proc png_set_swap uses edi, png_ptr:dword |
32 | proc png_set_swap uses edi, png_ptr:dword |
33 | png_debug 1, 'in png_set_swap' |
33 | png_debug 1, 'in png_set_swap' |
34 | 34 | ||
Line 35... | Line 35... | ||
35 | mov edi,[png_ptr] |
35 | mov edi,[png_ptr] |
36 | cmp edi,0 |
36 | test edi,edi |
37 | je @f ;if (..==0) return |
37 | jz @f ;if (..==0) return |
Line 38... | Line 38... | ||
38 | 38 | ||
39 | cmp byte[edi+png_struct.bit_depth],16 |
39 | cmp byte[edi+png_struct.bit_depth],16 |
40 | jne @f ;if (..==..) |
40 | jne @f ;if (..==..) |
41 | or dword[edi+png_struct.transformations], PNG_SWAP_BYTES |
41 | or dword[edi+png_struct.transformations], PNG_SWAP_BYTES |
Line 49... | Line 49... | ||
49 | proc png_set_packing uses edi, png_ptr:dword |
49 | proc png_set_packing uses edi, png_ptr:dword |
50 | png_debug 1, 'in png_set_packing' |
50 | png_debug 1, 'in png_set_packing' |
51 | 51 | ||
Line 52... | Line 52... | ||
52 | mov edi,[png_ptr] |
52 | mov edi,[png_ptr] |
53 | cmp edi,0 |
53 | test edi,edi |
54 | je @f ;if (..==0) return |
54 | jz @f ;if (..==0) return |
Line 55... | Line 55... | ||
55 | 55 | ||
56 | cmp byte[edi+png_struct.bit_depth],8 |
56 | cmp byte[edi+png_struct.bit_depth],8 |
57 | jge @f ;if (..<..) |
57 | jge @f ;if (..<..) |
58 | or dword[edi+png_struct.transformations], PNG_PACK |
58 | or dword[edi+png_struct.transformations], PNG_PACK |
Line 69... | Line 69... | ||
69 | proc png_set_packswap uses edi, png_ptr:dword |
69 | proc png_set_packswap uses edi, png_ptr:dword |
70 | png_debug 1, 'in png_set_packswap' |
70 | png_debug 1, 'in png_set_packswap' |
71 | 71 | ||
Line 72... | Line 72... | ||
72 | mov edi,[png_ptr] |
72 | mov edi,[png_ptr] |
73 | cmp edi,0 |
73 | test edi,edi |
74 | je @f ;if (..==0) return |
74 | jz @f ;if (..==0) return |
Line 75... | Line 75... | ||
75 | 75 | ||
76 | cmp byte[edi+png_struct.bit_depth],8 |
76 | cmp byte[edi+png_struct.bit_depth],8 |
77 | jge @f ;if (..<..) |
77 | jge @f ;if (..<..) |
78 | or dword[edi+png_struct.transformations], PNG_PACKSWAP |
78 | or dword[edi+png_struct.transformations], PNG_PACKSWAP |
Line 85... | Line 85... | ||
85 | proc png_set_shift uses ecx edi, png_ptr:dword, true_bits:dword |
85 | proc png_set_shift uses ecx edi, png_ptr:dword, true_bits:dword |
86 | png_debug 1, 'in png_set_shift' |
86 | png_debug 1, 'in png_set_shift' |
87 | 87 | ||
Line 88... | Line 88... | ||
88 | mov edi,[png_ptr] |
88 | mov edi,[png_ptr] |
89 | cmp edi,0 |
89 | test edi,edi |
90 | je @f ;if (..==0) return |
90 | jz @f ;if (..==0) return |
Line 91... | Line 91... | ||
91 | 91 | ||
92 | or dword[edi+png_struct.transformations], PNG_SHIFT |
92 | or dword[edi+png_struct.transformations], PNG_SHIFT |
93 | mov ecx,sizeof.png_color_8 |
93 | mov ecx,sizeof.png_color_8 |
94 | mov edi,[edi+png_struct.shift] |
94 | mov edi,[edi+png_struct.shift] |
Line 103... | Line 103... | ||
103 | proc png_set_interlace_handling uses edi, png_ptr:dword |
103 | proc png_set_interlace_handling uses edi, png_ptr:dword |
104 | png_debug 1, 'in png_set_interlace handling' |
104 | png_debug 1, 'in png_set_interlace handling' |
105 | 105 | ||
Line 106... | Line 106... | ||
106 | mov edi,[png_ptr] |
106 | mov edi,[png_ptr] |
107 | cmp edi,0 |
107 | test edi,edi |
108 | je @f |
108 | jz @f |
109 | cmp byte[edi+png_struct.interlaced],0 |
109 | cmp byte[edi+png_struct.interlaced],0 |
110 | je @f ;if(..!=0 && ..!=0) |
110 | je @f ;if(..!=0 && ..!=0) |
111 | or dword[edi+png_struct.transformations], PNG_INTERLACE |
111 | or dword[edi+png_struct.transformations], PNG_INTERLACE |
112 | mov eax,7 |
112 | mov eax,7 |
113 | jmp .end_f |
113 | jmp .end_f |
Line 129... | Line 129... | ||
129 | proc png_set_filler uses eax edi, png_ptr:dword, filler:dword, filler_loc:dword |
129 | proc png_set_filler uses eax edi, png_ptr:dword, filler:dword, filler_loc:dword |
130 | png_debug 1, 'in png_set_filler' |
130 | png_debug 1, 'in png_set_filler' |
131 | 131 | ||
Line 132... | Line 132... | ||
132 | mov edi,[png_ptr] |
132 | mov edi,[png_ptr] |
133 | cmp edi,0 |
133 | test edi,edi |
134 | je .end_f ;if (..==0) return |
134 | jz .end_f ;if (..==0) return |
Line 135... | Line 135... | ||
135 | 135 | ||
136 | ; In libpng 1.6 it is possible to determine whether this is a read or write |
136 | ; In libpng 1.6 it is possible to determine whether this is a read or write |
Line 137... | Line 137... | ||
137 | ; operation and therefore to do more checking here for a valid call. |
137 | ; operation and therefore to do more checking here for a valid call. |
Line 219... | Line 219... | ||
219 | proc png_set_add_alpha uses eax edi, png_ptr:dword, filler:dword, filler_loc:dword |
219 | proc png_set_add_alpha uses eax edi, png_ptr:dword, filler:dword, filler_loc:dword |
220 | png_debug 1, 'in png_set_add_alpha' |
220 | png_debug 1, 'in png_set_add_alpha' |
221 | 221 | ||
Line 222... | Line 222... | ||
222 | mov edi,[png_ptr] |
222 | mov edi,[png_ptr] |
223 | cmp edi,0 |
223 | test edi,edi |
224 | je .end_f ;if (..==0) return |
224 | jz .end_f ;if (..==0) return |
Line 225... | Line 225... | ||
225 | 225 | ||
226 | stdcall png_set_filler, edi, [filler], [filler_loc] |
226 | stdcall png_set_filler, edi, [filler], [filler_loc] |
227 | ; The above may fail to do anything. |
227 | ; The above may fail to do anything. |
228 | mov eax,[edi+png_struct.transformations] |
228 | mov eax,[edi+png_struct.transformations] |
Line 238... | Line 238... | ||
238 | proc png_set_swap_alpha uses edi, png_ptr:dword |
238 | proc png_set_swap_alpha uses edi, png_ptr:dword |
239 | png_debug 1, 'in png_set_swap_alpha' |
239 | png_debug 1, 'in png_set_swap_alpha' |
240 | 240 | ||
Line 241... | Line 241... | ||
241 | mov edi,[png_ptr] |
241 | mov edi,[png_ptr] |
242 | cmp edi,0 |
242 | test edi,edi |
243 | je .end_f ;if (..==0) return |
243 | jz .end_f ;if (..==0) return |
244 | or dword[edi+png_struct.transformations], PNG_SWAP_ALPHA |
244 | or dword[edi+png_struct.transformations], PNG_SWAP_ALPHA |
245 | .end_f: |
245 | .end_f: |
246 | ret |
246 | ret |
247 | endp |
247 | endp |
Line 252... | Line 252... | ||
252 | proc png_set_invert_alpha uses edi, png_ptr:dword |
252 | proc png_set_invert_alpha uses edi, png_ptr:dword |
253 | png_debug 1, 'in png_set_invert_alpha' |
253 | png_debug 1, 'in png_set_invert_alpha' |
254 | 254 | ||
Line 255... | Line 255... | ||
255 | mov edi,[png_ptr] |
255 | mov edi,[png_ptr] |
256 | cmp edi,0 |
256 | test edi,edi |
257 | je .end_f ;if (..==0) return |
257 | jz .end_f ;if (..==0) return |
258 | or dword[edi+png_struct.transformations], PNG_INVERT_ALPHA |
258 | or dword[edi+png_struct.transformations], PNG_INVERT_ALPHA |
259 | .end_f: |
259 | .end_f: |
260 | ret |
260 | ret |
261 | endp |
261 | endp |
Line 265... | Line 265... | ||
265 | proc png_set_invert_mono uses edi, png_ptr:dword |
265 | proc png_set_invert_mono uses edi, png_ptr:dword |
266 | png_debug 1, 'in png_set_invert_mono' |
266 | png_debug 1, 'in png_set_invert_mono' |
267 | 267 | ||
Line 268... | Line 268... | ||
268 | mov edi,[png_ptr] |
268 | mov edi,[png_ptr] |
269 | cmp edi,0 |
269 | test edi,edi |
270 | je .end_f ;if (..==0) return |
270 | jz .end_f ;if (..==0) return |
271 | or dword[edi+png_struct.transformations], PNG_INVERT_MONO |
271 | or dword[edi+png_struct.transformations], PNG_INVERT_MONO |
272 | .end_f: |
272 | .end_f: |
273 | ret |
273 | ret |
274 | endp |
274 | endp |
Line 275... | Line 275... | ||
275 | 275 | ||
276 | ; Invert monochrome grayscale data |
276 | ; Invert monochrome grayscale data |
277 | ;void (png_row_infop row_info, bytep row) |
277 | ;void (png_row_infop row_info, bytep row) |
278 | align 4 |
278 | align 4 |
- | 279 | proc png_do_invert uses eax ebx ecx edx, row_info:dword, row:dword |
|
- | 280 | ;ecx - i |
|
- | 281 | ;eax - rp |
|
279 | proc png_do_invert, row_info:dword, row:dword |
282 | ;edx - istop |
Line 280... | Line -... | ||
280 | png_debug 1, 'in png_do_invert' |
- | |
281 | 283 | png_debug 1, 'in png_do_invert' |
|
282 | ; This test removed from libpng version 1.0.13 and 1.2.0: |
- | |
283 | ; if (row_info->bit_depth == 1 && |
284 | |
284 | 285 | mov ebx,[row_info] |
|
285 | ; if (row_info->color_type == PNG_COLOR_TYPE_GRAY) |
286 | cmp byte[ebx+png_row_info.color_type],PNG_COLOR_TYPE_GRAY |
286 | ; { |
- | |
287 | ; bytep rp = row; |
287 | jne .end0 |
- | 288 | mov eax,[row] |
|
- | 289 | mov edx,[ebx+png_row_info.rowbytes] |
|
288 | ; png_size_t i; |
290 | xor ecx,ecx |
289 | ; png_size_t istop = row_info->rowbytes; |
291 | jmp @f |
290 | 292 | align 4 |
|
- | 293 | .cycle0: |
|
291 | ; for (i = 0; i < istop; i++) |
294 | inc ecx |
- | 295 | @@: |
|
292 | ; { |
296 | cmp ecx,edx |
293 | ; *rp = (byte)(~(*rp)); |
297 | jae .end_f |
294 | ; rp++; |
298 | not byte[eax] |
295 | ; } |
299 | inc eax |
296 | ; } |
300 | jmp .cycle0 |
- | 301 | .end0: |
|
297 | 302 | cmp byte[ebx+png_row_info.color_type],PNG_COLOR_TYPE_GRAY_ALPHA |
|
298 | ; else if (row_info->color_type == PNG_COLOR_TYPE_GRAY_ALPHA && |
303 | jne .end1 |
299 | ; row_info->bit_depth == 8) |
304 | cmp byte[ebx+png_row_info.bit_depth],8 |
300 | ; { |
- | |
301 | ; bytep rp = row; |
305 | jne .end1 |
- | 306 | mov eax,[row] |
|
- | 307 | mov edx,[ebx+png_row_info.rowbytes] |
|
- | 308 | xor ecx,ecx |
|
- | 309 | jmp @f |
|
- | 310 | align 4 |
|
302 | ; png_size_t i; |
311 | .cycle1: |
303 | ; png_size_t istop = row_info->rowbytes; |
312 | add ecx,2 |
304 | 313 | @@: |
|
305 | ; for (i = 0; i < istop; i += 2) |
314 | cmp ecx,edx |
306 | ; { |
315 | jae .end_f |
307 | ; *rp = (byte)(~(*rp)); |
316 | not byte[eax] |
308 | ; rp += 2; |
317 | add eax,2 |
309 | ; } |
- | |
310 | ; } |
318 | jmp .cycle1 |
311 | 319 | .end1: |
|
- | 320 | if PNG_16BIT_SUPPORTED eq 1 |
|
312 | if PNG_16BIT_SUPPORTED eq 1 |
321 | cmp byte[ebx+png_row_info.color_type],PNG_COLOR_TYPE_GRAY_ALPHA |
313 | ; else if (row_info->color_type == PNG_COLOR_TYPE_GRAY_ALPHA && |
322 | jne .end_f |
314 | ; row_info->bit_depth == 16) |
323 | cmp byte[ebx+png_row_info.bit_depth],16 |
315 | ; { |
- | |
316 | ; bytep rp = row; |
324 | jne .end_f |
- | 325 | mov eax,[row] |
|
317 | ; png_size_t i; |
326 | mov edx,[ebx+png_row_info.rowbytes] |
318 | ; png_size_t istop = row_info->rowbytes; |
327 | xor ecx,ecx |
319 | 328 | jmp @f |
|
- | 329 | align 4 |
|
- | 330 | .cycle2: |
|
320 | ; for (i = 0; i < istop; i += 4) |
331 | add ecx,4 |
321 | ; { |
332 | @@: |
322 | ; *rp = (byte)(~(*rp)); |
333 | cmp ecx,edx |
323 | ; *(rp + 1) = (byte)(~(*(rp + 1))); |
334 | jae .end_f |
324 | ; rp += 4; |
335 | not word[eax] |
325 | ; } |
336 | add eax,4 |
- | 337 | jmp .cycle2 |
|
326 | ; } |
338 | end if |
327 | end if |
339 | .end_f: |
Line 328... | Line 340... | ||
328 | ret |
340 | ret |
329 | endp |
341 | endp |
Line 622... | Line 634... | ||
622 | ;void (png_row_infop row_info, bytep row) |
634 | ;void (png_row_infop row_info, bytep row) |
623 | align 4 |
635 | align 4 |
624 | proc png_do_bgr, row_info:dword, row:dword |
636 | proc png_do_bgr, row_info:dword, row:dword |
625 | png_debug 1, 'in png_do_bgr' |
637 | png_debug 1, 'in png_do_bgr' |
626 | 638 | ;ebx - rp |
|
- | 639 | ;ecx - i |
|
- | 640 | ;esi - row_width |
|
- | 641 | pushad |
|
627 | ; if ((row_info->color_type & PNG_COLOR_MASK_COLOR) != 0) |
642 | mov edi,[row_info] |
- | 643 | movzx eax,byte[edi+png_row_info.color_type] |
|
- | 644 | and eax,PNG_COLOR_MASK_COLOR |
|
628 | ; { |
645 | je .end_f |
629 | ; uint_32 row_width = row_info->width; |
646 | mov esi,[edi+png_row_info.width] |
630 | ; if (row_info->bit_depth == 8) |
647 | cmp byte[edi+png_row_info.bit_depth],8 |
631 | ; { |
648 | jne .end0 |
632 | ; if (row_info->color_type == PNG_COLOR_TYPE_RGB) |
649 | cmp byte[edi+png_row_info.color_type],PNG_COLOR_TYPE_RGB |
633 | ; { |
650 | jne .end1 |
634 | ; bytep rp; |
651 | xor ecx,ecx |
- | 652 | mov ebx,[row] |
|
635 | ; uint_32 i; |
653 | jmp @f |
- | 654 | align 4 |
|
- | 655 | .cycle0: |
|
- | 656 | inc ecx |
|
- | 657 | add ebx,3 |
|
636 | 658 | @@: |
|
637 | ; for (i = 0, rp = row; i < row_width; i++, rp += 3) |
659 | cmp ecx,esi |
638 | ; { |
660 | jae .end_f |
639 | ; byte save = *rp; |
661 | mov dl,[ebx] |
640 | ; *rp = *(rp + 2); |
662 | mov al,[ebx+2] |
641 | ; *(rp + 2) = save; |
663 | mov [ebx],al |
642 | ; } |
664 | mov [ebx+2],dl |
643 | ; } |
665 | jmp .cycle0 |
644 | 666 | .end1: |
|
645 | ; else if (row_info->color_type == PNG_COLOR_TYPE_RGB_ALPHA) |
667 | cmp byte[edi+png_row_info.color_type],PNG_COLOR_TYPE_RGB_ALPHA |
646 | ; { |
668 | jne .end_f |
647 | ; bytep rp; |
669 | xor ecx,ecx |
648 | ; uint_32 i; |
670 | mov ebx,[row] |
649 | 671 | jmp @f |
|
- | 672 | align 4 |
|
- | 673 | .cycle1: |
|
- | 674 | inc ecx |
|
- | 675 | add ebx,4 |
|
- | 676 | @@: |
|
650 | ; for (i = 0, rp = row; i < row_width; i++, rp += 4) |
677 | cmp ecx,esi |
651 | ; { |
- | |
652 | ; byte save = *rp; |
678 | jae .end_f |
653 | ; *rp = *(rp + 2); |
679 | mov dl,[ebx] |
654 | ; *(rp + 2) = save; |
680 | mov al,[ebx+2] |
655 | ; } |
681 | mov [ebx],al |
656 | ; } |
682 | mov [ebx+2],dl |
657 | ; } |
683 | jmp .cycle1 |
658 | 684 | .end0: |
|
659 | if PNG_16BIT_SUPPORTED eq 1 |
685 | if PNG_16BIT_SUPPORTED eq 1 |
660 | ; else if (row_info->bit_depth == 16) |
686 | cmp byte[edi+png_row_info.bit_depth],16 |
661 | ; { |
687 | jne .end_f |
662 | ; if (row_info->color_type == PNG_COLOR_TYPE_RGB) |
688 | cmp byte[edi+png_row_info.color_type],PNG_COLOR_TYPE_RGB |
663 | ; { |
689 | jne .end2 |
664 | ; bytep rp; |
690 | xor ecx,ecx |
665 | ; uint_32 i; |
691 | mov ebx,[row] |
666 | 692 | jmp @f |
|
667 | ; for (i = 0, rp = row; i < row_width; i++, rp += 6) |
693 | align 4 |
668 | ; { |
- | |
- | 694 | .cycle2: |
|
- | 695 | inc ecx |
|
669 | ; byte save = *rp; |
696 | add ebx,6 |
670 | ; *rp = *(rp + 4); |
697 | @@: |
- | 698 | cmp ecx,esi |
|
671 | ; *(rp + 4) = save; |
699 | jae .end_f |
672 | ; save = *(rp + 1); |
700 | mov dx,[ebx] |
673 | ; *(rp + 1) = *(rp + 5); |
701 | mov ax,[ebx+4] |
674 | ; *(rp + 5) = save; |
702 | mov [ebx],ax |
675 | ; } |
703 | mov [ebx+4],dx |
676 | ; } |
704 | jmp .cycle2 |
677 | 705 | .end2: |
|
678 | ; else if (row_info->color_type == PNG_COLOR_TYPE_RGB_ALPHA) |
706 | cmp byte[edi+png_row_info.color_type],PNG_COLOR_TYPE_RGB_ALPHA |
679 | ; { |
707 | jne .end_f |
680 | ; bytep rp; |
708 | xor ecx,ecx |
681 | ; uint_32 i; |
709 | mov ebx,[row] |
682 | 710 | jmp @f |
|
683 | ; for (i = 0, rp = row; i < row_width; i++, rp += 8) |
711 | align 4 |
684 | ; { |
- | |
- | 712 | .cycle3: |
|
685 | ; byte save = *rp; |
713 | inc ecx |
686 | ; *rp = *(rp + 4); |
714 | add ebx,8 |
687 | ; *(rp + 4) = save; |
715 | @@: |
- | 716 | cmp ecx,esi |
|
688 | ; save = *(rp + 1); |
717 | jae .end_f |
689 | ; *(rp + 1) = *(rp + 5); |
718 | mov dx,[ebx] |
690 | ; *(rp + 5) = save; |
719 | mov ax,[ebx+4] |
691 | ; } |
720 | mov [ebx],ax |
692 | ; } |
721 | mov [ebx+4],dx |
693 | ; } |
722 | jmp .cycle3 |
694 | end if |
723 | end if |
695 | ; } |
724 | .end_f: |
- | 725 | popad |
|
696 | ret |
726 | ret |
697 | endp |
727 | endp |
698 | 728 | ||
Line 699... | Line 729... | ||
699 | ; Added at libpng-1.5.10 |
729 | ; Added at libpng-1.5.10 |
700 | ;void (png_structrp png_ptr, png_row_infop row_info) |
730 | ;void (png_structrp png_ptr, png_row_infop row_info) |
Line 802... | Line 832... | ||
802 | proc png_set_user_transform_info uses eax edi, png_ptr:dword, user_transform_ptr:dword, user_transform_depth:dword, user_transform_channels:dword |
832 | proc png_set_user_transform_info uses eax edi, png_ptr:dword, user_transform_ptr:dword, user_transform_depth:dword, user_transform_channels:dword |
803 | png_debug 1, 'in png_set_user_transform_info' |
833 | png_debug 1, 'in png_set_user_transform_info' |
804 | 834 | ||
Line 805... | Line 835... | ||
805 | mov edi,[png_ptr] |
835 | mov edi,[png_ptr] |
806 | cmp edi,0 |
836 | test edi,edi |
807 | je .end_f |
837 | jz .end_f |
Line 808... | Line 838... | ||
808 | 838 | ||
809 | if PNG_READ_USER_TRANSFORM_SUPPORTED eq 1 |
839 | if PNG_READ_USER_TRANSFORM_SUPPORTED eq 1 |
810 | mov eax,[edi+png_struct.mode] |
840 | mov eax,[edi+png_struct.mode] |
811 | and eax,PNG_IS_READ_STRUCT |
841 | and eax,PNG_IS_READ_STRUCT |