forked from KolibriOS/kolibrios
zSea rc4
1) background image to the proportional stretching with cropping 2) optimize scaling.obj 3) scaling.obj and convert.obj support RAW header to all cases is now git-svn-id: svn://kolibrios.org@2163 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
parent
48e49905d0
commit
d250796055
@ -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 @@ background:
|
||||
|
||||
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 ; 15,4 set mode
|
||||
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
|
||||
;---------------------------------------------------------------------
|
@ -38,7 +38,7 @@ lsz fitext,\
|
||||
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,6 +198,22 @@ zoom_factors:
|
||||
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
|
||||
@ -234,6 +250,19 @@ background_color dd 0xffffff
|
||||
|
||||
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 @@ op_text:
|
||||
.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
|
||||
|
@ -49,13 +49,6 @@ START:
|
||||
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
|
||||
@ -67,11 +60,6 @@ START:
|
||||
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 @@ START:
|
||||
shr eax,1
|
||||
mov [ebx+12],eax
|
||||
@@:
|
||||
|
||||
popad
|
||||
ret 4
|
||||
;---------------------------------------------------------------------
|
||||
@ -90,7 +77,6 @@ START:
|
||||
mcall 68,20
|
||||
mov [image_file],eax
|
||||
|
||||
|
||||
mov ecx,[area_size]
|
||||
mov eax,ecx
|
||||
shr ecx,2
|
||||
@ -104,8 +90,7 @@ START:
|
||||
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 @@ START:
|
||||
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 @@ START:
|
||||
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 @@ START:
|
||||
@@:
|
||||
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 @@ START:
|
||||
.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 @@ START:
|
||||
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 @@ START:
|
||||
dec ecx
|
||||
jnz .2b_1
|
||||
|
||||
jmp .less_8b ;.ret_ok
|
||||
jmp .less_8b
|
||||
;---------------------------------------------------------------------
|
||||
.1b:
|
||||
call .get_memory
|
||||
@ -294,8 +277,6 @@ START:
|
||||
|
||||
mov al,bl
|
||||
shr al,7
|
||||
; and al,1b
|
||||
; shl eax,8
|
||||
|
||||
stosd
|
||||
|
||||
@ -326,21 +307,19 @@ START:
|
||||
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 @@ Convert24b:
|
||||
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 @@ Convert24b:
|
||||
mov [ebx+20],eax ; store RAW pointer
|
||||
popad
|
||||
ret 4
|
||||
|
||||
;---------------------------------------------------------------------
|
||||
.32b:
|
||||
cld
|
||||
lodsd
|
||||
|
||||
stosw
|
||||
shr eax,16
|
||||
stosb
|
||||
@ -482,7 +481,7 @@ Convert24b:
|
||||
align 16
|
||||
EXPORTS:
|
||||
dd szStart, START
|
||||
dd szVersion, 0x00010002
|
||||
dd szVersion, 0x00010003
|
||||
dd szConv_24b, Convert24b
|
||||
dd 0
|
||||
|
||||
|
@ -38,20 +38,28 @@ include '../../../../macros.inc'
|
||||
;---------------------------------------------------------------------
|
||||
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 @@ START:
|
||||
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 @@ START:
|
||||
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 @@ START:
|
||||
; 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
|
||||
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 @@ align 4
|
||||
pop ebx
|
||||
;--------------------------------
|
||||
jmp .ex_1
|
||||
;--------------------------------
|
||||
align 4
|
||||
@@:
|
||||
;--------------------------------
|
||||
imul eax,dword [y]
|
||||
;--------------------------------
|
||||
align 4
|
||||
@@:
|
||||
mov bx,word [new_size.y1]
|
||||
;--------------------------------
|
||||
align 4
|
||||
@ -301,6 +299,7 @@ align 4
|
||||
test ebx,ebx
|
||||
jnz @f
|
||||
inc ebx
|
||||
;--------------------------------
|
||||
align 4
|
||||
@@:
|
||||
xor edx,edx
|
||||
@ -356,6 +355,9 @@ align 4
|
||||
align 4
|
||||
@@:
|
||||
imul eax,dword [x]
|
||||
;--------------------------------
|
||||
align 4
|
||||
@@:
|
||||
mov bx,word [new_size.x1]
|
||||
;--------------------------------
|
||||
align 4
|
||||
@ -404,7 +406,6 @@ align 4
|
||||
;---------------------------------------------------------------------
|
||||
align 4
|
||||
.get_memory:
|
||||
|
||||
xor ecx,ecx
|
||||
mov cx,[new_size.x1]
|
||||
shl ecx,3
|
||||
@ -422,9 +423,62 @@ align 4
|
||||
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 @@ include 'b_filter.inc'
|
||||
align 4
|
||||
EXPORTS:
|
||||
dd szStart, START
|
||||
dd szVersion, 0x00010002
|
||||
dd szVersion, 0x00010003
|
||||
dd 0
|
||||
|
||||
szStart db 'START',0
|
||||
@ -448,6 +502,9 @@ new_size:
|
||||
x: dd 0
|
||||
y: dd 0
|
||||
|
||||
crop_x dd 0
|
||||
crop_y dd 0
|
||||
|
||||
size_x dd 0
|
||||
bytes_to_pixel dd 0
|
||||
|
||||
|
@ -44,9 +44,23 @@ thread4: ; start of bgrd thread
|
||||
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
|
||||
|
@ -77,6 +77,7 @@ thread2: ; start of info thread
|
||||
|
||||
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
|
||||
|
@ -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
|
||||
|
@ -67,10 +67,6 @@ no_scaling:
|
||||
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 @@ scaling:
|
||||
.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 @@ scaling:
|
||||
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 @@ scaling:
|
||||
.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,12 +209,13 @@ scaling:
|
||||
movzx esi,byte [filtering_flag]
|
||||
; mov edi,[background_color]
|
||||
|
||||
push dword [background_color] ;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
|
||||
push dword [scaling_mode] ; edx - scaling mode
|
||||
push ecx ; ecx - start_coordinates
|
||||
push ebx ; ebx - new_size
|
||||
push dword image_file ;eax - convert data table
|
||||
push dword image_file ; eax - convert data table
|
||||
|
||||
; pusha
|
||||
; mcall 26,9
|
||||
@ -297,18 +285,24 @@ scaling:
|
||||
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 @@ scaling:
|
||||
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,34 +335,40 @@ scaling:
|
||||
; 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
|
||||
@@:
|
||||
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:
|
||||
|
Loading…
Reference in New Issue
Block a user