VNC viewer: bugfixes and optimization for CopyRect encoding.

git-svn-id: svn://kolibrios.org@5708 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
hidnplayr 2015-08-10 11:09:36 +00:00
parent c032ebbe0f
commit 8f52c43d64
3 changed files with 22 additions and 15 deletions

View File

@ -14,7 +14,7 @@
encoding_CopyRect:
DEBUGF 2,"CopyRect\n"
DEBUGF 1,"CopyRect\n"
@@:
lea eax, [esi+4]
@ -38,8 +38,7 @@ encoding_CopyRect:
mov eax, [rectangle.y]
movzx ebx, [screen.width]
mul ebx ; [screen.width]*[rectangle.y]
mov ebx, [rectangle.x]
add eax, ebx ; [screen.width]*[rectangle.y]+[rectangle.x]
add eax, [rectangle.x] ; [screen.width]*[rectangle.y]+[rectangle.x]
lea edi, [framebuffer_data+eax*3] ; edi = framebuffer_data+([screen.width]*[rectangle.y]+[rectangle.x])*3
movzx eax, [screen.width]
@ -47,28 +46,34 @@ encoding_CopyRect:
lea ebp, [eax*3] ; ebp = ([screen.width]-[rectangle.width])*3
cmp esi, edi
ja .copy
ja .not_backwards
; source pixels come before destination in buffer, copy backwards
; Source pixels come before destination in buffer, copy backwards.
DEBUGF 1,"backwards\n"
mov eax, [rectangle.height]
dec eax
movzx edx, [screen.width]
mul edx
lea eax, [eax*3-1]
add eax, [rectangle.width]
lea eax, [eax*3-1] ; eax = (([rectangle.height]-1)*[screen.width]+[rectangle.width])*3-1
add esi, eax
add edi, eax
neg ebp
std
.copy:
.not_backwards:
; Do the actual copying
mov eax, [rectangle.width]
lea eax, [eax*3]
mov ebx, eax
and eax, 11b
shr ebx, 2
mov edx, [rectangle.height]
mov ecx, [rectangle.width]
lea ecx, [ecx*3]
.lineloop:
push ecx
rep movsb
pop ecx
mov ecx, eax
rep movsb
mov ecx, ebx
rep movsd
add esi, ebp
add edi, ebp
dec edx

View File

@ -185,7 +185,7 @@ else
end if
DEBUGF 1, "Sending encoding info\n"
mcall send, [socketnum], SetEncodings, 12, 0
mcall send, [socketnum], SetEncodings, SetEncodings.length, 0
; Set main window caption to servername
mov ecx, dword[receive_buffer+framebuffer.name_length]
@ -268,6 +268,7 @@ rectangle_loop:
mov [rectangle.height], eax
lodsd ; encoding
bswap eax
DEBUGF 1, "rectangle: width=%u height=%u x=%u y=%u encoding: ",\
[rectangle.width]:2, [rectangle.height]:2, [rectangle.x]:2, [rectangle.y]:2

View File

@ -317,6 +317,7 @@ SetEncodings db 2 ; setEncodings
; db 0, 0, 0, 5 ; HexTile
; db 0, 0, 0, 15 ; TRLE
; db 0, 0, 0, 16 ; ZRLE
.length = $ - SetEncodings
FramebufferUpdateRequest db 3
.inc db 0 ; incremental