From 077f779deaadd5120e296c8fbc76cbddff6b6e5a Mon Sep 17 00:00:00 2001 From: "Sergey Semyonov (Serge)" Date: Wed, 29 Nov 2006 07:32:57 +0000 Subject: [PATCH] fixed cursor clipping in 24bpp video mode git-svn-id: svn://kolibrios.org@224 a494cfbc-eb01-0410-851d-a64ba20cac60 --- kernel/trunk/boot/shutdown.inc | 1 + kernel/trunk/drivers/sis.asm | 4 +- kernel/trunk/drivers/unisound.asm | 7 ++- kernel/trunk/kernel.asm | 2 - kernel/trunk/video/cursors.inc | 93 ++++++++++++++++++++++++++++--- 5 files changed, 94 insertions(+), 13 deletions(-) diff --git a/kernel/trunk/boot/shutdown.inc b/kernel/trunk/boot/shutdown.inc index 2edafb9f7d..87cd3675c6 100644 --- a/kernel/trunk/boot/shutdown.inc +++ b/kernel/trunk/boot/shutdown.inc @@ -9,6 +9,7 @@ system_shutdown: ; shut down the system + call stop_all_services push 3 ; stop playing cd pop eax diff --git a/kernel/trunk/drivers/sis.asm b/kernel/trunk/drivers/sis.asm index 462df26971..6863c4c0b8 100644 --- a/kernel/trunk/drivers/sis.asm +++ b/kernel/trunk/drivers/sis.asm @@ -334,6 +334,9 @@ proc START stdcall, state:dword ret .stop: call stop + mov ax, 0x1c + mov edx, PCM_OUT_SR_REG + call [ctrl.ctrl_write16] mov [ctrl.user_callback], 0 ret endp @@ -891,7 +894,6 @@ proc stop mov [ctrl.lvi_reg], eax mov edx, PCM_OUT_LVI_REG call [ctrl.ctrl_write8] - ret endp diff --git a/kernel/trunk/drivers/unisound.asm b/kernel/trunk/drivers/unisound.asm index cbaae15805..78dc627bc9 100644 --- a/kernel/trunk/drivers/unisound.asm +++ b/kernel/trunk/drivers/unisound.asm @@ -295,8 +295,7 @@ proc START stdcall, state:dword mov eax, [state] cmp eax, 1 - je .entry - jmp .stop + jne .stop .entry: if DEBUG @@ -377,7 +376,6 @@ proc START stdcall, state:dword ret .stop: call stop - mov [ctrl.user_callback], 0 ret endp @@ -1021,6 +1019,9 @@ proc stop mov edx, PCM_OUT_LVI_REG call [ctrl.ctrl_write8] + mov ax, 0x1c + mov edx, PCM_OUT_SR_REG + call [ctrl.ctrl_write16] ret endp diff --git a/kernel/trunk/kernel.asm b/kernel/trunk/kernel.asm index 76e3fcefcd..afb93c26e2 100644 --- a/kernel/trunk/kernel.asm +++ b/kernel/trunk/kernel.asm @@ -1950,8 +1950,6 @@ sysfn_shutdown: ; 18.1 = BOOT mov [0x2f0000+0x9030],byte 0 for_shutdown_parameter: - call stop_all_services - mov eax,[0x3004] add eax,2 mov [shutdown_processes],eax diff --git a/kernel/trunk/video/cursors.inc b/kernel/trunk/video/cursors.inc index 362f3b948c..d073896b49 100644 --- a/kernel/trunk/video/cursors.inc +++ b/kernel/trunk/video/cursors.inc @@ -4,6 +4,24 @@ LOAD_FROM_MEM equ 1 LOAD_INDIRECT equ 2 LOAD_SYSTEM equ 3 +struc BITMAPINFOHEADER { + .biSize dd ? ; DWORD + .biWidth dd ? ; LONG + .biHeight dd ? ; LONG + .biPlanes dw ? ; WORD + .biBitCount dw ? ; WORD + .biCompression dd ? ; DWORD + .biSizeImage dd ? ; DWORD + .biXPelsPerMeter dd ? ; LONG + .biYPelsPerMeter dd ? ; LONG + .biClrUsed dd ? ; DWORD + .biClrImportant dd ? ; DWORD +} + +virtual at 0 + BI BITMAPINFOHEADER +end virtual + align 4 proc vesa_init_cursor stdcall, dst:dword, src:dword locals @@ -17,9 +35,12 @@ proc vesa_init_cursor stdcall, dst:dword, src:dword endl mov esi, [src] - add esi,[esi+18d] - + add esi,[esi+18] mov eax,esi + + cmp [esi+BI.biBitCount], 24 + je .img_24 +.img_4: add eax, [esi] mov [pQuad],eax add eax,64 @@ -85,6 +106,52 @@ proc vesa_init_cursor stdcall, dst:dword, src:dword sub [height],1 jnz .l1 ret +.img_24: + add eax, [esi] + mov [pQuad],eax + add eax, 0xC00 + mov [pAnd],eax + mov eax,[esi+BI.biWidth] + mov [width],eax + mov ebx,[esi+BI.biHeight] + shr ebx,1 + mov [height],ebx + + mov edi, [dst] + add edi, 32*31*4 + mov [rBase],edi + + mov esi,[pAnd] + mov ebx, [pQuad] +.row_24: + mov eax, [esi] + bswap eax + mov [counter], 32 +@@: + xor edx, edx + shl eax,1 + setc dl + dec edx + + mov ecx, [ebx] + and ecx, 0x00FFFFFF + and ecx, edx + and edx, 0xFF000000 + or edx, ecx + mov [edi], edx + add ebx, 3 + add edi, 4 + dec [counter] + jnz @B + + add esi, 4 + mov edi,[rBase] + sub edi,128 + mov [rBase],edi + sub [height],1 + jnz .row_24 + ret + endp align 4 @@ -379,12 +446,18 @@ proc cursor_24 stdcall, hcursor:dword, x:dword, y:dword sub edi, ecx cmp edi, eax - cmovg edi, eax + ;cmovg edi, eax + jng @F + mov edi, eax +@@: sub edi, [_dx] sub edx, [y] cmp edx, eax - cmovg edx, eax + ;cmovg edx, eax + jng @F + mov edx, eax +@@: sub edx, [_dy] mov [w], edi @@ -393,7 +466,7 @@ proc cursor_24 stdcall, hcursor:dword, x:dword, y:dword mov [cur_saved_h], edx sub eax, edi - lea eax, [eax+eax*2] + shl eax, 2 ;lea eax, [eax+eax*2] lea edi, [edi+edi*2] sub ebx, edi mov [cur_saved_interl], ebx @@ -486,12 +559,18 @@ proc cursor_32 stdcall, hcursor:dword, x:dword, y:dword sub edi, ecx cmp edi, eax - cmovg edi, eax +; cmovg edi, eax + jng @F + mov edi, eax +@@: sub edi, [_dx] sub edx, [y] cmp edx, eax - cmovg edx, eax +; cmovg edx, eax + jng @F + mov edx, eax +@@: sub edx, [_dy] mov [w], edi