Merge "Ensure Outline consistently sets the radius to be undefined" into nyc-dev
am: 48653d225b
* commit '48653d225b964f4e62e5e94d98966826875dd99c':
Ensure Outline consistently sets the radius to be undefined
This commit is contained in:
@@ -32,13 +32,15 @@ import android.graphics.drawable.Drawable;
|
|||||||
* @see Drawable#getOutline(Outline)
|
* @see Drawable#getOutline(Outline)
|
||||||
*/
|
*/
|
||||||
public final class Outline {
|
public final class Outline {
|
||||||
|
private static final float RADIUS_UNDEFINED = -1.0f;
|
||||||
|
|
||||||
/** @hide */
|
/** @hide */
|
||||||
public Path mPath;
|
public Path mPath;
|
||||||
|
|
||||||
/** @hide */
|
/** @hide */
|
||||||
public Rect mRect;
|
public Rect mRect;
|
||||||
/** @hide */
|
/** @hide */
|
||||||
public float mRadius;
|
public float mRadius = RADIUS_UNDEFINED;
|
||||||
/** @hide */
|
/** @hide */
|
||||||
public float mAlpha;
|
public float mAlpha;
|
||||||
|
|
||||||
@@ -63,7 +65,7 @@ public final class Outline {
|
|||||||
public void setEmpty() {
|
public void setEmpty() {
|
||||||
mPath = null;
|
mPath = null;
|
||||||
mRect = null;
|
mRect = null;
|
||||||
mRadius = 0;
|
mRadius = RADIUS_UNDEFINED;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -223,6 +225,7 @@ public final class Outline {
|
|||||||
mPath.reset();
|
mPath.reset();
|
||||||
mPath.addOval(left, top, right, bottom, Path.Direction.CW);
|
mPath.addOval(left, top, right, bottom, Path.Direction.CW);
|
||||||
mRect = null;
|
mRect = null;
|
||||||
|
mRadius = RADIUS_UNDEFINED;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -249,7 +252,7 @@ public final class Outline {
|
|||||||
|
|
||||||
mPath.set(convexPath);
|
mPath.set(convexPath);
|
||||||
mRect = null;
|
mRect = null;
|
||||||
mRadius = -1.0f;
|
mRadius = RADIUS_UNDEFINED;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -17,6 +17,7 @@
|
|||||||
package android.graphics.drawable.shapes;
|
package android.graphics.drawable.shapes;
|
||||||
|
|
||||||
import android.graphics.Canvas;
|
import android.graphics.Canvas;
|
||||||
|
import android.graphics.Outline;
|
||||||
import android.graphics.Paint;
|
import android.graphics.Paint;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -46,5 +47,11 @@ public class ArcShape extends RectShape {
|
|||||||
public void draw(Canvas canvas, Paint paint) {
|
public void draw(Canvas canvas, Paint paint) {
|
||||||
canvas.drawArc(rect(), mStart, mSweep, true, paint);
|
canvas.drawArc(rect(), mStart, mSweep, true, paint);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void getOutline(Outline outline) {
|
||||||
|
// Since we don't support concave outlines, arc shape does not attempt
|
||||||
|
// to provide an outline.
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user