Merge "Avoid duplicate surface creation."
This commit is contained in:
@@ -76,6 +76,8 @@ public class Allocation extends BaseObj {
|
|||||||
new HashMap<Long, Allocation>();
|
new HashMap<Long, Allocation>();
|
||||||
OnBufferAvailableListener mBufferNotifier;
|
OnBufferAvailableListener mBufferNotifier;
|
||||||
|
|
||||||
|
private Surface mGetSurfaceSurface = null;
|
||||||
|
|
||||||
private Element.DataType validateObjectIsPrimitiveArray(Object d, boolean checkType) {
|
private Element.DataType validateObjectIsPrimitiveArray(Object d, boolean checkType) {
|
||||||
final Class c = d.getClass();
|
final Class c = d.getClass();
|
||||||
if (!c.isArray()) {
|
if (!c.isArray()) {
|
||||||
@@ -1990,7 +1992,12 @@ public class Allocation extends BaseObj {
|
|||||||
if ((mUsage & USAGE_IO_INPUT) == 0) {
|
if ((mUsage & USAGE_IO_INPUT) == 0) {
|
||||||
throw new RSInvalidStateException("Allocation is not a surface texture.");
|
throw new RSInvalidStateException("Allocation is not a surface texture.");
|
||||||
}
|
}
|
||||||
return mRS.nAllocationGetSurface(getID(mRS));
|
|
||||||
|
if (mGetSurfaceSurface == null) {
|
||||||
|
mGetSurfaceSurface = mRS.nAllocationGetSurface(getID(mRS));
|
||||||
|
}
|
||||||
|
|
||||||
|
return mGetSurfaceSurface;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user