Subversion Repositories Kolibri OS

Compare Revisions

Regard whitespace Rev 226 → Rev 227

/kernel/trunk/video/cursors.inc
151,7 → 151,6
sub [height],1
jnz .row_24
ret
 
endp
 
align 4
172,6 → 171,8
ret
.found:
btr [ebx], eax
popfd
 
mov [cursor_start],ebx
sub ebx, cursor_map
shl ebx, 3
178,49 → 179,59
add eax,ebx
shl eax,3
lea eax,[cursors+eax+eax*2]
popfd
 
xor ebx, ebx
mov [eax+CURSOR.magic], 'CURS'
mov [eax+CURSOR.size], CURSOR_SIZE
mov [eax+CURSOR.pid], ebx
mov [eax+CURSOR.hot_x], ebx
mov [eax+CURSOR.hot_y], ebx
ret
endp
 
align 4
proc create_cursor
locals
h_cur dd ?
endl
proc set_cursor stdcall, hcursor:dword
mov eax, [hcursor]
mov ebx, [CURRENT_TASK]
shl ebx, 8
xchg eax, [ebx+PROC_BASE+APPDATA.cursor]
ret
endp
 
call alloc_cursor
proc vesa_cursor stdcall, hcursor:dword, src:dword, flags:dword
 
stdcall kernel_alloc, 0x1000
test eax, eax
jz .fail
 
mov [h_cur], eax
mov edi, eax
mov edi, [hcursor]
mov [edi+CURSOR.base], eax
 
xor ebx, ebx
mov esi, [src]
mov ebx, [flags]
cmp bx, LOAD_INDIRECT
je .indirect
 
mov [edi+CURSOR.magic], 'CURS'
mov [edi+CURSOR.size], CURSOR_SIZE
mov [edi+CURSOR.pid], ebx
mov [edi+CURSOR.hot_x], ebx
mov [edi+CURSOR.hot_y], ebx
movzx ecx, word [esi+10]
movzx edx, word [esi+12]
mov [edi+CURSOR.hot_x], ecx
mov [edi+CURSOR.hot_y], edx
 
stdcall kernel_alloc, dword 0x2000
test eax, eax
jz .fail
 
mov ebx, eax
mov eax, [h_cur]
mov [eax+CURSOR.base], ebx
ret
stdcall vesa_init_cursor, eax, esi
mov eax, [hcursor]
.fail:
ret
endp
.indirect:
shr ebx, 16
movzx ecx, bh
movzx edx, bl
mov [eax+CURSOR.hot_x], ecx
mov [eax+CURSOR.hot_y], edx
 
align 4
proc set_cursor stdcall, hcursor:dword
mov eax, [hcursor]
mov ebx, [CURRENT_TASK]
shl ebx, 8
xchg eax, [ebx+PROC_BASE+APPDATA.cursor]
xchg edi, eax
mov ecx, 1024
cld
rep movsd
ret
endp
 
230,75 → 241,29
handle dd ?
endl
 
movzx eax, word [flags]
cmp eax, LOAD_FROM_FILE
jne .from_mem
xor eax, eax
mov [handle], eax
cmp word [flags], LOAD_FROM_FILE
jne @F
 
stdcall load_file, [src]
test eax, eax
jz .exit
mov [src], eax
 
call create_cursor
@@:
call alloc_cursor
test eax, eax
jz .fail
 
stdcall [create_cursor], eax, [src], [flags]
mov [handle], eax
mov esi, [src]
movzx ebx, word [esi+10]
movzx ecx, word [esi+12]
mov [eax+CURSOR.hot_x], ebx
mov [eax+CURSOR.hot_y], ecx
 
stdcall vesa_init_cursor, [eax+CURSOR.base], esi
.fail:
cmp word [flags], LOAD_FROM_FILE
jne .exit
stdcall kernel_free, [src]
.exit:
mov eax, [handle]
ret
 
.from_mem:
cmp eax, LOAD_FROM_MEM
jne .indirect
 
call create_cursor
test eax, eax
jz .exit
 
mov [handle], eax
mov esi, [src]
movzx ebx, word [esi+10]
movzx ecx, word [esi+12]
mov [eax+CURSOR.hot_x], ebx
mov [eax+CURSOR.hot_y], ecx
 
stdcall vesa_init_cursor, [eax+CURSOR.base], [src]
mov eax, [handle]
ret
 
.indirect:
cmp eax, LOAD_INDIRECT
jne .fail
 
call create_cursor
test eax, eax
jz .exit
 
movzx edx, byte [flags+2]
movzx ebx, byte [flags+3]
mov [eax+CURSOR.hot_x], ebx
mov [eax+CURSOR.hot_y], edx
 
mov edi, [eax+CURSOR.base]
mov esi, [src]
mov ecx, 1024
cld
rep movsd
ret
.fail:
mov ebx, [src]
stdcall kernel_free, ebx
.exit:
xor eax, eax
ret
endp
 
align 4
330,9 → 295,19
add edx, 4
mov [cursor_end], edx
 
stdcall load_driver, drv_hw_mouse
test eax, eax
jz .sw_mouse
 
stdcall load_cursor, def_arrow, dword LOAD_FROM_MEM
mov [def_cursor], eax
ret
.sw_mouse:
mov [create_cursor], vesa_cursor
 
stdcall load_cursor, def_arrow, dword LOAD_FROM_MEM
mov [def_cursor], eax
 
mov ecx, [SCR_X_SIZE]
mov edx, [SCR_Y_SIZE]
inc ecx
446,7 → 421,6
 
sub edi, ecx
cmp edi, eax
;cmovg edi, eax
jng @F
mov edi, eax
@@:
454,7 → 428,6
 
sub edx, [y]
cmp edx, eax
;cmovg edx, eax
jng @F
mov edx, eax
@@:
559,7 → 532,6
 
sub edi, ecx
cmp edi, eax
; cmovg edi, eax
jng @F
mov edi, eax
@@:
567,7 → 539,6
 
sub edx, [y]
cmp edx, eax
; cmovg edx, eax
jng @F
mov edx, eax
@@: