optimize 'libimg.obj',

fix in 'zlib.obj',
animage can save '*.png' files

git-svn-id: svn://kolibrios.org@6741 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
IgorA 2016-11-23 09:11:10 +00:00
parent 40e48bd347
commit e73f2a8659
9 changed files with 131 additions and 92 deletions

View File

@ -112,7 +112,7 @@ PNG_SIMPLIFIED_WRITE_STDIO_SUPPORTED equ 0 ;1
PNG_SIMPLIFIED_WRITE_SUPPORTED equ 1 PNG_SIMPLIFIED_WRITE_SUPPORTED equ 1
PNG_STDIO_SUPPORTED equ 1 PNG_STDIO_SUPPORTED equ 1
PNG_STORE_UNKNOWN_CHUNKS_SUPPORTED equ 1 PNG_STORE_UNKNOWN_CHUNKS_SUPPORTED equ 1
PNG_TEXT_SUPPORTED equ 1 PNG_TEXT_SUPPORTED equ 0
PNG_TIME_RFC1123_SUPPORTED equ 1 PNG_TIME_RFC1123_SUPPORTED equ 1
PNG_UNKNOWN_CHUNKS_SUPPORTED equ 1 PNG_UNKNOWN_CHUNKS_SUPPORTED equ 1
PNG_USER_CHUNKS_SUPPORTED equ 1 PNG_USER_CHUNKS_SUPPORTED equ 1
@ -120,19 +120,19 @@ PNG_USER_LIMITS_SUPPORTED equ 1
PNG_USER_MEM_SUPPORTED equ 1 PNG_USER_MEM_SUPPORTED equ 1
PNG_USER_TRANSFORM_INFO_SUPPORTED equ 1 PNG_USER_TRANSFORM_INFO_SUPPORTED equ 1
PNG_USER_TRANSFORM_PTR_SUPPORTED equ 1 PNG_USER_TRANSFORM_PTR_SUPPORTED equ 1
PNG_WARNINGS_SUPPORTED equ 1 PNG_WARNINGS_SUPPORTED equ 0
PNG_WRITE_16BIT_SUPPORTED equ 1 PNG_WRITE_16BIT_SUPPORTED equ 1
PNG_WRITE_ANCILLARY_CHUNKS_SUPPORTED equ 1 PNG_WRITE_ANCILLARY_CHUNKS_SUPPORTED equ 1
PNG_WRITE_BGR_SUPPORTED equ 1 PNG_WRITE_BGR_SUPPORTED equ 1
PNG_WRITE_CHECK_FOR_INVALID_INDEX_SUPPORTED equ 1 PNG_WRITE_CHECK_FOR_INVALID_INDEX_SUPPORTED equ 1
PNG_WRITE_COMPRESSED_TEXT_SUPPORTED equ 1 PNG_WRITE_COMPRESSED_TEXT_SUPPORTED equ 1
PNG_WRITE_CUSTOMIZE_COMPRESSION_SUPPORTED equ 1 PNG_WRITE_CUSTOMIZE_COMPRESSION_SUPPORTED equ 1
PNG_WRITE_CUSTOMIZE_ZTXT_COMPRESSION_SUPPORTED equ 1 PNG_WRITE_CUSTOMIZE_ZTXT_COMPRESSION_SUPPORTED equ 0
PNG_WRITE_FILLER_SUPPORTED equ 1 PNG_WRITE_FILLER_SUPPORTED equ 1
PNG_WRITE_FILTER_SUPPORTED equ 1 PNG_WRITE_FILTER_SUPPORTED equ 1
PNG_WRITE_FLUSH_SUPPORTED equ 1 PNG_WRITE_FLUSH_SUPPORTED equ 1
PNG_WRITE_GET_PALETTE_MAX_SUPPORTED equ 1 PNG_WRITE_GET_PALETTE_MAX_SUPPORTED equ 1
PNG_WRITE_INTERLACING_SUPPORTED equ 1 PNG_WRITE_INTERLACING_SUPPORTED equ 0
PNG_WRITE_INT_FUNCTIONS_SUPPORTED equ 1 PNG_WRITE_INT_FUNCTIONS_SUPPORTED equ 1
PNG_WRITE_INVERT_ALPHA_SUPPORTED equ 1 PNG_WRITE_INVERT_ALPHA_SUPPORTED equ 1
PNG_WRITE_INVERT_SUPPORTED equ 1 PNG_WRITE_INVERT_SUPPORTED equ 1
@ -143,45 +143,45 @@ PNG_WRITE_SHIFT_SUPPORTED equ 1
PNG_WRITE_SUPPORTED equ 1 PNG_WRITE_SUPPORTED equ 1
PNG_WRITE_SWAP_ALPHA_SUPPORTED equ 1 PNG_WRITE_SWAP_ALPHA_SUPPORTED equ 1
PNG_WRITE_SWAP_SUPPORTED equ 1 PNG_WRITE_SWAP_SUPPORTED equ 1
PNG_WRITE_TEXT_SUPPORTED equ 1 PNG_WRITE_TEXT_SUPPORTED equ 0
PNG_WRITE_TRANSFORMS_SUPPORTED equ 1 PNG_WRITE_TRANSFORMS_SUPPORTED equ 0
PNG_WRITE_UNKNOWN_CHUNKS_SUPPORTED equ 1 PNG_WRITE_UNKNOWN_CHUNKS_SUPPORTED equ 0
PNG_WRITE_USER_TRANSFORM_SUPPORTED equ 1 PNG_WRITE_USER_TRANSFORM_SUPPORTED equ 1
PNG_WRITE_WEIGHTED_FILTER_SUPPORTED equ 1 PNG_WRITE_WEIGHTED_FILTER_SUPPORTED equ 1
PNG_WRITE_bKGD_SUPPORTED equ 1 PNG_WRITE_bKGD_SUPPORTED equ 0
PNG_WRITE_cHRM_SUPPORTED equ 1 PNG_WRITE_cHRM_SUPPORTED equ 0
PNG_WRITE_gAMA_SUPPORTED equ 1 PNG_WRITE_gAMA_SUPPORTED equ 0
PNG_WRITE_hIST_SUPPORTED equ 1 PNG_WRITE_hIST_SUPPORTED equ 0
PNG_WRITE_iCCP_SUPPORTED equ 1 PNG_WRITE_iCCP_SUPPORTED equ 0
PNG_WRITE_iTXt_SUPPORTED equ 1 PNG_WRITE_iTXt_SUPPORTED equ 0
PNG_WRITE_oFFs_SUPPORTED equ 1 PNG_WRITE_oFFs_SUPPORTED equ 0
PNG_WRITE_pCAL_SUPPORTED equ 1 PNG_WRITE_pCAL_SUPPORTED equ 0
PNG_WRITE_pHYs_SUPPORTED equ 1 PNG_WRITE_pHYs_SUPPORTED equ 0
PNG_WRITE_sBIT_SUPPORTED equ 1 PNG_WRITE_sBIT_SUPPORTED equ 0
PNG_WRITE_sCAL_SUPPORTED equ 1 PNG_WRITE_sCAL_SUPPORTED equ 0
PNG_WRITE_sPLT_SUPPORTED equ 1 PNG_WRITE_sPLT_SUPPORTED equ 0
PNG_WRITE_sRGB_SUPPORTED equ 1 PNG_WRITE_sRGB_SUPPORTED equ 0
PNG_WRITE_tEXt_SUPPORTED equ 1 PNG_WRITE_tEXt_SUPPORTED equ 0
PNG_WRITE_tIME_SUPPORTED equ 1 PNG_WRITE_tIME_SUPPORTED equ 0
PNG_WRITE_tRNS_SUPPORTED equ 1 PNG_WRITE_tRNS_SUPPORTED equ 0
PNG_WRITE_zTXt_SUPPORTED equ 1 PNG_WRITE_zTXt_SUPPORTED equ 0
PNG_bKGD_SUPPORTED equ 1 PNG_bKGD_SUPPORTED equ 0
PNG_cHRM_SUPPORTED equ 1 PNG_cHRM_SUPPORTED equ 0
PNG_gAMA_SUPPORTED equ 1 PNG_gAMA_SUPPORTED equ 0
PNG_hIST_SUPPORTED equ 1 PNG_hIST_SUPPORTED equ 0
PNG_iCCP_SUPPORTED equ 1 PNG_iCCP_SUPPORTED equ 0
PNG_iTXt_SUPPORTED equ 1 PNG_iTXt_SUPPORTED equ 0
PNG_oFFs_SUPPORTED equ 1 PNG_oFFs_SUPPORTED equ 0
PNG_pCAL_SUPPORTED equ 1 PNG_pCAL_SUPPORTED equ 0
PNG_pHYs_SUPPORTED equ 1 PNG_pHYs_SUPPORTED equ 0
PNG_sBIT_SUPPORTED equ 1 PNG_sBIT_SUPPORTED equ 0
PNG_sCAL_SUPPORTED equ 1 PNG_sCAL_SUPPORTED equ 0
PNG_sPLT_SUPPORTED equ 1 PNG_sPLT_SUPPORTED equ 0
PNG_sRGB_SUPPORTED equ 1 PNG_sRGB_SUPPORTED equ 0
PNG_tEXt_SUPPORTED equ 1 PNG_tEXt_SUPPORTED equ 0
PNG_tIME_SUPPORTED equ 1 PNG_tIME_SUPPORTED equ 0
PNG_tRNS_SUPPORTED equ 1 PNG_tRNS_SUPPORTED equ 0
PNG_zTXt_SUPPORTED equ 1 PNG_zTXt_SUPPORTED equ 0
; end of options ; end of options
; settings ; settings
PNG_API_RULE equ 0 PNG_API_RULE equ 0

View File

@ -123,7 +123,7 @@ dd deflate_state.status,4,ta2
dd deflate_state.pending_buf,4,ta3 dd deflate_state.pending_buf,4,ta3
dd deflate_state.pending_buf_size,4,ta4 dd deflate_state.pending_buf_size,4,ta4
dd deflate_state.pending_out,4,ta5 dd deflate_state.pending_out,4,ta5
dd deflate_state.pending,2,ta6 dd deflate_state.pending,4,ta6
dd deflate_state.wrap,4,ta7 dd deflate_state.wrap,4,ta7
dd deflate_state.gzhead,4,ta8 dd deflate_state.gzhead,4,ta8
dd deflate_state.gzindex,4,ta9 dd deflate_state.gzindex,4,ta9

View File

@ -544,7 +544,7 @@ proc deflateResetKeep uses ebx edi, strm:dword
mov dword[ebx+z_stream.msg],Z_NULL ;use zfree if we ever allocate msg dynamically mov dword[ebx+z_stream.msg],Z_NULL ;use zfree if we ever allocate msg dynamically
mov word[ebx+z_stream.data_type],Z_UNKNOWN mov word[ebx+z_stream.data_type],Z_UNKNOWN
mov word[edi+deflate_state.pending],0 mov dword[edi+deflate_state.pending],0
mov eax,[edi+deflate_state.pending_buf] mov eax,[edi+deflate_state.pending_buf]
mov [edi+deflate_state.pending_out],eax mov [edi+deflate_state.pending_out],eax
@ -639,7 +639,7 @@ proc deflatePending uses ebx edi, strm:dword, pending:dword, bits:dword
cmp dword[pending],Z_NULL cmp dword[pending],Z_NULL
je @f ;if (..!=..) je @f ;if (..!=..)
mov eax,[pending] mov eax,[pending]
movzx ebx,word[edi+deflate_state.pending] mov ebx,[edi+deflate_state.pending]
mov [eax],ebx mov [eax],ebx
@@: @@:
cmp dword[bits],Z_NULL cmp dword[bits],Z_NULL
@ -892,7 +892,7 @@ proc flush_pending uses eax ebx ecx edx, strm:dword
mov edx,[ebx+z_stream.state] mov edx,[ebx+z_stream.state]
stdcall _tr_flush_bits, edx stdcall _tr_flush_bits, edx
movzx ecx,word[edx+deflate_state.pending] mov ecx,[edx+deflate_state.pending]
cmp cx,[ebx+z_stream.avail_out] cmp cx,[ebx+z_stream.avail_out]
jle @f ;if (..>..) jle @f ;if (..>..)
movzx ecx,word[ebx+z_stream.avail_out] movzx ecx,word[ebx+z_stream.avail_out]
@ -905,8 +905,8 @@ proc flush_pending uses eax ebx ecx edx, strm:dword
add [edx+deflate_state.pending_out],ecx add [edx+deflate_state.pending_out],ecx
add [ebx+z_stream.total_out],ecx add [ebx+z_stream.total_out],ecx
sub [ebx+z_stream.avail_out],cx sub [ebx+z_stream.avail_out],cx
sub [edx+deflate_state.pending],cx sub [edx+deflate_state.pending],ecx
cmp word[edx+deflate_state.pending],0 cmp dword[edx+deflate_state.pending],0
jne @f ;if (..==0) jne @f ;if (..==0)
mov eax,[edx+deflate_state.pending_buf] mov eax,[edx+deflate_state.pending_buf]
mov [edx+deflate_state.pending_out],eax mov [edx+deflate_state.pending_out],eax
@ -1048,9 +1048,8 @@ if GZIP eq 1
@@: @@:
cmp dword[edx+gz_header.hcrc],0 cmp dword[edx+gz_header.hcrc],0
je @f ;if (..) je @f ;if (..)
movzx eax,word[edi+deflate_state.pending]
stdcall calc_crc32, [ebx+z_stream.adler],\ stdcall calc_crc32, [ebx+z_stream.adler],\
[edi+deflate_state.pending_buf], eax [edi+deflate_state.pending_buf], [edi+deflate_state.pending]
mov [ebx+z_stream.adler],eax mov [ebx+z_stream.adler],eax
@@: @@:
mov dword[edi+deflate_state.gzindex],0 mov dword[edi+deflate_state.gzindex],0
@ -1116,21 +1115,21 @@ if GZIP eq 1
jne .end5 ;if (..==..) jne .end5 ;if (..==..)
cmp dword[edx+gz_header.extra],Z_NULL cmp dword[edx+gz_header.extra],Z_NULL
je .end21 ;if (..!=..) je .end21 ;if (..!=..)
movzx esi,word[edi+deflate_state.pending] mov esi,[edi+deflate_state.pending]
;esi = beg ;start of bytes to update crc ;esi = beg ;start of bytes to update crc
movzx ecx,word[edx+gz_header.extra_len] movzx ecx,word[edx+gz_header.extra_len]
.cycle0: ;while (..<..) .cycle0: ;while (..<..)
cmp dword[edi+deflate_state.gzindex],ecx cmp dword[edi+deflate_state.gzindex],ecx
jge .cycle0end jge .cycle0end
movzx eax,word[edi+deflate_state.pending] mov eax,[edi+deflate_state.pending]
cmp eax,[edi+deflate_state.pending_buf_size] cmp eax,[edi+deflate_state.pending_buf_size]
jne .end24 ;if (..==..) jne .end24 ;if (..==..)
mov dword[edx+gz_header.hcrc],0 mov dword[edx+gz_header.hcrc],0
je @f je @f
cmp [edi+deflate_state.pending],si cmp [edi+deflate_state.pending],esi
jle @f ;if (.. && ..>..) jle @f ;if (.. && ..>..)
movzx ecx,word[edi+deflate_state.pending] mov ecx,[edi+deflate_state.pending]
sub ecx,esi sub ecx,esi
mov eax,[edi+deflate_state.pending_buf] mov eax,[edi+deflate_state.pending_buf]
add eax,esi add eax,esi
@ -1138,7 +1137,7 @@ if GZIP eq 1
mov [ebx+z_stream.adler],eax mov [ebx+z_stream.adler],eax
@@: @@:
stdcall flush_pending, ebx stdcall flush_pending, ebx
movzx esi,word[edi+deflate_state.pending] mov esi,[edi+deflate_state.pending]
cmp esi,[edi+deflate_state.pending_buf_size] cmp esi,[edi+deflate_state.pending_buf_size]
je .cycle0end ;if (..==..) break je .cycle0end ;if (..==..) break
.end24: .end24:
@ -1153,9 +1152,9 @@ if GZIP eq 1
.cycle0end: .cycle0end:
mov dword[edx+gz_header.hcrc],0 mov dword[edx+gz_header.hcrc],0
je @f je @f
cmp [edi+deflate_state.pending],si cmp [edi+deflate_state.pending],esi
jle @f ;if (.. && ..>..) jle @f ;if (.. && ..>..)
movzx ecx,word[edi+deflate_state.pending] mov ecx,[edi+deflate_state.pending]
sub ecx,esi sub ecx,esi
mov eax,[edi+deflate_state.pending_buf] mov eax,[edi+deflate_state.pending_buf]
add eax,esi add eax,esi
@ -1175,18 +1174,18 @@ if GZIP eq 1
jne .end6 ;if (..==..) jne .end6 ;if (..==..)
cmp dword[edx+gz_header.name],Z_NULL cmp dword[edx+gz_header.name],Z_NULL
je .end22 ;if (..!=..) je .end22 ;if (..!=..)
movzx esi,word[edi+deflate_state.pending] mov esi,[edi+deflate_state.pending]
;esi = beg ;start of bytes to update crc ;esi = beg ;start of bytes to update crc
.cycle1: ;do .cycle1: ;do
movzx eax,word[edi+deflate_state.pending] mov eax,[edi+deflate_state.pending]
cmp eax,[edi+deflate_state.pending_buf_size] cmp eax,[edi+deflate_state.pending_buf_size]
jne .end25 ;if (..==..) jne .end25 ;if (..==..)
mov dword[edx+gz_header.hcrc],0 mov dword[edx+gz_header.hcrc],0
je @f je @f
cmp [edi+deflate_state.pending],si cmp [edi+deflate_state.pending],esi
jle @f ;if (.. && ..>..) jle @f ;if (.. && ..>..)
movzx ecx,word[edi+deflate_state.pending] mov ecx,[edi+deflate_state.pending]
sub ecx,esi sub ecx,esi
mov eax,[edi+deflate_state.pending_buf] mov eax,[edi+deflate_state.pending_buf]
add eax,esi add eax,esi
@ -1194,9 +1193,8 @@ if GZIP eq 1
mov [ebx+z_stream.adler],eax mov [ebx+z_stream.adler],eax
@@: @@:
stdcall flush_pending, ebx stdcall flush_pending, ebx
movzx esi,word[edi+deflate_state.pending] mov esi,[edi+deflate_state.pending]
movzx eax,word[edi+deflate_state.pending] cmp esi,[edi+deflate_state.pending_buf_size]
cmp eax,[edi+deflate_state.pending_buf_size]
jne .end25 ;if (..==..) jne .end25 ;if (..==..)
mov dword[val],1 mov dword[val],1
jmp .cycle1end jmp .cycle1end
@ -1214,9 +1212,9 @@ if GZIP eq 1
.cycle1end: .cycle1end:
mov dword[edx+gz_header.hcrc],0 mov dword[edx+gz_header.hcrc],0
je @f je @f
cmp [edi+deflate_state.pending],si cmp [edi+deflate_state.pending],esi
jle @f ;if (.. && ..>..) jle @f ;if (.. && ..>..)
movzx ecx,word[edi+deflate_state.pending] mov ecx,[edi+deflate_state.pending]
sub ecx,esi sub ecx,esi
mov eax,[edi+deflate_state.pending_buf] mov eax,[edi+deflate_state.pending_buf]
add eax,esi add eax,esi
@ -1235,18 +1233,18 @@ if GZIP eq 1
jne .end7 ;if (..==..) jne .end7 ;if (..==..)
cmp dword[edx+gz_header.comment],Z_NULL cmp dword[edx+gz_header.comment],Z_NULL
je .end23 ;if (..!=..) je .end23 ;if (..!=..)
movzx esi,word[edi+deflate_state.pending] mov esi,[edi+deflate_state.pending]
;esi = beg ;start of bytes to update crc ;esi = beg ;start of bytes to update crc
.cycle2: ;do .cycle2: ;do
movzx eax,word[edi+deflate_state.pending] mov eax,[edi+deflate_state.pending]
cmp eax,[edi+deflate_state.pending_buf_size] cmp eax,[edi+deflate_state.pending_buf_size]
jne .end26 ;if (..==..) jne .end26 ;if (..==..)
mov dword[edx+gz_header.hcrc],0 mov dword[edx+gz_header.hcrc],0
je @f je @f
cmp [edi+deflate_state.pending],si cmp [edi+deflate_state.pending],esi
jle @f ;if (.. && ..>..) jle @f ;if (.. && ..>..)
movzx ecx,word[edi+deflate_state.pending] mov ecx,[edi+deflate_state.pending]
sub ecx,esi sub ecx,esi
mov eax,[edi+deflate_state.pending_buf] mov eax,[edi+deflate_state.pending_buf]
add eax,esi add eax,esi
@ -1254,9 +1252,8 @@ if GZIP eq 1
mov [ebx+z_stream.adler],eax mov [ebx+z_stream.adler],eax
@@: @@:
stdcall flush_pending, ebx stdcall flush_pending, ebx
movzx esi,word[edi+deflate_state.pending] mov esi,[edi+deflate_state.pending]
movzx eax,word[edi+deflate_state.pending] cmp esi,[edi+deflate_state.pending_buf_size]
cmp eax,[edi+deflate_state.pending_buf_size]
jne .end26 ;if (..==..) jne .end26 ;if (..==..)
mov dword[val],1 mov dword[val],1
jmp .cycle2end jmp .cycle2end
@ -1274,9 +1271,9 @@ if GZIP eq 1
.cycle2end: .cycle2end:
mov dword[edx+gz_header.hcrc],0 mov dword[edx+gz_header.hcrc],0
je @f je @f
cmp [edi+deflate_state.pending],si cmp [edi+deflate_state.pending],esi
jle @f ;if (.. && ..>..) jle @f ;if (.. && ..>..)
movzx ecx,word[edi+deflate_state.pending] mov ecx,[edi+deflate_state.pending]
sub ecx,esi sub ecx,esi
mov eax,[edi+deflate_state.pending_buf] mov eax,[edi+deflate_state.pending_buf]
add eax,esi add eax,esi
@ -1294,13 +1291,13 @@ if GZIP eq 1
jne .end8 ;if (..==..) jne .end8 ;if (..==..)
cmp dword[edx+gz_header.hcrc],0 cmp dword[edx+gz_header.hcrc],0
je .end9 ;if (..) je .end9 ;if (..)
movzx ecx,word[edi+deflate_state.pending] mov ecx,[edi+deflate_state.pending]
add ecx,2 add ecx,2
cmp ecx,[edi+deflate_state.pending_buf_size] cmp ecx,[edi+deflate_state.pending_buf_size]
jle @f ;if (..>..) jle @f ;if (..>..)
stdcall flush_pending, ebx stdcall flush_pending, ebx
@@: @@:
movzx ecx,word[edi+deflate_state.pending] mov ecx,[edi+deflate_state.pending]
add ecx,2 add ecx,2
cmp ecx,[edi+deflate_state.pending_buf_size] cmp ecx,[edi+deflate_state.pending_buf_size]
jg @f ;if (..<=..) jg @f ;if (..<=..)
@ -1318,7 +1315,7 @@ if GZIP eq 1
end if end if
; Flush as much pending output as possible ; Flush as much pending output as possible
cmp word[edi+deflate_state.pending],0 cmp dword[edi+deflate_state.pending],0
je .end13 ;if (..!=0) je .end13 ;if (..!=0)
stdcall flush_pending, ebx stdcall flush_pending, ebx
cmp word[ebx+z_stream.avail_out],0 cmp word[ebx+z_stream.avail_out],0
@ -1478,13 +1475,13 @@ end if
; If avail_out is zero, the application will call deflate again ; If avail_out is zero, the application will call deflate again
; to flush the rest. ; to flush the rest.
cmp word[edi+deflate_state.pending],0 cmp dword[edi+deflate_state.pending],0
jle @f ;if (..>0) ;write the trailer only once! jle @f ;if (..>0) ;write the trailer only once!
neg word[edi+deflate_state.pending] neg dword[edi+deflate_state.pending]
inc word[edi+deflate_state.pending] inc dword[edi+deflate_state.pending]
@@: @@:
mov eax,Z_OK mov eax,Z_OK
cmp word[edi+deflate_state.pending],0 cmp dword[edi+deflate_state.pending],0
je .end_f je .end_f
mov eax,Z_STREAM_END mov eax,Z_STREAM_END
.end_f: .end_f:

View File

@ -75,7 +75,7 @@ struct deflate_state ;internal_state
pending_buf dd ? ;Bytef *;output still pending pending_buf dd ? ;Bytef *;output still pending
pending_buf_size dd ? ;ulg ;size of pending_buf pending_buf_size dd ? ;ulg ;size of pending_buf
pending_out dd ? ;Bytef * ;next pending byte to output to the stream pending_out dd ? ;Bytef * ;next pending byte to output to the stream
pending dw ? ;uInt ;nb of bytes in the pending buffer pending dd ? ;uInt ;nb of bytes in the pending buffer
wrap dd ? ;int ;bit 0 true for zlib, bit 1 true for gzip wrap dd ? ;int ;bit 0 true for zlib, bit 1 true for gzip
gzhead dd ? ;gz_headerp ;gzip header information to write gzhead dd ? ;gz_headerp ;gzip header information to write
gzindex dd ? ;uInt ;where in extra, name, or comment gzindex dd ? ;uInt ;where in extra, name, or comment

View File

@ -155,10 +155,10 @@ pop ebx eax
macro put_short s, w macro put_short s, w
{ {
movzx eax,word[s+deflate_state.pending] mov eax,[s+deflate_state.pending]
add eax,[s+deflate_state.pending_buf] add eax,[s+deflate_state.pending_buf]
mov word[eax],w mov word[eax],w
add word[s+deflate_state.pending],2 add dword[s+deflate_state.pending],2
} }
; =========================================================================== ; ===========================================================================
@ -1875,7 +1875,7 @@ endl
mov eax,[lx] mov eax,[lx]
shl eax,1 shl eax,1
add eax,[edi+deflate_state.lit_bufsize] add eax,[edi+deflate_state.lit_bufsize]
cmp word[edi+deflate_state.pending],ax cmp [edi+deflate_state.pending],eax
jl @f jl @f
zlib_assert 'pendingBuf overflow' ;Assert(..<..) zlib_assert 'pendingBuf overflow' ;Assert(..<..)
@@: @@:

View File

@ -1,6 +1,11 @@
;******************************************************* ;*******************************************************
;**************GRAPHICS EDITOR ANIMAGE ***************** ;**************GRAPHICS EDITOR ANIMAGE *****************
;******************************************************* ;*******************************************************
; version: 1.52
; last update: 23.11.2016
; changes: Can save *.png files
; autors: IgorA
;--------------------------------------------------------
; version: 1.51 ; version: 1.51
; last update: 23.03.2016 ; last update: 23.03.2016
; changes: Use library 'kmenu.obj', update GUI ; changes: Use library 'kmenu.obj', update GUI
@ -42,7 +47,7 @@ include '../../../KOSfuncs.inc'
include '../../../develop/libraries/box_lib/load_lib.mac' include '../../../develop/libraries/box_lib/load_lib.mac'
include '../../../dll.inc' include '../../../dll.inc'
include '../../../libio.inc' include '../../../libio.inc'
;include '../../../develop/libraries/libs-dev/libimg/libimg.inc' include '../../../develop/libraries/libs-dev/libimg/libimg.inc'
;include '../../../debug.inc' ;include '../../../debug.inc'
@use_library_mem mem.Alloc,mem.Free,mem.ReAlloc,dll.Load @use_library_mem mem.Alloc,mem.Free,mem.ReAlloc,dll.Load

View File

@ -153,7 +153,7 @@ no_save_:
; savedialog drawwin,save1,save2,file_path ; savedialog drawwin,save1,save2,file_path
;--------------------------------------------------------------------- ;---------------------------------------------------------------------
; replace extension to '.bmp' ; replace extension to '.png'
push eax esi push eax esi
mov esi,[OpenDialog_data.filename_area] mov esi,[OpenDialog_data.filename_area]
xor eax,eax xor eax,eax
@ -165,7 +165,7 @@ no_save_:
sub esi,5 sub esi,5
cmp [esi],byte '.' cmp [esi],byte '.'
jne @f jne @f
mov [esi],dword '.bmp' mov [esi],dword '.png'
@@: @@:
pop esi eax pop esi eax
;--------------------------------------------------------------------- ;---------------------------------------------------------------------
@ -179,6 +179,42 @@ save1:
save_enter: save_enter:
mcall SF_SET_EVENTS_MASK,0x80000027 ;100111b mcall SF_SET_EVENTS_MASK,0x80000027 ;100111b
xor al,al
mov edi,file_path
repne scasb
mov eax,[edi-5]
or eax,0x20202000 ;down register
cmp eax,'.png'
jne .end0
;create image struct
stdcall [img_create], [Picture_SizeX], [Picture_SizeY], Image.bpp24
test eax,eax
jz @f
;copy image
mov edi,[eax+Image.Data]
mov esi,[PointerToPicture]
mov ecx,[Picture_SizeX]
imul ecx,[Picture_SizeY]
imul ecx,3
rep movsb
;encode image
stdcall [img_encode], eax, LIBIMG_FORMAT_PNG, 0
test eax,eax
jz @f
;copy output image
mov edi,[PointerToEditBufer]
mov esi,eax
mov eax,ecx
rep movsb
@@:
mov ecx,eax
mov eax,file_path
mov ebx,[PointerToEditBufer]
jmp .end1
.end0:
call analizing_picture_to_palette call analizing_picture_to_palette
;eax => number of colors in picture ;eax => number of colors in picture
@ -194,6 +230,7 @@ save_enter:
mov ecx,ebx mov ecx,ebx
mov ebx,[PointerToEditBufer] mov ebx,[PointerToEditBufer]
.end1:
call save_file call save_file
mov [save_flag],1 mov [save_flag],1

View File

@ -1,7 +1,7 @@
;********************************************************** ;**********************************************************
;------------------TEXT DATA------------------------------- ;------------------TEXT DATA-------------------------------
;********************************************************** ;**********************************************************
name_of_program db 'ANIMAGE graphics editor v1.51',0 name_of_program db 'ANIMAGE graphics editor v1.52',0
mouse_pos_x db 'X=' mouse_pos_x db 'X='
mouse_pos_y db 'Y=' mouse_pos_y db 'Y='
new_text1 db 'PICTURE SIZE X' new_text1 db 'PICTURE SIZE X'

View File

@ -821,9 +821,9 @@ f1: db 0
.373:db 'á¡à®á ¯à¨§­ ª  ­ ¯à ¢«¥­¨ï df=0',0 .373:db 'á¡à®á ¯à¨§­ ª  ­ ¯à ¢«¥­¨ï df=0',0
.374:db 'á¡à®á ¯à¨§­ ª  à §à¥è¥­¨ï ¯à¥à뢠­¨ï if=0',0 .374:db 'á¡à®á ¯à¨§­ ª  à §à¥è¥­¨ï ¯à¥à뢠­¨ï if=0',0
.376:db 'áà ¢­¥­¨¥ ®¯¥à ­¤®¢ ¨ ¯® १ã«ìâ â ¬ áà ¢­¥­¨ï ãáâ ­ ¢«¨¢ ¥â ä« £¨ (af, cf, of, pf, sf ¨ zf)',0 .376:db 'áà ¢­¥­¨¥ ®¯¥à ­¤®¢ ¨ ¯® १ã«ìâ â ¬ áà ¢­¥­¨ï ãáâ ­ ¢«¨¢ ¥â ä« £¨ (af, cf, of, pf, sf ¨ zf)',0
.378:db 'ср Ђ­Ѕ­ЈЅ 1-­Ў Ё ЉтЎЂых стрЎЊ',0 .378:db '‘à ¢­¥­¨¥ 1-­® ¡ ©â®¢ëå áâப. ‘âப  ¨§ esi áà ¢­¨¢ ¥âáï á® áâப®© edi.',0
.379:db 'ср Ђ­Ѕ­ЈЅ 4-х Ё ЉтЎЂых стрЎЊ',0 .379:db '‘à ¢­¥­¨¥ 4-å ¡ ©â®¢ëå áâப. ‘âப  ¨§ esi áà ¢­¨¢ ¥âáï á® áâப®© edi.',0
.381:db 'ср Ђ­Ѕ­ЈЅ 2-х Ё ЉтЎЂых стрЎЊ',0 .381:db '‘à ¢­¥­¨¥ 2-å ¡ ©â®¢ëå áâப. ‘âப  ¨§ esi áà ¢­¨¢ ¥âáï á® áâப®© edi.',0
.383:db '¬­®£®áâà®ç­ë© ª®¬¬¥­â à¨©',0 .383:db '¬­®£®áâà®ç­ë© ª®¬¬¥­â à¨©',0
.389:db 'ᥣ¬¥­â­ë© ॣ¨áâà - ᥣ¬¥­â ª®¤ ',0 .389:db 'ᥣ¬¥­â­ë© ॣ¨áâà - ᥣ¬¥­â ª®¤ ',0
.390:db '¯à¥®¡à §®¢ ­¨¥ á«®¢  ¢ ¤¢®©­®¥ á«®¢®. ”« £¨ ­¥ ¬¥­ïîâáï.',0 .390:db '¯à¥®¡à §®¢ ­¨¥ á«®¢  ¢ ¤¢®©­®¥ á«®¢®. ”« £¨ ­¥ ¬¥­ïîâáï.',0