diff options
author | Jason Sams <jsams@google.com> | 2015-03-18 23:48:52 +0000 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2015-03-18 23:48:52 +0000 |
commit | 68af9a9904e50d5d0f9349beff769f9bfbeacd7f (patch) | |
tree | 2cff79131070c8b2dddad3b1b8e15f277ab6057b /rs/java | |
parent | 61bc9d535ba664dfda0beffc509ea22644ce77c3 (diff) | |
parent | b533f3e1ad098b38070369609e6b1892828bc111 (diff) | |
download | frameworks_base-68af9a9904e50d5d0f9349beff769f9bfbeacd7f.zip frameworks_base-68af9a9904e50d5d0f9349beff769f9bfbeacd7f.tar.gz frameworks_base-68af9a9904e50d5d0f9349beff769f9bfbeacd7f.tar.bz2 |
am b533f3e1: am 1aadd347: Merge "Avoid duplicate surface creation."
* commit 'b533f3e1ad098b38070369609e6b1892828bc111':
Avoid duplicate surface creation.
Diffstat (limited to 'rs/java')
-rw-r--r-- | rs/java/android/renderscript/Allocation.java | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/rs/java/android/renderscript/Allocation.java b/rs/java/android/renderscript/Allocation.java index c6afa2c..523c8fb 100644 --- a/rs/java/android/renderscript/Allocation.java +++ b/rs/java/android/renderscript/Allocation.java @@ -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; } /** |