From: george82 Date: Fri, 27 Oct 2006 16:11:52 +0000 (+0000) Subject: Added ScaleFilters class implementation to the X-Git-Tag: v0.0.90~384^2~202 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=5f203e6553fb38c26dd3296c423f5e0db123a4b7;p=tigervnc.git Added ScaleFilters class implementation to the 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 --- diff --git a/common/rfb/ScaleFilters.h b/common/rfb/ScaleFilters.h index 950838a2..6839f18a 100644 --- a/common/rfb/ScaleFilters.h +++ b/common/rfb/ScaleFilters.h @@ -69,11 +69,38 @@ namespace rfb { else return sin(pi*x)/(pi*x); } - class ScaleFilter { - public: + typedef struct { char name[30]; - int radius; + double radius; filter_func func; + } SFilter; + + class ScaleFilters { + public: + ScaleFilters() { initFilters(); }; + + SFilter &operator[](unsigned int filter_id) { + return filters[filter_id]; + } + + protected: + void initFilters() { + filters[scaleFilterNearestNeighbor] = create("Nearest neighbor", 0.5, nearest_neighbor); + filters[scaleFilterBilinear] = create("Bilinear", 1, linear); + filters[scaleFilterBicubic] = create("Bicubic", 2, cubic); + filters[scaleFilterSinc] = create("Sinc", 4, sinc); + } + + SFilter create(char *name_, double radius_, filter_func func_) { + SFilter filter; + strncpy(filter.name, name_, sizeof(filter.name)-1); + filter.name[sizeof(filter.name)-1] = '\0'; + filter.radius = radius_; + filter.func = func_; + return filter; + } + + SFilter filters[scaleFiltersMax]; }; };