animage: fix zoom buttons, optimize

git-svn-id: svn://kolibrios.org@6369 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
IgorA 2016-03-23 21:55:26 +00:00
parent f0920318da
commit 26ca18d747
6 changed files with 90 additions and 40 deletions

View File

@ -2512,6 +2512,16 @@ dword-значение цвета 0x00RRGGBB
* eax = если успешно - указатель на область памяти с данными * eax = если успешно - указатель на область памяти с данными
* eax = 1 - ошибка * eax = 1 - ошибка
* eax = -1 - отсутствует область главного списка * eax = -1 - отсутствует область главного списка
Замечания:
* буфер, на который указывает eax, содержит следующую информацию:
* +0: dword: общая длина данных
* +4: dword: определяет тип данныx:
* 0 = Текст
* 1 = Текст с блочным выделением
* 2 = Изображение
* 3 = RAW
* 4 и выше зарезервировано
* +8: более детально смотрите файл clipboard_container_rus.txt
---------------------- Константы для регистров: ---------------------- ---------------------- Константы для регистров: ----------------------
eax - SF_CLIPBOARD (54) eax - SF_CLIPBOARD (54)

View File

@ -313,6 +313,8 @@ used_OldX rd 1 ;for draw hard contour
used_OldY rd 1 used_OldY rd 1
rectangular_shade_x rd 1 ;ª®®à¤¨­ â  x ®¡« á⨠¤«ï ª®¯¨à®¢ ­¨ï rectangular_shade_x rd 1 ;ª®®à¤¨­ â  x ®¡« á⨠¤«ï ª®¯¨à®¢ ­¨ï
rectangular_shade_y rd 1 rectangular_shade_y rd 1
paste_img_w rd 1 ;è¨à¨­  ¢áâ ¢«ï¥¬®£® ¨§®¡à ¦¥­¨ï
paste_img_h rd 1 ;¢ëá®â  ¢áâ ¢«ï¥¬®£® ¨§®¡à ¦¥­¨ï
crossing_old_x rd 1 crossing_old_x rd 1
crossing_old_y rd 1 crossing_old_y rd 1
crossing rd 1 crossing rd 1

View File

@ -75,12 +75,12 @@ no_znak2:
mov edx, 0xD5CDCB mov edx, 0xD5CDCB
mcall 13 mcall 13
mov eax,ci_panel_x_pos ;mov eax,ci_panel_x_pos
mov ebx,ci_panel_y_pos ;mov ebx,ci_panel_y_pos
mov ecx,[Window_SizeX] ;mov ecx,[Window_SizeX]
mov edx,50 ;mov edx,50
mov esi,1 ;mov esi,1
sub ecx,5+ci_panel_x_pos+ci_offs_skin_w ;sub ecx,5+ci_panel_x_pos+ci_offs_skin_w
call draw_icons call draw_icons
call PrintMousePos call PrintMousePos
;------------------------------------------------ ;------------------------------------------------

View File

@ -82,7 +82,7 @@ draw_icons:
;buttons of zoom ;buttons of zoom
and [counter],0 and [counter],0
mov [Icon_X],ci_panel_x_pos+159 mov [Icon_X],ci_panel_x_pos+178
next_button_zoom: next_button_zoom:

View File

@ -313,6 +313,14 @@ no_signum_fill_r_y_copy:
sub ebx,edi sub ebx,edi
mov edx,[PointerToEditBufer] mov edx,[PointerToEditBufer]
mov eax,[rectangular_shade_x]
sub eax,[OldX]
mov [edx],eax ;image.w
mov eax,[rectangular_shade_y]
sub eax,[OldY]
mov [edx+4],eax ;image.h
mov dword[edx+8],24 ;bit in pixel
add edx,12 ;copy image parametrs
mov [y],edi mov [y],edi
loop_fill_rectangle_y_copy: loop_fill_rectangle_y_copy:
@ -345,6 +353,9 @@ loop_fill_rectangle_x_copy:
cmp eax,[rectangular_shade_y] cmp eax,[rectangular_shade_y]
jl loop_fill_rectangle_y_copy jl loop_fill_rectangle_y_copy
;...todo use system buffer...
;mcall SF_CLIPBOARD,SSF_WRITE_CB,,[PointerToEditBufer]
call MovePictureToWorkScreen call MovePictureToWorkScreen
mov [DrawSprite_flag],1 mov [DrawSprite_flag],1
jmp end_menu jmp end_menu
@ -408,6 +419,15 @@ no_signum_fill_r_x_paste:
no_signum_fill_r_y_paste: no_signum_fill_r_y_paste:
mov edx,[PointerToEditBufer] mov edx,[PointerToEditBufer]
cmp dword[edx+8],24
jne end_menu
mov eax,[edx]
add eax,[OldX]
mov [paste_img_w],eax
mov eax,[edx+4]
add eax,[OldY]
mov [paste_img_h],eax
add edx,12 ;copy image parametrs
mov [y],edi mov [y],edi
loop_fill_rectangle_y_paste: loop_fill_rectangle_y_paste:
@ -428,15 +448,21 @@ loop_fill_rectangle_x_paste:
mov eax,[x] mov eax,[x]
add eax,[Dx_] add eax,[Dx_]
cmp eax,[paste_img_w]
je no_paste_data_x
mov [x],eax mov [x],eax
cmp eax,[rectangular_shade_x] cmp eax,[rectangular_shade_x]
jl loop_fill_rectangle_x_paste jl loop_fill_rectangle_x_paste
no_paste_data_x:
mov eax,[y] mov eax,[y]
add eax,[Dy_] add eax,[Dy_]
cmp eax,[paste_img_h]
je no_paste_data_y
mov [y],eax mov [y],eax
cmp eax,[rectangular_shade_y] cmp eax,[rectangular_shade_y]
jl loop_fill_rectangle_y_paste jl loop_fill_rectangle_y_paste
no_paste_data_y:
call MovePictureToWorkScreen call MovePictureToWorkScreen
mov [Paste_flag],1 mov [Paste_flag],1

View File

@ -1,96 +1,108 @@
;----------------------------------------------------------- ;-----------------------------------------------------------
;------------------SaveFonForSprite------------------------- ;SaveFonForSprite:
; PointerToPicture -> PointerToSpriteBufer
;
;PutFonForSprite:
; PointerToSpriteBufer -> PointerToPicture
;
;DrawSprite:
; PointerToEditBufer -> PointerToPicture
;----------------------------------------------------------- ;-----------------------------------------------------------
SaveFonForSprite:
mov edi,[PointerToSpriteBufer] align 4
SaveFonForSprite:
mov ecx,[SpriteSizeX] mov ecx,[SpriteSizeX]
or ecx,ecx
jz .end_f
mov edx,[Picture_SizeX] mov edx,[Picture_SizeX]
sub edx,[SpriteSizeX] sub edx,ecx
mov esi,[SpriteCoordinatY] mov esi,[SpriteCoordinatY]
imul esi,[Picture_SizeX] imul esi,[Picture_SizeX]
add esi,[SpriteCoordinatX] add esi,[SpriteCoordinatX]
lea edx,[edx+edx*2] lea edx,[edx+edx*2]
lea esi,[esi+esi*2] lea esi,[esi+esi*2]
add esi,[PointerToPicture] add esi,[PointerToPicture]
mov edi,[PointerToSpriteBufer]
mov ebx,[SpriteSizeY] mov ebx,[SpriteSizeY]
mov [counter],ecx mov [counter],ecx
next_line_sprite_save: .next_line_sprite_save:
mov ecx,[counter] mov ecx,[counter]
align 4
next_pixel_sprite_save: @@:
movsw movsw
movsb movsb
dec ecx dec ecx
jnz next_pixel_sprite_save jnz @b
add esi,edx add esi,edx
dec ebx dec ebx
jnz next_line_sprite_save jnz .next_line_sprite_save
.end_f:
ret ret
;----------------------------------------------------------- ;-----------------------------------------------------------
;-------------------PutFonForSprite-------------------------
;-----------------------------------------------------------
PutFonForSprite:
mov esi,[PointerToSpriteBufer] align 4
PutFonForSprite:
mov ecx,[SpriteSizeX] mov ecx,[SpriteSizeX]
or ecx,ecx
jz .end_f
mov edx,[Picture_SizeX] mov edx,[Picture_SizeX]
sub edx,[SpriteSizeX] sub edx,ecx
mov edi,[SpriteOldCoordinatY] mov edi,[SpriteOldCoordinatY]
imul edi,[Picture_SizeX] imul edi,[Picture_SizeX]
add edi,[SpriteOldCoordinatX] add edi,[SpriteOldCoordinatX]
lea edx,[edx+edx*2] lea edx,[edx+edx*2]
lea edi,[edi+edi*2] lea edi,[edi+edi*2]
add edi,[PointerToPicture] add edi,[PointerToPicture]
mov esi,[PointerToSpriteBufer]
mov ebx,[SpriteSizeY] mov ebx,[SpriteSizeY]
mov [counter],ecx mov [counter],ecx
next_line_sprite_put: .next_line_sprite_put:
mov ecx,[counter] mov ecx,[counter]
align 4
next_pixel_sprite_put: @@:
movsw movsw
movsb movsb
dec ecx dec ecx
jnz next_pixel_sprite_put jnz @b
add edi,edx add edi,edx
dec ebx dec ebx
jnz next_line_sprite_put jnz .next_line_sprite_put
.end_f:
ret ret
;----------------------------------------------------------- ;-----------------------------------------------------------
;------------------DrawFonForSprite-------------------------
;-----------------------------------------------------------
DrawSprite:
mov esi,[PointerToEditBufer] align 4
DrawSprite:
mov ecx,[SpriteSizeX] mov ecx,[SpriteSizeX]
or ecx,ecx
jz .end_f
mov edx,[Picture_SizeX] mov edx,[Picture_SizeX]
sub edx,[SpriteSizeX] sub edx,ecx
mov edi,[SpriteCoordinatY] mov edi,[SpriteCoordinatY]
imul edi,[Picture_SizeX] imul edi,[Picture_SizeX]
add edi,[SpriteCoordinatX] add edi,[SpriteCoordinatX]
lea edx,[edx+edx*2] lea edx,[edx+edx*2]
lea edi,[edi+edi*2] lea edi,[edi+edi*2]
add edi,[PointerToPicture] add edi,[PointerToPicture]
mov esi,[PointerToEditBufer]
mov ebx,[SpriteSizeY] mov ebx,[SpriteSizeY]
mov [counter],ecx mov [counter],ecx
next_line_sprite_draw: .next_line_sprite_draw:
mov ecx,[counter] mov ecx,[counter]
align 4
next_pixel_sprite_draw: @@:
movsw movsw
movsb movsb
dec ecx dec ecx
jnz next_pixel_sprite_draw jnz @b
add edi,edx add edi,edx
dec ebx dec ebx
jnz next_line_sprite_draw jnz .next_line_sprite_draw
.end_f:
ret ret