from Mario79: rewritten background image code

git-svn-id: svn://kolibrios.org@469 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Sergey Semyonov (Serge) 2007-04-24 08:56:03 +00:00
parent 016062e7e6
commit db5fd1e74a
5 changed files with 732 additions and 801 deletions

View File

@ -282,7 +282,6 @@ BUTTON_INFO equ (OS_BASE+0x02C0000)
RESERVED_PORTS equ (OS_BASE+0x02D0000) RESERVED_PORTS equ (OS_BASE+0x02D0000)
IRQ_SAVE equ (OS_BASE+0x02E0000) IRQ_SAVE equ (OS_BASE+0x02E0000)
BOOT_VAR equ (OS_BASE+0x02f0000) BOOT_VAR equ (OS_BASE+0x02f0000)
IMG_BACKGROUND equ (OS_BASE+0x0300000)
WinMapAddress equ (OS_BASE+0x0460000) WinMapAddress equ (OS_BASE+0x0460000)
display_data equ (OS_BASE+0x0460000) display_data equ (OS_BASE+0x0460000)

View File

@ -329,6 +329,8 @@ com1_mouse_detected rb 1
com2_mouse_detected rb 1 com2_mouse_detected rb 1
;* end code - Mario79 ;* end code - Mario79
img_background rd 1
mem_BACKGROUND rd 1
wraw_bacground_select rb 1 wraw_bacground_select rb 1
lba_read_enabled rd 1 ; 0 = disabled , 1 = enabled lba_read_enabled rd 1 ; 0 = disabled , 1 = enabled

View File

@ -500,12 +500,22 @@ high_code:
mov [graph_data_l+4],al mov [graph_data_l+4],al
mov [graph_data_l+7],ah mov [graph_data_l+7],ah
mov [CURRENT_TASK],dword 1 mov [CURRENT_TASK],dword 1
mov [TASK_COUNT],dword 1 mov [TASK_COUNT],dword 1
mov [TASK_BASE],dword TASK_DATA mov [TASK_BASE],dword TASK_DATA
mov [current_slot], SLOT_BASE+256 mov [current_slot], SLOT_BASE+256
; set background
xor eax,eax
inc eax
mov [display_data-12],eax
mov [display_data-8],eax
mov [display_data-4],eax
mov [mem_BACKGROUND],4095
stdcall kernel_alloc, [mem_BACKGROUND]
mov [img_background], eax
;!!!!!!!!!!!!!!!!!!!!!!!!!! ;!!!!!!!!!!!!!!!!!!!!!!!!!!
include 'detect/disks.inc' include 'detect/disks.inc'
;!!!!!!!!!!!!!!!!!!!!!!!!!! ;!!!!!!!!!!!!!!!!!!!!!!!!!!
@ -2296,8 +2306,37 @@ sys_background:
mov [display_data-8],ebx mov [display_data-8],ebx
mov [display_data-4],ecx mov [display_data-4],ecx
; mov [bgrchanged],1 ; mov [bgrchanged],1
pushad
; return memory for old background
stdcall kernel_free, [img_background]
; calculate RAW size
xor eax,eax
inc eax
cmp [display_data-8],eax
jae @f
mov [display_data-8],eax
@@:
cmp [display_data-4],eax
jae @f
mov [display_data-4],eax
@@:
mov eax,[display_data-8]
imul eax,[display_data-4]
inc eax
imul eax,3
mov [mem_BACKGROUND],eax
; get memory for new background
stdcall kernel_alloc, [mem_BACKGROUND]
test eax, eax
jz .exit_mem
mov [img_background], eax
.exit_mem:
popad
sbgrr: sbgrr:
ret ret
nosb1: nosb1:
cmp eax,2 ; SET PIXEL cmp eax,2 ; SET PIXEL
@ -2309,7 +2348,12 @@ sys_background:
and edx,0xFF000000 ;255*256*256*256 and edx,0xFF000000 ;255*256*256*256
and ecx,0x00FFFFFF ;255*256*256+255*256+255 and ecx,0x00FFFFFF ;255*256*256+255*256+255
add edx,ecx add edx,ecx
mov [ebx+IMG_BACKGROUND],edx
; mov [ebx+IMG_BACKGROUND],edx
push eax
mov eax,[img_background]
mov [ebx+eax],edx
pop eax
; mov [bgrchanged],1 ; mov [bgrchanged],1
ret ret
nosb2: nosb2:
@ -2342,29 +2386,17 @@ draw_background_temp:
; bughere ; bughere
mov edi, [TASK_BASE] mov edi, [TASK_BASE]
add ebx, [edi+TASKDATA.mem_start] add ebx, [edi+TASKDATA.mem_start]
; mov esi, ebx
; mov edi, ecx
mov eax, ebx mov eax, ebx
mov ebx, ecx mov ebx, ecx
add ecx, edx add ecx, edx
cmp ecx, 0x160000-16 add ebx, [img_background] ;IMG_BACKGROUND
ja .fin
; add edi, 0x300000
add ebx, IMG_BACKGROUND
mov ecx, edx mov ecx, edx
cmp ecx, 0x160000-16
ja .fin
; mov [bgrchanged],1
; cld
; rep movsb
call memmove call memmove
.fin: .fin:
ret ret
nosb5: nosb5:
ret ret
align 4 align 4
sys_getbackground: sys_getbackground:
@ -2380,10 +2412,13 @@ sys_getbackground:
cmp eax,2 ; PIXEL cmp eax,2 ; PIXEL
jnz nogb2 jnz nogb2
mov edx,0x160000-16 ; mov edx,0x160000-16
cmp edx,ebx ; cmp edx,ebx
jbe nogb2 ; jbe nogb2
mov eax, [ebx+IMG_BACKGROUND] ; mov eax, [ebx+IMG_BACKGROUND]
mov eax,[img_background]
mov eax,[ebx+eax]
and eax, 0xFFFFFF and eax, 0xFFFFFF
mov [esp+36],eax mov [esp+36],eax
ret ret
@ -3533,12 +3568,12 @@ calculatebackground: ; background
; all black ; all black
mov [display_data-8],dword 4 ; size x ; mov [display_data-8],dword 4 ; size x
mov [display_data-4],dword 2 ; size y ; mov [display_data-4],dword 2 ; size y
mov edi, IMG_BACKGROUND ; set background to black mov edi, [img_background] ;IMG_BACKGROUND ; set background to black
xor eax, eax xor eax, eax
mov ecx, 0x0fff00 / 4 mov ecx, 1023 ;0x0fff00 / 4
cld cld
rep stosd rep stosd

View File

@ -220,7 +220,7 @@ vesa12_drawbackground:
push eax push eax
push ebx push ebx
mov esi,IMG_BACKGROUND mov esi,[img_background] ;IMG_BACKGROUND
cmp [WinMapAddress-12],dword 1 ; tiled background cmp [WinMapAddress-12],dword 1 ; tiled background
jne no_vesa12_tiled_bgr jne no_vesa12_tiled_bgr
@ -282,7 +282,7 @@ vesa12_drawbackground:
add esi,eax add esi,eax
add esi,eax add esi,eax
add esi,eax add esi,eax
add esi,IMG_BACKGROUND add esi,[img_background] ;IMG_BACKGROUND
pop ebx pop ebx
pop eax pop eax

File diff suppressed because it is too large Load Diff