From cf23a1ccc73634f836a3b1a57d26c97452ba1451 Mon Sep 17 00:00:00 2001 From: "Sergey Semyonov (Serge)" Date: Mon, 11 Feb 2008 12:28:01 +0000 Subject: [PATCH] SDK: hardware accelerated drawing (R500 required) git-svn-id: svn://kolibrios.org@733 a494cfbc-eb01-0410-851d-a64ba20cac60 --- programs/develop/sdk/trunk/HDraw/hdraw.inc | 122 +++++++++++++++++++++ 1 file changed, 122 insertions(+) create mode 100644 programs/develop/sdk/trunk/HDraw/hdraw.inc diff --git a/programs/develop/sdk/trunk/HDraw/hdraw.inc b/programs/develop/sdk/trunk/HDraw/hdraw.inc new file mode 100644 index 0000000000..2814f118a4 --- /dev/null +++ b/programs/develop/sdk/trunk/HDraw/hdraw.inc @@ -0,0 +1,122 @@ + +SRV_GETVERSION equ 0 +SOLID_FILL equ 1 +LINE2P equ 2 + +io.handle equ esp +io.code equ esp+4 +io.input equ esp+8 +io.inp_size equ esp+12 +io.output equ esp+16 +io.out_size equ esp+20 + +IOSIZE equ 24 + +; retval +; ebx= service version +; eax= error code +; 0= no error +; -1= common error + +align 4 + +init_HDraw: + mov eax, 68 + mov ebx, 16 + mov ecx, szHDraw + int 0x40 + + mov [HDraw], eax + test eax, eax + jz .fail + + push 0 ;storage for version + mov eax, esp + xor ebx, ebx + + push 4 ;.out_size + push eax ;.output + push ebx ;.inp_size + push ebx ;.input + push SRV_GETVERSION ;.code + push [HDraw] ;.handle + + mov eax, 68 + mov ebx, 17 + mov ecx, esp + int 0x40 + add esp, IOSIZE + pop ebx ;version + ret +.fail: + or eax, -1 + ret + +; param +; eax= color +; ebx= x +; ecx= y +; edx= w +; esi= h + +; retval +; eax= error code + +align 4 +solid_fill: + + push esi + push edx + push ecx + push ebx + push eax + + xor eax, eax + mov ebx, esp ;FILL + + push eax ;.out_size + push eax ;.output + push 5 ;.inp_size + push ebx ;.input + push SOLID_FILL ;.code + push [HDraw] ;.handle + + mov eax, 68 + mov ebx, 17 + mov ecx, esp + int 0x40 + add esp, (IOSIZE+5*4) ;io_control+FILL + ret + +align 4 +line2p: + push esi ;y2 + push edx ;x2 + push ecx ;y1 + push ebx ;x1 + push eax ;color + + xor eax, eax + mov ebx, esp ;LINE2P + + push eax ;.out_size + push eax ;.output + push 5 ;.inp_size + push ebx ;.input + push LINE2P ;.code + push [HDraw] ;.handle + + mov eax, 68 + mov ebx, 17 + mov ecx, esp + int 0x40 + add esp, (IOSIZE+5*4) ;io_control+LINE2P + ret + + +align 4 +HDraw rd 1 + +szHDraw db 'HDRAW',0 + +