kiv: Fix canvas size calculation bug when pressing '=' twice.

Reported by Leency:
1. Open "Home.jpg" image in KIV.
2. Press '=' two or more times.
=> Each time image becomes smaller on the right bottom.

git-svn-id: svn://kolibrios.org@7726 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Ivan Baravy 2020-02-20 01:26:27 +00:00
parent 3163804b76
commit d8113abd2e

View File

@ -154,7 +154,6 @@ still:
mouse: mouse:
mov [pict_moved], 0 mov [pict_moved], 0
invoke scrollbar_vert_mouse, scroll_bar_data_vertical invoke scrollbar_vert_mouse, scroll_bar_data_vertical
invoke scrollbar_hort_mouse, scroll_bar_data_horizontal invoke scrollbar_hort_mouse, scroll_bar_data_horizontal
xor ecx, ecx xor ecx, ecx
@ -327,16 +326,18 @@ keyloop:
call slide_show call slide_show
jmp keyloop jmp keyloop
.set_scale_none: .set_scale_none:
stdcall set_scale_mode, LIBIMG_SCALE_NONE mov eax, LIBIMG_SCALE_NONE
mov eax, [scale_mode] call set_scale_mode
jz @f
call recalc_canvas call recalc_canvas
; call draw_view @@:
jmp keyloop jmp keyloop
.set_scale_fit_min: .set_scale_fit_min:
stdcall set_scale_mode, LIBIMG_SCALE_FIT_MIN mov eax, LIBIMG_SCALE_FIT_MIN
mov eax, [scale_mode] call set_scale_mode
jz @f
call recalc_work call recalc_work
; call draw_view @@:
jmp keyloop jmp keyloop
.move_pictport_left: .move_pictport_left:
stdcall move_pictport, -KEY_MOVE_PIXELS, 0 stdcall move_pictport, -KEY_MOVE_PIXELS, 0
@ -669,14 +670,6 @@ proc slide_show
mov [bShowToolbarSave], al mov [bShowToolbarSave], al
mov [bShowToolbar], 0 mov [bShowToolbar], 0
mov [canvas_padding], 0 mov [canvas_padding], 0
; mov eax, [procinfo.box.width]
; mov [window.width], eax
; mov eax, [procinfo.box.height]
; mov [window.height], eax
; mov eax, [procinfo.box.left]
; mov [window.left], eax
; mov eax, [procinfo.box.top]
; mov [window.top], eax
mov [bg_color], 0x00000000 mov [bg_color], 0x00000000
mcall SF_GET_SCREEN_SIZE mcall SF_GET_SCREEN_SIZE
mov edx, eax mov edx, eax
@ -684,7 +677,8 @@ proc slide_show
movzx eax, ax movzx eax, ax
mov esi, eax mov esi, eax
mcall SF_CHANGE_WINDOW, 0, 0, , mcall SF_CHANGE_WINDOW, 0, 0, ,
stdcall set_scale_mode, LIBIMG_SCALE_FIT_MIN mov eax, LIBIMG_SCALE_FIT_MIN
call set_scale_mode
.done: .done:
pop edi esi ebx pop edi esi ebx
@ -1777,17 +1771,12 @@ proc scale_fit_min_calc
endp endp
proc set_scale_mode _mode ; eax: new scaling mode
push eax ecx ; z/Z - not/changed
xor ecx, ecx proc set_scale_mode
mov eax, [_mode] cmp eax, [scale_mode]
cmp [scale_mode], eax
jz @f
mov [bScaleModeChanged], 1
mov [scale_mode], eax mov [scale_mode], eax
@@: setnz [bScaleModeChanged]
pop ecx eax
ret ret
endp endp