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: encoding_CopyRect:
DEBUGF 2,"CopyRect\n" DEBUGF 1,"CopyRect\n"
@@: @@:
lea eax, [esi+4] lea eax, [esi+4]
@ -38,8 +38,7 @@ encoding_CopyRect:
mov eax, [rectangle.y] mov eax, [rectangle.y]
movzx ebx, [screen.width] movzx ebx, [screen.width]
mul ebx ; [screen.width]*[rectangle.y] mul ebx ; [screen.width]*[rectangle.y]
mov ebx, [rectangle.x] add eax, [rectangle.x] ; [screen.width]*[rectangle.y]+[rectangle.x]
add eax, ebx ; [screen.width]*[rectangle.y]+[rectangle.x]
lea edi, [framebuffer_data+eax*3] ; edi = framebuffer_data+([screen.width]*[rectangle.y]+[rectangle.x])*3 lea edi, [framebuffer_data+eax*3] ; edi = framebuffer_data+([screen.width]*[rectangle.y]+[rectangle.x])*3
movzx eax, [screen.width] movzx eax, [screen.width]
@ -47,28 +46,34 @@ encoding_CopyRect:
lea ebp, [eax*3] ; ebp = ([screen.width]-[rectangle.width])*3 lea ebp, [eax*3] ; ebp = ([screen.width]-[rectangle.width])*3
cmp esi, edi 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] mov eax, [rectangle.height]
dec eax
movzx edx, [screen.width] movzx edx, [screen.width]
mul edx 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 esi, eax
add edi, eax add edi, eax
neg ebp neg ebp
std 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 edx, [rectangle.height]
mov ecx, [rectangle.width]
lea ecx, [ecx*3]
.lineloop: .lineloop:
push ecx mov ecx, eax
rep movsb rep movsb
pop ecx mov ecx, ebx
rep movsd
add esi, ebp add esi, ebp
add edi, ebp add edi, ebp
dec edx dec edx

View File

@ -185,7 +185,7 @@ else
end if end if
DEBUGF 1, "Sending encoding info\n" 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 ; Set main window caption to servername
mov ecx, dword[receive_buffer+framebuffer.name_length] mov ecx, dword[receive_buffer+framebuffer.name_length]
@ -268,6 +268,7 @@ rectangle_loop:
mov [rectangle.height], eax mov [rectangle.height], eax
lodsd ; encoding lodsd ; encoding
bswap eax
DEBUGF 1, "rectangle: width=%u height=%u x=%u y=%u encoding: ",\ DEBUGF 1, "rectangle: width=%u height=%u x=%u y=%u encoding: ",\
[rectangle.width]:2, [rectangle.height]:2, [rectangle.x]:2, [rectangle.y]:2 [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, 5 ; HexTile
; db 0, 0, 0, 15 ; TRLE ; db 0, 0, 0, 15 ; TRLE
; db 0, 0, 0, 16 ; ZRLE ; db 0, 0, 0, 16 ; ZRLE
.length = $ - SetEncodings
FramebufferUpdateRequest db 3 FramebufferUpdateRequest db 3
.inc db 0 ; incremental .inc db 0 ; incremental