diff options
author | Tim Murray <timmurray@google.com> | 2013-04-12 13:07:54 -0700 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2013-04-12 13:07:54 -0700 |
commit | f151a5411eb6afd104daac10b3e43f5e3a60c61d (patch) | |
tree | efa46a936610929c66cdcd0e58b6bf4fc7cca4e7 /graphics/java/android/renderscript/Allocation.java | |
parent | 2d28d6229f8cb5e158998de421ee0a0d1ff865fe (diff) | |
parent | d6b8a035337e096f8d313b70f2178f4ec54ba2e4 (diff) |
am d6b8a035: Merge "Add support for synchronous get()." into jb-mr2-dev
* commit 'd6b8a035337e096f8d313b70f2178f4ec54ba2e4':
Add support for synchronous get().
Diffstat (limited to 'graphics/java/android/renderscript/Allocation.java')
-rw-r--r-- | graphics/java/android/renderscript/Allocation.java | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/graphics/java/android/renderscript/Allocation.java b/graphics/java/android/renderscript/Allocation.java index acc6b99e19bb..ea29b7dc49cc 100644 --- a/graphics/java/android/renderscript/Allocation.java +++ b/graphics/java/android/renderscript/Allocation.java @@ -277,14 +277,14 @@ public class Allocation extends BaseObj { throw new RSIllegalArgumentException("Invalid usage combination."); } } - - // don't need to account for USAGE_SHARED Allocations - if ((usage & USAGE_SHARED) == 0) { - int numBytes = t.getCount() * t.getElement().getBytesSize(); - rs.addAllocSizeForGC(numBytes); - mGCSize = numBytes; + if (t != null) { + // don't need to account for USAGE_SHARED Allocations + if ((usage & USAGE_SHARED) == 0) { + int numBytes = t.getCount() * t.getElement().getBytesSize(); + rs.addAllocSizeForGC(numBytes); + mGCSize = numBytes; + } } - mType = t; mUsage = usage; @@ -355,6 +355,12 @@ public class Allocation extends BaseObj { mType.updateFromNative(); updateCacheInfo(mType); } + // don't need to account for USAGE_SHARED Allocations + if ((mUsage & USAGE_SHARED) == 0) { + int numBytes = mType.getCount() * mType.getElement().getBytesSize(); + mRS.addAllocSizeForGC(numBytes); + mGCSize = numBytes; + } } /** |