kolibrios/programs/media/animage/trunk/screen.inc
IgorA 6f44ae55dd fix interface calculating,
fix scroll broken in 6352,
fix keyboard function

git-svn-id: svn://kolibrios.org@6357 a494cfbc-eb01-0410-851d-a64ba20cac60
2016-03-19 09:57:37 +00:00

336 lines
6.1 KiB
PHP

;----------------------------------------------------------
;--------Move picture from array to work screeen-----------
;----------------------------------------------------------
MovePictureToWorkScreen:
call cleare_screen
mov eax,[Picture_SizeX]
mov ebx,[Picture_SizeY]
mov ecx,[MaxWorkScreen_SizeX]
mov edx,[MaxWorkScreen_SizeY]
mov esi,[k]
imul eax,esi
imul ebx,esi
cmp eax,ecx
jle lab1
mov eax,[MaxWorkScreen_SizeX]
mov [WorkScreen_SizeX],eax
jmp lab2
lab1:
mov [WorkScreen_SizeX],eax
lab2:
cmp ebx,edx
jle lab3
mov ebx,[MaxWorkScreen_SizeY]
mov [WorkScreen_SizeY],ebx
jmp lab4
lab3:
mov [WorkScreen_SizeY],ebx
lab4:
mov eax,[WorkScreen_SizeX]
mov ebx,[k]
cdq
idiv ebx
mov [CounterX],eax
mov eax,[WorkScreen_SizeY]
cdq
idiv ebx
mov [CounterY],eax
mov eax,[WorkScreen_SizeX]
mov ecx,eax
mov ebx,[k]
cdq
idiv ebx
imul eax,ebx
sub ecx,eax
lea ecx,[ecx+ecx*2]
mov eax,[WorkScreen_SizeX]
mov ebx,[k]
dec ebx
imul eax,ebx
lea eax,[eax+eax*2]
add eax,ecx
mov [OffsetYWorkScreen],eax
mov ebx,[Picture_SizeX]
mov eax,[CounterX]
sub ebx,eax
lea ebx,[ebx+ebx*2]
mov [OffsetYPicture],ebx
mov eax,[WorkScreen_SizeX]
mov ebx,[k]
sub eax,ebx
lea eax,[eax+eax*2]
mov [OffsetYBigPixel],eax
mov eax,[PosX]
mov ebx,[PosY]
mov ecx,[Picture_SizeX]
imul ecx,ebx
add eax,ecx
lea eax,[eax+eax*2]
add eax,[PointerToPicture]
mov ebx,[ScreenPointer]
mov edi,[CounterY]
;if size of picture natural(mastab is 1) than move picture to work screen
cmp [k],1
jne no_zoom_1_
screen_y_1:
mov esi,[CounterX]
screen_x_1:
mov ecx,[eax]
and ecx,0xffffff
mov ebp,ecx
shr ecx,16
mov [ebx],bp
mov [ebx+2],cl
add ebx,3;
add eax,3
dec esi
jnz screen_x_1
add eax,[OffsetYPicture]
add ebx,[OffsetYWorkScreen]
dec edi
jnz screen_y_1
jmp fps
no_zoom_1_:
cmp [k],2
jne no_zoom_2
screen_y_2:
mov esi,[CounterX]
screen_x_2:
mov ecx,[eax]
and ecx,0xffffff
mov ebp,ecx
shr ecx,16
mov edx,ebx
mov [edx],bp
mov [edx+2],cl
mov [edx+3],bp
mov [edx+3+2],cl
add edx,3*2
add edx,[OffsetYBigPixel]
mov [edx],bp
mov [edx+2],cl
mov [edx+3],bp
mov [edx+3+2],cl
add edx,3*2
add edx,[OffsetYBigPixel]
add ebx,3*2
add eax,3
dec esi
jnz screen_x_2
add eax,[OffsetYPicture]
add ebx,[OffsetYWorkScreen]
dec edi
jnz screen_y_2
jmp fps
no_zoom_2:
cmp [k],4
jne no_zoom_4
screen_y_4:
mov esi,[CounterX]
screen_x_4:
mov ecx,[eax]
and ecx,0xffffff
mov ebp,ecx
shr ecx,16
mov edx,ebx
mov [edx],bp
mov [edx+2],cl
mov [edx+3],bp
mov [edx+3+2],cl
mov [edx+6],bp
mov [edx+6+2],cl
mov [edx+9],bp
mov [edx+9+2],cl
add edx,3*4
add edx,[OffsetYBigPixel]
mov [edx],bp
mov [edx+2],cl
mov [edx+3],bp
mov [edx+3+2],cl
mov [edx+6],bp
mov [edx+6+2],cl
mov [edx+9],bp
mov [edx+9+2],cl
add edx,3*4
add edx,[OffsetYBigPixel]
mov [edx],bp
mov [edx+2],cl
mov [edx+3],bp
mov [edx+3+2],cl
mov [edx+6],bp
mov [edx+6+2],cl
mov [edx+9],bp
mov [edx+9+2],cl
add edx,3*4
add edx,[OffsetYBigPixel]
mov [edx],bp
mov [edx+2],cl
mov [edx+3],bp
mov [edx+3+2],cl
mov [edx+6],bp
mov [edx+6+2],cl
mov [edx+9],bp
mov [edx+9+2],cl
add edx,3*4
add edx,[OffsetYBigPixel]
add ebx,4*3
add eax,3
dec esi
jnz screen_x_4
add eax,[OffsetYPicture]
add ebx,[OffsetYWorkScreen]
dec edi
jnz screen_y_4
jmp fps
no_zoom_4:
;if zoom more than 4
screen_y:
mov esi,[CounterX]
screen_x:
mov ecx,[eax]
and ecx,0xffffff
mov ebp,ecx
shr ecx,16
;---------------------------------------------------------
push ebx eax
mov edx,[k]
big_pixel_y:
mov eax,[k]
big_pixel_x:
mov [ebx],bp
mov [ebx+2],cl
add ebx,3
dec eax
jnz big_pixel_x
add ebx,[OffsetYBigPixel]
dec edx
jnz big_pixel_y
pop eax ebx
;---------------------------------------------------------
mov edx,[k]
lea edx,[edx+edx*2]
add ebx,edx
add eax,3
dec esi
jnz screen_x
add eax,[OffsetYPicture]
add ebx,[OffsetYWorkScreen]
dec edi
jnz screen_y
fps:
mov ebx,[ScreenPointer]
mov ecx,[WorkScreen_SizeX]
mov edx,[WorkScreen_SizeY]
shl ecx,16
add ecx,edx
mov edx,((ci_edit_wnd_x_pos+ci_edit_wnd_border) shl 16)\
+ (ci_edit_wnd_y_pos+ci_edit_wnd_border)
mcall SF_PUT_IMAGE
ret
;----------------------------------------------------------
;--------------------clear screen--------------------------
;----------------------------------------------------------
cleare_screen:
mov edi,[ScreenPointer]
mov ebx,[WorkScreen_SizeX]
imul ebx,[WorkScreen_SizeY]
lea ebx,[ebx+ebx*2]
mov eax,0xffffffff
mov ecx,ebx
shr ecx,2
rep stosd
mov ecx,ebx
and ecx,3
rep stosb
ret
;----------------------------------------------------------
;-------------cleare work arrea(work screen)---------------
;----------------------------------------------------------
cleare_work_arrea:
mov edi,[PointerToPicture]
mov ebx,[Picture_SizeX]
imul ebx,[Picture_SizeY]
lea ebx,[ebx+ebx*2]
mov eax,0xffffffff
mov ecx,ebx
shr ecx,2
rep stosd
mov ecx,ebx
and ecx,3
rep stosb
ret
;-----------------------------------------------------------
;calculate position work screen on a picture
;-----------------------------------------------------------
CalculatePositionScreen:
mov eax,[Picture_SizeX]
sub eax,[CounterX]
cmp [PosX],eax
jle @f
mov [PosX],eax
@@:
cmp [PosX],0
jns @f
mov [PosX],0
@@:
mov ebx,[Picture_SizeY]
sub ebx,[CounterY]
cmp [PosY],ebx
jle @f
mov [PosY],ebx
@@:
cmp [PosY],0
jns @f
mov [PosY],0
@@:
ret
;-----------------------------------------------------------
;-----------calculate cordinats on work picture--------------
;-----------------------------------------------------------
GetScreenCordinats:
mov eax,[MouseX]
mov ebx,[MouseY]
sub eax,ci_edit_wnd_x_pos+ci_edit_wnd_border
cmp eax,0
jge @f
xor eax,eax
@@:
sub ebx,ci_edit_wnd_y_pos+ci_edit_wnd_border
cmp ebx,0
jge @f
xor ebx,ebx
@@:
mov ecx,[k]
cdq
idiv ecx
mov [ScreenX],eax
mov eax,ebx
cdq
idiv ecx
mov [ScreenY],eax
ret