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

Commit 1aadd347 authored by Jason Sams's avatar Jason Sams Committed by Gerrit Code Review
Browse files

Merge "Avoid duplicate surface creation."

parents 28e6aeca 1e68bac5
Loading
Loading
Loading
Loading
+8 −1
Original line number Diff line number Diff line
@@ -76,6 +76,8 @@ public class Allocation extends BaseObj {
            new HashMap<Long, Allocation>();
    OnBufferAvailableListener mBufferNotifier;

    private Surface mGetSurfaceSurface = null;

    private Element.DataType validateObjectIsPrimitiveArray(Object d, boolean checkType) {
        final Class c = d.getClass();
        if (!c.isArray()) {
@@ -1990,7 +1992,12 @@ public class Allocation extends BaseObj {
        if ((mUsage & USAGE_IO_INPUT) == 0) {
            throw new RSInvalidStateException("Allocation is not a surface texture.");
        }
        return mRS.nAllocationGetSurface(getID(mRS));

        if (mGetSurfaceSurface == null) {
            mGetSurfaceSurface = mRS.nAllocationGetSurface(getID(mRS));
        }

        return mGetSurfaceSurface;
    }

    /**