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

Commit f0e06784 authored by Chris Craik's avatar Chris Craik
Browse files

Avoid trying to draw invisible ShapeDrawables

This avoids work when a drawable is declared with @android:color/transparent

Change-Id: I1b6d3b22751e378be047a5538dfd4d4baab3c03a
parent 29466f85
Loading
Loading
Loading
Loading
+12 −9
Original line number Diff line number Diff line
@@ -217,6 +217,8 @@ public class ShapeDrawable extends Drawable {
        int prevAlpha = paint.getAlpha();
        paint.setAlpha(modulateAlpha(prevAlpha, mShapeState.mAlpha));

        // only draw shape if it may affect output
        if (paint.getAlpha() != 0 || paint.getXfermode() != null || paint.hasShadow) {
            if (mShapeState.mShape != null) {
                // need the save both for the translate, and for the (unknown) Shape
                int count = canvas.save();
@@ -226,6 +228,7 @@ public class ShapeDrawable extends Drawable {
            } else {
                canvas.drawRect(r, paint);
            }
        }

        // restore
        paint.setAlpha(prevAlpha);