[xiph-commits] r12506 - trunk/sushivision
xiphmont at svn.xiph.org
xiphmont at svn.xiph.org
Wed Feb 21 17:02:26 PST 2007
Author: xiphmont
Date: 2007-02-21 17:02:25 -0800 (Wed, 21 Feb 2007)
New Revision: 12506
Modified:
trunk/sushivision/dimension.c
Log:
Add the same always 'fill the whole pane when possible' code to
continuous dimensions as exists for discrete; this comes up in
over/undersampled dimensions.
Modified: trunk/sushivision/dimension.c
===================================================================
--- trunk/sushivision/dimension.c 2007-02-22 00:29:26 UTC (rev 12505)
+++ trunk/sushivision/dimension.c 2007-02-22 01:02:25 UTC (rev 12506)
@@ -49,13 +49,50 @@
scalespace *data,
scalespace *iter){
+ /* the panel scales may be reversed (the easiest way to do y)
+ and/or the dimension may have an inverted scale. */
+ int pneg, dimneg;
+
+ if(lo>hi){ // == must be 1 to match scale gen code when width is 0
+ pneg = -1;
+ }else{
+ pneg = 1;
+ }
+
+ if(d->scale->val_list[0] > d->scale->val_list[d->scale->vals-1]){
+ dimneg = -1;
+ }else{
+ dimneg = 1;
+ }
+
+
switch(d->type){
case SUSHIV_DIM_CONTINUOUS:
{
+ double ceil = d->scale->val_list[d->scale->vals-1] * dimneg;
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);
+
+ /* if possible, the data/iterator scales should cover the entire pane exposed
+ by the panel scale so long as there's room left to extend them without
+ overflowing the lo/hi fenceposts */
+ while(1){
+ double panel2 = scalespace_value(panel,panel->pixels)*pneg;
+ double data2 = scalespace_value(data,data_w)*pneg;
+
+ if(data2>=panel2)break;
+ data_w++;
+ if(data2>ceil){
+ data_w--;
+ break;
+ }
+ }
+
+ data->pixels = data_w;
+ iter->pixels = data_w;
+
}
break;
case SUSHIV_DIM_DISCRETE:
@@ -73,22 +110,6 @@
int hi_i = floor(hi * d->private->discrete_denominator /
d->private->discrete_numerator);
- /* the panel scales may be reversed (the easiest way to do y)
- and/or the dimension may have an inverted scale. */
- int pneg, dimneg;
-
- if(lo_i>hi_i){ // == must be 1 to match scale gen code when width is 0
- pneg = -1;
- }else{
- pneg = 1;
- }
-
- if(d->scale->val_list[0] > d->scale->val_list[d->scale->vals-1]){
- dimneg = -1;
- }else{
- dimneg = 1;
- }
-
if(floor_i < ceil_i){
if(lo_i < floor_i)lo_i = floor_i;
if(hi_i > ceil_i)hi_i = ceil_i;
More information about the commits
mailing list