diff options
author | george82 <george82@3789f03b-4d11-0410-bbf8-ca57d06f2519> | 2006-04-05 15:33:50 +0000 |
---|---|---|
committer | george82 <george82@3789f03b-4d11-0410-bbf8-ca57d06f2519> | 2006-04-05 15:33:50 +0000 |
commit | fea770deba173fc1089f628d48ebc249fd4ce887 (patch) | |
tree | 3365d0c10ac1a6047c4ba2397c2f3815cae0ca39 /rfb | |
parent | c5b3973accbae9d3aac50182ca451e9f2596cb31 (diff) | |
download | tigervnc-fea770deba173fc1089f628d48ebc249fd4ce887.tar.gz tigervnc-fea770deba173fc1089f628d48ebc249fd4ce887.zip |
Small code improvements.
Added the new method calculateScaledBufferSize() to
the rfb::ScaledPixelBuffer class.
git-svn-id: svn://svn.code.sf.net/p/tigervnc/code/trunk@514 3789f03b-4d11-0410-bbf8-ca57d06f2519
Diffstat (limited to 'rfb')
-rw-r--r-- | rfb/ScaledPixelBuffer.cxx | 15 | ||||
-rw-r--r-- | rfb/ScaledPixelBuffer.h | 6 |
2 files changed, 13 insertions, 8 deletions
diff --git a/rfb/ScaledPixelBuffer.cxx b/rfb/ScaledPixelBuffer.cxx index bd1ff724..bf4612de 100644 --- a/rfb/ScaledPixelBuffer.cxx +++ b/rfb/ScaledPixelBuffer.cxx @@ -45,8 +45,7 @@ void ScaledPixelBuffer::setSourceBuffer(U8 **src_data_, int w, int h) { src_data = src_data_; src_width = w; src_height = h; - scaled_width = (int)ceil(src_width * scale_ratio); - scaled_height = (int)ceil(src_height * scale_ratio); + calculateScaledBufferSize(); recreateScaledBuffer(); } @@ -54,13 +53,8 @@ void ScaledPixelBuffer::setScale(int scale_) { if (scale != scale_) { scale = scale_; scale_ratio = double(scale) / 100; - - scaled_width = (int)ceil(src_width * scale_ratio); - scaled_height = (int)ceil(src_height * scale_ratio); - + calculateScaledBufferSize(); recreateScaledBuffer(); - - scaleRect(Rect(0, 0, scaled_width, scaled_height)); } } @@ -129,5 +123,10 @@ Rect ScaledPixelBuffer::calculateScaleBoundary(const Rect& r) { return Rect(x_start, y_start, x_end, y_end); } +void ScaledPixelBuffer::calculateScaledBufferSize() { + scaled_width = (int)ceil(src_width * scale_ratio); + scaled_height = (int)ceil(src_height * scale_ratio); +} + void ScaledPixelBuffer::recreateScaledBuffer() { } diff --git a/rfb/ScaledPixelBuffer.h b/rfb/ScaledPixelBuffer.h index f7243e14..3b6aa7ef 100644 --- a/rfb/ScaledPixelBuffer.h +++ b/rfb/ScaledPixelBuffer.h @@ -63,6 +63,12 @@ namespace rfb { inline Rect calculateScaleBoundary(const Rect& r); protected: + + // Calculate the scaled buffer size depending on the source buffer + // parameters (width, height, pixel format) + void calculateScaledBufferSize(); + + // Recreate the scaled pixel buffer virtual void recreateScaledBuffer(); int src_width; |