2012-03-15 16:41:29 +04:00
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
;; ;;
|
2014-12-01 06:51:07 +03:00
|
|
|
;; Copyright (C) KolibriOS team 2011-2014. All rights reserved. ;;
|
2012-03-15 16:41:29 +04:00
|
|
|
;; Distributed under terms of the GNU General Public License ;;
|
|
|
|
;; ;;
|
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
2012-03-08 12:33:38 +04:00
|
|
|
|
2014-12-01 06:51:07 +03:00
|
|
|
$Revision: 5164 $
|
|
|
|
|
|
|
|
|
2012-03-08 12:33:38 +04:00
|
|
|
struct BLITTER_BLOCK
|
|
|
|
xmin dd ?
|
|
|
|
ymin dd ?
|
|
|
|
xmax dd ?
|
|
|
|
ymax dd ?
|
|
|
|
ends
|
|
|
|
|
|
|
|
|
|
|
|
struct BLITTER
|
2012-03-15 19:34:46 +04:00
|
|
|
dc RECT
|
|
|
|
sc RECT
|
2012-03-08 12:33:38 +04:00
|
|
|
dst_x dd ? ; 32
|
|
|
|
dst_y dd ? ; 36
|
|
|
|
src_x dd ? ; 40
|
|
|
|
src_y dd ? ; 44
|
|
|
|
w dd ? ; 48
|
|
|
|
h dd ? ; 52
|
|
|
|
|
|
|
|
bitmap dd ? ; 56
|
|
|
|
stride dd ? ; 60
|
|
|
|
ends
|
|
|
|
|
|
|
|
|
2012-03-15 19:34:46 +04:00
|
|
|
|
2012-03-08 12:33:38 +04:00
|
|
|
align 4
|
2012-03-15 19:34:46 +04:00
|
|
|
block_clip:
|
|
|
|
;esi= clip RECT ptr
|
|
|
|
;edi= RECT ptr
|
|
|
|
;return code:
|
|
|
|
;eax= 0 - draw, 1 - don't draw
|
2012-03-08 12:33:38 +04:00
|
|
|
|
|
|
|
push ebx
|
2012-03-15 19:34:46 +04:00
|
|
|
|
|
|
|
mov eax, [edi+RECT.left]
|
|
|
|
mov ebx, [edi+RECT.right]
|
|
|
|
mov ecx, [esi+RECT.left] ;clip.left
|
|
|
|
mov edx, [esi+RECT.right] ;clip.right
|
|
|
|
|
|
|
|
cmp eax, edx ;left >= clip.right
|
|
|
|
jge .fail
|
|
|
|
|
|
|
|
cmp ebx, ecx ;right < clip.left
|
|
|
|
jl .fail
|
|
|
|
|
|
|
|
cmp eax, ecx ;left >= clip.left
|
|
|
|
jae @F
|
|
|
|
|
|
|
|
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
|
2012-03-08 12:33:38 +04:00
|
|
|
pop ebx
|
2012-03-15 19:34:46 +04:00
|
|
|
xor eax, eax
|
2012-03-08 12:33:38 +04:00
|
|
|
ret
|
2012-03-15 19:34:46 +04:00
|
|
|
.fail:
|
2012-03-08 12:33:38 +04:00
|
|
|
pop ebx
|
2012-03-15 19:34:46 +04:00
|
|
|
mov eax, 1
|
2012-03-08 12:33:38 +04:00
|
|
|
ret
|
|
|
|
|
2012-03-15 19:34:46 +04:00
|
|
|
|
2012-03-08 12:33:38 +04:00
|
|
|
align 4
|
|
|
|
blit_clip:
|
|
|
|
|
2012-03-15 19:34:46 +04:00
|
|
|
.sx0 equ 8
|
|
|
|
.sy0 equ 12
|
|
|
|
.sx1 equ 16
|
|
|
|
.sy1 equ 20
|
2012-03-08 12:33:38 +04:00
|
|
|
|
2012-03-15 19:34:46 +04:00
|
|
|
.dx0 equ 24
|
|
|
|
.dy0 equ 28
|
|
|
|
.dx1 equ 32
|
|
|
|
.dy1 equ 36
|
2012-03-08 12:33:38 +04:00
|
|
|
|
|
|
|
|
|
|
|
push edi
|
|
|
|
push esi
|
|
|
|
push ebx
|
|
|
|
sub esp, 40
|
|
|
|
|
|
|
|
mov ebx, ecx
|
|
|
|
mov edx, [ecx+BLITTER.src_x]
|
|
|
|
mov [esp+.sx0], edx
|
|
|
|
mov eax, [ecx+BLITTER.src_y]
|
|
|
|
mov [esp+.sy0], eax
|
|
|
|
add edx, [ecx+BLITTER.w]
|
|
|
|
add eax, [ecx+BLITTER.h]
|
2012-03-15 19:34:46 +04:00
|
|
|
mov [esp+.sx1], edx
|
2012-03-08 12:33:38 +04:00
|
|
|
mov [esp+.sy1], eax
|
|
|
|
|
2012-03-15 19:34:46 +04:00
|
|
|
lea edi, [esp+.sx0]
|
|
|
|
lea esi, [ebx+BLITTER.sc]
|
2012-03-08 12:33:38 +04:00
|
|
|
|
|
|
|
call block_clip
|
|
|
|
test eax, eax
|
2012-03-15 19:34:46 +04:00
|
|
|
mov esi, 1
|
|
|
|
jnz .done
|
2012-03-08 12:33:38 +04:00
|
|
|
|
|
|
|
mov edi, [esp+.sx0]
|
|
|
|
mov edx, [ebx+BLITTER.dst_x]
|
|
|
|
add edx, edi
|
|
|
|
sub edx, [ebx+BLITTER.src_x]
|
|
|
|
mov [esp+.dx0], edx
|
|
|
|
|
|
|
|
mov ecx, [esp+.sy0]
|
|
|
|
mov eax, [ebx+BLITTER.dst_y]
|
|
|
|
add eax, ecx
|
|
|
|
sub eax, [ebx+BLITTER.src_y]
|
|
|
|
mov [esp+.dy0], eax
|
2012-03-15 19:34:46 +04:00
|
|
|
|
2012-03-08 12:33:38 +04:00
|
|
|
sub edx, edi
|
|
|
|
add edx, [esp+.sx1]
|
|
|
|
mov [esp+.dx1], edx
|
|
|
|
|
|
|
|
sub eax, ecx
|
|
|
|
add eax, [esp+.sy1]
|
|
|
|
mov [esp+.dy1], eax
|
|
|
|
|
2012-03-15 19:34:46 +04:00
|
|
|
lea edi, [esp+.dx0]
|
|
|
|
lea esi, [ebx+BLITTER.dc]
|
2012-03-08 12:33:38 +04:00
|
|
|
call block_clip
|
|
|
|
test eax, eax
|
2012-03-15 19:34:46 +04:00
|
|
|
mov esi, 1
|
|
|
|
jnz .done
|
2012-03-08 12:33:38 +04:00
|
|
|
|
|
|
|
mov edx, [esp+.dx0]
|
|
|
|
mov eax, [esp+.dx1]
|
|
|
|
sub eax, edx
|
|
|
|
mov [ebx+BLITTER.w], eax
|
|
|
|
|
|
|
|
mov eax, [esp+.dy0]
|
|
|
|
mov ecx, [esp+.dy1]
|
|
|
|
sub ecx, eax
|
|
|
|
mov [ebx+BLITTER.h], ecx
|
|
|
|
|
|
|
|
mov ecx, [ebx+BLITTER.src_x]
|
|
|
|
add ecx, edx
|
|
|
|
sub ecx, [ebx+BLITTER.dst_x]
|
|
|
|
mov [ebx+BLITTER.src_x], ecx
|
|
|
|
|
|
|
|
mov ecx, [ebx+BLITTER.src_y]
|
|
|
|
add ecx, eax
|
|
|
|
sub ecx, [ebx+BLITTER.dst_y]
|
|
|
|
mov [ebx+BLITTER.src_y], ecx
|
|
|
|
mov [ebx+BLITTER.dst_x], edx
|
|
|
|
mov [ebx+BLITTER.dst_y], eax
|
|
|
|
xor esi, esi
|
2012-03-15 19:34:46 +04:00
|
|
|
.done:
|
2012-03-08 12:33:38 +04:00
|
|
|
mov eax, esi
|
|
|
|
add esp, 40
|
|
|
|
pop ebx
|
|
|
|
pop esi
|
|
|
|
pop edi
|
|
|
|
|
|
|
|
|
|
|
|
purge .sx0
|
|
|
|
purge .sy0
|
|
|
|
purge .sx1
|
|
|
|
purge .sy1
|
|
|
|
|
|
|
|
purge .dx0
|
|
|
|
purge .dy0
|
|
|
|
purge .dx1
|
|
|
|
purge .dy1
|
|
|
|
|
|
|
|
ret
|
|
|
|
|
|
|
|
align 4
|
|
|
|
blit_32:
|
2013-02-07 13:10:30 +04:00
|
|
|
|
|
|
|
.x_y equ 72
|
|
|
|
.tmp_x_y equ 76
|
|
|
|
|
|
|
|
|
2012-03-08 12:33:38 +04:00
|
|
|
push ebp
|
|
|
|
push edi
|
|
|
|
push esi
|
|
|
|
push ebx
|
2013-02-07 13:10:30 +04:00
|
|
|
sub esp, 80
|
2012-03-08 12:33:38 +04:00
|
|
|
|
|
|
|
mov eax, [TASK_BASE]
|
|
|
|
mov ebx, [eax-twdw + WDATA.box.width]
|
|
|
|
mov edx, [eax-twdw + WDATA.box.height]
|
2012-03-15 19:34:46 +04:00
|
|
|
inc ebx
|
|
|
|
inc edx
|
2012-03-08 12:33:38 +04:00
|
|
|
|
|
|
|
xor eax, eax
|
|
|
|
|
2012-03-15 19:34:46 +04:00
|
|
|
mov [esp+BLITTER.dc.left], eax
|
|
|
|
mov [esp+BLITTER.dc.top], eax
|
|
|
|
mov [esp+BLITTER.dc.right], ebx
|
|
|
|
mov [esp+BLITTER.dc.bottom], edx
|
2012-03-08 12:33:38 +04:00
|
|
|
|
2012-03-15 19:34:46 +04:00
|
|
|
mov [esp+BLITTER.sc.left], eax
|
|
|
|
mov [esp+BLITTER.sc.top], eax
|
2012-03-08 12:33:38 +04:00
|
|
|
mov eax, [ecx+24]
|
2012-03-15 19:34:46 +04:00
|
|
|
|
|
|
|
mov [esp+BLITTER.sc.right], eax
|
2012-03-08 12:33:38 +04:00
|
|
|
mov eax, [ecx+28]
|
2012-03-15 19:34:46 +04:00
|
|
|
|
|
|
|
mov [esp+BLITTER.sc.bottom], eax
|
2012-03-08 12:33:38 +04:00
|
|
|
|
|
|
|
mov eax, [ecx]
|
|
|
|
mov [esp+BLITTER.dst_x], eax
|
|
|
|
mov eax, [ecx+4]
|
|
|
|
mov [esp+BLITTER.dst_y], eax
|
|
|
|
|
|
|
|
mov eax, [ecx+16]
|
|
|
|
mov [esp+BLITTER.src_x], eax
|
|
|
|
mov eax, [ecx+20]
|
|
|
|
mov [esp+BLITTER.src_y], eax
|
|
|
|
mov eax, [ecx+8]
|
|
|
|
mov [esp+BLITTER.w], eax
|
|
|
|
mov eax, [ecx+12]
|
|
|
|
mov [esp+BLITTER.h], eax
|
|
|
|
|
|
|
|
|
|
|
|
mov eax, [ecx+32]
|
|
|
|
mov [esp+56], eax
|
|
|
|
mov eax, [ecx+36]
|
|
|
|
mov [esp+60], eax
|
|
|
|
|
|
|
|
mov ecx, esp
|
|
|
|
call blit_clip
|
|
|
|
test eax, eax
|
2013-02-07 13:10:30 +04:00
|
|
|
jne .done
|
2012-03-08 12:33:38 +04:00
|
|
|
|
|
|
|
mov eax, [TASK_BASE]
|
|
|
|
|
|
|
|
mov ebx, [esp+BLITTER.dst_x]
|
|
|
|
mov ebp, [esp+BLITTER.dst_y]
|
|
|
|
add ebx, [eax-twdw + WDATA.box.left]
|
|
|
|
add ebp, [eax-twdw + WDATA.box.top]
|
|
|
|
|
|
|
|
mov ecx, ebx
|
|
|
|
shl ecx, 16
|
|
|
|
mov cx, bp
|
2013-02-07 13:10:30 +04:00
|
|
|
mov [esp+.x_y], ecx
|
2012-03-08 12:33:38 +04:00
|
|
|
|
|
|
|
mov edi, ebp
|
|
|
|
|
2012-10-12 22:24:48 +04:00
|
|
|
mov edi, [BPSLine_calc_area+edi*4]
|
|
|
|
mov ebp, [d_width_calc_area+ebp*4]
|
2012-03-15 16:41:29 +04:00
|
|
|
|
2012-03-08 12:33:38 +04:00
|
|
|
add ebp, ebx
|
|
|
|
add ebp, [_WinMapAddress]
|
|
|
|
|
|
|
|
mov eax, [esp+BLITTER.src_y]
|
|
|
|
imul eax, [esp+BLITTER.stride]
|
|
|
|
mov esi, [esp+BLITTER.src_x]
|
|
|
|
lea esi, [eax+esi*4]
|
|
|
|
add esi, [esp+BLITTER.bitmap]
|
|
|
|
|
|
|
|
mov ecx, [esp+BLITTER.h]
|
|
|
|
mov edx, [esp+BLITTER.w]
|
|
|
|
|
|
|
|
test ecx, ecx ;FIXME check clipping
|
2013-02-07 13:10:30 +04:00
|
|
|
jz .done
|
2012-03-08 12:33:38 +04:00
|
|
|
|
|
|
|
test edx, edx
|
2013-02-07 13:10:30 +04:00
|
|
|
jz .done
|
2012-03-08 12:33:38 +04:00
|
|
|
|
|
|
|
lea edi, [edi+ebx*4]
|
|
|
|
|
2013-02-07 13:10:30 +04:00
|
|
|
; xchg bx, bx
|
2012-10-12 22:24:48 +04:00
|
|
|
|
2012-03-08 12:33:38 +04:00
|
|
|
mov ebx, [CURRENT_TASK]
|
2013-02-07 13:10:30 +04:00
|
|
|
mov ecx, [esp+80]
|
|
|
|
shr ecx, 4
|
|
|
|
and ecx, 3
|
|
|
|
|
|
|
|
jmp dword [.tbl_32+ecx*4]
|
2012-10-12 22:24:48 +04:00
|
|
|
|
2012-03-08 12:33:38 +04:00
|
|
|
align 4
|
2013-02-07 13:10:30 +04:00
|
|
|
.tbl_32 dd blit_copy_32
|
|
|
|
dd blit_copy_32_bgr
|
|
|
|
dd blit_trans_32
|
|
|
|
dd blit_trans_32_bgr
|
|
|
|
|
|
|
|
.done:
|
|
|
|
add esp, 80
|
|
|
|
pop ebx
|
|
|
|
pop esi
|
|
|
|
pop edi
|
|
|
|
pop ebp
|
|
|
|
ret
|
|
|
|
|
|
|
|
align 4
|
|
|
|
blit_copy_32_bgr:
|
|
|
|
mov ebx, 1
|
|
|
|
|
|
|
|
align 4
|
|
|
|
blit_copy_32:
|
|
|
|
|
2012-03-08 12:33:38 +04:00
|
|
|
.outer32:
|
2013-02-07 13:10:30 +04:00
|
|
|
mov eax, [esp+.x_y]
|
|
|
|
mov [esp+.tmp_x_y], eax
|
2012-03-08 12:33:38 +04:00
|
|
|
xor ecx, ecx
|
|
|
|
align 4
|
|
|
|
.inner32:
|
|
|
|
cmp [ebp+ecx], bl
|
2012-03-15 16:41:29 +04:00
|
|
|
jne .skip
|
2012-03-08 12:33:38 +04:00
|
|
|
;--------------------------------------
|
|
|
|
mov eax, [esi+ecx*4]
|
|
|
|
|
2012-03-15 16:41:29 +04:00
|
|
|
; check for hardware cursor
|
|
|
|
cmp [_display.select_cursor], select_cursor
|
|
|
|
je @f
|
|
|
|
cmp [_display.select_cursor], 0
|
|
|
|
jne .no_mouseunder
|
|
|
|
;--------------------------------------
|
|
|
|
align 4
|
|
|
|
@@:
|
2012-03-08 12:33:38 +04:00
|
|
|
push ecx
|
2013-02-07 13:10:30 +04:00
|
|
|
mov ecx, [esp+4+.tmp_x_y]
|
2012-03-08 12:33:38 +04:00
|
|
|
|
|
|
|
; check mouse area for putpixel
|
|
|
|
call [_display.check_mouse]
|
|
|
|
pop ecx
|
2013-02-07 13:10:30 +04:00
|
|
|
|
2012-03-15 16:41:29 +04:00
|
|
|
;--------------------------------------
|
|
|
|
align 4
|
|
|
|
.no_mouseunder:
|
2012-03-08 12:33:38 +04:00
|
|
|
; store to real LFB
|
|
|
|
mov [LFB_BASE+edi+ecx*4], eax
|
|
|
|
;--------------------------------------
|
|
|
|
align 4
|
2012-03-15 16:41:29 +04:00
|
|
|
.skip:
|
2013-02-07 13:10:30 +04:00
|
|
|
add [esp+.tmp_x_y], dword 0x10000
|
2012-03-08 12:33:38 +04:00
|
|
|
inc ecx
|
|
|
|
dec edx
|
|
|
|
jnz .inner32
|
|
|
|
|
|
|
|
add esi, [esp+BLITTER.stride]
|
|
|
|
add edi, [_display.pitch]
|
|
|
|
add ebp, [_display.width]
|
2013-02-07 13:10:30 +04:00
|
|
|
inc dword [esp+.x_y]
|
2012-03-08 12:33:38 +04:00
|
|
|
|
|
|
|
mov edx, [esp+BLITTER.w]
|
|
|
|
dec [esp+BLITTER.h]
|
|
|
|
jnz .outer32
|
|
|
|
|
2013-02-07 13:10:30 +04:00
|
|
|
jmp blit_32.done
|
2012-03-08 12:33:38 +04:00
|
|
|
|
2012-10-12 22:24:48 +04:00
|
|
|
|
2013-02-07 13:10:30 +04:00
|
|
|
align 4
|
|
|
|
blit_trans_32_bgr:
|
|
|
|
mov ebx, 1
|
2012-03-08 12:33:38 +04:00
|
|
|
|
|
|
|
align 4
|
2013-02-07 13:10:30 +04:00
|
|
|
blit_trans_32:
|
|
|
|
|
|
|
|
.outer32:
|
|
|
|
mov eax, [esp+.x_y]
|
|
|
|
mov [esp+.tmp_x_y], eax
|
2012-03-08 12:33:38 +04:00
|
|
|
xor ecx, ecx
|
|
|
|
|
|
|
|
align 4
|
2013-02-07 13:10:30 +04:00
|
|
|
.inner32:
|
|
|
|
|
2012-03-08 12:33:38 +04:00
|
|
|
cmp [ebp+ecx], bl
|
2013-02-07 13:10:30 +04:00
|
|
|
jne .skip
|
2012-03-08 12:33:38 +04:00
|
|
|
;--------------------------------------
|
|
|
|
mov eax, [esi+ecx*4]
|
2013-02-07 13:10:30 +04:00
|
|
|
test eax, 0xFF000000
|
|
|
|
jz .skip
|
2012-03-08 12:33:38 +04:00
|
|
|
|
2012-03-15 16:41:29 +04:00
|
|
|
; check for hardware cursor
|
|
|
|
cmp [_display.select_cursor], select_cursor
|
|
|
|
je @f
|
|
|
|
cmp [_display.select_cursor], 0
|
2013-02-07 13:10:30 +04:00
|
|
|
jne .no_mouseunder
|
2012-03-15 16:41:29 +04:00
|
|
|
;--------------------------------------
|
|
|
|
align 4
|
|
|
|
@@:
|
2012-03-08 12:33:38 +04:00
|
|
|
push ecx
|
|
|
|
|
2013-02-07 13:10:30 +04:00
|
|
|
mov ecx, [esp+4+.tmp_x_y]
|
2012-03-08 12:33:38 +04:00
|
|
|
|
|
|
|
; check mouse area for putpixel
|
|
|
|
call [_display.check_mouse]
|
|
|
|
pop ecx
|
2012-03-15 16:41:29 +04:00
|
|
|
;--------------------------------------
|
|
|
|
align 4
|
2013-02-07 13:10:30 +04:00
|
|
|
.no_mouseunder:
|
|
|
|
; store to real LFB
|
|
|
|
mov [LFB_BASE+edi+ecx*4], eax
|
2012-03-08 12:33:38 +04:00
|
|
|
;--------------------------------------
|
|
|
|
align 4
|
2013-02-07 13:10:30 +04:00
|
|
|
.skip:
|
|
|
|
add [esp+.tmp_x_y], dword 0x10000
|
2012-03-08 12:33:38 +04:00
|
|
|
inc ecx
|
|
|
|
dec edx
|
2013-02-07 13:10:30 +04:00
|
|
|
jnz .inner32
|
2012-03-08 12:33:38 +04:00
|
|
|
|
|
|
|
add esi, [esp+BLITTER.stride]
|
|
|
|
add edi, [_display.pitch]
|
|
|
|
add ebp, [_display.width]
|
2013-02-07 13:10:30 +04:00
|
|
|
inc dword [esp+.x_y]
|
2012-03-08 12:33:38 +04:00
|
|
|
|
|
|
|
mov edx, [esp+BLITTER.w]
|
|
|
|
dec [esp+BLITTER.h]
|
2013-02-07 13:10:30 +04:00
|
|
|
jnz .outer32
|
2012-03-08 12:33:38 +04:00
|
|
|
|
2013-02-07 13:10:30 +04:00
|
|
|
jmp blit_32.done
|