[xiph-commits] r13767 - trunk/sushivision

xiphmont at svn.xiph.org xiphmont at svn.xiph.org
Thu Sep 6 13:00:26 PDT 2007


Author: xiphmont
Date: 2007-09-06 13:00:26 -0700 (Thu, 06 Sep 2007)
New Revision: 13767

Modified:
   trunk/sushivision/dimension.c
   trunk/sushivision/example_fractal.c
Log:
Minor bugfixes to API work



Modified: trunk/sushivision/dimension.c
===================================================================
--- trunk/sushivision/dimension.c	2007-09-06 19:45:28 UTC (rev 13766)
+++ trunk/sushivision/dimension.c	2007-09-06 20:00:26 UTC (rev 13767)
@@ -701,6 +701,8 @@
   d->legend = strdup(decl->label);
   d->type = SV_DIM_CONTINUOUS;
   d->private = calloc(1, sizeof(*d->private));
+  d->private->discrete_numerator = 1;
+  d->private->discrete_denominator = 1;
 
   // parse decllist
   for(i=0;i<decl->n;i++){
@@ -732,7 +734,7 @@
       if(isnan(v)){
 	fprintf(stderr,"sushivision: Missing denominator value in \"%s\"\n.",name);
       }else if(v==0){
-	fprintf(stderr,"sushivision: denominator value may not be zero\n.",name);
+	fprintf(stderr,"sushivision: denominator value may not be zero\n.");
       }else{
 	d->type = SV_DIM_PICKLIST;
 	d->private->discrete_denominator = v;
@@ -763,9 +765,15 @@
 
   // in the runtime version, don't just blindly reset values!
   d->bracket[0]=scale->val_list[0];
-  d->val = 0;
   d->bracket[1]=scale->val_list[d->scale->vals-1];
 
+  if(d->bracket[0] < d->bracket[1]){
+    if(d->val<d->bracket[0])d->val=d->bracket[0];
+    if(d->val>d->bracket[1])d->val=d->bracket[1];
+  }else{
+    if(d->val>d->bracket[0])d->val=d->bracket[0];
+    if(d->val<d->bracket[1])d->val=d->bracket[1];
+  }
   // redraw the slider
 
   return 0;
@@ -797,8 +805,15 @@
   
   d->scale = scale;
   d->bracket[0]=scale->val_list[0];
-  d->val = 0;
   d->bracket[1]=scale->val_list[d->scale->vals-1];
+
+  if(d->bracket[0] < d->bracket[1]){
+    if(d->val<d->bracket[0])d->val=d->bracket[0];
+    if(d->val>d->bracket[1])d->val=d->bracket[1];
+  }else{
+    if(d->val>d->bracket[0])d->val=d->bracket[0];
+    if(d->val<d->bracket[1])d->val=d->bracket[1];
+  }
   return ret;
 }
 

Modified: trunk/sushivision/example_fractal.c
===================================================================
--- trunk/sushivision/example_fractal.c	2007-09-06 19:45:28 UTC (rev 13766)
+++ trunk/sushivision/example_fractal.c	2007-09-06 20:00:26 UTC (rev 13767)
@@ -59,19 +59,19 @@
 
   // "name:label(arg,arg,arg...)"
 
-  sv_dim_t *d0 = sv_dim_new("rc:Re\\(c\\)");
+  sv_dim_new("rc:Re\\(c\\)");
   sv_dim_make_scale("-2.25, -0.75, 0, 0.25, 0.75");
   
-  sv_dim_t *d1 = sv_dim_new("ic:Im\\(c\\)");
+  sv_dim_new("ic:Im\\(c\\)");
   sv_dim_make_scale("-2,-1,0,1,2");
 
-  sv_dim_t *d2 = sv_dim_new("rz:Re\\(z0\\)");
+  sv_dim_new("rz:Re\\(z0\\)");
   sv_dim_make_scale("-2.25, -1, 0, 1, 2.25");
 
-  sv_dim_t *d3 = sv_dim_new("iz:Im\\(z0\\)");
+  sv_dim_new("iz:Im\\(z0\\)");
   sv_dim_make_scale("-2.25, -1, 0, 1, 2.25");
 
-  sv_dim_t *d4 = sv_dim_new("it:Max Iterations(picklist)");
+  sv_dim_new("it:Max Iterations(picklist)");
   sv_dim_make_scale("100:one hundred,"
 		    "1000:one thousand,"
 		    "10000:ten thousand,"



More information about the commits mailing list