2015-08-03 21:07:56 +03:00
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
;; ;;
|
|
|
|
;; Copyright (C) KolibriOS team 2010-2015. All rights reserved. ;;
|
|
|
|
;; Distributed under terms of the GNU General Public License ;;
|
|
|
|
;; ;;
|
|
|
|
;; VNC client for KolibriOS ;;
|
|
|
|
;; ;;
|
|
|
|
;; Written by hidnplayr@kolibrios.org ;;
|
|
|
|
;; ;;
|
|
|
|
;; GNU GENERAL PUBLIC LICENSE ;;
|
|
|
|
;; Version 2, June 1991 ;;
|
|
|
|
;; ;;
|
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
|
2015-08-20 12:30:24 +03:00
|
|
|
load_pixel: ; returns in eax
|
2015-08-12 14:47:57 +03:00
|
|
|
|
2015-08-04 19:29:37 +03:00
|
|
|
if BITS_PER_PIXEL = 8
|
2015-08-11 21:39:38 +03:00
|
|
|
|
2015-08-20 12:30:24 +03:00
|
|
|
xor eax, eax
|
|
|
|
lodsb
|
|
|
|
mov eax, [lut_8bpp+eax*4]
|
2015-08-11 21:39:38 +03:00
|
|
|
|
2015-08-04 19:29:37 +03:00
|
|
|
else if BITS_PER_PIXEL = 16
|
2015-08-11 21:39:38 +03:00
|
|
|
|
2015-08-20 12:30:24 +03:00
|
|
|
push ebx
|
2015-08-04 19:29:37 +03:00
|
|
|
lodsw
|
2015-08-20 12:30:24 +03:00
|
|
|
mov bx, ax
|
|
|
|
shl bx, 5
|
|
|
|
and bh, 0xfc ; green
|
|
|
|
|
|
|
|
mov bl, ah
|
|
|
|
and bl, 0xf8 ; red
|
|
|
|
shl ebx, 8
|
|
|
|
|
|
|
|
mov bl, al
|
|
|
|
shl bl, 3
|
|
|
|
and bl, 0xf8 ; blue
|
|
|
|
mov eax, ebx
|
|
|
|
pop ebx
|
2015-08-11 21:39:38 +03:00
|
|
|
|
2015-08-14 16:30:03 +03:00
|
|
|
else if BITS_PER_PIXEL = 24
|
2015-08-11 21:39:38 +03:00
|
|
|
|
2015-08-20 12:30:24 +03:00
|
|
|
mov eax, [esi]
|
|
|
|
and eax, 0x00ffffff
|
2015-08-04 19:29:37 +03:00
|
|
|
add esi, 3
|
2015-08-11 21:39:38 +03:00
|
|
|
|
2015-08-14 16:30:03 +03:00
|
|
|
else if BITS_PER_PIXEL = 32
|
|
|
|
|
2015-08-20 12:30:24 +03:00
|
|
|
lodsd
|
2015-08-14 16:30:03 +03:00
|
|
|
|
2015-08-04 19:29:37 +03:00
|
|
|
end if
|
2015-08-03 21:07:56 +03:00
|
|
|
|
|
|
|
ret
|
|
|
|
|
2015-08-20 12:30:24 +03:00
|
|
|
|
|
|
|
|
2015-08-03 21:07:56 +03:00
|
|
|
encoding_RRE:
|
|
|
|
|
2015-08-11 21:39:38 +03:00
|
|
|
DEBUGF 1,"RRE\n"
|
2015-08-03 21:07:56 +03:00
|
|
|
|
|
|
|
@@:
|
2015-08-11 21:39:38 +03:00
|
|
|
lea eax, [esi+4+BYTES_PER_PIXEL]
|
2015-08-03 21:07:56 +03:00
|
|
|
cmp [datapointer], eax
|
|
|
|
jae @f
|
|
|
|
call read_data.more
|
|
|
|
jmp @b
|
|
|
|
@@:
|
|
|
|
|
|
|
|
lodsd
|
|
|
|
bswap eax
|
|
|
|
mov [subrectangles], eax
|
|
|
|
|
2015-08-11 21:39:38 +03:00
|
|
|
DEBUGF 1, "%u subrectangles\n", eax
|
|
|
|
|
|
|
|
; Calculate first pixel pos
|
2015-08-03 21:07:56 +03:00
|
|
|
movzx eax, [screen.width]
|
|
|
|
mul [rectangle.y] ; [screen.width]*[rectangle.y]
|
|
|
|
add eax, [rectangle.x] ; [screen.width]*[rectangle.y]+[rectangle.x]
|
2015-08-14 16:30:03 +03:00
|
|
|
lea edi, [framebuffer+eax*3] ; edi = framebuffer_data+([screen.width]*[rectangle.y]+[rectangle.x])*3
|
2015-08-03 21:07:56 +03:00
|
|
|
|
2015-08-11 21:39:38 +03:00
|
|
|
; Calculate offset between two rows of pixels
|
2015-08-03 21:07:56 +03:00
|
|
|
movzx eax, [screen.width]
|
|
|
|
sub eax, [rectangle.width]
|
|
|
|
lea ebp, [eax*3] ; ebp = ([screen.width]-[rectangle.width])*3
|
|
|
|
|
2015-08-20 12:30:24 +03:00
|
|
|
; Get background color
|
|
|
|
call load_pixel
|
|
|
|
|
2015-08-11 21:39:38 +03:00
|
|
|
; Draw background rectangle
|
2015-08-03 21:07:56 +03:00
|
|
|
push edi
|
|
|
|
mov edx, [rectangle.height]
|
|
|
|
.lineloop:
|
|
|
|
mov ecx, [rectangle.width]
|
|
|
|
.pixelloop:
|
|
|
|
stosw
|
|
|
|
rol eax, 16
|
|
|
|
stosb
|
|
|
|
rol eax, 16
|
|
|
|
dec ecx
|
|
|
|
jnz .pixelloop
|
|
|
|
add edi, ebp
|
|
|
|
dec edx
|
|
|
|
jnz .lineloop
|
|
|
|
pop edi
|
|
|
|
|
2015-08-11 21:39:38 +03:00
|
|
|
; Any subrectangles at all?
|
|
|
|
cmp [subrectangles], 0
|
|
|
|
je next_rectangle
|
|
|
|
|
2015-08-03 21:07:56 +03:00
|
|
|
.subrectangle:
|
2015-08-20 12:30:24 +03:00
|
|
|
push edi
|
2015-08-03 21:07:56 +03:00
|
|
|
@@:
|
2015-08-11 21:39:38 +03:00
|
|
|
lea eax, [esi+8+BYTES_PER_PIXEL]
|
2015-08-03 21:07:56 +03:00
|
|
|
cmp [datapointer], eax
|
|
|
|
jae @f
|
|
|
|
call read_data.more
|
|
|
|
jmp @b
|
|
|
|
@@:
|
|
|
|
|
2015-08-11 21:39:38 +03:00
|
|
|
; Get subrectangle color
|
2015-08-20 12:30:24 +03:00
|
|
|
call load_pixel
|
|
|
|
push eax
|
2015-08-03 21:07:56 +03:00
|
|
|
|
2015-08-11 21:39:38 +03:00
|
|
|
; Get coordinates
|
2015-08-03 21:07:56 +03:00
|
|
|
xor eax, eax
|
|
|
|
lodsw
|
|
|
|
xchg al, ah
|
|
|
|
mov [subrectangle.x], eax
|
|
|
|
lodsw
|
|
|
|
xchg al, ah
|
|
|
|
mov [subrectangle.y], eax
|
|
|
|
lodsw
|
|
|
|
xchg al, ah
|
2015-08-11 21:39:38 +03:00
|
|
|
mov [subrectangle.width], eax
|
2015-08-03 21:07:56 +03:00
|
|
|
lodsw
|
|
|
|
xchg al, ah
|
2015-08-11 21:39:38 +03:00
|
|
|
mov [subrectangle.height], eax
|
|
|
|
DEBUGF 1, "Subrectangle: x=%u y=%u width=%u height=%u\n", \
|
|
|
|
[subrectangle.x], [subrectangle.y], [subrectangle.width], [subrectangle.height]
|
2015-08-03 21:07:56 +03:00
|
|
|
|
2015-08-11 21:39:38 +03:00
|
|
|
; Calculate pos of first pixel
|
|
|
|
movzx eax, [screen.width]
|
2015-08-03 21:07:56 +03:00
|
|
|
mul [subrectangle.y]
|
|
|
|
add eax, [subrectangle.x]
|
2015-08-11 21:39:38 +03:00
|
|
|
lea eax, [eax*3]
|
2015-08-03 21:07:56 +03:00
|
|
|
add edi, eax
|
|
|
|
|
2015-08-11 21:39:38 +03:00
|
|
|
; Calculate offset between two rows of pixels
|
|
|
|
movzx eax, [screen.width]
|
|
|
|
sub eax, [subrectangle.width]
|
|
|
|
lea ebp, [eax*3] ; ebp = ([screen.width]-[rectangle.width])*3
|
|
|
|
|
|
|
|
; Draw the subrectangle
|
2015-08-20 12:30:24 +03:00
|
|
|
pop eax
|
2015-08-03 21:07:56 +03:00
|
|
|
mov edx, [subrectangle.height]
|
|
|
|
.lineloop2:
|
|
|
|
mov ecx, [subrectangle.width]
|
|
|
|
.pixelloop2:
|
|
|
|
stosw
|
|
|
|
rol eax, 16
|
|
|
|
stosb
|
|
|
|
rol eax, 16
|
|
|
|
dec ecx
|
|
|
|
jnz .pixelloop2
|
|
|
|
add edi, ebp
|
|
|
|
dec edx
|
|
|
|
jnz .lineloop2
|
|
|
|
pop edi
|
|
|
|
dec [subrectangles]
|
|
|
|
jnz .subrectangle
|
2015-08-20 12:30:24 +03:00
|
|
|
jmp next_rectangle
|
|
|
|
|