summaryrefslogtreecommitdiff
path: root/graphics/java/android/renderscript/Allocation.java
diff options
context:
space:
mode:
Diffstat (limited to 'graphics/java/android/renderscript/Allocation.java')
-rw-r--r--graphics/java/android/renderscript/Allocation.java10
1 files changed, 9 insertions, 1 deletions
diff --git a/graphics/java/android/renderscript/Allocation.java b/graphics/java/android/renderscript/Allocation.java
index 54de6aa4240a..914799250729 100644
--- a/graphics/java/android/renderscript/Allocation.java
+++ b/graphics/java/android/renderscript/Allocation.java
@@ -274,12 +274,20 @@ public class Allocation extends BaseObj {
}
}
+ // 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;
if (t != null) {
updateCacheInfo(t);
}
+
}
private void validateIsInt32() {
@@ -1235,6 +1243,7 @@ public class Allocation extends BaseObj {
if (type.getID(rs) == 0) {
throw new RSInvalidStateException("Bad Type");
}
+
int id = rs.nAllocationCreateTyped(type.getID(rs), mips.mID, usage, 0);
if (id == 0) {
throw new RSRuntimeException("Allocation creation failed.");
@@ -1384,7 +1393,6 @@ public class Allocation extends BaseObj {
return alloc;
}
-
int id = rs.nAllocationCreateFromBitmap(t.getID(rs), mips.mID, b, usage);
if (id == 0) {
throw new RSRuntimeException("Load failed.");