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
\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