From e89d47fb19a0a0438b2b038f0e7ab005d72a9be2 Mon Sep 17 00:00:00 2001 From: george82 Date: Sat, 27 May 2006 12:31:08 +0000 Subject: [PATCH] ScaledDIBSectionBuffer class improvements: Copy the pixel data from source buffer to scale buffer if scale was changed to 100 percent and copy the pixel data from scaled buffer to source buffer if scale was changed from 100 percent. It allow refresh the Desktop Window without sending FramebufferUpdateRequest message and decrease the network traffic. git-svn-id: svn://svn.code.sf.net/p/tigervnc/code/trunk@597 3789f03b-4d11-0410-bbf8-ca57d06f2519 --- win/rfb_win32/ScaledDIBSectionBuffer.cxx | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/win/rfb_win32/ScaledDIBSectionBuffer.cxx b/win/rfb_win32/ScaledDIBSectionBuffer.cxx index bd6b4d37..be921f95 100644 --- a/win/rfb_win32/ScaledDIBSectionBuffer.cxx +++ b/win/rfb_win32/ScaledDIBSectionBuffer.cxx @@ -45,15 +45,23 @@ void ScaledDIBSectionBuffer::setScale(int scale_) { if (!src_buffer) { src_buffer = new ManagedPixelBuffer(format, src_width, src_height); src_data = &(src_buffer->data); + memcpy(src_buffer->data, data, area() * (getPF().bpp/8)); } } else { scaling = false; - if (src_buffer) delete src_buffer; - src_buffer = 0; - src_data = 0; } ScaledPixelBuffer::setScale(scale_); recreateScaledBuffer(); + if (scaling) { + scaleRect(Rect(0, 0, src_width, src_height)); + } else { + memcpy(data, src_buffer->data, src_buffer->area() * (src_buffer->getPF().bpp/8)); + if (src_buffer) { + delete src_buffer; + src_buffer = 0; + src_data = 0; + } + } } void ScaledDIBSectionBuffer::setPF(const PixelFormat &pf_) { -- 2.39.5