]> git.donarmstrong.com Git - lilypond.git/commitdiff
lookup.cc: warn about, but do not draw, empty boxes
authorKeith OHara <k-ohara5a5a@oco.net>
Sun, 16 Sep 2012 23:26:01 +0000 (16:26 -0700)
committerKeith OHara <k-ohara5a5a@oco.net>
Fri, 21 Sep 2012 04:18:51 +0000 (21:18 -0700)
lily/lookup.cc
scm/fret-diagrams.scm

index f37d98c0e3d9e83a8bccb49d227e7b22ae295afc..e903d5a9a403b18f1ce1192642f8f769619b741e 100644 (file)
@@ -27,6 +27,7 @@ using namespace std;
 
 #include "line-interface.hh"
 #include "warn.hh"
+#include "international.hh"
 #include "dimensions.hh"
 #include "bezier.hh"
 #include "file-path.hh"
@@ -169,13 +170,18 @@ Lookup::filled_box (Box b)
 Stencil
 Lookup::round_filled_box (Box b, Real blotdiameter)
 {
-  if (b.x ().length () < blotdiameter)
-    blotdiameter = b.x ().length ();
-  if (b.y ().length () < blotdiameter)
-    blotdiameter = b.y ().length ();
+  Real width = b.x ().delta ();
+  blotdiameter = min (blotdiameter, width);
+  Real height = b.y ().delta ();
+  blotdiameter = min (blotdiameter, height);
 
-  if (isinf (b.x ().delta ()) || isinf (b.y ().delta ()))
-    return Stencil (b, SCM_EOL);
+  if (blotdiameter < 0.0)
+    {
+      if (!isinf (blotdiameter))
+        warning (_f ("Not drawing a box with negative dimension, %.2f by %.2f.",
+                     width, height));
+      return Stencil (b, SCM_EOL);
+    }
 
   SCM at = (scm_list_n (ly_symbol2scm ("round-filled-box"),
                         scm_from_double (-b[X_AXIS][LEFT]),
index a6645dc762d61024ae9cfeca770b9c03970a64de..83c4ee6b7addef25458262764112fb01379a640e 100644 (file)
@@ -646,8 +646,9 @@ fret-diagram overall parameters."
                 (stencil-coordinates
                   end-fret-coordinate end-string-coordinate)))
          (ly:round-filled-box
-           (cons (car lower-left) (car upper-right))
-           (cons (cdr lower-left) (cdr upper-right))
+           ;; Put limits in order, or else the intervals are considered empty
+           (ordered-cons (car lower-left) (car upper-right))
+           (ordered-cons (cdr lower-left) (cdr upper-right))
            sth)))
 
      (define (draw-xo xo-list)