/kernel/branches/net/video/blitter.inc |
---|
14,8 → 14,8 |
struct BLITTER |
dc BLITTER_BLOCK |
sc BLITTER_BLOCK |
dc RECT |
sc RECT |
dst_x dd ? ; 32 |
dst_y dd ? ; 36 |
src_x dd ? ; 40 |
28,145 → 28,84 |
ends |
align 4 |
block_clip: |
;esi= clip RECT ptr |
;edi= RECT ptr |
;return code: |
;eax= 0 - draw, 1 - don't draw |
__L1OutCode: |
push ebx |
mov ebx, 8 |
cmp edx, [eax] |
jl .L2 |
xor ebx, ebx |
cmp edx, [eax+8] |
setg bl |
sal ebx, 2 |
.L2: |
cmp ecx, [eax+4] |
jge .L3 |
or ebx, 1 |
jmp .L4 |
.L3: |
cmp ecx, [eax+12] |
jle .L4 |
or ebx, 2 |
.L4: |
mov eax, ebx |
pop ebx |
ret |
mov eax, [edi+RECT.left] |
mov ebx, [edi+RECT.right] |
mov ecx, [esi+RECT.left] ;clip.left |
mov edx, [esi+RECT.right] ;clip.right |
align 4 |
block_clip: |
push ebp |
push edi |
push esi |
push ebx |
sub esp, 4 |
cmp eax, edx ;left >= clip.right |
jge .fail |
mov ebx, eax |
mov [esp], edx |
mov ebp, ecx |
mov ecx, [ecx] |
mov edx, [edx] |
call __L1OutCode |
cmp ebx, ecx ;right < clip.left |
jl .fail |
mov esi, eax |
mov edx, [esp+28] |
mov ecx, [edx] |
.L21: |
mov eax, [esp+24] |
mov edx, [eax] |
mov eax, ebx |
call __L1OutCode |
cmp eax, ecx ;left >= clip.left |
jae @F |
mov edi, eax |
.L20: |
mov eax, edi |
and eax, esi |
jne .L9 |
cmp esi, edi |
je .L9 |
test esi, esi |
jne .L10 |
test edi, 1 |
je .L11 |
mov eax, [ebx+4] |
jmp .L25 |
.L11: |
test edi, 2 |
je .L13 |
mov eax, [ebx+12] |
.L25: |
mov edx, [esp+28] |
jmp .L22 |
.L13: |
test edi, 4 |
je .L14 |
mov eax, [ebx+8] |
jmp .L26 |
.L14: |
and edi, 8 |
je .L12 |
mov eax, [ebx] |
.L26: |
mov edx, [esp+24] |
.L22: |
mov [edx], eax |
.L12: |
mov eax, [esp+28] |
mov ecx, [eax] |
jmp .L21 |
.L10: |
test esi, 1 |
je .L16 |
mov eax, [ebx+4] |
jmp .L23 |
.L16: |
test esi, 2 |
je .L18 |
mov eax, [ebx+12] |
.L23: |
mov [ebp+0], eax |
jmp .L17 |
.L18: |
test esi, 4 |
je .L19 |
mov eax, [ebx+8] |
jmp .L24 |
.L19: |
and esi, 8 |
je .L17 |
mov eax, [ebx] |
.L24: |
mov edx, [esp] |
mov [edx], eax |
.L17: |
mov ecx, [ebp+0] |
mov eax, [esp] |
mov edx, [eax] |
mov eax, ebx |
call __L1OutCode |
mov esi, eax |
jmp .L20 |
.L9: |
add esp, 4 |
mov eax, ecx |
@@: |
mov [edi+RECT.left], eax |
cmp ebx, edx ;right <= clip.right |
jle @f |
mov ebx, edx |
@@: |
mov [edi+RECT.right], ebx |
mov eax, [edi+RECT.top] |
mov ebx, [edi+RECT.bottom] |
mov ecx, [esi+RECT.top] ;clip.top |
mov edx, [esi+RECT.bottom] ;clip.bottom |
cmp eax, edx ;top >= clip.bottom |
jge .fail |
cmp ebx, ecx ;bottom < clip.top |
jl .fail |
cmp eax, ecx ;top >= clip.top |
jae @F |
mov eax, ecx |
@@: |
mov [edi+RECT.top], eax |
cmp ebx, edx ;bottom <= clip.bottom |
jle @f |
mov ebx, edx |
@@: |
mov [edi+RECT.bottom], ebx |
pop ebx |
pop esi |
pop edi |
pop ebp |
xor eax, eax |
ret |
.fail: |
pop ebx |
mov eax, 1 |
ret |
align 4 |
blit_clip: |
.sx0 equ 36 |
.sy0 equ 32 |
.sx1 equ 28 |
.sy1 equ 24 |
.sx0 equ 8 |
.sy0 equ 12 |
.sx1 equ 16 |
.sy1 equ 20 |
.dx0 equ 20 |
.dy0 equ 16 |
.dx1 equ 12 |
.dy1 equ 8 |
.dx0 equ 24 |
.dy0 equ 28 |
.dx1 equ 32 |
.dy1 equ 36 |
push edi |
180,25 → 119,17 |
mov eax, [ecx+BLITTER.src_y] |
mov [esp+.sy0], eax |
add edx, [ecx+BLITTER.w] |
dec edx |
add eax, [ecx+BLITTER.h] |
mov [esp+.sx1], edx |
add eax, [ecx+BLITTER.h] |
dec eax |
mov [esp+.sy1], eax |
lea ecx, [esp+.sy0] |
lea edx, [esp+.sx0] |
lea eax, [ebx+BLITTER.sc] |
lea esi, [esp+.sy1] |
lea edi, [esp+.sx0] |
lea esi, [ebx+BLITTER.sc] |
mov [esp+4], esi |
lea esi, [esp+.sx1] |
mov [esp], esi |
call block_clip |
test eax, eax |
mov esi, 1 |
test eax, eax |
jne .L28 |
jnz .done |
mov edi, [esp+.sx0] |
mov edx, [ebx+BLITTER.dst_x] |
211,6 → 142,7 |
add eax, ecx |
sub eax, [ebx+BLITTER.src_y] |
mov [esp+.dy0], eax |
sub edx, edi |
add edx, [esp+.sx1] |
mov [esp+.dx1], edx |
219,26 → 151,20 |
add eax, [esp+.sy1] |
mov [esp+.dy1], eax |
lea ecx, [esp+.dy0] |
lea edx, [esp+.dx0] |
lea eax, [esp+.dy1] |
mov [esp+4], eax |
lea eax, [esp+.dx1] |
mov [esp], eax |
mov eax, ebx |
lea edi, [esp+.dx0] |
lea esi, [ebx+BLITTER.dc] |
call block_clip |
test eax, eax |
jne .L28 |
mov esi, 1 |
jnz .done |
mov edx, [esp+.dx0] |
mov eax, [esp+.dx1] |
inc eax |
sub eax, edx |
mov [ebx+BLITTER.w], eax |
mov eax, [esp+.dy0] |
mov ecx, [esp+.dy1] |
inc ecx |
sub ecx, eax |
mov [ebx+BLITTER.h], ecx |
254,7 → 180,7 |
mov [ebx+BLITTER.dst_x], edx |
mov [ebx+BLITTER.dst_y], eax |
xor esi, esi |
.L28: |
.done: |
mov eax, esi |
add esp, 40 |
pop ebx |
274,10 → 200,7 |
ret |
align 4 |
blit_32: |
push ebp |
push edi |
288,23 → 211,25 |
mov eax, [TASK_BASE] |
mov ebx, [eax-twdw + WDATA.box.width] |
mov edx, [eax-twdw + WDATA.box.height] |
inc ebx |
inc edx |
xor eax, eax |
mov [esp+BLITTER.dc.xmin], eax |
mov [esp+BLITTER.dc.ymin], eax |
mov [esp+BLITTER.dc.xmax], ebx |
mov [esp+BLITTER.dc.ymax], edx |
mov [esp+BLITTER.dc.left], eax |
mov [esp+BLITTER.dc.top], eax |
mov [esp+BLITTER.dc.right], ebx |
mov [esp+BLITTER.dc.bottom], edx |
mov [esp+BLITTER.sc.xmin], eax |
mov [esp+BLITTER.sc.ymin], eax |
mov [esp+BLITTER.sc.left], eax |
mov [esp+BLITTER.sc.top], eax |
mov eax, [ecx+24] |
dec eax |
mov [esp+BLITTER.sc.xmax], eax |
mov [esp+BLITTER.sc.right], eax |
mov eax, [ecx+28] |
dec eax |
mov [esp+BLITTER.sc.ymax], eax |
mov [esp+BLITTER.sc.bottom], eax |
mov eax, [ecx] |
mov [esp+BLITTER.dst_x], eax |
mov eax, [ecx+4] |
429,7 → 354,7 |
.done: |
; call [draw_pointer] |
call __sys_draw_pointer |
; call __sys_draw_pointer |
.L57: |
add esp, 72 |
pop ebx |
/kernel/branches/net/video/cursors.inc |
---|
447,16 → 447,11 |
;------------------------------------------------------------------------------ |
align 4 |
proc delete_cursor stdcall, hcursor:dword |
locals |
hsrv dd ? |
io_code dd ? |
input dd ? |
inp_size dd ? |
output dd ? |
out_size dd ? |
endl |
; DEBUGF 1,'K : delete_cursor %x\n', [hcursor] |
mov esi, [hcursor] |
cmp [esi+CURSOR.magic], 'CURS' |
jne .fail |
642,6 → 637,8 |
sub edi, [y] |
inc ebx |
inc edi |
sub ebx, [_dx] |
sub edi, [_dy] |
mov [cur.w], ebx |
mov [cur.h], edi |
758,6 → 755,8 |
sub edi, [y] |
inc ebx |
inc edi |
sub ebx, [_dx] |
sub edi, [_dy] |
mov [cur.w], ebx |
mov [cur.h], edi |
835,10 → 834,10 |
;-------------------------------------- |
push eax ebx |
; offset X |
mov ecx, [X_UNDER_subtraction_CUR_hot_x] |
movzx ecx, word [X_UNDER_subtraction_CUR_hot_x] |
sub eax, ecx ; x1 |
; offset Y |
mov ecx, [Y_UNDER_subtraction_CUR_hot_y] |
movzx ecx, word [Y_UNDER_subtraction_CUR_hot_y] |
sub ebx, ecx ; y1 |
;-------------------------------------- |
; ebx = offset y |
874,31 → 873,26 |
; eax = new color |
;-------------------------------------- |
; check for Y |
cmp cx, [Y_UNDER_subtraction_CUR_hot_y] |
jb .no_mouse_area |
cmp cx, [Y_UNDER_sub_CUR_hot_y_add_curh] |
jae .no_mouse_area |
sub cx, [Y_UNDER_subtraction_CUR_hot_y] |
jb .no_mouse_area |
rol ecx, 16 |
;-------------------------------------- |
; check for X |
cmp cx, [X_UNDER_subtraction_CUR_hot_x] |
cmp cx, [X_UNDER_sub_CUR_hot_x_add_curh] |
jae .no_mouse_area |
sub cx, [X_UNDER_subtraction_CUR_hot_x] |
jb .no_mouse_area |
cmp cx, [X_UNDER_sub_CUR_hot_x_add_curh] |
jae .no_mouse_area |
ror ecx, 16 |
;-------------------------------------- |
align 4 |
.1: |
push eax |
; offset X |
mov ax, [X_UNDER_subtraction_CUR_hot_x] |
sub cx, ax ; x1 |
ror ecx, 16 |
; offset Y |
mov ax, [Y_UNDER_subtraction_CUR_hot_y] |
sub cx, ax ; y1 |
;-------------------------------------- |
; ecx = (offset x) shl 16 + (offset y) |
push ebx |
905,10 → 899,23 |
mov ebx, ecx |
shr ebx, 16 ; x |
and ecx, 0xffff ; y |
cmp ecx, [cur.h] |
jae @f |
cmp ebx, [cur.w] |
jb .ok |
;-------------------------------------- |
align 4 |
@@: |
; DEBUGF 1, "K : SHIT HAPPENS: %x %x \n", ecx,ebx |
pop ebx |
jmp .sh ; SORRY! SHIT HAPPENS! |
;-------------------------------------- |
align 4 |
.ok: |
; ecx = offset y |
; ebx = offset x |
mov eax, [esp + 4] |
push ebx ecx |
imul ecx, [cur.w] ;y |
add ecx, ebx |
944,10 → 951,14 |
test eax, 0xFF000000 |
jz @f |
pop ecx |
add esp, 4 |
ret |
;-------------------------------------- |
align 4 |
.sh: |
mov ecx, -1 |
;-------------------------------------- |
align 4 |
@@: |
pop eax |
;-------------------------------------- |
/kernel/branches/net/video/vesa20.inc |
---|
406,29 → 406,38 |
jne .skip |
;-------------------------------------- |
push ecx |
mov ecx, [putimg.real_sy_and_abs_cy + 4] |
;-------------------------------------- |
align 4 |
.sh: |
neg ecx |
add ecx, [putimg.real_sx_and_abs_cx + 4] |
;-------------------------------------- |
; check for X |
cmp cx, [X_UNDER_sub_CUR_hot_x_add_curh] |
jae .no_mouse_area |
sub cx, [X_UNDER_subtraction_CUR_hot_x] |
jb .no_mouse_area |
shl ecx, 16 |
add ecx, [putimg.real_sy_and_abs_cy + 4] |
sub ecx, edi |
;-------------------------------------- |
; check for Y |
cmp cx, [Y_UNDER_subtraction_CUR_hot_y] |
jb .no_mouse_area |
cmp cx, [Y_UNDER_sub_CUR_hot_y_add_curh] |
jae .no_mouse_area |
rol ecx, 16 |
add ecx, [putimg.real_sx_and_abs_cx + 4] |
sub ecx, [esp] |
;-------------------------------------- |
; check for X |
cmp cx, [X_UNDER_subtraction_CUR_hot_x] |
sub cx, [Y_UNDER_subtraction_CUR_hot_y] |
jb .no_mouse_area |
cmp cx, [X_UNDER_sub_CUR_hot_x_add_curh] |
jae .no_mouse_area |
;-------------------------------------- |
; check mouse area for putpixel |
call check_mouse_area_for_putpixel_new.1 |
cmp ecx, -1 ;SHIT HAPPENS? |
jne .no_mouse_area |
mov ecx, [esp] |
jmp .sh |
;-------------------------------------- |
align 4 |
.no_mouse_area: |
608,29 → 617,38 |
jne .skip |
;-------------------------------------- |
push ecx |
mov ecx, [putimg.real_sy_and_abs_cy + 4] |
;-------------------------------------- |
align 4 |
.sh: |
neg ecx |
add ecx, [putimg.real_sx_and_abs_cx + 4] |
;-------------------------------------- |
; check for X |
cmp cx, [X_UNDER_sub_CUR_hot_x_add_curh] |
jae .no_mouse_area |
sub cx, [X_UNDER_subtraction_CUR_hot_x] |
jb .no_mouse_area |
shl ecx, 16 |
add ecx, [putimg.real_sy_and_abs_cy + 4] |
sub ecx, edi |
;-------------------------------------- |
; check for Y |
cmp cx, [Y_UNDER_subtraction_CUR_hot_y] |
jb .no_mouse_area |
cmp cx, [Y_UNDER_sub_CUR_hot_y_add_curh] |
jae .no_mouse_area |
rol ecx, 16 |
add ecx, [putimg.real_sx_and_abs_cx + 4] |
sub ecx, [esp] |
;-------------------------------------- |
; check for X |
cmp cx, [X_UNDER_subtraction_CUR_hot_x] |
sub cx, [Y_UNDER_subtraction_CUR_hot_y] |
jb .no_mouse_area |
cmp cx, [X_UNDER_sub_CUR_hot_x_add_curh] |
jae .no_mouse_area |
;-------------------------------------- |
; check mouse area for putpixel |
call check_mouse_area_for_putpixel_new.1 |
cmp ecx, -1 ;SHIT HAPPENS? |
jne .no_mouse_area |
mov ecx, [esp] |
jmp .sh |
;-------------------------------------- |
align 4 |
.no_mouse_area: |
767,21 → 785,23 |
jnz @f |
;-------------------------------------- |
; check for Y |
cmp cx, [Y_UNDER_subtraction_CUR_hot_y] |
jb @f |
cmp cx, [Y_UNDER_sub_CUR_hot_y_add_curh] |
jae @f |
sub cx, [Y_UNDER_subtraction_CUR_hot_y] |
jb @f |
rol ecx, 16 |
;-------------------------------------- |
; check for X |
cmp cx, [X_UNDER_subtraction_CUR_hot_x] |
jb @f |
cmp cx, [X_UNDER_sub_CUR_hot_x_add_curh] |
jae @f |
sub cx, [X_UNDER_subtraction_CUR_hot_x] |
jb @f |
ror ecx, 16 |
call check_mouse_area_for_putpixel_new.1 |
;-------------------------------------- |
align 4 |
841,21 → 861,23 |
jnz @f |
;-------------------------------------- |
; check for Y |
cmp cx, [Y_UNDER_subtraction_CUR_hot_y] |
jb @f |
cmp cx, [Y_UNDER_sub_CUR_hot_y_add_curh] |
jae @f |
sub cx, [Y_UNDER_subtraction_CUR_hot_y] |
jb @f |
rol ecx, 16 |
;-------------------------------------- |
; check for X |
cmp cx, [X_UNDER_subtraction_CUR_hot_x] |
jb @f |
cmp cx, [X_UNDER_sub_CUR_hot_x_add_curh] |
jae @f |
sub cx, [X_UNDER_subtraction_CUR_hot_x] |
jb @f |
ror ecx, 16 |
call check_mouse_area_for_putpixel_new.1 |
;-------------------------------------- |
align 4 |
1372,22 → 1394,24 |
sub ecx, esi |
;-------------------------------------- |
; check for Y |
cmp cx, [Y_UNDER_subtraction_CUR_hot_y] |
jb .no_mouse_area |
cmp cx, [Y_UNDER_sub_CUR_hot_y_add_curh] |
jae .no_mouse_area |
sub cx, [Y_UNDER_subtraction_CUR_hot_y] |
jb .no_mouse_area |
rol ecx, 16 |
add ecx, [drbar.real_sx_and_abs_cx] |
sub ecx, edi |
;-------------------------------------- |
; check for X |
cmp cx, [X_UNDER_subtraction_CUR_hot_x] |
cmp cx, [X_UNDER_sub_CUR_hot_x_add_curh] |
jae .no_mouse_area |
sub cx, [X_UNDER_subtraction_CUR_hot_x] |
jb .no_mouse_area |
cmp cx, [X_UNDER_sub_CUR_hot_x_add_curh] |
jae .no_mouse_area |
ror ecx, 16 |
;-------------------------------------- |
; check mouse area for putpixel |
push eax |
1557,22 → 1581,24 |
sub ecx, esi |
;-------------------------------------- |
; check for Y |
cmp cx, [Y_UNDER_subtraction_CUR_hot_y] |
jb .no_mouse_area |
cmp cx, [Y_UNDER_sub_CUR_hot_y_add_curh] |
jae .no_mouse_area |
sub cx, [Y_UNDER_subtraction_CUR_hot_y] |
jb .no_mouse_area |
rol ecx, 16 |
add ecx, [drbar.real_sx_and_abs_cx] |
sub ecx, edi |
;-------------------------------------- |
; check for X |
cmp cx, [X_UNDER_subtraction_CUR_hot_x] |
cmp cx, [X_UNDER_sub_CUR_hot_x_add_curh] |
jae .no_mouse_area |
sub cx, [X_UNDER_subtraction_CUR_hot_x] |
jb .no_mouse_area |
cmp cx, [X_UNDER_sub_CUR_hot_x_add_curh] |
jae .no_mouse_area |
ror ecx, 16 |
;-------------------------------------- |
; check mouse area for putpixel |
push eax |