summaryrefslogtreecommitdiffstats
path: root/common
diff options
context:
space:
mode:
authorgeorge82 <george82@3789f03b-4d11-0410-bbf8-ca57d06f2519>2006-12-03 17:31:39 +0000
committergeorge82 <george82@3789f03b-4d11-0410-bbf8-ca57d06f2519>2006-12-03 17:31:39 +0000
commit5e5628488301ce493831c5f92ecbb13482c57a78 (patch)
treec587e6737abbfb8b5c4fc68423ca8961bace9893 /common
parent1c2e9e6a2262f45ad368a77bf35a4a9340f1aa90 (diff)
downloadtigervnc-5e5628488301ce493831c5f92ecbb13482c57a78.tar.gz
tigervnc-5e5628488301ce493831c5f92ecbb13482c57a78.zip
Modified ScaledPixelBuffer::calculateScaleBoundary() in
compliance with any scaled filters. git-svn-id: svn://svn.code.sf.net/p/tigervnc/code/trunk@2166 3789f03b-4d11-0410-bbf8-ca57d06f2519
Diffstat (limited to 'common')
-rw-r--r--common/rfb/ScaledPixelBuffer.cxx17
1 files changed, 10 insertions, 7 deletions
diff --git a/common/rfb/ScaledPixelBuffer.cxx b/common/rfb/ScaledPixelBuffer.cxx
index b5b3ea32..639dcd9d 100644
--- a/common/rfb/ScaledPixelBuffer.cxx
+++ b/common/rfb/ScaledPixelBuffer.cxx
@@ -158,13 +158,16 @@ void ScaledPixelBuffer::scaleRect(const Rect& rect) {
Rect ScaledPixelBuffer::calculateScaleBoundary(const Rect& r) {
int x_start, y_start, x_end, y_end;
- double sup = scaleFilters[scaleFilterID].radius;
- x_start = r.tl.x-sup < 0 ? 0 : int((r.tl.x-sup) * scale_ratio + 1);
- y_start = r.tl.y-sup < 0 ? 0 : int((r.tl.y-sup) * scale_ratio + 1);
- x_end = int((r.br.x+sup-1) * scale_ratio);
- x_end = x_end < scaled_width ? x_end + 1 : scaled_width;
- y_end = int((r.br.y+sup-1) * scale_ratio);
- y_end = y_end < scaled_height ? y_end + 1 : scaled_height;
+ double radius = scaleFilters[scaleFilterID].radius;
+ double translate = 0.5*scale_ratio - 0.5;
+ x_start = (int)ceil(scale_ratio*(r.tl.x-radius) + translate);
+ y_start = (int)ceil(scale_ratio*(r.tl.y-radius) + translate);
+ x_end = (int)ceil(scale_ratio*(r.br.x+radius) + translate);
+ y_end = (int)ceil(scale_ratio*(r.br.y+radius) + translate);
+ if (x_start < 0) x_start = 0;
+ if (y_start < 0) y_start = 0;
+ if (x_end > scaled_width) x_end = scaled_width;
+ if (y_end > scaled_height) y_end = scaled_height;
return Rect(x_start, y_start, x_end, y_end);
}