From bb92e1203066f02244eb26b6c1e2a09846314ce1 Mon Sep 17 00:00:00 2001 From: george82 Date: Wed, 24 May 2006 10:05:24 +0000 Subject: [PATCH] Small rfb_win32::ScaledDIBSectionBuffer class code improvements. Create rfb_win32::ScaledDIBSectionBuffer::src_buffer only if the vncviewer work in the scaling mode. git-svn-id: svn://svn.code.sf.net/p/tigervnc/code/trunk@584 3789f03b-4d11-0410-bbf8-ca57d06f2519 --- rfb_win32/ScaledDIBSectionBuffer.cxx | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/rfb_win32/ScaledDIBSectionBuffer.cxx b/rfb_win32/ScaledDIBSectionBuffer.cxx index e6c15b8e..bd6b4d37 100644 --- a/rfb_win32/ScaledDIBSectionBuffer.cxx +++ b/rfb_win32/ScaledDIBSectionBuffer.cxx @@ -40,23 +40,28 @@ ScaledDIBSectionBuffer::~ScaledDIBSectionBuffer() { void ScaledDIBSectionBuffer::setScale(int scale_) { if (scale_ == getScale()) return; - if (src_buffer) { - delete src_buffer; - src_buffer = 0; - } if (scale_ != 100) { scaling = true; - src_buffer = new ManagedPixelBuffer(format, src_width, src_height); - src_data = &(src_buffer->data); + if (!src_buffer) { + src_buffer = new ManagedPixelBuffer(format, src_width, src_height); + src_data = &(src_buffer->data); + } } else { scaling = false; + if (src_buffer) delete src_buffer; + src_buffer = 0; + src_data = 0; } ScaledPixelBuffer::setScale(scale_); + recreateScaledBuffer(); } -void ScaledDIBSectionBuffer::setPF(const PixelFormat &pf) { - if (scaling) src_buffer->setPF(pf); - DIBSectionBuffer::setPF(pf); +void ScaledDIBSectionBuffer::setPF(const PixelFormat &pf_) { + if (scaling) { + ScaledPixelBuffer::setPF(pf_); + src_buffer->setPF(pf_); + } + DIBSectionBuffer::setPF(pf_); scaled_data = data; } -- 2.39.5