[xiph-commits] r12064 - trunk/sushivision

xiphmont at svn.xiph.org xiphmont at svn.xiph.org
Wed Nov 8 04:38:00 PST 2006


Author: xiphmont
Date: 2006-11-08 04:37:59 -0800 (Wed, 08 Nov 2006)
New Revision: 12064

Modified:
   trunk/sushivision/plot.c
Log:
Prevent x and y axis mark labels from overlapping



Modified: trunk/sushivision/plot.c
===================================================================
--- trunk/sushivision/plot.c	2006-11-08 12:29:06 UTC (rev 12063)
+++ trunk/sushivision/plot.c	2006-11-08 12:37:59 UTC (rev 12064)
@@ -40,6 +40,7 @@
   cairo_t *c = cairo_create(s);
   int i=0,x,y;
   char buffer[80];
+  int y_width=0;
 
   cairo_save(c);
   cairo_set_operator(c,CAIRO_OPERATOR_CLEAR);
@@ -87,6 +88,8 @@
     cairo_text_extents_t extents;
     cairo_text_extents (c, buffer, &extents);
 
+    if(extents.width > y_width) y_width = extents.width;
+
     if(y - extents.height > 0){
       
       double yy = h-y+.5-(extents.height/2 + extents.y_bearing);
@@ -118,7 +121,7 @@
     cairo_text_extents_t extents;
     cairo_text_extents (c, buffer, &extents);
 
-    if(x - extents.height > 0){
+    if(x - extents.height > y_width+5 ){
 
       cairo_move_to(c,2, x+.5-(extents.height/2 + extents.y_bearing));
       cairo_set_source_rgba(c,0,0,0,.5);



More information about the commits mailing list