forked from KolibriOS/kolibrios
new fast algoritm for undo,
optimize code git-svn-id: svn://kolibrios.org@6355 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
parent
ac1294b91a
commit
5f7bdd499c
@ -3,7 +3,7 @@
|
||||
;---------------------------------------------
|
||||
mouse:
|
||||
or ecx,-1
|
||||
mcall 9,procinfo
|
||||
mcall SF_THREAD_INFO,procinfo
|
||||
|
||||
mov eax,[procinfo+70] ;staus of window
|
||||
test eax,100b
|
||||
@ -210,47 +210,28 @@ mouse_in_work_arrea:
|
||||
cmp [Activate_instrument],0
|
||||
jnz no_undo___
|
||||
;------------begin copy for undo-------------
|
||||
inc [number_undo]
|
||||
cmp [number_undo],1
|
||||
jne no_one__
|
||||
|
||||
mov edi,[PointerToCopyPicture]
|
||||
|
||||
no_one__:
|
||||
cmp [number_undo],2
|
||||
jne no_two__
|
||||
|
||||
;copy bufer number 2 to bufer number 0
|
||||
mov edi,[PointerToCopyPicture2]
|
||||
|
||||
no_two__:
|
||||
cmp [number_undo],3
|
||||
jne no_three__
|
||||
|
||||
;copy bufer number two to bufer number one
|
||||
mov esi,[PointerToCopyPicture2]
|
||||
mov edi,[PointerToCopyPicture]
|
||||
mov ecx,[Picture_SizeX]
|
||||
imul ecx,[Picture_SizeY]
|
||||
lea ecx,[ecx+ecx*2]
|
||||
add ecx,4
|
||||
shr ecx,2
|
||||
inc ecx
|
||||
cld
|
||||
rep movsd
|
||||
;end copy
|
||||
dec [number_undo]
|
||||
mov edi,[PointerToCopyPicture2]
|
||||
|
||||
no_three__:
|
||||
mov esi,[PointerToPicture]
|
||||
mov ecx,[Picture_SizeX]
|
||||
imul ecx,[Picture_SizeY]
|
||||
lea ecx,[ecx+ecx*2]
|
||||
add ecx,4
|
||||
mov ebx,ecx
|
||||
shr ecx,2
|
||||
inc ecx
|
||||
cld
|
||||
rep movsd
|
||||
mov ecx,ebx
|
||||
and ecx,3
|
||||
rep movsb
|
||||
;call MovePictureToWorkScreen
|
||||
;rotate bufers +1
|
||||
and [number_undo],0 ;erase all undo
|
||||
mov eax,[PointerToPicture]
|
||||
mov ebx,[PointerToCopyPicture]
|
||||
mov ecx,[PointerToCopyPicture2]
|
||||
mov [PointerToPicture],ecx
|
||||
mov [PointerToCopyPicture],eax
|
||||
mov [PointerToCopyPicture2],ebx
|
||||
;--------------end copy for undo-------------
|
||||
no_undo___:
|
||||
call TakeButtonInstruments
|
||||
@ -263,7 +244,7 @@ no_use_instruments:
|
||||
;---------get mouse cordinats-------------------
|
||||
;-----------------------------------------------
|
||||
GetMouseCoordinats:
|
||||
mcall 37,1
|
||||
mcall SF_MOUSE_GET,SSF_WINDOW_POSITION
|
||||
mov ebx,eax
|
||||
shr eax,16
|
||||
and ebx,0xffff
|
||||
@ -274,5 +255,5 @@ GetMouseCoordinats:
|
||||
;-------get mouse attributs----------------------
|
||||
;------------------------------------------------
|
||||
GetMouseClick:
|
||||
mcall 37,2
|
||||
mcall SF_MOUSE_GET,SSF_BUTTON
|
||||
ret
|
@ -95,6 +95,61 @@ local .horizontal_width_save
|
||||
jnz .next_color_save
|
||||
}
|
||||
|
||||
macro draw_calc_pixels brush
|
||||
{
|
||||
local .next_pixel_put
|
||||
local .vertical_width
|
||||
local .horizontal_width
|
||||
local .no_draw_pixel
|
||||
|
||||
mov ebx,[ReserveArray]
|
||||
mov ecx,[ebx]
|
||||
mov edx,[Color]
|
||||
mov esi,[Color]
|
||||
shr edx,16
|
||||
add ebx,4
|
||||
mov edi,[line_width]
|
||||
dec edi
|
||||
imul edi,25
|
||||
add edi,brush
|
||||
.next_pixel_put:
|
||||
|
||||
mov eax,[ebx]
|
||||
push eax
|
||||
push ecx
|
||||
xor ebp,ebp
|
||||
mov [counter2],5
|
||||
|
||||
.vertical_width:
|
||||
mov [counter],5
|
||||
|
||||
.horizontal_width:
|
||||
xor ecx,ecx
|
||||
mov cl,byte[edi+ebp]
|
||||
test cl,cl
|
||||
jz .no_draw_pixel
|
||||
mov [eax],si
|
||||
mov [eax+2],dl
|
||||
.no_draw_pixel:
|
||||
add eax,3
|
||||
inc ebp
|
||||
dec [counter]
|
||||
jnz .horizontal_width
|
||||
|
||||
mov ecx,[Picture_SizeX]
|
||||
sub ecx,5
|
||||
lea ecx,[ecx+ecx*2]
|
||||
add eax,ecx
|
||||
dec [counter2]
|
||||
jnz .vertical_width
|
||||
|
||||
pop ecx
|
||||
pop eax
|
||||
add ebx,4
|
||||
dec ecx
|
||||
jnz .next_pixel_put
|
||||
}
|
||||
|
||||
;-----------------------------------------------------------
|
||||
;-----instruments of panel(icon's instruments)--------------
|
||||
;-----------------------------------------------------------
|
||||
@ -723,56 +778,9 @@ TakeButtonInstruments:
|
||||
square_width_save
|
||||
|
||||
;draw calculated pixels on work arrea
|
||||
mov ebx,[ReserveArray]
|
||||
mov ecx,[ebx]
|
||||
mov edx,[Color]
|
||||
mov esi,[Color]
|
||||
shr edx,16
|
||||
add ebx,4
|
||||
mov edi,[line_width]
|
||||
dec edi
|
||||
imul edi,25
|
||||
next_pixel_put_line:
|
||||
|
||||
mov eax,[ebx]
|
||||
push eax
|
||||
push ecx
|
||||
xor ebp,ebp
|
||||
and [counter2],0
|
||||
|
||||
vertical_width:
|
||||
and [counter],0
|
||||
|
||||
horizontal_width:
|
||||
xor ecx,ecx
|
||||
mov cl,byte[width_pixels+edi+ebp]
|
||||
test cl,cl
|
||||
jz no_draw_pixel_line
|
||||
mov [eax],si
|
||||
mov [eax+2],dl
|
||||
no_draw_pixel_line:
|
||||
add eax,3
|
||||
inc ebp
|
||||
inc [counter]
|
||||
cmp [counter],5
|
||||
jne horizontal_width
|
||||
|
||||
mov ecx,[Picture_SizeX]
|
||||
sub ecx,5
|
||||
lea ecx,[ecx+ecx*2]
|
||||
add eax,ecx
|
||||
inc [counter2]
|
||||
cmp [counter2],5
|
||||
jne vertical_width
|
||||
|
||||
pop ecx
|
||||
pop eax
|
||||
add ebx,4
|
||||
dec ecx
|
||||
jnz next_pixel_put_line
|
||||
draw_calc_pixels width_pixels
|
||||
|
||||
call MovePictureToWorkScreen
|
||||
|
||||
jmp still
|
||||
no_line:
|
||||
|
||||
@ -835,53 +843,7 @@ TakeButtonInstruments:
|
||||
square_width_save
|
||||
|
||||
;draw calculated pixels on work arrea
|
||||
mov ebx,[ReserveArray]
|
||||
mov ecx,[ebx]
|
||||
mov edx,[Color]
|
||||
mov esi,[Color]
|
||||
shr edx,16
|
||||
add ebx,4
|
||||
mov edi,[line_width]
|
||||
dec edi
|
||||
imul edi,25
|
||||
next_pixel_put_rectangle:
|
||||
|
||||
mov eax,[ebx]
|
||||
push eax
|
||||
push ecx
|
||||
xor ebp,ebp
|
||||
and [counter2],0
|
||||
|
||||
vertical_width_rectangle:
|
||||
and [counter],0
|
||||
|
||||
horizontal_width_rectangle:
|
||||
xor ecx,ecx
|
||||
mov cl,byte[width_pixels_rectangle+edi+ebp]
|
||||
test cl,cl
|
||||
jz no_draw_pixel_rectangle
|
||||
mov [eax],si
|
||||
mov [eax+2],dl
|
||||
no_draw_pixel_rectangle:
|
||||
add eax,3
|
||||
inc ebp
|
||||
inc [counter]
|
||||
cmp [counter],5
|
||||
jne horizontal_width_rectangle
|
||||
|
||||
mov ecx,[Picture_SizeX]
|
||||
sub ecx,5
|
||||
lea ecx,[ecx+ecx*2]
|
||||
add eax,ecx
|
||||
inc [counter2]
|
||||
cmp [counter2],5
|
||||
jne vertical_width_rectangle
|
||||
|
||||
pop ecx
|
||||
pop eax
|
||||
add ebx,4
|
||||
dec ecx
|
||||
jnz next_pixel_put_rectangle
|
||||
draw_calc_pixels width_pixels_rectangle
|
||||
|
||||
call MovePictureToWorkScreen
|
||||
jmp still
|
||||
@ -1033,53 +995,7 @@ TakeButtonInstruments:
|
||||
square_width_save
|
||||
|
||||
;draw calculated pixels on work arrea
|
||||
mov ebx,[ReserveArray]
|
||||
mov ecx,[ebx]
|
||||
mov edx,[Color]
|
||||
mov esi,[Color]
|
||||
shr edx,16
|
||||
add ebx,4
|
||||
mov edi,[line_width]
|
||||
dec edi
|
||||
imul edi,25
|
||||
next_pixel_put_circle:
|
||||
|
||||
mov eax,[ebx]
|
||||
push eax
|
||||
push ecx
|
||||
xor ebp,ebp
|
||||
and [counter2],0
|
||||
|
||||
vertical_width_circle:
|
||||
and [counter],0
|
||||
|
||||
horizontal_width_circle:
|
||||
xor ecx,ecx
|
||||
mov cl,byte[width_pixels+edi+ebp]
|
||||
test cl,cl
|
||||
jz no_draw_pixel_circle
|
||||
mov [eax],si
|
||||
mov [eax+2],dl
|
||||
no_draw_pixel_circle:
|
||||
add eax,3
|
||||
inc ebp
|
||||
inc [counter]
|
||||
cmp [counter],5
|
||||
jne horizontal_width_circle
|
||||
|
||||
mov ecx,[Picture_SizeX]
|
||||
sub ecx,5
|
||||
lea ecx,[ecx+ecx*2]
|
||||
add eax,ecx
|
||||
inc [counter2]
|
||||
cmp [counter2],5
|
||||
jne vertical_width_circle
|
||||
|
||||
pop ecx
|
||||
pop eax
|
||||
add ebx,4
|
||||
dec ecx
|
||||
jnz next_pixel_put_circle
|
||||
draw_calc_pixels width_pixels
|
||||
|
||||
call MovePictureToWorkScreen
|
||||
jmp still
|
||||
@ -1715,53 +1631,7 @@ TakeButtonInstruments:
|
||||
square_width_save
|
||||
|
||||
;draw calculated pixels on work arrea
|
||||
mov ebx,[ReserveArray]
|
||||
mov ecx,[ebx]
|
||||
mov edx,[Color]
|
||||
mov esi,[Color]
|
||||
shr edx,16
|
||||
add ebx,4
|
||||
mov edi,[line_width]
|
||||
dec edi
|
||||
imul edi,25
|
||||
next_pixel_put_konture:
|
||||
|
||||
mov eax,[ebx]
|
||||
push eax
|
||||
push ecx
|
||||
xor ebp,ebp
|
||||
and [counter2],0
|
||||
|
||||
vertical_width_konture:
|
||||
and [counter],0
|
||||
|
||||
horizontal_width_konture:
|
||||
xor ecx,ecx
|
||||
mov cl,byte[width_pixels+edi+ebp]
|
||||
test cl,cl
|
||||
jz no_draw_pixel_konture
|
||||
mov [eax],si
|
||||
mov [eax+2],dl
|
||||
no_draw_pixel_konture:
|
||||
add eax,3
|
||||
inc ebp
|
||||
inc [counter]
|
||||
cmp [counter],5
|
||||
jne horizontal_width_konture
|
||||
|
||||
mov ecx,[Picture_SizeX]
|
||||
sub ecx,5
|
||||
lea ecx,[ecx+ecx*2]
|
||||
add eax,ecx
|
||||
inc [counter2]
|
||||
cmp [counter2],5
|
||||
jne vertical_width_konture
|
||||
|
||||
pop ecx
|
||||
pop eax
|
||||
add ebx,4
|
||||
dec ecx
|
||||
jnz next_pixel_put_konture
|
||||
draw_calc_pixels width_pixels
|
||||
|
||||
mov eax,[ScreenX]
|
||||
mov ebx,[ScreenY]
|
||||
@ -1913,53 +1783,7 @@ TakeButtonInstruments:
|
||||
square_width_save
|
||||
|
||||
;draw calculated pixels on work arrea
|
||||
mov ebx,[ReserveArray]
|
||||
mov ecx,[ebx]
|
||||
mov edx,[Color]
|
||||
mov esi,[Color]
|
||||
shr edx,16
|
||||
add ebx,4
|
||||
mov edi,[line_width]
|
||||
dec edi
|
||||
imul edi,25
|
||||
next_pixel_put_ellips:
|
||||
|
||||
mov eax,[ebx]
|
||||
push eax
|
||||
push ecx
|
||||
xor ebp,ebp
|
||||
and [counter2],0
|
||||
|
||||
vertical_width_ellips:
|
||||
and [counter],0
|
||||
|
||||
horizontal_width_ellips:
|
||||
xor ecx,ecx
|
||||
mov cl,byte[width_pixels+edi+ebp]
|
||||
test cl,cl
|
||||
jz no_draw_pixel_ellips
|
||||
mov [eax],si
|
||||
mov [eax+2],dl
|
||||
no_draw_pixel_ellips:
|
||||
add eax,3
|
||||
inc ebp
|
||||
inc [counter]
|
||||
cmp [counter],5
|
||||
jne horizontal_width_ellips
|
||||
|
||||
mov ecx,[Picture_SizeX]
|
||||
sub ecx,5
|
||||
lea ecx,[ecx+ecx*2]
|
||||
add eax,ecx
|
||||
inc [counter2]
|
||||
cmp [counter2],5
|
||||
jne vertical_width_ellips
|
||||
|
||||
pop ecx
|
||||
pop eax
|
||||
add ebx,4
|
||||
dec ecx
|
||||
jnz next_pixel_put_ellips
|
||||
draw_calc_pixels width_pixels
|
||||
|
||||
call MovePictureToWorkScreen
|
||||
jmp still
|
||||
|
@ -255,8 +255,7 @@ no_save:
|
||||
cmp [number_menu],5
|
||||
jne no_exit_program
|
||||
|
||||
mov eax,-1
|
||||
mcall
|
||||
mcall SF_TERMINATE_PROCESS
|
||||
;---------------------------------------------------------------------
|
||||
no_exit_program:
|
||||
no_file:
|
||||
@ -268,34 +267,19 @@ no_file:
|
||||
cmp [number_menu],1
|
||||
jne no_undo
|
||||
|
||||
cmp [number_undo],1
|
||||
jne no_one____
|
||||
cmp [number_undo],2 ;2 - maximum undo count
|
||||
jge no_undo
|
||||
|
||||
mov esi,[PointerToCopyPicture]
|
||||
;rotate bufers -1
|
||||
inc [number_undo]
|
||||
mov eax,[PointerToPicture]
|
||||
mov ebx,[PointerToCopyPicture]
|
||||
mov ecx,[PointerToCopyPicture2]
|
||||
mov [PointerToPicture],ebx
|
||||
mov [PointerToCopyPicture],ecx
|
||||
mov [PointerToCopyPicture2],eax
|
||||
|
||||
no_one____:
|
||||
cmp [number_undo],2
|
||||
jne no_two____
|
||||
|
||||
mov esi,[PointerToCopyPicture2]
|
||||
|
||||
no_two____:
|
||||
mov edi,[PointerToPicture]
|
||||
mov ecx,[Picture_SizeX]
|
||||
imul ecx,[Picture_SizeY]
|
||||
lea ecx,[ecx+ecx*2]
|
||||
add ecx,4
|
||||
shr ecx,2
|
||||
cld
|
||||
rep movsd
|
||||
call MovePictureToWorkScreen
|
||||
|
||||
dec [number_undo]
|
||||
jnz no_null_undo
|
||||
|
||||
mov [number_undo],1
|
||||
|
||||
no_null_undo:
|
||||
and [number_panel],0
|
||||
and [number_menu],0
|
||||
jmp still
|
||||
|
Loading…
Reference in New Issue
Block a user