aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorgeorge82 <george82@3789f03b-4d11-0410-bbf8-ca57d06f2519>2006-09-05 15:44:35 +0000
committergeorge82 <george82@3789f03b-4d11-0410-bbf8-ca57d06f2519>2006-09-05 15:44:35 +0000
commit96b17b95cb6cf74ec2d977b82dd2788a7e50589d (patch)
treecd51586f456e902d5ceebe1c182205ad1d784651
parentcb5a9a275e56d14e0c4f545338881bf5e3b382aa (diff)
downloadtigervnc-96b17b95cb6cf74ec2d977b82dd2788a7e50589d.tar.gz
tigervnc-96b17b95cb6cf74ec2d977b82dd2788a7e50589d.zip
Small the ScaledDIBSectionBuffer class code improvements.
git-svn-id: svn://svn.code.sf.net/p/tigervnc/code/trunk@647 3789f03b-4d11-0410-bbf8-ca57d06f2519
-rw-r--r--win/rfb_win32/ScaledDIBSectionBuffer.cxx11
-rw-r--r--win/rfb_win32/ScaledDIBSectionBuffer.h2
2 files changed, 9 insertions, 4 deletions
diff --git a/win/rfb_win32/ScaledDIBSectionBuffer.cxx b/win/rfb_win32/ScaledDIBSectionBuffer.cxx
index e0091877..155de3de 100644
--- a/win/rfb_win32/ScaledDIBSectionBuffer.cxx
+++ b/win/rfb_win32/ScaledDIBSectionBuffer.cxx
@@ -45,6 +45,7 @@ void ScaledDIBSectionBuffer::setScaleRatio(double scale_ratio_) {
if (scale_ratio_ != 1) scaling = true;
else scaling = false;
ScaledPixelBuffer::setScaleRatio(scale_ratio_);
+ calculateScaledBufferSize();
recreateBuffers();
}
@@ -73,8 +74,6 @@ void ScaledDIBSectionBuffer::setSize(int src_width_, int src_height_) {
}
void ScaledDIBSectionBuffer::recreateScaledBuffer() {
- width_ = scaled_width;
- height_ = scaled_height;
if (width_ && height_ && (format.depth != 0)) {
DIBSectionBuffer::recreateBuffer();
scaled_data = data;
@@ -82,8 +81,6 @@ void ScaledDIBSectionBuffer::recreateScaledBuffer() {
}
void ScaledDIBSectionBuffer::recreateBuffers() {
- width_ = scaled_width;
- height_ = scaled_height;
if (scaled_width && scaled_height && format.depth != 0 && scale_ratio != 0) {
if (scaling) {
if (src_buffer) {
@@ -111,6 +108,12 @@ void ScaledDIBSectionBuffer::recreateBuffers() {
}
}
+void ScaledDIBSectionBuffer::calculateScaledBufferSize() {
+ ScaledPixelBuffer::calculateScaledBufferSize();
+ width_ = scaled_width;
+ height_ = scaled_height;
+}
+
void ScaledDIBSectionBuffer::fillRect(const Rect &dest, Pixel pix) {
if (scaling) {
src_buffer->fillRect(dest, pix);
diff --git a/win/rfb_win32/ScaledDIBSectionBuffer.h b/win/rfb_win32/ScaledDIBSectionBuffer.h
index c2b8ed7d..69c38481 100644
--- a/win/rfb_win32/ScaledDIBSectionBuffer.h
+++ b/win/rfb_win32/ScaledDIBSectionBuffer.h
@@ -51,6 +51,8 @@ namespace rfb {
virtual void setScale(int scale) { setScaleRatio(double(scale)/100.0); };
virtual void setScaleRatio(double scale_ratio);
+ virtual void calculateScaledBufferSize();
+
Rect getRect() const { return ScaledPixelBuffer::getRect(); }
Rect getRect(const Point& pos) const { return ScaledPixelBuffer::getRect(pos); }