* gui/window.inc optimizations: check_window_position & set_screen speedup

git-svn-id: svn://kolibrios.org@1368 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Mihail Semenyako (mike.dld) 2010-01-08 12:20:53 +00:00
parent 342688c49e
commit dd75d94380

View File

@ -327,18 +327,18 @@ calculatescreen: ;/////////////////////////////////////////////////////////////
mov eax, [edi + WDATA.box.left] mov eax, [edi + WDATA.box.left]
cmp eax, [esp + RECT.right] cmp eax, [esp + RECT.right]
ja .skip_window jg .skip_window
mov ebx, [edi + WDATA.box.top] mov ebx, [edi + WDATA.box.top]
cmp ebx, [esp + RECT.bottom] cmp ebx, [esp + RECT.bottom]
ja .skip_window jg .skip_window
mov ecx, [edi + WDATA.box.width] mov ecx, [edi + WDATA.box.width]
add ecx, eax add ecx, eax
cmp ecx, [esp + RECT.left] cmp ecx, [esp + RECT.left]
jb .skip_window jl .skip_window
mov edx, [edi + WDATA.box.height] mov edx, [edi + WDATA.box.height]
add edx, ebx add edx, ebx
cmp edx, [esp + RECT.top] cmp edx, [esp + RECT.top]
jb .skip_window jl .skip_window
cmp eax, [esp + RECT.left] cmp eax, [esp + RECT.left]
jae @f jae @f
@ -454,49 +454,63 @@ check_window_position: ;///////////////////////////////////////////////////////
mov esi, [Screen_Max_X] mov esi, [Screen_Max_X]
cmp ecx, esi cmp ecx, esi
jbe .check_left ja .fix_width
mov ecx, esi
mov [edi + WDATA.box.width], esi
.check_left: .check_left:
or eax, eax or eax, eax
jg @f jl .fix_left_low
xor eax, eax add eax, ecx
jmp .fix_left
@@: add eax, ecx
cmp eax, esi cmp eax, esi
jle .check_height jg .fix_left_high
mov eax, esi
sub eax, ecx
.fix_left:
mov [edi + WDATA.box.left], eax
.check_height: .check_height:
mov esi, [Screen_Max_Y] mov esi, [Screen_Max_Y]
cmp edx, esi cmp edx, esi
jbe .check_top ja .fix_height
mov edx, esi
mov [edi + WDATA.box.height], esi
.check_top: .check_top:
or ebx, ebx or ebx, ebx
jg @f jl .fix_top_low
xor ebx, ebx add ebx, edx
jmp .fix_top
@@: add ebx, edx
cmp ebx, esi cmp ebx, esi
jle .exit jg .fix_top_high
mov ebx, esi
sub ebx, edx
.fix_top:
mov [edi + WDATA.box.top], ebx
.exit: .exit:
pop esi edx ecx ebx eax pop esi edx ecx ebx eax
ret ret
.fix_width:
mov ecx, esi
mov [edi + WDATA.box.width], esi
jmp .check_left
.fix_left_low:
xor eax, eax
mov [edi + WDATA.box.left], eax
jmp .check_height
.fix_left_high:
mov eax, esi
sub eax, ecx
mov [edi + WDATA.box.left], eax
jmp .check_height
.fix_height:
mov edx, esi
mov [edi + WDATA.box.height], esi
jmp .check_top
.fix_top_low:
xor ebx, ebx
mov [edi + WDATA.box.top], ebx
jmp .exit
.fix_top_high:
mov ebx, esi
sub ebx, edx
mov [edi + WDATA.box.top], ebx
jmp .exit
align 4 align 4
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------
sys_window_mouse: ;//////////////////////////////////////////////////////////// sys_window_mouse: ;////////////////////////////////////////////////////////////
@ -1510,19 +1524,28 @@ end virtual
inc edx inc edx
; get WinMap start ; get WinMap start
push esi
mov edi, [Screen_Max_X] mov edi, [Screen_Max_X]
inc edi inc edi
mov esi, edi
imul edi, ebx imul edi, ebx
add edi, eax add edi, eax
add edi, [_WinMapAddress] add edi, [_WinMapAddress]
mov eax, esi pop eax
mov ah, al
push ax
shl eax, 16
pop ax
.next_line: .next_line:
push ecx push ecx
shr ecx, 2
rep stosd
mov ecx, [esp]
and ecx, 3
rep stosb rep stosb
pop ecx pop ecx
add edi, [Screen_Max_X] add edi, esi
inc edi
sub edi, ecx sub edi, ecx
dec edx dec edx
jnz .next_line jnz .next_line
@ -1640,55 +1663,54 @@ window._.window_activate: ;////////////////////////////////////////////////////
push eax ebx push eax ebx
; if type of current active window is 3 or 4, it must be redrawn ; if type of current active window is 3 or 4, it must be redrawn
mov eax, [TASK_COUNT] mov ebx, [TASK_COUNT]
movzx eax, word[WIN_POS + eax * 2] movzx ebx, word[WIN_POS + ebx * 2]
shl eax, 5 shl ebx, 5
add eax, window_data add eax, window_data
mov bl, [eax + WDATA.fl_wstyle] mov al, [window_data + ebx + WDATA.fl_wstyle]
and bl, 0x0f and al, 0x0f
cmp bl, 0x03 cmp al, 0x03
je .set_window_redraw_flag je .set_window_redraw_flag
cmp bl, 0x04 cmp al, 0x04
je .set_window_redraw_flag jne .move_others_down
jmp .move_others_down
.set_window_redraw_flag: .set_window_redraw_flag:
mov [eax + WDATA.fl_redraw], 1 mov [window_data + ebx + WDATA.fl_redraw], 1
.move_others_down: .move_others_down:
; ax <- process no ; ax <- process no
movzx eax, word[esi] movzx ebx, word[esi]
; ax <- position in window stack ; ax <- position in window stack
movzx eax, word[WIN_STACK + eax * 2] movzx ebx, word[WIN_STACK + ebx * 2]
; drop others ; drop others
xor ebx, ebx xor eax, eax
.next_stack_window: .next_stack_window:
cmp ebx, [TASK_COUNT] cmp eax, [TASK_COUNT]
jae .move_self_up jae .move_self_up
inc ebx inc eax
cmp [WIN_STACK + ebx * 2], ax cmp [WIN_STACK + eax * 2], bx
jbe .next_stack_window jbe .next_stack_window
dec word[WIN_STACK + ebx * 2] dec word[WIN_STACK + eax * 2]
jmp .next_stack_window jmp .next_stack_window
.move_self_up: .move_self_up:
movzx eax, word[esi] movzx ebx, word[esi]
; number of processes ; number of processes
mov bx, [TASK_COUNT] mov ax, [TASK_COUNT]
; this is the last (and the upper) ; this is the last (and the upper)
mov [WIN_STACK + eax * 2], bx mov [WIN_STACK + ebx * 2], ax
; update on screen - window stack ; update on screen - window stack
xor ebx, ebx xor eax, eax
.next_window_pos: .next_window_pos:
cmp ebx, [TASK_COUNT] cmp eax, [TASK_COUNT]
jae .reset_vars jae .reset_vars
inc ebx inc eax
movzx eax, word[WIN_STACK + ebx * 2] movzx ebx, word[WIN_STACK + eax * 2]
mov [WIN_POS + eax * 2], bx mov [WIN_POS + ebx * 2], ax
jmp .next_window_pos jmp .next_window_pos
.reset_vars: .reset_vars: