summaryrefslogtreecommitdiffstats
path: root/common/rfb/ScaledPixelBuffer.cxx
diff options
context:
space:
mode:
authorgeorge82 <george82@3789f03b-4d11-0410-bbf8-ca57d06f2519>2007-03-20 10:54:38 +0000
committergeorge82 <george82@3789f03b-4d11-0410-bbf8-ca57d06f2519>2007-03-20 10:54:38 +0000
commitc4eb6262e62defefd076c7080b3aa3d48446b09d (patch)
tree75b867217f2f82a25c7136182d1083dd31b41099 /common/rfb/ScaledPixelBuffer.cxx
parent486740f17ae8611091c86f054a62333e6e5a4876 (diff)
downloadtigervnc-c4eb6262e62defefd076c7080b3aa3d48446b09d.tar.gz
tigervnc-c4eb6262e62defefd076c7080b3aa3d48446b09d.zip
Added the routines for manipulation the scale filter method. It allow change the
scale filter. git-svn-id: svn://svn.code.sf.net/p/tigervnc/code/trunk@2241 3789f03b-4d11-0410-bbf8-ca57d06f2519
Diffstat (limited to 'common/rfb/ScaledPixelBuffer.cxx')
-rw-r--r--common/rfb/ScaledPixelBuffer.cxx13
1 files changed, 13 insertions, 0 deletions
diff --git a/common/rfb/ScaledPixelBuffer.cxx b/common/rfb/ScaledPixelBuffer.cxx
index 1be029df..35d5d3b1 100644
--- a/common/rfb/ScaledPixelBuffer.cxx
+++ b/common/rfb/ScaledPixelBuffer.cxx
@@ -86,6 +86,19 @@ void ScaledPixelBuffer::setScale(int scale_) {
}
}
+void ScaledPixelBuffer::setScaleFilter(unsigned int scaleFilterID_) {
+ if (scaleFilterID == scaleFilterID_ || scaleFilterID_ > scaleFilterMaxNumber) return;
+
+ scaleFilterID = scaleFilterID_;
+
+ if (src_width && src_height && scaled_width && scaled_height && pf.depth > 0) {
+ freeWeightTabs();
+ scaleFilters.makeWeightTabs(scaleFilterID, src_width, scaled_width, &xWeightTabs);
+ scaleFilters.makeWeightTabs(scaleFilterID, src_height, scaled_height, &yWeightTabs);
+ if (scale != 100) scaleRect(Rect(0, 0, src_width, src_height));
+ }
+}
+
inline void ScaledPixelBuffer::rgbFromPixel(U32 p, int &r, int &g, int &b) {
r = (((p >> pf.redShift ) & pf.redMax ) * 255 + pf.redMax /2) / pf.redMax;
g = (((p >> pf.greenShift) & pf.greenMax) * 255 + pf.greenMax/2) / pf.greenMax;