[xiph-commits] r12265 - trunk/sushivision

xiphmont at svn.xiph.org xiphmont at svn.xiph.org
Sat Dec 30 17:50:48 PST 2006


Author: xiphmont
Date: 2006-12-30 17:50:47 -0800 (Sat, 30 Dec 2006)
New Revision: 12265

Modified:
   trunk/sushivision/scale.c
Log:
Alter underflow behavior of scales; rather than catching a failure
later and rejecting the change, don't allow scales to underflow in the
first place.

Scale handling is now slightly higher resolution that the actual
objective dimension handling.



Modified: trunk/sushivision/scale.c
===================================================================
--- trunk/sushivision/scale.c	2006-12-30 01:08:53 UTC (rev 12264)
+++ trunk/sushivision/scale.c	2006-12-31 01:50:47 UTC (rev 12265)
@@ -246,9 +246,9 @@
   ret.pixels=pixels;
   ret.legend=name;
 
-  if(range == 0){
-    ret.m = 0;
-    return ret;
+  if(range < DBL_MIN*pixels){
+    ret.m = DBL_MIN * pixels;
+    highpoint = lowpoint + ret.m;
   }
 
   if(range!=0.){
@@ -283,33 +283,9 @@
   ret.m = pow(10,place);
   first = (long long)(lowpoint/ret.m)/step*step;
 
-  if(neg){
-    if(LLONG_MAX * ret.m < highpoint){
-      ret.m = 0;
-      return ret;
-    }
-  }else{
-    if(LLONG_MAX * ret.m < lowpoint){
-      ret.m = 0;
-      return ret;
-    }
-  }
-
   while(first * ret.m * neg < lowpoint*neg)
     first += step;
 
-  if(neg){
-    if(LLONG_MIN * ret.m > lowpoint){
-      ret.m = 0;
-      return ret;
-    }
-  }else{
-    if(LLONG_MIN * ret.m > highpoint){
-      ret.m = 0;
-      return ret;
-    }
-  }
-
   while(first * ret.m * neg > highpoint*neg)
     first -= step;
 



More information about the commits mailing list