summaryrefslogtreecommitdiffstats
path: root/common
diff options
context:
space:
mode:
authorgeorge82 <george82@3789f03b-4d11-0410-bbf8-ca57d06f2519>2006-11-20 15:37:33 +0000
committergeorge82 <george82@3789f03b-4d11-0410-bbf8-ca57d06f2519>2006-11-20 15:37:33 +0000
commitba9299d327aa223b2452c9c58ce1e62b4026217c (patch)
treece1d7dbfda1c3dd7383b35ae35697ef0492e3955 /common
parent1f80656d02fc0ec3d70767ff33db03d766581193 (diff)
downloadtigervnc-ba9299d327aa223b2452c9c58ce1e62b4026217c.tar.gz
tigervnc-ba9299d327aa223b2452c9c58ce1e62b4026217c.zip
Fixed the small bugs with the makeWeightTabs function.
makeWeightTabs must work with the pointer to weightTabs. git-svn-id: svn://svn.code.sf.net/p/tigervnc/code/trunk@2117 3789f03b-4d11-0410-bbf8-ca57d06f2519
Diffstat (limited to 'common')
-rw-r--r--common/rfb/ScaleFilters.cxx13
-rw-r--r--common/rfb/ScaleFilters.h2
2 files changed, 8 insertions, 7 deletions
diff --git a/common/rfb/ScaleFilters.cxx b/common/rfb/ScaleFilters.cxx
index 4782adde..e90e1e38 100644
--- a/common/rfb/ScaleFilters.cxx
+++ b/common/rfb/ScaleFilters.cxx
@@ -87,20 +87,21 @@ SFilter ScaleFilters::create(char *name_, double radius_, filter_func func_) {
return filter;
}
-void ScaleFilters::makeWeightTabs(int filter_id, int src_x, int dst_x, SFilterWeightTab *weightTabs) {
+void ScaleFilters::makeWeightTabs(int filter_id, int src_x, int dst_x, SFilterWeightTab **pWeightTabs) {
double sx;
- double ratio = dst_x / src_x;
+ double ratio = double(dst_x) / src_x;
SFilter sFilter = filters[filter_id];
-
- weightTabs = new SFilterWeightTab[dst_x];
+
+ *pWeightTabs = new SFilterWeightTab[dst_x];
+ SFilterWeightTab *weightTabs = *pWeightTabs;
// Make the weight tab for the each dest x position
for (int x = 0; x < dst_x; x++) {
sx = double(x) / ratio;
// Calculate the scale filter interval, [i0, i1)
- int i0 = int(__rfbmin(ceil(sx-sFilter.radius), 0));
- int i1 = int(__rfbmax(ceil(sx+sFilter.radius), src_x));
+ int i0 = int(__rfbmax(ceil(sx-sFilter.radius), 0));
+ int i1 = int(__rfbmin(ceil(sx+sFilter.radius), src_x));
weightTabs[x].i0 = i0; weightTabs[x].i1 = i1;
weightTabs[x].weight = new float[i1-i0];
diff --git a/common/rfb/ScaleFilters.h b/common/rfb/ScaleFilters.h
index 317d0b41..c2555a74 100644
--- a/common/rfb/ScaleFilters.h
+++ b/common/rfb/ScaleFilters.h
@@ -60,7 +60,7 @@ namespace rfb {
SFilter &operator[](unsigned int filter_id);
- void makeWeightTabs(int filter, int src_x, int dst_x, SFilterWeightTab *weightTabs);
+ void makeWeightTabs(int filter, int src_x, int dst_x, SFilterWeightTab **weightTabs);
protected:
void initFilters();