Add outline alpha
bug:16140822
bug:16566746
This allows background drawables to alter the opacity of a shadow
being cast with their own alpha values.
Change-Id: I49698cc7c1bf4b2b55ffe2f82899543ca62bc61c
diff --git a/libs/hwui/Outline.h b/libs/hwui/Outline.h
index 83426e8..6dacd5ed 100644
--- a/libs/hwui/Outline.h
+++ b/libs/hwui/Outline.h
@@ -28,18 +28,20 @@
Outline()
: mShouldClip(false)
, mType(kOutlineType_None)
- , mRadius(0) {}
+ , mRadius(0)
+ , mAlpha(0.0f) {}
- void setRoundRect(int left, int top, int right, int bottom, float radius) {
+ void setRoundRect(int left, int top, int right, int bottom, float radius, float alpha) {
mType = kOutlineType_RoundRect;
mBounds.set(left, top, right, bottom);
mRadius = radius;
mPath.reset();
mPath.addRoundRect(SkRect::MakeLTRB(left, top, right, bottom),
radius, radius);
+ mAlpha = alpha;
}
- void setConvexPath(const SkPath* outline) {
+ void setConvexPath(const SkPath* outline, float alpha) {
if (!outline) {
setEmpty();
return;
@@ -47,22 +49,29 @@
mType = kOutlineType_ConvexPath;
mPath = *outline;
mBounds.set(outline->getBounds());
+ mAlpha = alpha;
}
void setEmpty() {
mType = kOutlineType_Empty;
mPath.reset();
+ mAlpha = 0.0f;
}
void setNone() {
mType = kOutlineType_None;
mPath.reset();
+ mAlpha = 0.0f;
}
bool isEmpty() const {
return mType == kOutlineType_Empty;
}
+ float getAlpha() const {
+ return mAlpha;
+ }
+
void setShouldClip(bool clip) {
mShouldClip = clip;
}
@@ -103,6 +112,7 @@
OutlineType mType;
Rect mBounds;
float mRadius;
+ float mAlpha;
SkPath mPath;
};