Subversion Repositories Kolibri OS

Compare Revisions

Regard whitespace Rev 2162 → Rev 2163

/programs/media/zsea/plugins/scaling/scaling.asm
38,20 → 38,28
;---------------------------------------------------------------------
START:
pushad
mov edi,dword [esp+56]
mov esi,dword [esp+52]
mov edx,dword [esp+48]
mov ecx,dword [esp+44]
mov ebx,dword [esp+40]
mov eax,dword [esp+36]
mov eax,dword [esp+60] ; eax - crop size
mov ebx,eax
and eax,0xffff
shr ebx,16
mov [crop_x],ebx
mov [crop_y],eax
mov edi,dword [esp+56] ; edi - background color
mov esi,dword [esp+52] ; esi - filtering
mov edx,dword [esp+48] ; edx - scaling mode
mov ecx,dword [esp+44] ; ecx - start_coordinates
mov ebx,dword [esp+40] ; ebx - new_size
mov eax,dword [esp+36] ; eax - convert data table
mov [pointer],eax
test bx,bx
jnz @f
inc bx
@@:
ror ebx,16
test bx,bx
jnz @f
inc bx
@@:
rol ebx,16
108,6 → 116,16
imul ebx,[bytes_to_pixel]
mov [size_x],ebx
mov eax,[crop_y]
test eax,eax
jz @f
mov [y],eax
@@:
mov eax,[crop_x]
test eax,eax
jz @f
mov [x],eax
@@:
mov eax,100
shl eax,12
mov ebx,[scaling_mode]
120,13 → 138,7
mov [scaling_delta],eax
call .get_memory
cmp [scaling_mode],0
jne @f
call .scaling
jmp .ret_ok
@@:
call .scaling_2
;---------------------------------------------------------------------
.ret_ok:
mcall 68,13,[area_for_x]
147,27 → 159,10
; mov [ebx+44],eax
.exit:
popad
ret 24
ret 28
;---------------------------------------------------------------------
align 4
.scaling:
xor ecx,ecx
.y:
xor ebx,ebx
;-------------------------
.x:
call ebp
inc ebx
cmp bx,[new_size.x1]
jb .x
;-------------------------
inc ecx
cmp cx,[new_size.y1]
jb .y
ret
;---------------------------------------------------------------------
align 4
.scaling_2:
xor eax,eax
mov ax,[start_coordinates.y]
imul eax,[size_x]
274,10 → 269,10
align 4
.new_y:
mov [temp_y],eax
 
mov ebx,[scaling_mode]
test ebx,ebx
jz @f
imul eax,[scaling_delta]
;--------------------------------
push ebx
290,10 → 285,13
pop ebx
;--------------------------------
jmp .ex_1
;--------------------------------
align 4
@@:
imul eax,dword [y]
;--------------------------------
imul eax,dword [y]
align 4
@@:
mov bx,word [new_size.y1]
;--------------------------------
align 4
301,6 → 299,7
test ebx,ebx
jnz @f
inc ebx
;--------------------------------
align 4
@@:
xor edx,edx
356,6 → 355,9
align 4
@@:
imul eax,dword [x]
;--------------------------------
align 4
@@:
mov bx,word [new_size.x1]
;--------------------------------
align 4
404,7 → 406,6
;---------------------------------------------------------------------
align 4
.get_memory:
 
xor ecx,ecx
mov cx,[new_size.x1]
shl ecx,3
422,9 → 423,62
mov eax,3
@@:
imul ecx,eax
mov edx,ecx
add ecx,44
mov eax,[image_file]
add ecx,[eax+24] ;palette area size
mcall 68,12
mov [raw_area],eax
mov edi,eax
; create RAW header
push esi
mov esi,[image_file]
mov ecx,44/4
cld
rep movsd ;copy the 3 first dword for the structure of RAW
mov edi,[raw_area]
movzx eax,word [new_size.x1]
mov [edi+4],eax
movzx eax,word [new_size.y1]
mov [edi+8],eax
mov [edi+32],edx ;rgb area size
xor eax,eax
mov [edi+36],eax ;transparency area pointer
mov [edi+40],eax ;transparency area size
cmp [filtering],eax ;0 or 1
je @f
 
mov [edi+20],eax ;palette area pointer
mov [edi+24],eax ;palette area size
mov [edi+28],dword 44 ;rgb area pointer
cmp [edi+12],dword 8 ;overall depth of the pixel
ja .not_overall_depth_8
mov [edi+12],dword 24 ;overall depth of the pixel
mov [edi+16],word 8 ;channel depth of the pixel
.not_overall_depth_8:
add edi,44
jmp .end
@@:
mov eax,[edi+24]
add edi,44
test eax,eax ;palette area is present?
jz @f
sub esi,44
mov ecx,[esi+24]
shr ecx,2
add esi,[esi+20]
cld
rep movsd ;copy palette area
@@:
 
.end:
pop esi
ret
;---------------------------------------------------------------------
include 'b_filter.inc'
432,7 → 486,7
align 4
EXPORTS:
dd szStart, START
dd szVersion, 0x00010002
dd szVersion, 0x00010003
dd 0
 
szStart db 'START',0
448,6 → 502,9
x: dd 0
y: dd 0
 
crop_x dd 0
crop_y dd 0
 
size_x dd 0
bytes_to_pixel dd 0