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

Commit be4d4fa3 authored by Diego Perez's avatar Diego Perez
Browse files

NopCanvas is only hw accelerated during construction

During construction, we want to make NopCanvas as light as possible so
we just say that we are hw accelerated.
This caused some crashes further down the line for some views that
thought that NopCanvas was hw accelerated. From now on, NopCanvas is
only hw accelerated during construction.

Test: Covered by the existing tests
Change-Id: If09a662312e5c90d011e7ab2cbb524ef7b420d12
parent 349a8aef
Loading
Loading
Loading
Loading
+6 −2
Original line number Diff line number Diff line
@@ -31,14 +31,18 @@ import android.graphics.RectF;
 * Canvas implementation that does not do any rendering
 */
public class NopCanvas extends Canvas {
    private boolean mIsHardwareAccelerated = true;

    public NopCanvas() {
        super();
        // We return true the first time so there are no allocations for the software renderer in
        // the constructor
        mIsHardwareAccelerated = false;
    }

    @Override
    public boolean isHardwareAccelerated() {
        // Return true so there is no allocations for the software renderer in the constructor
        return true;
        return mIsHardwareAccelerated;
    }

    @Override