217 constexpr AddSegmentFunc gSegmentFunctions[] = {
222 AddMoveDegenLineClose,
225 AddMoveDegenQuadClose,
228 AddMoveDegenCubicClose,
240 const char* gSegmentNames[] = {
245 "MoveDegenLineClose",
248 "MoveDegenQuadClose",
251 "MoveDegenCubicClose",
268 constexpr FillAndName gFills[] = {
274 struct StyleAndName {
278 constexpr StyleAndName
gStyles[] = {
288 constexpr CapAndName gCaps[] = {
298 const char title[] =
"Random Paths Drawn Into Rectangle Clips With "
299 "Indicated Style, Fill and Linecaps, "
300 "with Stroke width 6";
301 canvas->
drawString(title, 20, 20, font, titlePaint);
308 unsigned numSegments = std::size(gSegmentFunctions);
309 unsigned numCaps = std::size(gCaps);
310 unsigned numStyles = std::size(
gStyles);
311 unsigned numFills = std::size(gFills);
312 for (
size_t row = 0; row < 6; ++row) {
317 for (
size_t column = 0; column < 4; ++column) {
323 StyleAndName style =
gStyles[(rand.
nextU() >> 16) % numStyles];
324 CapAndName cap = gCaps[(rand.
nextU() >> 16) % numCaps];
325 FillAndName fill = gFills[(rand.
nextU() >> 16) % numFills];
326 unsigned s1 = (rand.
nextU() >> 16) % numSegments;
327 unsigned s2 = (rand.
nextU() >> 16) % numSegments;
328 unsigned s3 = (rand.
nextU() >> 16) % numSegments;
329 unsigned s4 = (rand.
nextU() >> 16) % numSegments;
330 unsigned s5 = (rand.
nextU() >> 16) % numSegments;
333 pt = gSegmentFunctions[s1](path, pt);
334 pt = gSegmentFunctions[s2](path, pt);
335 pt = gSegmentFunctions[s3](path, pt);
336 pt = gSegmentFunctions[s4](path, pt);
337 pt = gSegmentFunctions[s5](path, pt);
339 this->drawPath(path.detach(), canvas,
color, rect,
340 cap.fCap, cap.fJoin, style.fStyle,
354 canvas->
drawString(style.fName, 0, rect.height() + 12, font, labelPaint);
355 canvas->
drawString(fill.fName, 0, rect.height() + 24, font, labelPaint);
356 canvas->
drawString(cap.fName, 0, rect.height() + 36, font, labelPaint);
357 canvas->
drawString(gSegmentNames[s1], 0, rect.height() + 48, font, labelPaint);
358 canvas->
drawString(gSegmentNames[s2], 0, rect.height() + 60, font, labelPaint);
359 canvas->
drawString(gSegmentNames[s3], 0, rect.height() + 72, font, labelPaint);
360 canvas->
drawString(gSegmentNames[s4], 0, rect.height() + 84, font, labelPaint);
361 canvas->
drawString(gSegmentNames[s5], 0, rect.height() + 96, font, labelPaint);