summaryrefslogtreecommitdiff
path: root/graphics/java/android/renderscript/Allocation.java
diff options
context:
space:
mode:
authorTim Murray <timmurray@google.com>2013-04-10 16:21:40 -0700
committerTim Murray <timmurray@google.com>2013-04-11 16:25:29 -0700
commit7c4caadb939b1563328251c156262c179a685c70 (patch)
treead98bb41045c7273136478190546cb4279e29c98 /graphics/java/android/renderscript/Allocation.java
parentb3a9872549137f6c3983609e48e5b2d4fc94a3d4 (diff)
Add support for synchronous get().
bug 8599910 Change-Id: I0e7c52350cc1abb14a5ed59bb92e8e0346209d53
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 575133146008..051b03f3568d 100644
--- a/graphics/java/android/renderscript/Allocation.java
+++ b/graphics/java/android/renderscript/Allocation.java
@@ -273,14 +273,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;
@@ -351,6 +351,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;
+ }
}
/**