From 8f52c43d644bfe7805d0059df850ec190839a6cb Mon Sep 17 00:00:00 2001 From: hidnplayr Date: Mon, 10 Aug 2015 11:09:36 +0000 Subject: [PATCH] VNC viewer: bugfixes and optimization for CopyRect encoding. git-svn-id: svn://kolibrios.org@5708 a494cfbc-eb01-0410-851d-a64ba20cac60 --- programs/network/vncc/copyrect.inc | 33 +++++++++++++++++------------- programs/network/vncc/network.inc | 3 ++- programs/network/vncc/vncc.asm | 1 + 3 files changed, 22 insertions(+), 15 deletions(-) diff --git a/programs/network/vncc/copyrect.inc b/programs/network/vncc/copyrect.inc index 8ec918265b..e911fe9c75 100644 --- a/programs/network/vncc/copyrect.inc +++ b/programs/network/vncc/copyrect.inc @@ -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 diff --git a/programs/network/vncc/network.inc b/programs/network/vncc/network.inc index 1db2e0ec56..02b2b5356c 100644 --- a/programs/network/vncc/network.inc +++ b/programs/network/vncc/network.inc @@ -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 diff --git a/programs/network/vncc/vncc.asm b/programs/network/vncc/vncc.asm index ac33e373fb..7b5fa0a048 100644 --- a/programs/network/vncc/vncc.asm +++ b/programs/network/vncc/vncc.asm @@ -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