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

Commit 87a3b395 authored by Matthew Ng's avatar Matthew Ng
Browse files

Skip hardware bitmaps if canvas does not support hardware acceleration

Test: use go/web-hv on nav bar
Change-Id: Id7d5f01aa0dbe9d05d0526726f64fc5233b9f563
Fixes: 110949540
parent ead8ff3f
Loading
Loading
Loading
Loading
+11 −2
Original line number Diff line number Diff line
@@ -82,7 +82,12 @@ public class ShadowKeyDrawable extends Drawable {
        if (bounds.isEmpty()) {
            return;
        }
        if (mState.mLastDrawnBitmap == null) {

        // If no cache or previous cached bitmap is hardware/software acceleration does not match
        // the current canvas on draw then regenerate
        if (mState.mLastDrawnBitmap == null
                || mState.mIsHardwareBitmap != canvas.isHardwareAccelerated()) {
            mState.mIsHardwareBitmap = canvas.isHardwareAccelerated();
            regenerateBitmapCache();
        }
        canvas.drawBitmap(mState.mLastDrawnBitmap, null, bounds, mPaint);
@@ -171,7 +176,10 @@ public class ShadowKeyDrawable extends Drawable {
            d.draw(canvas);
        }

        if (mState.mIsHardwareBitmap) {
            bitmap = bitmap.copy(Bitmap.Config.HARDWARE, false);
        }

        mState.mLastDrawnBitmap = bitmap;
        canvas.restore();
    }
@@ -186,6 +194,7 @@ public class ShadowKeyDrawable extends Drawable {
        int mShadowSize;
        int mShadowColor;

        boolean mIsHardwareBitmap;
        Bitmap mLastDrawnBitmap;
        ConstantState mChildState;