summaryrefslogtreecommitdiffstats
path: root/src/com/android/launcher3/folder/PreviewBackground.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/com/android/launcher3/folder/PreviewBackground.java')
-rw-r--r--src/com/android/launcher3/folder/PreviewBackground.java22
1 files changed, 15 insertions, 7 deletions
diff --git a/src/com/android/launcher3/folder/PreviewBackground.java b/src/com/android/launcher3/folder/PreviewBackground.java
index 61490eee8..eba5d984d 100644
--- a/src/com/android/launcher3/folder/PreviewBackground.java
+++ b/src/com/android/launcher3/folder/PreviewBackground.java
@@ -195,19 +195,28 @@ public class PreviewBackground {
invalidate();
}
+ public int getBgColor() {
+ int alpha = (int) Math.min(MAX_BG_OPACITY, BG_OPACITY * mColorMultiplier);
+ return ColorUtils.setAlphaComponent(mBgColor, alpha);
+ }
+
public void drawBackground(Canvas canvas) {
mPaint.setStyle(Paint.Style.FILL);
- int alpha = (int) Math.min(MAX_BG_OPACITY, BG_OPACITY * mColorMultiplier);
- mPaint.setColor(ColorUtils.setAlphaComponent(mBgColor, alpha));
+ mPaint.setColor(getBgColor());
drawCircle(canvas, 0 /* deltaRadius */);
- // Draw shadow.
+ drawShadow(canvas);
+ }
+
+ public void drawShadow(Canvas canvas) {
if (mShadowShader == null) {
return;
}
+
float radius = getScaledRadius();
float shadowRadius = radius + mStrokeWidth;
+ mPaint.setStyle(Paint.Style.FILL);
mPaint.setColor(Color.BLACK);
int offsetX = getOffsetX();
int offsetY = getOffsetY();
@@ -219,7 +228,7 @@ public class PreviewBackground {
} else {
saveCount = canvas.save(Canvas.CLIP_SAVE_FLAG);
- clipCanvasSoftware(canvas, Region.Op.DIFFERENCE);
+ canvas.clipPath(getClipPath(), Region.Op.DIFFERENCE);
}
mShaderMatrix.setScale(shadowRadius, shadowRadius);
@@ -295,12 +304,11 @@ public class PreviewBackground {
radius - deltaRadius, mPaint);
}
- // It is the callers responsibility to save and restore the canvas layers.
- void clipCanvasSoftware(Canvas canvas, Region.Op op) {
+ public Path getClipPath() {
mPath.reset();
float r = getScaledRadius();
mPath.addCircle(r + getOffsetX(), r + getOffsetY(), r, Path.Direction.CW);
- canvas.clipPath(mPath, op);
+ return mPath;
}
// It is the callers responsibility to save and restore the canvas layers.