add image height change in 'buf2d_resize'

git-svn-id: svn://kolibrios.org@6178 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
IgorA 2016-02-09 11:22:50 +00:00
parent eba5156860
commit 64709b0b3e

View File

@ -823,7 +823,7 @@ proc buf_resize, buf_struc:dword, new_w:dword, new_h:dword, options:dword
cmp ebx,buf2d_h
jge @f
;ᦠ⨥ ¯® ¢ëá®â¥
;... ¥é¥ ­¥ ¯®¤¤¥à¦¨¢ ¥âáï ...
stdcall img_rgb24_hresize, buf2d_data,eax,buf2d_h,ebx
@@:
.24_end_r:
bt dword[options],0 ;¨§¬¥­. ¡ãä¥à
@ -1830,6 +1830,118 @@ popad
ret
endp
;description:
; ᦠ⨥ ¨§®¡à ¦¥­¨ï ¯® ¢ëá®â¥ (à §¬¥àë ¡ãä¥à  ­¥ ¬¥­ïîâáï)
;input:
; data_rgb - pointer to rgb data
; size_w - width img in pixels
; size_h - height img in pixels
; size_h_new - new height img in pixels
align 16
proc img_rgb24_hresize, data_rgb:dword, size_w:dword, size_h:dword, size_h_new:dword
locals
pr dd 0
pg dd 0
pb dd 0
img_n dd ? ;㪠§ â¥«ì ­  ¤ ­­ë¥ ­®¢®£® ¨§®¡à ¦¥­¨ï
cols dd ?
lin_b dd ? ;à §¬¥à «¨­¨¨ ¨§®¡à ¦¥­¨ï ¢ ¡ ©â å
data_n dd ? ;㪠§ â¥«ì ­  ¤ ­­ë¥ ¤«ï ­®¢®£® á⮫¡æ  ¯¨ªá¥«¥©
endl
pushad
;eax - delta for inp. img
;ebx - delta for outp. img
;esi - pointer to data_rgb
mov esi,[data_rgb]
mov [data_n],esi
mov eax,[size_w]
mov [cols],eax
lea eax,[eax+eax*2]
mov [lin_b],eax
align 4
.cycyle_0:
mov eax,[size_h_new]
mov ecx,[size_h]
mov ebx,ecx
mov esi,[data_n]
mov [img_n],esi
add dword[data_n],3 ;¯¥à¥å®¤ ­  á«¥¤ãî騩 á⮫¡¥æ ¯¨ªá¥«¥©
align 4
.cycyle_1:
cmp eax,ebx
jg .else_0
;ª®¯¨àã¥¬ë© ¯¨ªá¥«ì ¬ ªá¨¬ «ì­® ¢«¨ï¥â ­  १ã«ìâ â
;­ ª ¯«¨¢ ¥¬ rgb ¤«ï ¨­â¥à¯®«ï樨 ¯¨ªá¥«¥©
mov edx,[size_h_new]
movzx edi,byte[esi]
imul edi,edx
add [pb],edi
movzx edi,byte[esi+1]
imul edi,edx
add [pg],edi
movzx edi,byte[esi+2]
imul edi,edx
add [pr],edi
cmp eax,ebx
je .d2_add
jmp .if_0_end
.else_0:
;ª®¯¨àã¥¬ë© ¯¨ªá¥«ì ¯®¯ ¤¥â ­  £à ­¨æã ¯¨ªá¥«¥©
mov edx,ebx
sub edx,eax
add edx,[size_h_new]
movzx edi,byte[esi]
imul edi,edx
add [pb],edi
movzx edi,byte[esi+1]
imul edi,edx
add [pg],edi
movzx edi,byte[esi+2]
imul edi,edx
add [pr],edi
;á®å࠭塞 £®â®¢®¥ rgb
.d2_add:
push eax
mov edi,[img_n]
mov eax,[pb]
xor edx,edx
div dword[size_h] ;eax /= [size_h]
stosb
mov eax,[pg]
xor edx,edx
div dword[size_h] ;eax /= [size_h]
stosb
mov eax,[pr]
xor edx,edx
div dword[size_h] ;eax /= [size_h]
stosb
pop eax
mov edx,[lin_b]
add dword[img_n],edx ;next pixel
;®¡­®¢«ï¥¬ rgb ¤«ï ­®¢®£® ¯¨ªá¥«ï
mov edx,eax
sub edx,ebx
movzx edi,byte[esi]
imul edi,edx
mov [pb],edi
movzx edi,byte[esi+1]
imul edi,edx
mov [pg],edi
movzx edi,byte[esi+2]
imul edi,edx
mov [pr],edi
add ebx,[size_h]
.if_0_end:
add eax,[size_h_new]
add esi,[lin_b] ;next pixel
dec ecx
jnz .cycyle_1
dec dword[cols]
jnz .cycyle_0
popad
ret
endp
;¯à¥®¡à §®¢ ­¨¥ ¡ãä¥à  ¨§ 24-¡¨â­®£® ¢ 8-¡¨â­ë©
; spectr - ®¯à¥¤¥«ï¥â ª ª®© ᯥªâà ¡à âì ¯à¨ ¯à¥®¡à §®¢ ­¨¨ 0-ᨭ¨©, 1-§¥«¥­ë©, 2-ªà á­ë©
align 4