Subversion Repositories Kolibri OS

Compare Revisions

Regard whitespace Rev 2162 → Rev 2163

/programs/media/zsea/backgrnd.inc
3,10 → 3,10
background:
cmp [soi],0
je .end
 
cmp [bgrmode],dword 2
jbe @f
jmp .end
@@:
ja .stretch_crop
 
mov ecx,[img_width] ; øèðèíà
test ecx,ecx
jz .end
24,20 → 24,149
 
cmp [img_resolution],24
je @f
push dword image_file
call [convert_Conv_24b]
mov ecx,[raw_pointer_2]
add ecx,44
mcall 15,5 ;15,5 set data
mov ecx,[raw_pointer_2]
mcall 68,13
mcall 68,13,[raw_pointer_2]
jmp .set_mode
@@:
mcall 15,5 ; 15,5 set data
.set_mode:
mov ecx,[bgrmode]
mcall 15,4,[bgrmode] ; 15,4 set mode
dec ebx ; 15,3 redraw background
mcall
.end:
ret
;---------------------------------------------------------------------
.stretch_crop:
; cmp [bgrmode],dword 3
; jne .stretch_inscribe
xor eax,eax
mov [stretch_start_coordinates],eax
mcall 14
 
mov ebx,eax
and eax,0xffff
inc eax
mov [screen_high],eax
shr ebx,16
inc ebx
mov [screen_width],ebx
xchg eax,ebx
call calculate_relation
mov [screen_relation],eax
mov eax,[img_width]
mov ebx,[img_high]
call calculate_relation
mov [picture_relation],eax
cmp eax,[screen_relation]
jb @f
; Y = Yimg
; X = Yimg*Xscreen/Yscreen
mov eax,[img_high]
mov [stretch_img_high],eax
mov eax,[img_high]
imul eax,dword [screen_width]
mov ebx,[screen_high]
call integer_division
mov [stretch_img_width],eax
mov ebx,[img_width]
sub ebx,eax
shr ebx,1
mov [stretch_start_coordinates.x],bx
jmp .continue
@@:
; X = Ximg
; Y = Ximg*Yscreen/Xscreen
mov eax,[img_width]
mov [stretch_img_width],eax
mov eax,[img_width]
imul eax,dword [screen_high]
mov ebx,[screen_width]
call integer_division
mov [stretch_img_high],eax
mov ebx,[img_high]
sub ebx,eax
shr ebx,1
mov [stretch_start_coordinates.y],bx
.continue:
mov ebx,[screen_width]
shl ebx,16
add ebx,[screen_high]
mov eax,[stretch_img_width]
shl eax,16
add eax,[stretch_img_high]
push dword eax ; eax - crop size
push dword 0 ; edi - background color
push dword 1 ; esi - filtering
push dword 0 ; edx - scaling mode
push dword [stretch_start_coordinates] ; ecx - start_coordinates
push ebx ; ebx - new_size
push dword image_file ; eax - convert data table
 
call [Scaling_Start]
call background_1
ret
;---------------------------------------------------------------------
;.stretch_inscribe:
; ret
;---------------------------------------------------------------------
background_1:
mov ecx,[screen_width] ;[crop_img_width] ; øèðèíà
test ecx,ecx
jz .end
mov edx,[screen_high] ;[crop_img_high] ; âûñîòà 
test edx,edx
jz .end
mcall 15,1 ; set size
 
mov esi,ecx
imul esi,edx
lea esi,[esi*3]
mov ecx,[raw_pointer_2] ;[soi]
mov eax,[ecx+28]
add ecx,eax
 
xor edx,edx
 
mov eax,[raw_pointer_2]
mov eax,[eax+12] ;overall depth of the pixel
cmp al,24
je @f
 
mov eax,[raw_pointer_2]
mov [crop_raw_pointer],eax
push dword crop_image_file
call [convert_Conv_24b]
mov ecx,[crop_raw_pointer_2]
add ecx,44
mcall 15,5 ;15,5 set data
mcall 68,13,[crop_raw_pointer_2]
jmp .set_mode
@@:
mcall 15,5 ; 15,5 set data
.set_mode:
xor ecx,ecx
inc ecx
; mov ecx,[bgrmode]
mcall 15,4 ; 15,4 set mode
dec ebx ; 15,3 redraw background
mcall
.end:
mov ecx,[raw_pointer_2]
mcall 68,13
ret
;---------------------------------------------------------------------
/programs/media/zsea/data.inc
38,7 → 38,7
db 0
;---------------------------------------------------------------------
Authors_text:
.1: db 'zSea version: 1.00 RC3 Date: 24/08/2011',0
.1: db 'zSea version: 1.00 RC4 Date: 07/09/2011',0
.2: db 'Authors:',0
.3: db 'Marat Zakiyanov aka Mario(Mario79)',0
.4: db 'zSea program, modules: cnv_bmp.obj,',0
198,11 → 198,27
dd 5000
 
zoom_factors_old dd 0
 
;---------------------------------------------------------------------
; not change this section!!!
; start section
;---------------------------------------------------------------------
align 4
crop_image_file dd 0 ;+0
crop_raw_pointer dd 0 ;+4
crop_return_code dd 0 ;+8
crop_img_size dd 0 ;+12
crop_deflate_unpack dd 0 ;+16
crop_raw_pointer_2 dd 0 ;+20
;---------------------------------------------------------------------
; end section
;---------------------------------------------------------------------
 
;---------------------------------------------------------------------
; not change this section!!!
; start section
;---------------------------------------------------------------------
align 4
image_file dd 0 ;+0
raw_pointer dd 0 ;+4
return_code dd 0 ;+8
234,6 → 250,19
 
skin_height dd 0
 
screen_high dd 0
screen_width dd 0
 
stretch_start_coordinates:
.y dw 0
.x dw 0
 
screen_relation dd 0
picture_relation dd 0
 
stretch_img_high dd 0
stretch_img_width dd 0
 
RAW1_pointer dd 0
RAW1_size_x dd 0
RAW1_size dd 0
871,9 → 900,9
.e1:
.2 db 'Stretch'
.e2:
.3 db 'Stretch + V crop'
.3 db 'Stretch + Crop'
.e3:
.4 db 'Stretch + H crop'
.4 db 'Stretch + Inscribe'
.e4:
 
option_group1 dd op1
/programs/media/zsea/plugins/convert/convert.asm
49,14 → 49,7
add esi,eax
mov edi,esi
mov ecx,[eax+32]
; xor ebx,ebx
; mov [raw_area],ebx
 
; mov ebx,[pointer]
; movzx eax,word [eax+18]
; mov [ebx+24],eax
; jmp .ret_ok
cmp [eax+16],word 16
je .16b
cmp [eax+12],dword 1
67,11 → 60,6
je .4b
;---------------------------------------------------------------------
.ret_ok:
; mov ebx,[pointer]
; mov eax,[raw_area]
; mov [ebx+20],eax ; store RAW pointer
; mov [ebx+24],ecx
 
mov ebx,[image_file]
cmp [ebx+18],word 2
jne @f
79,7 → 67,6
shr eax,1
mov [ebx+12],eax
@@:
popad
ret 4
;---------------------------------------------------------------------
90,7 → 77,6
mcall 68,20
mov [image_file],eax
 
mov ecx,[area_size]
mov eax,ecx
shr ecx,2
104,8 → 90,7
cld
rep movsd
mov ecx,[raw_area]
mcall 68,13
mcall 68,13,[raw_area]
mov eax,[image_file]
mov ebx,[pointer]
mov [ebx+4],eax
113,8 → 98,9
ret 4
;---------------------------------------------------------------------
.16b:
; eax - RAW image_file
cmp [eax+18],word 3
je @f ;.convert_16_in_8
je @f
cmp [eax+18],word 4
jne .16b_1
@@:
134,7 → 120,6
mov [eax+12],ebx
 
mov ebx,eax
; jmp .ret_ok
.convert_16_in_8: ; converting 16 bit sample to 8 bit
cld
158,11 → 143,13
@@:
dec ecx
jnz .convert_16_in_8
jmp .16b_end
;---------------------------------------------------------------------
.16b_1:
; eax - RAW image_file
cmp [eax+18],word 1
je @f ;.convert_16_in_8_1
je @f
cmp [eax+18],word 2
jne .16b_end
@@:
176,8 → 163,6
.convert_16_in_8_1:
cld
lodsw
; shr ax,8
; mov al,ah
stosb
dec ecx
jnz .convert_16_in_8_1
210,12 → 195,10
dec ecx
jnz .4b_1
jmp .less_8b ;.ret_ok
jmp .less_8b
;---------------------------------------------------------------------
.2b:
call .get_memory
; jmp .ret_ok
; shr ecx,1
mov edx,ebx
mov eax,ebx
shr ebx,2
259,7 → 242,7
dec ecx
jnz .2b_1
jmp .less_8b ;.ret_ok
jmp .less_8b
;---------------------------------------------------------------------
.1b:
call .get_memory
294,8 → 277,6
mov al,bl
shr al,7
; and al,1b
; shl eax,8
stosd
326,21 → 307,19
add edi,edx
dec ecx
jnz .1b_1
jmp .less_8b ;.ret_ok
 
jmp .less_8b
;---------------------------------------------------------------------
.get_memory:
; eax - RAW image_file
mov ebx,dword 8
mov [eax+16],bx
mov [eax+12],ebx
; mov esi,[eax+28]
; add esi,eax
; push ecx
mov ecx,[eax+4]
imul ecx,[eax+8]
push eax
mov [area_size],ecx
mcall 68,12
; pop ecx
mov [raw_area],eax
mov edi,eax
pop eax
365,11 → 344,33
imul ecx,[eax+8]
push eax ecx
lea ecx,[ecx*3]
mcall 68,12
mov edx,ecx
add ecx,44 ; header
mcall 68,12 ;get new RAW area
mov [raw_area],eax
mov edi,eax
push esi
mov esi,[image_file]
mov ecx,3
cld
rep movsd ;copy the 3 first dword for the structure of RAW
pop esi
sub edi,12
mov [edi+12],dword 24 ;overall depth of the pixel
mov [edi+16],word 8 ;channel depth of the pixel
xor eax,eax
mov [edi+20],eax ;palette area pointer
mov [edi+24],eax ;palette area size
mov [edi+28],dword 44 ;rgb area pointer
mov [edi+32],edx ;rgb area size
mov [edi+36],eax ;transparency area pointer
mov [edi+40],eax ;transparency area size
pop ecx eax
 
add edi,44
 
cmp [eax+12],dword 32
je .32b
cmp [eax+12],dword 16
385,12 → 386,10
mov [ebx+20],eax ; store RAW pointer
popad
ret 4
 
;---------------------------------------------------------------------
.32b:
cld
lodsd
stosw
shr eax,16
stosb
482,7 → 481,7
align 16
EXPORTS:
dd szStart, START
dd szVersion, 0x00010002
dd szVersion, 0x00010003
dd szConv_24b, Convert24b
dd 0
 
/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
 
/programs/media/zsea/win_bcgr.inc
44,9 → 44,23
jmp .still
;---------------------------------------------------------------------
@@:
cmp [option_group1],op2
jne @f
mov [bgrmode],dword 2
jmp .still
;---------------------------------------------------------------------
@@:
cmp [option_group1],op3
jne @f
mov [bgrmode],dword 3
jmp .still
;---------------------------------------------------------------------
@@:
; cmp [option_group1],op4
; jne .still
mov [bgrmode],dword 4
jmp .still
;---------------------------------------------------------------------
.key:
mcall
cmp ah,27
/programs/media/zsea/win_info.inc
77,6 → 77,7
add edx,10
mcall ,,[Total_Repeat_N]
 
; mcall 47,0x80000,[PID2],<200, 5>,0xffffff
; mcall 47,0x800a0000,[error_locate],<140,5>,0x10ffffff
mcall 12,2
/programs/media/zsea/zSea.asm
25,7 → 25,7
; (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
; SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
;*****************************************************************************
; v.1.0 rñ3 24.08.2011
; v.1.0 rñ4 07.09.2011
;******************************************************************************
use32
org 0x0
/programs/media/zsea/zoom.inc
67,10 → 67,6
mov [zoom_factors],dword zoom_factors.100
mov eax,[eax]
jmp zoom_plus.2
; call calculate_arrows_offset
; call draw_zoom_factors
; jmp red
;---------------------------------------------------------------------
scaling:
mov eax,[soi]
114,10 → 110,6
.fill_for_L_R:
cmp [no_fill],1
je @f
; xor eax,eax
; mov [no_fill],al
; ret
;@@:
pusha
mov ebx,[image_start_coordinates]
mov ecx,ebx
130,7 → 122,6
add bx,ax
add bx,[wa_width_2]
mov ax,[wa_width_1]
; add ax,5
sub ax,bx
rol ebx,16
mov bx,ax
142,10 → 133,6
.fill_for_U_D:
cmp [no_fill],1
je @f
; xor eax,eax
; mov [no_fill],al
; ret
;@@:
pusha
mov ebx,[image_start_coordinates]
mov ecx,ebx
222,6 → 209,7
movzx esi,byte [filtering_flag]
; mov edi,[background_color]
 
push dword 0 ; eax - crop size
push dword [background_color] ;edi - background color
push esi ; esi - filtering
push dword [scaling_mode] ;edx - scaling mode
297,18 → 285,24
add edx,eax
call .fill_for_U_D
@@:
mov esi,[img_resolution]
cmp [img_resolution_2],15
jne @f
mov esi,15
@@:
; mov esi,[img_resolution]
; cmp [img_resolution_2],15
; jne @f
; mov esi,15
;@@:
mov eax,[raw_pointer_2]
mov esi,[eax+12]
mov eax,[raw_pointer]
mov edi,[eax+20]
add edi,eax
; mov edi,[img_palette]
 
xor ebp,ebp
 
mov ebx,[raw_pointer_2]
mov eax,[ebx+28]
add ebx,eax
 
mov eax,ecx
test ax,ax
317,12 → 311,12
test eax,eax
jz .no_draw ;@f
cmp [filtering_flag],0
je @f
cmp esi,8
jne @f
mov esi,24
@@:
; cmp [filtering_flag],0
; je @f
; cmp esi,8
; jne @f
; mov esi,24
;@@:
mcall 65
.no_draw:
; mov eax,ecx
341,21 → 335,29
; and eax,0xffff
; mov [test4],eax
 
push ebx
call draw_file_name_to_work_area
pop ebx
mov ecx,ebx ;[raw_pointer_2]
mcall 68,13
mcall 68,13,[raw_pointer_2]
xor eax,eax
mov ax,[wa_width_2]
mov ebx,[img_width]
; imul eax,100
call calculate_relation
mov [zoom_auto_factor],eax
ret
;---------------------------------------------------------------------
calculate_relation:
; relation = X*100/Y
; eax = eax*100/ebx
; ÅÀÕ = ÅÀÕ * 100
shl eax,2 ; óìíîæåíèå íà 4
lea eax,[eax+eax*4] ; óìíîæåíèå íà 5
lea eax,[eax+eax*4] ; óìíîæåíèå íà 5
mov ebx,[img_width]
integer_division:
; eax = eax/ebx
test ebx,ebx
jnz @f
inc ebx
362,13 → 364,11
@@:
xor edx,edx
div ebx
shl edx,1
cmp ebx,edx
jb @f
inc eax
@@:
mov [zoom_auto_factor],eax
; shl edx,1
; cmp ebx,edx
; jb @f
; inc eax
;@@:
ret
;---------------------------------------------------------------------
calculation_next_value_plus: