2015-08-03 15:13:09 +02: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-03 20:07:56 +02:00
|
|
|
encoding_CopyRect:
|
2015-08-03 15:13:09 +02:00
|
|
|
|
2015-08-10 13:09:36 +02:00
|
|
|
DEBUGF 1,"CopyRect\n"
|
2015-08-03 15:13:09 +02:00
|
|
|
|
|
|
|
@@:
|
|
|
|
lea eax, [esi+4]
|
|
|
|
cmp [datapointer], eax
|
|
|
|
jae @f
|
|
|
|
call read_data.more
|
|
|
|
jmp @b
|
|
|
|
@@:
|
|
|
|
|
|
|
|
push esi
|
|
|
|
|
|
|
|
movzx eax, word[esi+2] ; [src.y]
|
|
|
|
xchg al, ah
|
|
|
|
movzx ebx, [screen.width]
|
|
|
|
mul ebx ; [screen.width]*[src.y]
|
|
|
|
movzx ebx, word[esi] ; [src.x]
|
|
|
|
xchg bl, bh
|
|
|
|
add eax, ebx ; [screen.width]*[src.y]+[src.x]
|
|
|
|
lea esi, [framebuffer_data+eax*3] ; esi = framebuffer_data+([screen.width]*[src.y]+[src.x])*3
|
|
|
|
|
2015-08-03 20:07:56 +02:00
|
|
|
mov eax, [rectangle.y]
|
2015-08-03 15:13:09 +02:00
|
|
|
movzx ebx, [screen.width]
|
|
|
|
mul ebx ; [screen.width]*[rectangle.y]
|
2015-08-10 13:09:36 +02:00
|
|
|
add eax, [rectangle.x] ; [screen.width]*[rectangle.y]+[rectangle.x]
|
2015-08-03 15:13:09 +02:00
|
|
|
lea edi, [framebuffer_data+eax*3] ; edi = framebuffer_data+([screen.width]*[rectangle.y]+[rectangle.x])*3
|
|
|
|
|
|
|
|
movzx eax, [screen.width]
|
2015-08-03 20:07:56 +02:00
|
|
|
sub eax, [rectangle.width]
|
2015-08-03 15:13:09 +02:00
|
|
|
lea ebp, [eax*3] ; ebp = ([screen.width]-[rectangle.width])*3
|
|
|
|
|
|
|
|
cmp esi, edi
|
2015-08-10 13:09:36 +02:00
|
|
|
ja .not_backwards
|
2015-08-03 15:13:09 +02:00
|
|
|
|
2015-08-10 13:09:36 +02:00
|
|
|
; Source pixels come before destination in buffer, copy backwards.
|
|
|
|
DEBUGF 1,"backwards\n"
|
2015-08-03 20:07:56 +02:00
|
|
|
mov eax, [rectangle.height]
|
2015-08-10 13:09:36 +02:00
|
|
|
dec eax
|
2015-08-03 15:13:09 +02:00
|
|
|
movzx edx, [screen.width]
|
|
|
|
mul edx
|
2015-08-10 13:09:36 +02:00
|
|
|
add eax, [rectangle.width]
|
|
|
|
lea eax, [eax*3-1] ; eax = (([rectangle.height]-1)*[screen.width]+[rectangle.width])*3-1
|
2015-08-03 15:13:09 +02:00
|
|
|
add esi, eax
|
|
|
|
add edi, eax
|
|
|
|
neg ebp
|
|
|
|
std
|
2015-08-10 13:09:36 +02:00
|
|
|
.not_backwards:
|
2015-08-03 15:13:09 +02:00
|
|
|
|
2015-08-10 13:09:36 +02:00
|
|
|
; Do the actual copying
|
|
|
|
mov eax, [rectangle.width]
|
|
|
|
lea eax, [eax*3]
|
|
|
|
mov ebx, eax
|
|
|
|
and eax, 11b
|
|
|
|
shr ebx, 2
|
2015-08-03 20:07:56 +02:00
|
|
|
mov edx, [rectangle.height]
|
2015-08-03 15:13:09 +02:00
|
|
|
.lineloop:
|
2015-08-10 13:09:36 +02:00
|
|
|
mov ecx, eax
|
|
|
|
rep movsb
|
|
|
|
mov ecx, ebx
|
|
|
|
rep movsd
|
2015-08-03 15:13:09 +02:00
|
|
|
add esi, ebp
|
|
|
|
add edi, ebp
|
|
|
|
dec edx
|
|
|
|
jnz .lineloop
|
|
|
|
|
|
|
|
pop esi
|
|
|
|
add esi, 4
|
|
|
|
cld
|
|
|
|
jmp next_rectangle
|