libimg: fix save small png images
git-svn-id: svn://kolibrios.org@7279 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
parent
e1c7133e38
commit
c87db09b6e
@ -2144,23 +2144,27 @@ endl
|
|||||||
mov eax,[edx+png_image.format]
|
mov eax,[edx+png_image.format]
|
||||||
and eax,PNG_FORMAT_FLAG_ALPHA
|
and eax,PNG_FORMAT_FLAG_ALPHA
|
||||||
jz .end0 ;if (..!=0)
|
jz .end0 ;if (..!=0)
|
||||||
; bytep row_end;
|
|
||||||
; int aindex;
|
|
||||||
|
|
||||||
if PNG_SIMPLIFIED_WRITE_AFIRST_SUPPORTED eq 1
|
if PNG_SIMPLIFIED_WRITE_AFIRST_SUPPORTED eq 1
|
||||||
; if ((image->format & PNG_FORMAT_FLAG_AFIRST) != 0)
|
mov eax,[edx+png_image.format]
|
||||||
; {
|
and eax,PNG_FORMAT_FLAG_AFIRST
|
||||||
; aindex = -1;
|
jz .end2 ;if (..!=0)
|
||||||
; ++input_row; /* To point to the first component */
|
mov [aindex],-1
|
||||||
; ++output_row;
|
inc [input_row] ; To point to the first component
|
||||||
; }
|
inc [output_row]
|
||||||
|
jmp @f
|
||||||
; else
|
.end2: ;else
|
||||||
end if
|
end if
|
||||||
; aindex = channels;
|
mov eax,[channels]
|
||||||
|
mov [aindex],eax
|
||||||
|
.@@:
|
||||||
|
|
||||||
; Use row_end in place of a loop counter:
|
; Use row_end in place of a loop counter:
|
||||||
; row_end = output_row + image->width * (channels+1);
|
mov ecx,[channels]
|
||||||
|
inc ecx
|
||||||
|
imul ecx,[edx+png_image.width]
|
||||||
|
add ecx,[output_row]
|
||||||
|
;ecx = row_end
|
||||||
|
|
||||||
; while (y-- > 0)
|
; while (y-- > 0)
|
||||||
; {
|
; {
|
||||||
@ -2755,11 +2759,11 @@ end if
|
|||||||
|
|
||||||
.end9: ;else
|
.end9: ;else
|
||||||
if 1 ;;; IDAT compress all (only 24 bit)
|
if 1 ;;; IDAT compress all (only 24 bit)
|
||||||
|
cmp dword[ebx+png_image.height],1
|
||||||
|
jl .end8
|
||||||
mov ecx,[edx+png_image_write_control.row_bytes]
|
mov ecx,[edx+png_image_write_control.row_bytes]
|
||||||
inc ecx
|
inc ecx
|
||||||
imul ecx,[ebx+png_image.height]
|
imul ecx,[ebx+png_image.height]
|
||||||
cmp ecx,1
|
|
||||||
jl .end8
|
|
||||||
stdcall create_compress_IDAT, edi, [edx+png_image_write_control.first_row], ecx, [ebx+png_image.width], [ebx+png_image.height]
|
stdcall create_compress_IDAT, edi, [edx+png_image_write_control.first_row], ecx, [ebx+png_image.width], [ebx+png_image.height]
|
||||||
else ;;; IDAT compress by lines
|
else ;;; IDAT compress by lines
|
||||||
mov ecx,[ebx+png_image.height]
|
mov ecx,[ebx+png_image.height]
|
||||||
|
@ -1119,6 +1119,10 @@ endl
|
|||||||
imul ecx,3
|
imul ecx,3
|
||||||
mov edi,ecx
|
mov edi,ecx
|
||||||
imul edi,[ebx+Image.Height]
|
imul edi,[ebx+Image.Height]
|
||||||
|
cmp edi,4096
|
||||||
|
jge @f
|
||||||
|
mov edi,4096 ;minimum memory size
|
||||||
|
@@:
|
||||||
mov [encoded_file_size],edi
|
mov [encoded_file_size],edi
|
||||||
stdcall [mem.alloc],edi
|
stdcall [mem.alloc],edi
|
||||||
test eax,eax
|
test eax,eax
|
||||||
|
Loading…
Reference in New Issue
Block a user