more correct background redraw

git-svn-id: svn://kolibrios.org@1392 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Evgeny Grechnikov (Diamond) 2010-02-07 12:57:42 +00:00
parent ddd29cc90f
commit 1ee7b4055e
2 changed files with 34 additions and 18 deletions

View File

@ -260,6 +260,7 @@ SYS_SHUTDOWN equ (OS_BASE+0x000FF00)
TASK_ACTIVATE equ (OS_BASE+0x000FF01) TASK_ACTIVATE equ (OS_BASE+0x000FF01)
REDRAW_BACKGROUND equ (OS_BASE+0x000FFF0) REDRAW_BACKGROUND equ (OS_BASE+0x000FFF0)
BACKGROUND_CHANGED equ (OS_BASE+0x000FFF1)
BANK_RW equ (OS_BASE+0x000FFF2) BANK_RW equ (OS_BASE+0x000FFF2)
MOUSE_BACKGROUND equ (OS_BASE+0x000FFF4) MOUSE_BACKGROUND equ (OS_BASE+0x000FFF4)
DONT_DRAW_MOUSE equ (OS_BASE+0x000FFF5) DONT_DRAW_MOUSE equ (OS_BASE+0x000FFF5)

View File

@ -2436,8 +2436,8 @@ draw_background_temp:
;draw_background_temp: ;draw_background_temp:
; mov [bgrchanged],1 ;0 ; mov [bgrchanged],1 ;0
mov [background_defined], 1 mov [background_defined], 1
mov byte[BACKGROUND_CHANGED], 1
call force_redraw_background call force_redraw_background
mov [REDRAW_BACKGROUND], byte 2
nosb31: nosb31:
ret ret
nosb3: nosb3:
@ -2557,15 +2557,15 @@ nosb7:
ret ret
force_redraw_background: force_redraw_background:
and [draw_data+32 + RECT.left],dword 0 and [draw_data+32 + RECT.left], 0
and [draw_data+32 + RECT.top],dword 0 and [draw_data+32 + RECT.top], 0
push eax ebx push eax ebx
mov eax,[Screen_Max_X] mov eax,[Screen_Max_X]
mov ebx,[Screen_Max_Y] mov ebx,[Screen_Max_Y]
mov [draw_data+32 + RECT.right],eax mov [draw_data+32 + RECT.right],eax
mov [draw_data+32 + RECT.bottom],ebx mov [draw_data+32 + RECT.bottom],ebx
pop ebx eax pop ebx eax
mov byte [REDRAW_BACKGROUND], 1 inc byte[REDRAW_BACKGROUND]
ret ret
align 4 align 4
@ -3083,27 +3083,36 @@ set_mouse_event:
loop set_mouse_event loop set_mouse_event
mouse_not_active: mouse_not_active:
cmp [REDRAW_BACKGROUND],byte 0 ; background update ? cmp byte[BACKGROUND_CHANGED], 0
jz nobackgr jz no_set_bgr_event
cmp [background_defined], 0
jz nobackgr
cmp [REDRAW_BACKGROUND], byte 2
jnz no_set_bgr_event
xor edi, edi xor edi, edi
mov ecx, [TASK_COUNT] mov ecx, [TASK_COUNT]
set_bgr_event: set_bgr_event:
add edi, 256 add edi, 256
or [edi+SLOT_BASE+APPDATA.event_mask], 16 or [edi+SLOT_BASE+APPDATA.event_mask], 16
loop set_bgr_event loop set_bgr_event
mov byte[BACKGROUND_CHANGED], 0
no_set_bgr_event: no_set_bgr_event:
cmp byte[REDRAW_BACKGROUND], 0 ; background update ?
jz nobackgr
cmp [background_defined], 0
jz nobackgr
; mov [draw_data+32 + RECT.left],dword 0 ; mov [draw_data+32 + RECT.left],dword 0
; mov [draw_data+32 + RECT.top],dword 0 ; mov [draw_data+32 + RECT.top],dword 0
; mov eax,[Screen_Max_X] ; mov eax,[Screen_Max_X]
; mov ebx,[Screen_Max_Y] ; mov ebx,[Screen_Max_Y]
; mov [draw_data+32 + RECT.right],eax ; mov [draw_data+32 + RECT.right],eax
; mov [draw_data+32 + RECT.bottom],ebx ; mov [draw_data+32 + RECT.bottom],ebx
@@:
call drawbackground call drawbackground
mov [REDRAW_BACKGROUND],byte 0 xor eax, eax
xchg al, [REDRAW_BACKGROUND]
test al, al ; got new update request?
jnz @b
mov [draw_data+32 + RECT.left], eax
mov [draw_data+32 + RECT.top], eax
mov [draw_data+32 + RECT.right], eax
mov [draw_data+32 + RECT.bottom], eax
mov [MOUSE_BACKGROUND],byte 0 mov [MOUSE_BACKGROUND],byte 0
nobackgr: nobackgr:
@ -3219,32 +3228,37 @@ redrawscreen:
cmp ecx,1 cmp ecx,1
jnz .az jnz .az
mov al,[REDRAW_BACKGROUND] ; cmp byte[BACKGROUND_CHANGED], 0
cmp al,2 ; jnz newdw8
jz newdw8 cmp byte[REDRAW_BACKGROUND], 0
test al,al
jz .az jz .az
mov dl, 0
lea eax,[edi+draw_data-window_data] lea eax,[edi+draw_data-window_data]
mov ebx,[draw_limits.left] mov ebx,[draw_limits.left]
cmp ebx,[eax+RECT.left] cmp ebx,[eax+RECT.left]
jae @f jae @f
mov [eax+RECT.left],ebx mov [eax+RECT.left],ebx
mov dl, 1
@@: @@:
mov ebx,[draw_limits.top] mov ebx,[draw_limits.top]
cmp ebx,[eax+RECT.top] cmp ebx,[eax+RECT.top]
jae @f jae @f
mov [eax+RECT.top],ebx mov [eax+RECT.top],ebx
mov dl, 1
@@: @@:
mov ebx,[draw_limits.right] mov ebx,[draw_limits.right]
cmp ebx,[eax+RECT.right] cmp ebx,[eax+RECT.right]
jbe @f jbe @f
mov [eax+RECT.right],ebx mov [eax+RECT.right],ebx
mov dl, 1
@@: @@:
mov ebx,[draw_limits.bottom] mov ebx,[draw_limits.bottom]
cmp ebx,[eax+RECT.bottom] cmp ebx,[eax+RECT.bottom]
jbe @f jbe @f
mov [eax+RECT.bottom],ebx mov [eax+RECT.bottom],ebx
mov dl, 1
@@: @@:
add byte[REDRAW_BACKGROUND], dl
jmp newdw8 jmp newdw8
.az: .az:
@ -3264,7 +3278,7 @@ redrawscreen:
cmp dword [esp],1 cmp dword [esp],1
jne nobgrd jne nobgrd
mov byte [REDRAW_BACKGROUND], 1 inc byte[REDRAW_BACKGROUND]
newdw8: newdw8:
nobgrd: nobgrd:
@ -3294,6 +3308,7 @@ calculatebackground: ; background
rep stosd rep stosd
mov byte[REDRAW_BACKGROUND], 0 ; do not draw background! mov byte[REDRAW_BACKGROUND], 0 ; do not draw background!
mov byte[BACKGROUND_CHANGED], 0
ret ret