From e3341e7264eb5d2533cad338977fa26256b309ab Mon Sep 17 00:00:00 2001 From: george82 Date: Wed, 2 Aug 2006 15:23:39 +0000 Subject: [PATCH] ScaledDIBSectionBuffer class code improvements. Added check for changing class parameters such as width, height, pf. git-svn-id: svn://svn.code.sf.net/p/tigervnc/code/trunk@641 3789f03b-4d11-0410-bbf8-ca57d06f2519 --- win/rfb_win32/ScaledDIBSectionBuffer.cxx | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/win/rfb_win32/ScaledDIBSectionBuffer.cxx b/win/rfb_win32/ScaledDIBSectionBuffer.cxx index 700e90b3..df3a6c93 100644 --- a/win/rfb_win32/ScaledDIBSectionBuffer.cxx +++ b/win/rfb_win32/ScaledDIBSectionBuffer.cxx @@ -67,6 +67,8 @@ void ScaledDIBSectionBuffer::setScaleRatio(double scale_ratio_) { } void ScaledDIBSectionBuffer::setPF(const PixelFormat &pf_) { + if (memcmp(&getPF(), &pf_, sizeof(pf_)) == 0) return; + if (scaling) { ScaledPixelBuffer::setPF(pf_); src_buffer->setPF(pf_); @@ -76,6 +78,8 @@ void ScaledDIBSectionBuffer::setPF(const PixelFormat &pf_) { } void ScaledDIBSectionBuffer::setSize(int src_width_, int src_height_) { + if (src_width == src_width_ && src_height == src_height_) return; + src_width = src_width_; src_height = src_height_; if (scaling) { @@ -89,8 +93,10 @@ void ScaledDIBSectionBuffer::setSize(int src_width_, int src_height_) { void ScaledDIBSectionBuffer::recreateScaledBuffer() { width_ = scaled_width; height_ = scaled_height; - DIBSectionBuffer::recreateBuffer(); - scaled_data = data; + if (width_ && height_ && (format.depth != 0)) { + DIBSectionBuffer::recreateBuffer(); + scaled_data = data; + } } void ScaledDIBSectionBuffer::fillRect(const Rect &dest, Pixel pix) { -- 2.39.5