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

Commit cd6ea77d authored by Chris Craik's avatar Chris Craik Committed by Android (Google) Code Review
Browse files

Merge "Fix software layer alpha" into nyc-dev

parents 07a0e79a cfa6dade
Loading
Loading
Loading
Loading
+4 −5
Original line number Diff line number Diff line
@@ -16954,7 +16954,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
            }
        } else if (cache != null) {
            mPrivateFlags &= ~PFLAG_DIRTY_MASK;
            if (layerType == LAYER_TYPE_NONE) {
            if (layerType == LAYER_TYPE_NONE || mLayerPaint == null) {
                // no layer paint, use temporary paint to draw bitmap
                Paint cachePaint = parent.mCachePaint;
                if (cachePaint == null) {
@@ -16966,13 +16966,12 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
                canvas.drawBitmap(cache, 0.0f, 0.0f, cachePaint);
            } else {
                // use layer paint to draw the bitmap, merging the two alphas, but also restore
                int layerPaintAlpha = mLayerPaint != null ? mLayerPaint.getAlpha() : 255;
                if (mLayerPaint == null && alpha < 1) {
                    mLayerPaint = new Paint();
                int layerPaintAlpha = mLayerPaint.getAlpha();
                if (alpha < 1) {
                    mLayerPaint.setAlpha((int) (alpha * layerPaintAlpha));
                }
                canvas.drawBitmap(cache, 0.0f, 0.0f, mLayerPaint);
                if (mLayerPaint != null) {
                if (alpha < 1) {
                    mLayerPaint.setAlpha(layerPaintAlpha);
                }
            }