Rev 6780 | Rev 6881 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 6780 | Rev 6797 | ||
---|---|---|---|
Line 507... | Line 507... | ||
507 | 507 | ||
Line 508... | Line 508... | ||
508 | mov dword[edi+png_struct.zstream.next_in],0 |
508 | mov dword[edi+png_struct.zstream.next_in],0 |
509 | mov dword[edi+png_struct.zstream.avail_in],0 |
509 | mov dword[edi+png_struct.zstream.avail_in],0 |
510 | mov dword[edi+png_struct.zstream.next_out],0 |
510 | mov dword[edi+png_struct.zstream.next_out],0 |
511 | mov word[edi+png_struct.zstream.avail_out],0 |
511 | mov dword[edi+png_struct.zstream.avail_out],0 |
Line 512... | Line 512... | ||
512 | 512 | ||
513 | ; Now initialize if required, setting the new parameters, otherwise just |
513 | ; Now initialize if required, setting the new parameters, otherwise just |
Line 514... | Line 514... | ||
514 | ; to a simple reset to the previous parameters. |
514 | ; to a simple reset to the previous parameters. |
Line 641... | Line 641... | ||
641 | mov eax,ebx |
641 | mov eax,ebx |
642 | add eax,compression_state.output |
642 | add eax,compression_state.output |
643 | mov [edi+png_struct.zstream.next_out],eax |
643 | mov [edi+png_struct.zstream.next_out],eax |
644 | mov eax,sizeof.compression_state.output ;1024 |
644 | mov eax,sizeof.compression_state.output ;1024 |
645 | mov [edi+png_struct.zstream.avail_out],ax |
645 | mov [edi+png_struct.zstream.avail_out],eax |
646 | 646 | ||
Line 647... | Line 647... | ||
647 | mov [output_len],eax |
647 | mov [output_len],eax |
Line 648... | Line 648... | ||
648 | 648 | ||
649 | .cycle0: ;do |
649 | .cycle0: ;do |
Line 657... | Line 657... | ||
657 | 657 | ||
Line 658... | Line 658... | ||
658 | mov eax,[avail_in] |
658 | mov eax,[avail_in] |
659 | mov [edi+png_struct.zstream.avail_in],eax |
659 | mov [edi+png_struct.zstream.avail_in],eax |
Line 660... | Line 660... | ||
660 | 660 | ||
661 | cmp word[edi+png_struct.zstream.avail_out],0 |
661 | cmp dword[edi+png_struct.zstream.avail_out],0 |
662 | jne .end0 ;if (..==0) |
662 | jne .end0 ;if (..==0) |
663 | ; Chunk data is limited to 2^31 bytes in length, so the prefix |
663 | ; Chunk data is limited to 2^31 bytes in length, so the prefix |
Line 664... | Line 664... | ||
664 | ; length must be counted here. |
664 | ; length must be counted here. |
Line 697... | Line 697... | ||
697 | mov eax,[next] |
697 | mov eax,[next] |
698 | mov eax,[eax+png_compression_buffer.output] |
698 | mov eax,[eax+png_compression_buffer.output] |
699 | mov [edi+png_struct.zstream.next_out],eax |
699 | mov [edi+png_struct.zstream.next_out],eax |
700 | mov eax,[edi+png_struct.zbuffer_size] |
700 | mov eax,[edi+png_struct.zbuffer_size] |
701 | mov [edi+png_struct.zstream.avail_out],ax |
701 | mov [edi+png_struct.zstream.avail_out],eax |
702 | add [output_len],eax |
702 | add [output_len],eax |
Line 703... | Line 703... | ||
703 | 703 | ||
704 | ; Move 'end' to the next buffer pointer. |
704 | ; Move 'end' to the next buffer pointer. |
705 | mov eax,[next] |
705 | mov eax,[next] |
Line 731... | Line 731... | ||
731 | 731 | ||
Line 732... | Line 732... | ||
732 | ; There may be some space left in the last output buffer. This needs to |
732 | ; There may be some space left in the last output buffer. This needs to |
733 | ; be subtracted from output_len. |
733 | ; be subtracted from output_len. |
Line 734... | Line 734... | ||
734 | 734 | ||
735 | movzx eax,word[edi+png_struct.zstream.avail_out] |
735 | mov eax,[edi+png_struct.zstream.avail_out] |
736 | sub [output_len],eax |
736 | sub [output_len],eax |
737 | mov word[edi+png_struct.zstream.avail_out],0 ;safety |
737 | mov dword[edi+png_struct.zstream.avail_out],0 ;safety |
738 | mov eax,[output_len] |
738 | mov eax,[output_len] |
Line 739... | Line 739... | ||
739 | mov [ebx+compression_state.output_len],eax |
739 | mov [ebx+compression_state.output_len],eax |
740 | 740 | ||
Line 1214... | Line 1214... | ||
1214 | mov eax,[edi+png_struct.zbuffer_list] |
1214 | mov eax,[edi+png_struct.zbuffer_list] |
1215 | add eax,png_compression_buffer.output |
1215 | add eax,png_compression_buffer.output |
1216 | mov [edi+png_struct.zstream.next_out],eax |
1216 | mov [edi+png_struct.zstream.next_out],eax |
1217 | mov eax,[edi+png_struct.zbuffer_size] |
1217 | mov eax,[edi+png_struct.zbuffer_size] |
1218 | mov [edi+png_struct.zstream.avail_out],ax |
1218 | mov [edi+png_struct.zstream.avail_out],eax |
1219 | .end0: |
1219 | .end0: |
Line 1220... | Line 1220... | ||
1220 | 1220 | ||
1221 | ; Now loop reading and writing until all the input is consumed or an error |
1221 | ; Now loop reading and writing until all the input is consumed or an error |
1222 | ; terminates the operation. The _out values are maintained across calls to |
1222 | ; terminates the operation. The _out values are maintained across calls to |
Line 1256... | Line 1256... | ||
1256 | ; OUTPUT: write complete IDAT chunks when avail_out drops to zero. Note |
1256 | ; OUTPUT: write complete IDAT chunks when avail_out drops to zero. Note |
1257 | ; that these two zstream fields are preserved across the calls, therefore |
1257 | ; that these two zstream fields are preserved across the calls, therefore |
1258 | ; there is no need to set these up on entry to the loop. |
1258 | ; there is no need to set these up on entry to the loop. |
Line 1259... | Line 1259... | ||
1259 | 1259 | ||
1260 | cmp word[edi+png_struct.zstream.avail_out],0 |
1260 | cmp dword[edi+png_struct.zstream.avail_out],0 |
1261 | jne .end2 ;if (..==0) |
1261 | jne .end2 ;if (..==0) |
1262 | mov edx,[edi+png_struct.zbuffer_list] |
1262 | mov edx,[edi+png_struct.zbuffer_list] |
1263 | add edx,png_compression_buffer.output |
1263 | add edx,png_compression_buffer.output |
1264 | mov ecx,[edi+png_struct.zbuffer_size] |
1264 | mov ecx,[edi+png_struct.zbuffer_size] |
Line 1281... | Line 1281... | ||
1281 | stdcall png_write_complete_chunk, edi, png_IDAT, edx, ecx |
1281 | stdcall png_write_complete_chunk, edi, png_IDAT, edx, ecx |
1282 | or dword[edi+png_struct.mode],PNG_HAVE_IDAT |
1282 | or dword[edi+png_struct.mode],PNG_HAVE_IDAT |
Line 1283... | Line 1283... | ||
1283 | 1283 | ||
1284 | mov [edi+png_struct.zstream.next_out],edx |
1284 | mov [edi+png_struct.zstream.next_out],edx |
Line 1285... | Line 1285... | ||
1285 | mov [edi+png_struct.zstream.avail_out],cx |
1285 | mov [edi+png_struct.zstream.avail_out],ecx |
1286 | 1286 | ||
1287 | ; For SYNC_FLUSH or FINISH it is essential to keep calling zlib with |
1287 | ; For SYNC_FLUSH or FINISH it is essential to keep calling zlib with |
Line 1319... | Line 1319... | ||
1319 | 1319 | ||
Line 1320... | Line 1320... | ||
1320 | mov edx,[edi+png_struct.zbuffer_list] |
1320 | mov edx,[edi+png_struct.zbuffer_list] |
1321 | add edx,png_compression_buffer.output |
1321 | add edx,png_compression_buffer.output |
1322 | mov ecx,[edi+png_struct.zbuffer_size] |
1322 | mov ecx,[edi+png_struct.zbuffer_size] |
1323 | movzx eax,word[edi+png_struct.zstream.avail_out] |
1323 | mov eax,[edi+png_struct.zstream.avail_out] |
1324 | sub ecx,eax |
1324 | sub ecx,eax |
1325 | ;edx = data |
1325 | ;edx = data |
1326 | ;ecx = size |
1326 | ;ecx = size |
Line 1327... | Line 1327... | ||
1327 | 1327 | ||
Line 1335... | Line 1335... | ||
1335 | stdcall optimize_cmf, edx, eax |
1335 | stdcall optimize_cmf, edx, eax |
1336 | @@: |
1336 | @@: |
1337 | end if |
1337 | end if |
1338 | stdcall png_write_complete_chunk, edi, png_IDAT, edx, ecx |
1338 | stdcall png_write_complete_chunk, edi, png_IDAT, edx, ecx |
1339 | mov word[edi+png_struct.zstream.avail_out],0 |
1339 | mov dword[edi+png_struct.zstream.avail_out],0 |
1340 | mov dword[edi+png_struct.zstream.next_out],0 |
1340 | mov dword[edi+png_struct.zstream.next_out],0 |
1341 | or dword[edi+png_struct.mode], PNG_HAVE_IDAT or PNG_AFTER_IDAT |
1341 | or dword[edi+png_struct.mode], PNG_HAVE_IDAT or PNG_AFTER_IDAT |
1342 | 1342 | ||
Line 1343... | Line 1343... | ||
1343 | mov dword[edi+png_struct.zowner],0 ;Release the stream |
1343 | mov dword[edi+png_struct.zowner],0 ;Release the stream |
1344 | jmp .cycle0end |
1344 | jmp .cycle0end |