X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=lily%2Flookup.cc;h=e903d5a9a403b18f1ce1192642f8f769619b741e;hb=aae3ff48c2def641f2cda0d8f5950aeb63a2d84d;hp=4d4c0bdf6a6966925a91ec7d254808fa60554a57;hpb=bdf74886dc9bcaf01c55677bf2086f4b76a7ef8c;p=lilypond.git diff --git a/lily/lookup.cc b/lily/lookup.cc index 4d4c0bdf6a..e903d5a9a4 100644 --- a/lily/lookup.cc +++ b/lily/lookup.cc @@ -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,10 +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 (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]), @@ -333,11 +342,10 @@ Stencil Lookup::frame (Box b, Real thick, Real blot) { Stencil m; - Direction d = LEFT; for (Axis a = X_AXIS; a < NO_AXES; a = Axis (a + 1)) { Axis o = Axis ((a + 1) % NO_AXES); - do + for (LEFT_and_RIGHT (d)) { Box edges; edges[a] = b[a][d] + 0.5 * thick * Interval (-1, 1); @@ -346,7 +354,6 @@ Lookup::frame (Box b, Real thick, Real blot) m.add_stencil (round_filled_box (edges, blot)); } - while (flip (&d) != LEFT); } return m; }