Browse files

timob-8956: correct inner radius

  • Loading branch information...
1 parent 748253d commit 783dd475f6f0474d3972aead30f5a26e57a782d3 @pingwang2011 pingwang2011 committed May 25, 2012
Showing with 12 additions and 7 deletions.
  1. +12 −7 android/titanium/src/java/org/appcelerator/titanium/view/TiBackgroundDrawable.java
View
19 android/titanium/src/java/org/appcelerator/titanium/view/TiBackgroundDrawable.java
@@ -20,8 +20,6 @@
import android.graphics.Path;
import android.graphics.Path.Direction;
import android.graphics.Path.FillType;
-import android.graphics.PorterDuff;
-import android.graphics.PorterDuffXfermode;
import android.graphics.Rect;
import android.graphics.RectF;
import android.graphics.drawable.BitmapDrawable;
@@ -123,15 +121,22 @@ protected void onBoundsChange(Rect bounds)
if (border != null) {
if (border.radius > 0) {
- float radii[] = new float[8];
- Arrays.fill(radii, border.radius);
+ float outerRadii[] = new float[8];
+ Arrays.fill(outerRadii, border.radius);
borderPath = new Path();
- borderPath.addRoundRect(outerRect, radii, Direction.CW);
- borderPath.addRoundRect(innerRect, radii, Direction.CW);
+ borderPath.addRoundRect(outerRect, outerRadii, Direction.CW);
borderPath.setFillType(FillType.EVEN_ODD);
innerPath = new Path();
- innerPath.addRoundRect(innerRect, radii, Direction.CW);
innerPath.setFillType(FillType.EVEN_ODD);
+ if (border.radius - padding > 0) {
+ float innerRadii[] = new float[8];
+ Arrays.fill(innerRadii, border.radius - padding);
+ borderPath.addRoundRect(innerRect, innerRadii, Direction.CW);
+ innerPath.addRoundRect(innerRect, innerRadii, Direction.CW);
+ } else {
+ borderPath.addRect(innerRect, Direction.CW);
+ innerPath.addRect(innerRect, Direction.CW);
+ }
} else {
borderPath = new Path();
borderPath.addRect(outerRect, Direction.CW);

0 comments on commit 783dd47

Please sign in to comment.