Skip to content

Commit 7aaf1b5

Browse files
committed
some formatting changes
1 parent 20cf46e commit 7aaf1b5

File tree

1 file changed

+29
-30
lines changed

1 file changed

+29
-30
lines changed

core/src/processing/core/PGraphicsAndroid2D.java

Lines changed: 29 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -754,51 +754,50 @@ protected void arcImpl(float x, float y, float w, float h,
754754
}
755755
} else if (mode == OPEN) {
756756
if (fill) {
757-
// Work around:android does not support storke and fill with different color
758-
// after drawing the arc,draw the arc with Paint.Style.Stroke style again
757+
// Android does not support stroke and fill with different color
758+
// after drawing the arc,draw the arc with Paint.Style.Stroke style
759+
// again
759760
canvas.drawArc(rect, start, sweep, false, fillPaint);
760761
canvas.drawArc(rect, start, sweep, false, strokePaint);
761762
}
762763
if (stroke) {
763764
canvas.drawArc(rect, start, sweep, false, strokePaint);
764765
}
765766
} else if (mode == CHORD) {
766-
// Work around: draw an extra line between start angle point and end point
767-
// to achiece the Chord
768-
float endAngle = start + sweep;
769-
float halfRectWidth = rect.width()/2;
770-
float halfRectHeight = rect.height()/2;
771-
float centerX = rect.centerX();
772-
float centerY = rect.cenerY();
773-
774-
float startX = (float) (halfRectWidth* Math.cos(Math.toRadians(start))) + centerX;
775-
float startY = (float) (halfRectHeight * Math.sin(Math.toRadians(start))) + centerY;
776-
float endX = (float) (halfRectWidth * Math.cos(Math.toRadians(endAngle))) + centerX;
777-
float endY = (float) (halfRectHeight * Math.sin(Math.toRadians(endAngle))) + centerY;
778-
779-
if(fill){
780-
// draw the fill arc
781-
canvas.drawArc(rect,start,sweep,false,fillPaint);
782-
// draw the arc round border
783-
canvas.drawArc(rect,start,sweep,false,strokePaint);
784-
// draw the straight border
785-
canvas.drawLine(startX,startY,endX,endY,strokePaint);
786-
}
787-
if (stroke) {
788-
// draw the arc
789-
canvas.drawArc(rect,start,sweep,false,strokePaint);
790-
// draw the straight border
791-
canvas.drawLine(startX,startY,endX,endY,strokePaint);
792-
}
767+
// Draw an extra line between start angle point and end point to
768+
// achieve the chord
769+
float endAngle = start + sweep;
770+
float halfRectWidth = rect.width()/2;
771+
float halfRectHeight = rect.height()/2;
772+
float centerX = rect.centerX();
773+
float centerY = rect.centerY();
774+
775+
float startX = (float) (halfRectWidth* Math.cos(Math.toRadians(start))) + centerX;
776+
float startY = (float) (halfRectHeight * Math.sin(Math.toRadians(start))) + centerY;
777+
float endX = (float) (halfRectWidth * Math.cos(Math.toRadians(endAngle))) + centerX;
778+
float endY = (float) (halfRectHeight * Math.sin(Math.toRadians(endAngle))) + centerY;
793779

780+
if (fill) {
781+
// draw the fill arc
782+
canvas.drawArc(rect,start,sweep,false,fillPaint);
783+
// draw the arc round border
784+
canvas.drawArc(rect,start,sweep,false,strokePaint);
785+
// draw the straight border
786+
canvas.drawLine(startX,startY,endX,endY,strokePaint);
787+
}
788+
if (stroke) {
789+
// draw the arc
790+
canvas.drawArc(rect,start,sweep,false,strokePaint);
791+
// draw the straight border
792+
canvas.drawLine(startX,startY,endX,endY,strokePaint);
793+
}
794794
} else if (mode == PIE) {
795795
if (fill) {
796796
canvas.drawArc(rect, start, sweep, true, fillPaint);
797797
}
798798
if (stroke) {
799799
canvas.drawArc(rect, start, sweep, true, strokePaint);
800800
}
801-
802801
}
803802
}
804803
}

0 commit comments

Comments
 (0)