Avoid duplicate surface creation.

Change-Id: I43104c8b48dd26681735940e6b2e1ba902af2020
This commit is contained in:
Jason Sams
2015-03-17 16:36:55 -07:00
parent 28e6aeca3a
commit 1e68bac5f8

View File

@@ -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;
}
/**