Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 579e07b4 authored by Jay Aliomer's avatar Jay Aliomer
Browse files

Ripple mask shader not drawing properly

Test: using a test app
Fixes: 200069735
Fixes: 188112758
Fixes: 198177042
Fixes: 189485964
Change-Id: Ibc08e9945b1a57483beb93fa428be1ab0a5da9bb
parent 53c123b4
Loading
Loading
Loading
Loading
+9 −8
Original line number Diff line number Diff line
@@ -1098,19 +1098,16 @@ public class RippleDrawable extends LayerDrawable {
        }

        // Draw the appropriate mask anchored to (0,0).
        final int saveCount = mMaskCanvas.save();
        final int left = bounds.left;
        final int top = bounds.top;
        if (mState.mRippleStyle == STYLE_SOLID) {
        mMaskCanvas.translate(-left, -top);
        }
        if (maskType == MASK_EXPLICIT) {
            drawMask(mMaskCanvas);
        } else if (maskType == MASK_CONTENT) {
            drawContent(mMaskCanvas);
        }
        if (mState.mRippleStyle == STYLE_SOLID) {
            mMaskCanvas.translate(left, top);
        }
        mMaskCanvas.restoreToCount(saveCount);
        if (mState.mRippleStyle == STYLE_PATTERNED) {
            for (int i = 0; i < mRunningAnimations.size(); i++) {
                mRunningAnimations.get(i).getProperties().getShader().setShader(mMaskShader);
@@ -1210,9 +1207,13 @@ public class RippleDrawable extends LayerDrawable {
        updateMaskShaderIfNeeded();

        // Position the shader to account for canvas translation.
        if (mMaskShader != null && mState.mRippleStyle == STYLE_SOLID) {
        if (mMaskShader != null) {
            final Rect bounds = getBounds();
            if (mState.mRippleStyle == STYLE_PATTERNED) {
                mMaskMatrix.setTranslate(bounds.left, bounds.top);
            } else {
                mMaskMatrix.setTranslate(bounds.left - x, bounds.top - y);
            }
            mMaskShader.setLocalMatrix(mMaskMatrix);
        }