@@ -754,51 +754,50 @@ protected void arcImpl(float x, float y, float w, float h,
754
754
}
755
755
} else if (mode == OPEN ) {
756
756
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
759
760
canvas .drawArc (rect , start , sweep , false , fillPaint );
760
761
canvas .drawArc (rect , start , sweep , false , strokePaint );
761
762
}
762
763
if (stroke ) {
763
764
canvas .drawArc (rect , start , sweep , false , strokePaint );
764
765
}
765
766
} 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 ;
793
779
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
+ }
794
794
} else if (mode == PIE ) {
795
795
if (fill ) {
796
796
canvas .drawArc (rect , start , sweep , true , fillPaint );
797
797
}
798
798
if (stroke ) {
799
799
canvas .drawArc (rect , start , sweep , true , strokePaint );
800
800
}
801
-
802
801
}
803
802
}
804
803
}
0 commit comments