MCPcopy Index your code
hub / github.com/processing/processing / close

Method close

core/src/processing/opengl/LineStroker.java:519–591  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

517 }
518
519 public void close() {
520 if (lineToOrigin) {
521 // ignore the previous lineTo
522 lineToOrigin = false;
523 }
524
525 if (!started) {
526 finish();
527 return;
528 }
529
530 computeOffset(x0, y0, sx0, sy0, offset);
531 int mx = offset[0];
532 int my = offset[1];
533
534 // Draw penultimate join
535 boolean ccw = isCCW(px0, py0, x0, y0, sx0, sy0);
536 if (joinSegment) {
537 if (joinStyle == LinePath.JOIN_MITER) {
538 drawMiter(px0, py0, x0, y0, sx0, sy0, omx, omy, mx, my, pcolor0, ccw);
539 } else if (joinStyle == LinePath.JOIN_ROUND) {
540 drawRoundJoin(x0, y0, omx, omy, mx, my, 0, color0, false, ccw,
541 ROUND_JOIN_THRESHOLD);
542 }
543 } else {
544 // Draw internal joins as round
545 drawRoundJoin(x0, y0, omx, omy, mx, my, 0, color0, false, ccw,
546 ROUND_JOIN_INTERNAL_THRESHOLD);
547 }
548
549 emitLineTo(x0 + mx, y0 + my, color0);
550 emitLineTo(sx0 + mx, sy0 + my, scolor0);
551
552 ccw = isCCW(x0, y0, sx0, sy0, sx1, sy1);
553
554 // Draw final join on the outside
555 if (!ccw) {
556 if (joinStyle == LinePath.JOIN_MITER) {
557 drawMiter(x0, y0, sx0, sy0, sx1, sy1, mx, my, mx0, my0, color0, false);
558 } else if (joinStyle == LinePath.JOIN_ROUND) {
559 drawRoundJoin(sx0, sy0, mx, my, mx0, my0, 0, scolor0, false, false,
560 ROUND_JOIN_THRESHOLD);
561 }
562 }
563
564 emitLineTo(sx0 + mx0, sy0 + my0, scolor0);
565 emitLineTo(sx0 - mx0, sy0 - my0, scolor0); // same as reverse[0], reverse[1]
566
567 // Draw final join on the inside
568 if (ccw) {
569 if (joinStyle == LinePath.JOIN_MITER) {
570 drawMiter(x0, y0, sx0, sy0, sx1, sy1, -mx, -my, -mx0, -my0, color0,
571 false);
572 } else if (joinStyle == LinePath.JOIN_ROUND) {
573 drawRoundJoin(sx0, sy0, -mx, -my, -mx0, -my0, 0, scolor0, true, false,
574 ROUND_JOIN_THRESHOLD);
575 }
576 }

Callers 1

emitCloseMethod · 0.45

Calls 7

finishMethod · 0.95
computeOffsetMethod · 0.95
isCCWMethod · 0.95
drawMiterMethod · 0.95
drawRoundJoinMethod · 0.95
emitLineToMethod · 0.95
emitCloseMethod · 0.95

Tested by

no test coverage detected