]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/stencil-integral.cc
Issue 5167/6: Changes: show \markup xxx = ... \etc assignments
[lilypond.git] / lily / stencil-integral.cc
index 9a23d2f38c4ec777983dc2e364affdcd9f15bee5..b44258b6b1973c19d117626ba769a232467dd7e4 100644 (file)
@@ -55,9 +55,7 @@ when this transforms a point (x,y), the point is written as matrix:
 #include "skyline.hh"
 #include "skyline-pair.hh"
 #include "spanner.hh"
-
-using std::string;
-using std::vector;
+using namespace std;
 
 Real QUANTIZATION_UNIT = 0.2;
 
@@ -186,8 +184,8 @@ make_draw_line_boxes (vector<Box> &boxes, vector<Drul_array<Offset> > &buildings
   //////////////////////
   if (x1 < x0)
     {
-      std::swap (x0, x1);
-      std::swap (y0, y1);
+      swap (x0, x1);
+      swap (y0, y1);
     }
   Offset left (x0, y0);
   Offset right (x1, y1);
@@ -262,6 +260,7 @@ make_partial_ellipse_boxes (vector<Box> &boxes,
   expr = scm_cdr (expr);
   Real y_rad = robust_scm2double (scm_car (expr), 0.0);
   expr = scm_cdr (expr);
+  Offset rad (x_rad, y_rad);
   Real start = robust_scm2double (scm_car (expr), 0.0);
   expr = scm_cdr (expr);
   Real end = robust_scm2double (scm_car (expr), 0.0);
@@ -272,21 +271,19 @@ make_partial_ellipse_boxes (vector<Box> &boxes,
   expr = scm_cdr (expr);
   bool fill = to_boolean (scm_car (expr));
   //////////////////////
-  start = M_PI * start / 180;
-  end = M_PI * end / 180;
   if (end == start)
-    end += (2 * M_PI);
-  Offset sp (cos (start) * x_rad, sin (start) * y_rad);
-  Offset ep (cos (end) * x_rad, sin (end) * y_rad);
+    end += 360;
+  Offset sp (offset_directed (start).scale (rad));
+  Offset ep (offset_directed (end).scale (rad));
   //////////////////////
   Drul_array<vector<Offset> > points;
-  int quantization = std::max (1, (int) (((x_rad * trans.xx) + (y_rad * trans.yy)) * M_PI / QUANTIZATION_UNIT));
+  int quantization = max (1, (int) (((x_rad * trans.xx) + (y_rad * trans.yy)) * M_PI / QUANTIZATION_UNIT));
   for (DOWN_and_UP (d))
     {
       for (vsize i = 0; i < 1 + (vsize) quantization; i++)
         {
           Real ang = linear_map (start, end, 0, quantization, i);
-          Offset pt (cos (ang) * x_rad, sin (ang) * y_rad);
+          Offset pt (offset_directed (ang).scale (rad));
           Offset inter = pt + d * get_normal ((th/2) * pt.direction ());
           pango_matrix_transform_point (&trans, &inter[X_AXIS], &inter[Y_AXIS]);
           points[d].push_back (inter);
@@ -318,7 +315,7 @@ make_partial_ellipse_boxes (vector<Box> &boxes,
   if (th > 0.0)
     {
       // beg line cap
-      Offset pt (cos (start) * x_rad, sin (start) * y_rad);
+      Offset pt (offset_directed (start).scale (rad));
       create_path_cap (boxes,
                        buildings,
                        trans,
@@ -327,7 +324,7 @@ make_partial_ellipse_boxes (vector<Box> &boxes,
                        -get_normal (pt));
 
       // end line cap
-      pt = Offset (cos (end) * x_rad, sin (end) * y_rad);
+      pt = offset_directed (end).scale (rad);
       create_path_cap (boxes,
                        buildings,
                        trans,
@@ -777,7 +774,7 @@ make_glyph_string_boxes (vector<Box> &boxes,
         {
           assert (abs (xlen - ylen) < 10e-3);
 
-          Real scale_factor = std::max (xlen, ylen);
+          Real scale_factor = max (xlen, ylen);
           // the three operations below move the stencil from its original coordinates to current coordinates
           pango_matrix_translate (&transcopy, kerned_bbox[X_AXIS][LEFT],
                                   kerned_bbox[Y_AXIS][DOWN] - real_bbox[Y_AXIS][DOWN]);
@@ -897,9 +894,8 @@ stencil_dispatcher (vector<Box> &boxes,
 vector<Transform_matrix_and_expression>
 stencil_traverser (PangoMatrix trans, SCM expr)
 {
-  if (scm_is_null (expr))
-    return vector<Transform_matrix_and_expression> ();
-  else if (scm_is_eq (expr, ly_string2scm ("")))
+  if (scm_is_null (expr)
+      || (scm_is_string (expr) && scm_is_true (scm_string_null_p (expr))))
     return vector<Transform_matrix_and_expression> ();
   else if (scm_is_eq (scm_car (expr), ly_symbol2scm ("combine-stencil")))
     {
@@ -947,8 +943,10 @@ stencil_traverser (PangoMatrix trans, SCM expr)
     return stencil_traverser (trans, scm_caddr (expr));
   else if (scm_is_eq (scm_car (expr), ly_symbol2scm ("transparent-stencil")))
     return stencil_traverser (trans, scm_cadr (expr));
-  else if (scm_is_eq (scm_car (expr), ly_symbol2scm ("id")))
+  else if (scm_is_eq (scm_car (expr), ly_symbol2scm ("output-attributes")))
     return stencil_traverser (trans, scm_caddr (expr));
+  else if (scm_is_eq (scm_car (expr), ly_symbol2scm ("with-outline")))
+    return stencil_traverser (trans, scm_cadr (expr));
   else
     {
       vector<Transform_matrix_and_expression> out;