kiv: fixes in drawing and moving to next/prev images

git-svn-id: svn://kolibrios.org@1040 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Evgeny Grechnikov (Diamond) 2009-02-21 14:34:46 +00:00
parent 1415df25a3
commit 0c97a9c69c

View File

@ -233,6 +233,7 @@ free_img_data:
update_image_sizes: update_image_sizes:
pushf pushf
mov edx, [eax + Image.Width] mov edx, [eax + Image.Width]
mov [draw_width], edx
add edx, 19 add edx, 19
cmp edx, 40 + 25*9 cmp edx, 40 + 25*9
jae @f jae @f
@ -240,6 +241,7 @@ update_image_sizes:
@@: @@:
mov [wnd_width], edx mov [wnd_width], edx
mov esi, [eax + Image.Height] mov esi, [eax + Image.Height]
mov [draw_height], esi
add esi, 44 add esi, 44
mov [wnd_height], esi mov [wnd_height], esi
popf popf
@ -290,7 +292,7 @@ prev_image:
@@: @@:
cmp eax, [cur_file_idx] cmp eax, [cur_file_idx]
jz .notfound jz .notfound
push eax push eax ebx
imul esi, eax, 304 imul esi, eax, 304
add esi, [directory_ptr] add esi, [directory_ptr]
add esi, 32 + 40 add esi, 32 + 40
@ -307,15 +309,28 @@ prev_image:
jnz @b jnz @b
mov eax, curdir mov eax, curdir
call load_image call load_image
pop eax pushf
jc .scanloop
mov [cur_file_idx], eax
invoke img.destroy
mov esi, curdir mov esi, curdir
push esi
mov edi, @PARAMS mov edi, @PARAMS
mov ecx, 512/4 mov ecx, 512/4
rep movsd rep movsd
mov byte [edi-1], 0 mov byte [edi-1], 0
pop esi
@@:
lodsb
test al, al
jnz @b
@@:
dec esi
cmp byte [esi], '/'
jnz @b
mov byte [esi], 0
popf
pop ebx eax
jc .scanloop
mov [cur_file_idx], eax
invoke img.destroy
.ret: .ret:
ret ret
.notfound: .notfound:
@ -356,10 +371,7 @@ next_image:
jnz @b jnz @b
mov eax, curdir mov eax, curdir
call load_image call load_image
pop ebx eax pushf
jc .scanloop
mov [cur_file_idx], eax
invoke img.destroy
mov esi, curdir mov esi, curdir
push esi push esi
mov edi, @PARAMS mov edi, @PARAMS
@ -376,6 +388,11 @@ next_image:
cmp byte [esi], '/' cmp byte [esi], '/'
jnz @b jnz @b
mov byte [esi], 0 mov byte [esi], 0
popf
pop ebx eax
jc .scanloop
mov [cur_file_idx], eax
invoke img.destroy
.ret: .ret:
ret ret
.notfound: .notfound:
@ -512,6 +529,34 @@ free_directory:
ret ret
draw_window: draw_window:
cmp [bFirstDraw], 0
jz .posok
or ecx, -1
mcall 9, procinfo
cmp dword [ebx + 66], 0
jle .noredraw
mov edx, ecx
mov esi, ecx
cmp dword [ebx + 42], 40 + 25 * 9
jae @f
mov edx, 40 + 25 * 9
@@:
cmp dword [ebx + 46], 70
jae @f
mov esi, 70
@@:
mov eax, edx
and eax, esi
cmp eax, -1
jz @f
mov ebx, ecx
mcall 67
@@:
.posok:
mcall 12, 1
mcall 48, 4 mcall 48, 4
mov ebp, eax ; save skin height mov ebp, eax ; save skin height
add eax, [wnd_height] add eax, [wnd_height]
@ -521,34 +566,37 @@ draw_window:
mcall 0, , , 0x73FFFFFF, , s_header mcall 0, , , 0x73FFFFFF, , s_header
mcall 9, procinfo, -1 mcall 9, procinfo, -1
mov [bFirstDraw], 1
mov ebx, [procinfo + 62] mov ebx, [procinfo + 62]
inc ebx inc ebx
mcall 13, , <0, 35>, 0xFFFFFF mcall 13, , <0, 35>, 0xFFFFFF
mov ecx, [procinfo + 66] mov ecx, [procinfo + 66]
sub ecx, 4 inc ecx
shl ecx, 16 mov esi, [draw_height]
mov cl, 5 add esi, 35
mcall sub ecx, esi
mov cl, 35 jbe @f
ror ecx, 16
sub cx, 35
mov ebx, 5
mcall
; 5 pixels for indentation, [image.Width] pixels for image
; client_width - 5 - [image.Width] pixels must be white
mov ebx, [image]
mov esi, [procinfo + 62]
inc esi
push esi push esi
mov ebx, [ebx + Image.Width] shl esi, 16
sub esi, 5 add ecx, esi
sub esi, ebx pop esi
pop ebx mcall
xor ecx, ecx
@@:
add ecx, esi
add ecx, 35*10000h - 35
__mov ebx, 0, 5
mcall
mov esi, [draw_width]
add esi, ebx
mov ebx, [procinfo+62]
inc ebx
sub ebx, esi sub ebx, esi
shl ebx, 16 jbe @f
shl esi, 16
add ebx, esi add ebx, esi
mcall mcall
@@:
mov ebx, [procinfo + 62] mov ebx, [procinfo + 62]
push ebx push ebx
@ -601,23 +649,43 @@ draw_window:
mcall , buttons+rot180btn*20 mcall , buttons+rot180btn*20
mov ebx, [image] mov ebx, [image]
mov ecx, [ebx + Image.Width] mov ecx, [procinfo+62]
sub ecx, 4
mov ebp, [ebx + Image.Width]
cmp ecx, ebp
jb @f
mov ecx, ebp
@@:
sub ebp, ecx
mov edx, [procinfo+66]
sub edx, 34
cmp edx, [ebx + Image.Height]
jb @f
mov edx, [ebx + Image.Height]
@@:
shl ecx, 16 shl ecx, 16
add ecx, [ebx + Image.Height] add ecx, edx
__mov edx, 5, 35 __mov edx, 5, 35
mov esi, 8 mov esi, 8
cmp [ebx + Image.Type], Image.bpp8 cmp [ebx + Image.Type], Image.bpp8
jz @f jz .bpp8
mov esi, 24
cmp [ebx + Image.Type], Image.bpp24 cmp [ebx + Image.Type], Image.bpp24
jz @f jz .bpp24
mov esi, 32 mov esi, 32
shl ebp, 2
jmp @f
.bpp24:
mov esi, 24
lea ebp, [ebp*3]
.bpp8:
@@: @@:
mov edi, [ebx + Image.Palette] mov edi, [ebx + Image.Palette]
mov ebx, [ebx + Image.Data] mov ebx, [ebx + Image.Data]
xor ebp, ebp
mcall 65 mcall 65
mcall 12, 2
.noredraw:
ret ret
; void* __stdcall mem.Alloc(unsigned size); ; void* __stdcall mem.Alloc(unsigned size);
@ -880,6 +948,7 @@ import libimg , \
import sort, sort.START, 'START', SortDir, 'SortDir', strcmpi, 'strcmpi' import sort, sort.START, 'START', SortDir, 'SortDir', strcmpi, 'strcmpi'
bFirstDraw db 0
;----------------------------------------------------------------------------- ;-----------------------------------------------------------------------------
virtual at 0 virtual at 0
@ -950,6 +1019,8 @@ fh dd ?
image dd ? image dd ?
wnd_width dd ? wnd_width dd ?
wnd_height dd ? wnd_height dd ?
draw_width dd ?
draw_height dd ?
last_name_component dd ? last_name_component dd ?
cur_file_idx dd ? cur_file_idx dd ?