[xiph-commits] r12304 - trunk/sushivision

xiphmont at svn.xiph.org xiphmont at svn.xiph.org
Thu Jan 4 13:24:42 PST 2007


Author: xiphmont
Date: 2007-01-04 13:24:40 -0800 (Thu, 04 Jan 2007)
New Revision: 12304

Modified:
   trunk/sushivision/dimension.c
   trunk/sushivision/sushivision.h
Log:
Correct an iteration bug in discrete dims 

Make zero-indexing a flag option available on both continuous and
discrete dims; default behavior is to iterate from lowest range value.



Modified: trunk/sushivision/dimension.c
===================================================================
--- trunk/sushivision/dimension.c	2007-01-04 21:14:27 UTC (rev 12303)
+++ trunk/sushivision/dimension.c	2007-01-04 21:24:40 UTC (rev 12304)
@@ -53,8 +53,12 @@
 
   switch(d->type){
   case SUSHIV_DIM_CONTINUOUS:
-    *panel = scalespace_linear(lo, hi, panel_w, spacing, legend);
-    *data = *iter = scalespace_linear(lo, hi, data_w, spacing, legend);
+    {
+      double fl = ((d->flags & SUSHIV_DIM_ZEROINDEX) ? d->scale->val_list[0] : 0.);
+      *panel = scalespace_linear(lo, hi, panel_w, spacing, legend);
+      *data = scalespace_linear(lo, hi, data_w, spacing, legend);
+      *iter = scalespace_linear(lo-fl, hi-fl, data_w, spacing, legend);
+    }
     break;
   case SUSHIV_DIM_DISCRETE:
     {
@@ -86,9 +90,11 @@
 	d->private->discrete_denominator;
 
       data_w = hi_i-lo_i;
+      if(!(d->flags & SUSHIV_DIM_ZEROINDEX))
+	floor_i = 0;
 
       *panel = scalespace_linear(lo, hi, panel_w, spacing, legend);
-      *data = scalespace_linear(lo, hi, data_w, 1, legend);
+      *data = scalespace_linear(lo_i, hi_i, data_w, 1, legend);
       *iter = scalespace_linear(lo_i - floor_i, hi_i - floor_i, data_w, 1, legend);
       break;
     }

Modified: trunk/sushivision/sushivision.h
===================================================================
--- trunk/sushivision/sushivision.h	2007-01-04 21:14:27 UTC (rev 12303)
+++ trunk/sushivision/sushivision.h	2007-01-04 21:24:40 UTC (rev 12304)
@@ -55,6 +55,7 @@
 
 #define SUSHIV_DIM_NO_X 0x100
 #define SUSHIV_DIM_NO_Y 0x200
+#define SUSHIV_DIM_ZEROINDEX 0x1
 
 typedef struct sushiv_dimension_internal sushiv_dimension_internal_t;
 enum sushiv_dimension_type { SUSHIV_DIM_CONTINUOUS, 



More information about the commits mailing list