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
diff --git a/common/rfb/ScaleFilters.cxx b/common/rfb/ScaleFilters.cxx
index 4782add..e90e1e3 100644
--- a/common/rfb/ScaleFilters.cxx
+++ b/common/rfb/ScaleFilters.cxx
@@ -87,20 +87,21 @@
   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 317d0b4..c2555a7 100644
--- a/common/rfb/ScaleFilters.h
+++ b/common/rfb/ScaleFilters.h
@@ -60,7 +60,7 @@
 

     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();