diff options
author | Tim Murray <timmurray@google.com> | 2013-04-12 13:11:45 -0700 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2013-04-12 13:11:45 -0700 |
commit | d7fec6edade22f2ca2ce33d65b0d2f08efc0eddc (patch) | |
tree | 9dc3811fbfef02a74f79a284823df313b3932291 /graphics/java/android/renderscript/Allocation.java | |
parent | 720471f0fd2c28b63ec48da8d5b492c2ff08f0c0 (diff) | |
parent | f151a5411eb6afd104daac10b3e43f5e3a60c61d (diff) |
am f151a541: am d6b8a035: Merge "Add support for synchronous get()." into jb-mr2-dev
* commit 'f151a5411eb6afd104daac10b3e43f5e3a60c61d':
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; + } } /** |