]> source.dussan.org Git - tigervnc.git/commitdiff
Fixed the small bugs with the makeWeightTabs function.
authorgeorge82 <george82@3789f03b-4d11-0410-bbf8-ca57d06f2519>
Mon, 20 Nov 2006 15:37:33 +0000 (15:37 +0000)
committergeorge82 <george82@3789f03b-4d11-0410-bbf8-ca57d06f2519>
Mon, 20 Nov 2006 15:37:33 +0000 (15:37 +0000)
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

common/rfb/ScaleFilters.cxx
common/rfb/ScaleFilters.h

index 4782adde4b5fe382033dc7f1588bb7f3c2b1c8df..e90e1e38173acc96fdf9a0d78e2f67ac711a0cd5 100644 (file)
@@ -87,20 +87,21 @@ SFilter ScaleFilters::create(char *name_, double radius_, filter_func func_) {
   return filter;\r
 }\r
 \r
-void ScaleFilters::makeWeightTabs(int filter_id, int src_x, int dst_x, SFilterWeightTab *weightTabs) {\r
+void ScaleFilters::makeWeightTabs(int filter_id, int src_x, int dst_x, SFilterWeightTab **pWeightTabs) {\r
   double sx;\r
-  double ratio = dst_x / src_x;\r
+  double ratio = double(dst_x) / src_x;\r
   SFilter sFilter = filters[filter_id];\r
-\r
-  weightTabs = new SFilterWeightTab[dst_x];\r
+  \r
+  *pWeightTabs = new SFilterWeightTab[dst_x];\r
+  SFilterWeightTab *weightTabs = *pWeightTabs;\r
 \r
   // Make the weight tab for the each dest x position\r
   for (int x = 0; x < dst_x; x++) {\r
     sx = double(x) / ratio;\r
 \r
     // Calculate the scale filter interval, [i0, i1)\r
-    int i0 = int(__rfbmin(ceil(sx-sFilter.radius), 0));\r
-    int i1 = int(__rfbmax(ceil(sx+sFilter.radius), src_x));\r
+    int i0 = int(__rfbmax(ceil(sx-sFilter.radius), 0));\r
+    int i1 = int(__rfbmin(ceil(sx+sFilter.radius), src_x));\r
     weightTabs[x].i0 = i0; weightTabs[x].i1 = i1;\r
     weightTabs[x].weight = new float[i1-i0];\r
 \r
index 317d0b41395e3b296c656a888920d579b452347e..c2555a74d258471b404578f663f3efa33ca4cd13 100644 (file)
@@ -60,7 +60,7 @@ namespace rfb {
 \r
     SFilter &operator[](unsigned int filter_id);\r
 \r
-    void makeWeightTabs(int filter, int src_x, int dst_x, SFilterWeightTab *weightTabs);\r
+    void makeWeightTabs(int filter, int src_x, int dst_x, SFilterWeightTab **weightTabs);\r
 \r
   protected:\r
     void initFilters();\r