From 26ca18d747254fa0e26779fc5d5c35c8afa008e4 Mon Sep 17 00:00:00 2001 From: IgorA Date: Wed, 23 Mar 2016 21:55:26 +0000 Subject: [PATCH] animage: fix zoom buttons, optimize git-svn-id: svn://kolibrios.org@6369 a494cfbc-eb01-0410-851d-a64ba20cac60 --- kernel/trunk/docs/sysfuncr.txt | 12 ++- programs/media/animage/trunk/animage.asm | 2 + .../media/animage/trunk/events_of_window.inc | 12 +-- programs/media/animage/trunk/icons.inc | 2 +- .../media/animage/trunk/menu_instruments.inc | 26 +++++++ programs/media/animage/trunk/sprites.inc | 76 +++++++++++-------- 6 files changed, 90 insertions(+), 40 deletions(-) diff --git a/kernel/trunk/docs/sysfuncr.txt b/kernel/trunk/docs/sysfuncr.txt index bb06425698..5cb95e965d 100644 --- a/kernel/trunk/docs/sysfuncr.txt +++ b/kernel/trunk/docs/sysfuncr.txt @@ -2512,7 +2512,17 @@ dword-значение цвета 0x00RRGGBB * eax = если успешно - указатель на область памяти с данными * 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) ebx - SSF_READ_CB (1) diff --git a/programs/media/animage/trunk/animage.asm b/programs/media/animage/trunk/animage.asm index 029e04f607..a47810aa8a 100644 --- a/programs/media/animage/trunk/animage.asm +++ b/programs/media/animage/trunk/animage.asm @@ -313,6 +313,8 @@ used_OldX rd 1 ;for draw hard contour used_OldY rd 1 rectangular_shade_x rd 1 ;न x ஢ rectangular_shade_y rd 1 +paste_img_w rd 1 ;ਭ ⠢塞 ࠦ +paste_img_h rd 1 ; ⠢塞 ࠦ crossing_old_x rd 1 crossing_old_y rd 1 crossing rd 1 diff --git a/programs/media/animage/trunk/events_of_window.inc b/programs/media/animage/trunk/events_of_window.inc index 03ee0da710..44317d0f30 100644 --- a/programs/media/animage/trunk/events_of_window.inc +++ b/programs/media/animage/trunk/events_of_window.inc @@ -75,12 +75,12 @@ no_znak2: mov edx, 0xD5CDCB mcall 13 - mov eax,ci_panel_x_pos - mov ebx,ci_panel_y_pos - mov ecx,[Window_SizeX] - mov edx,50 - mov esi,1 - sub ecx,5+ci_panel_x_pos+ci_offs_skin_w + ;mov eax,ci_panel_x_pos + ;mov ebx,ci_panel_y_pos + ;mov ecx,[Window_SizeX] + ;mov edx,50 + ;mov esi,1 + ;sub ecx,5+ci_panel_x_pos+ci_offs_skin_w call draw_icons call PrintMousePos ;------------------------------------------------ diff --git a/programs/media/animage/trunk/icons.inc b/programs/media/animage/trunk/icons.inc index 783432dc82..6fd0861138 100644 --- a/programs/media/animage/trunk/icons.inc +++ b/programs/media/animage/trunk/icons.inc @@ -82,7 +82,7 @@ draw_icons: ;buttons of zoom and [counter],0 - mov [Icon_X],ci_panel_x_pos+159 + mov [Icon_X],ci_panel_x_pos+178 next_button_zoom: diff --git a/programs/media/animage/trunk/menu_instruments.inc b/programs/media/animage/trunk/menu_instruments.inc index a4da5d1a31..f0df91e384 100644 --- a/programs/media/animage/trunk/menu_instruments.inc +++ b/programs/media/animage/trunk/menu_instruments.inc @@ -313,6 +313,14 @@ no_signum_fill_r_y_copy: sub ebx,edi 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 loop_fill_rectangle_y_copy: @@ -345,6 +353,9 @@ loop_fill_rectangle_x_copy: cmp eax,[rectangular_shade_y] jl loop_fill_rectangle_y_copy + ;...todo use system buffer... + ;mcall SF_CLIPBOARD,SSF_WRITE_CB,,[PointerToEditBufer] + call MovePictureToWorkScreen mov [DrawSprite_flag],1 jmp end_menu @@ -408,6 +419,15 @@ no_signum_fill_r_x_paste: no_signum_fill_r_y_paste: 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 loop_fill_rectangle_y_paste: @@ -428,15 +448,21 @@ loop_fill_rectangle_x_paste: mov eax,[x] add eax,[Dx_] + cmp eax,[paste_img_w] + je no_paste_data_x mov [x],eax cmp eax,[rectangular_shade_x] jl loop_fill_rectangle_x_paste +no_paste_data_x: mov eax,[y] add eax,[Dy_] + cmp eax,[paste_img_h] + je no_paste_data_y mov [y],eax cmp eax,[rectangular_shade_y] jl loop_fill_rectangle_y_paste +no_paste_data_y: call MovePictureToWorkScreen mov [Paste_flag],1 diff --git a/programs/media/animage/trunk/sprites.inc b/programs/media/animage/trunk/sprites.inc index 07f1269c20..bfca84e770 100644 --- a/programs/media/animage/trunk/sprites.inc +++ b/programs/media/animage/trunk/sprites.inc @@ -1,96 +1,108 @@ ;----------------------------------------------------------- -;------------------SaveFonForSprite------------------------- +;SaveFonForSprite: +; PointerToPicture -> PointerToSpriteBufer +; +;PutFonForSprite: +; PointerToSpriteBufer -> PointerToPicture +; +;DrawSprite: +; PointerToEditBufer -> PointerToPicture ;----------------------------------------------------------- -SaveFonForSprite: - mov edi,[PointerToSpriteBufer] +align 4 +SaveFonForSprite: mov ecx,[SpriteSizeX] + or ecx,ecx + jz .end_f mov edx,[Picture_SizeX] - sub edx,[SpriteSizeX] + sub edx,ecx mov esi,[SpriteCoordinatY] imul esi,[Picture_SizeX] add esi,[SpriteCoordinatX] lea edx,[edx+edx*2] lea esi,[esi+esi*2] add esi,[PointerToPicture] + mov edi,[PointerToSpriteBufer] mov ebx,[SpriteSizeY] mov [counter],ecx - next_line_sprite_save: + .next_line_sprite_save: mov ecx,[counter] - - next_pixel_sprite_save: +align 4 + @@: movsw movsb dec ecx - jnz next_pixel_sprite_save + jnz @b add esi,edx dec ebx - jnz next_line_sprite_save - + jnz .next_line_sprite_save +.end_f: ret ;----------------------------------------------------------- -;-------------------PutFonForSprite------------------------- -;----------------------------------------------------------- -PutFonForSprite: - mov esi,[PointerToSpriteBufer] +align 4 +PutFonForSprite: mov ecx,[SpriteSizeX] + or ecx,ecx + jz .end_f mov edx,[Picture_SizeX] - sub edx,[SpriteSizeX] + sub edx,ecx mov edi,[SpriteOldCoordinatY] imul edi,[Picture_SizeX] add edi,[SpriteOldCoordinatX] lea edx,[edx+edx*2] lea edi,[edi+edi*2] add edi,[PointerToPicture] + mov esi,[PointerToSpriteBufer] mov ebx,[SpriteSizeY] mov [counter],ecx - next_line_sprite_put: + .next_line_sprite_put: mov ecx,[counter] - - next_pixel_sprite_put: +align 4 + @@: movsw movsb dec ecx - jnz next_pixel_sprite_put + jnz @b add edi,edx dec ebx - jnz next_line_sprite_put - + jnz .next_line_sprite_put +.end_f: ret ;----------------------------------------------------------- -;------------------DrawFonForSprite------------------------- -;----------------------------------------------------------- -DrawSprite: - mov esi,[PointerToEditBufer] +align 4 +DrawSprite: mov ecx,[SpriteSizeX] + or ecx,ecx + jz .end_f mov edx,[Picture_SizeX] - sub edx,[SpriteSizeX] + sub edx,ecx mov edi,[SpriteCoordinatY] imul edi,[Picture_SizeX] add edi,[SpriteCoordinatX] lea edx,[edx+edx*2] lea edi,[edi+edi*2] add edi,[PointerToPicture] + mov esi,[PointerToEditBufer] mov ebx,[SpriteSizeY] mov [counter],ecx - next_line_sprite_draw: + .next_line_sprite_draw: mov ecx,[counter] - - next_pixel_sprite_draw: +align 4 + @@: movsw movsb dec ecx - jnz next_pixel_sprite_draw + jnz @b add edi,edx dec ebx - jnz next_line_sprite_draw - + jnz .next_line_sprite_draw +.end_f: ret