Left: | ||
Right: |
OLD | NEW |
---|---|
1 /* | 1 /* |
2 This file is part of LilyPond, the GNU music typesetter. | 2 This file is part of LilyPond, the GNU music typesetter. |
3 | 3 |
4 Copyright (C) 2012--2020 Mike Solomon <mike@mikesolomon.org> | 4 Copyright (C) 2012--2020 Mike Solomon <mike@mikesolomon.org> |
5 | 5 |
6 LilyPond is free software: you can redistribute it and/or modify | 6 LilyPond is free software: you can redistribute it and/or modify |
7 it under the terms of the GNU General Public License as published by | 7 it under the terms of the GNU General Public License as published by |
8 the Free Software Foundation, either version 3 of the License, or | 8 the Free Software Foundation, either version 3 of the License, or |
9 (at your option) any later version. | 9 (at your option) any later version. |
10 | 10 |
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
153 fill); | 153 fill); |
154 } | 154 } |
155 | 155 |
156 void | 156 void |
157 make_partial_ellipse_boxes (Lazy_skyline_pair *skyline, | 157 make_partial_ellipse_boxes (Lazy_skyline_pair *skyline, |
158 Transform const &transform, Offset rad, Real start, | 158 Transform const &transform, Offset rad, Real start, |
159 Real end, Real th, bool connect, bool fill) | 159 Real end, Real th, bool connect, bool fill) |
160 { | 160 { |
161 if (end == start) | 161 if (end == start) |
162 end += 360; | 162 end += 360; |
163 | |
163 Real x_scale = sqrt (sqr (transform.get_xx ()) + sqr (transform.get_yx ())); | 164 Real x_scale = sqrt (sqr (transform.get_xx ()) + sqr (transform.get_yx ())); |
164 Real y_scale = sqrt (sqr (transform.get_xy ()) + sqr (transform.get_yy ())); | 165 Real y_scale = sqrt (sqr (transform.get_xy ()) + sqr (transform.get_yy ())); |
165 | 166 |
166 vector<Offset> points; | 167 vector<Offset> points; |
167 int quantization | 168 int quantization |
168 = std::max (1, (int) (((rad[X_AXIS] * x_scale) + (rad[Y_AXIS] * y_scale)) | 169 = std::max (1, (int) (((rad[X_AXIS] * x_scale) + (rad[Y_AXIS] * y_scale)) |
169 * M_PI / QUANTIZATION_UNIT)); | 170 * M_PI / QUANTIZATION_UNIT)); |
170 | 171 |
171 Offset last; | 172 Offset last; |
172 Offset first; | 173 Offset first; |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
219 { | 220 { |
220 int quantization = (int) (rounded * diameter * (x_scale + y_scale) | 221 int quantization = (int) (rounded * diameter * (x_scale + y_scale) |
221 * M_PI / QUANTIZATION_UNIT / 8); | 222 * M_PI / QUANTIZATION_UNIT / 8); |
222 /* if there is no quantization, there is no need to draw | 223 /* if there is no quantization, there is no need to draw |
223 rounded corners. >>> Set the effective skyline radius to 0 */ | 224 rounded corners. >>> Set the effective skyline radius to 0 */ |
224 Real radius = (quantization ? diameter / 2 : 0.); | 225 Real radius = (quantization ? diameter / 2 : 0.); |
225 | 226 |
226 /* draw straight lines */ | 227 /* draw straight lines */ |
227 Offset points[] = { | 228 Offset points[] = { |
228 Offset (-left, -bottom + radius), Offset (-left, top - radius), | 229 Offset (-left, -bottom + radius), Offset (-left, top - radius), |
229 Offset (-left + radius, -bottom), Offset (right - radius, -bottom), | |
230 Offset (right, -bottom + radius), Offset (right, top - radius), | |
231 Offset (-left + radius, top), Offset (right - radius, top), | 230 Offset (-left + radius, top), Offset (right - radius, top), |
231 Offset (right, top - radius), Offset (right, -bottom + radius), | |
232 Offset (right - radius, -bottom), Offset (-left + radius, -bottom), | |
232 }; | 233 }; |
233 for (vsize i = 0; i < ARRAYSIZE (points); i += 2) | 234 for (vsize i = 0; i < ARRAYSIZE (points); i += 2) |
234 { | 235 { |
235 skyline->add_segment (transform, points[i], points[i + 1]); | 236 skyline->add_contour_segment (transform, CW, points[i], |
237 points[i + 1]); | |
hahnjo
2020/05/08 08:15:59
AFAICS this is switching from CCW to CW - is there
hanwenn
2020/05/08 14:03:23
the previous code didn't have an ordering, afaict.
| |
236 } | 238 } |
237 | 239 |
238 /* draw rounded corners */ | 240 /* draw rounded corners */ |
239 if (radius) | 241 if (radius) |
240 { | 242 { |
241 Offset rad (radius, 0); | 243 Offset rad (radius, 0); |
242 Drul_array<Real> cx; | 244 Drul_array<Real> cx; |
243 Drul_array<Real> cy; | 245 Drul_array<Real> cy; |
244 | 246 |
245 cx[LEFT] = -left + radius; | 247 cx[LEFT] = -left + radius; |
(...skipping 700 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
946 | 948 |
947 MAKE_SCHEME_CALLBACK (Grob, pure_horizontal_skylines_from_element_stencils, 3); | 949 MAKE_SCHEME_CALLBACK (Grob, pure_horizontal_skylines_from_element_stencils, 3); |
948 SCM | 950 SCM |
949 Grob::pure_horizontal_skylines_from_element_stencils (SCM smob, SCM beg_scm, SCM end_scm) | 951 Grob::pure_horizontal_skylines_from_element_stencils (SCM smob, SCM beg_scm, SCM end_scm) |
950 { | 952 { |
951 Grob *me = unsmob<Grob> (smob); | 953 Grob *me = unsmob<Grob> (smob); |
952 int beg = robust_scm2int (beg_scm, 0); | 954 int beg = robust_scm2int (beg_scm, 0); |
953 int end = robust_scm2int (end_scm, 0); | 955 int end = robust_scm2int (end_scm, 0); |
954 return internal_skylines_from_element_stencils (me, Y_AXIS, true, beg, end); | 956 return internal_skylines_from_element_stencils (me, Y_AXIS, true, beg, end); |
955 } | 957 } |
OLD | NEW |