]> source.dussan.org Git - tigervnc.git/commitdiff
Added ScaleFilters class implementation to the
authorgeorge82 <george82@3789f03b-4d11-0410-bbf8-ca57d06f2519>
Fri, 27 Oct 2006 16:11:52 +0000 (16:11 +0000)
committergeorge82 <george82@3789f03b-4d11-0410-bbf8-ca57d06f2519>
Fri, 27 Oct 2006 16:11:52 +0000 (16:11 +0000)
ScaledPixelBuffer. It's routines to manipulates a set of
1-d scale filters.

git-svn-id: svn://svn.code.sf.net/p/tigervnc/code/trunk@2109 3789f03b-4d11-0410-bbf8-ca57d06f2519

common/rfb/ScaleFilters.h

index 950838a22e87008f05da8b32085fc5b73c2b9b56..6839f18a70fb4ca68a1258b454a5923d58a0d9d1 100644 (file)
@@ -69,11 +69,38 @@ namespace rfb {
     else return sin(pi*x)/(pi*x);\r
   }\r
 \r
-  class ScaleFilter {\r
-  public:\r
+  typedef struct {\r
     char name[30];\r
-    int radius;\r
+    double radius;\r
     filter_func func;\r
+  } SFilter;\r
+\r
+  class ScaleFilters {\r
+  public:\r
+    ScaleFilters() { initFilters(); };\r
+\r
+    SFilter &operator[](unsigned int filter_id) {\r
+      return filters[filter_id];\r
+    }\r
+\r
+  protected:\r
+    void initFilters() {\r
+      filters[scaleFilterNearestNeighbor] = create("Nearest neighbor", 0.5, nearest_neighbor);\r
+      filters[scaleFilterBilinear] = create("Bilinear", 1, linear);\r
+      filters[scaleFilterBicubic] = create("Bicubic", 2, cubic);\r
+      filters[scaleFilterSinc]  = create("Sinc", 4, sinc);\r
+    }\r
+\r
+    SFilter create(char *name_, double radius_, filter_func func_) {\r
+      SFilter filter;\r
+      strncpy(filter.name, name_, sizeof(filter.name)-1); \r
+      filter.name[sizeof(filter.name)-1] = '\0';\r
+      filter.radius = radius_;\r
+      filter.func = func_;\r
+      return filter;\r
+    }\r
+\r
+    SFilter filters[scaleFiltersMax];\r
   };\r
 \r
 };\r