summaryrefslogtreecommitdiff
path: root/graphics/java/android/renderscript/Allocation.java
diff options
context:
space:
mode:
authorTim Murray <timmurray@google.com>2013-04-12 20:03:51 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2013-04-12 20:03:52 +0000
commitd6b8a035337e096f8d313b70f2178f4ec54ba2e4 (patch)
tree9275ec57b60fe83045159dcf4efd2a50fe6bd71c /graphics/java/android/renderscript/Allocation.java
parent3016244ffb0ee59a191b294839468a81b45a01f1 (diff)
parent7c4caadb939b1563328251c156262c179a685c70 (diff)
Merge "Add support for synchronous get()." into jb-mr2-dev
Diffstat (limited to 'graphics/java/android/renderscript/Allocation.java')
-rw-r--r--graphics/java/android/renderscript/Allocation.java20
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;
+ }
}
/**