Only generate paint/mask bitmap when starting animations

Fixes: b/185570903
Test: performance testing bitmap threashold
Change-Id: Ia94011b3c7c34bf44e9ed7356873748724059c2a
This commit is contained in:
Jay Aliomer
2021-04-30 14:51:56 -04:00
parent 116e4c41e0
commit 8cd53fb886

View File

@@ -864,7 +864,6 @@ public class RippleDrawable extends LayerDrawable {
boolean shouldExit = mExitingAnimation;
mRippleActive = false;
mExitingAnimation = false;
getRipplePaint();
drawContent(canvas);
drawPatternedBackground(canvas, cx, cy);
if (shouldAnimate && mRunningAnimations.size() <= MAX_RIPPLES) {
@@ -928,7 +927,7 @@ public class RippleDrawable extends LayerDrawable {
startBackgroundAnimation();
}
if (mBackgroundOpacity == 0) return;
Paint p = mRipplePaint;
Paint p = getRipplePaint();
float newOpacity = mBackgroundOpacity;
final int origAlpha = p.getAlpha();
final int alpha = Math.min((int) (origAlpha * newOpacity + 0.5f), 255);
@@ -957,7 +956,7 @@ public class RippleDrawable extends LayerDrawable {
@NonNull
private RippleAnimationSession.AnimationProperties<Float, Paint> createAnimationProperties(
float x, float y, float cx, float cy, float w, float h) {
Paint p = new Paint(mRipplePaint);
Paint p = new Paint(getRipplePaint());
float radius = getComputedRadius();
RippleAnimationSession.AnimationProperties<Float, Paint> properties;
RippleShader shader = new RippleShader();