diff options
author | Stephen Hines <srhines@google.com> | 2013-09-09 17:56:07 -0700 |
---|---|---|
committer | Stephen Hines <srhines@google.com> | 2013-09-09 17:56:07 -0700 |
commit | 88990da58d0231b5a1b9a27b32c37839e95c7487 (patch) | |
tree | c76a81dd08bdc49b46be9956d3126b35db882dbf /graphics | |
parent | 6416729c4732be6bcdbc5f303752a9d1885f86d0 (diff) | |
download | frameworks_base-88990da58d0231b5a1b9a27b32c37839e95c7487.zip frameworks_base-88990da58d0231b5a1b9a27b32c37839e95c7487.tar.gz frameworks_base-88990da58d0231b5a1b9a27b32c37839e95c7487.tar.bz2 |
Don't set Allocation mSize when we have no Type.
Bug: 10667740
A3D creates Allocations before knowing the underlying Type (and thus size).
Moving the mSize calculation to be conditional for concrete Allocations
eliminates the bug. In the future, we could let A3D dynamically update the
Allocation size if it is necessary to improve heap behavior.
Change-Id: I520246806b6ead0387a1a41372dade1a6e7c2271
Diffstat (limited to 'graphics')
-rw-r--r-- | graphics/java/android/renderscript/Allocation.java | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/graphics/java/android/renderscript/Allocation.java b/graphics/java/android/renderscript/Allocation.java index ca72c25..dca934f 100644 --- a/graphics/java/android/renderscript/Allocation.java +++ b/graphics/java/android/renderscript/Allocation.java @@ -269,9 +269,12 @@ public class Allocation extends BaseObj { mType = t; mUsage = usage; - mSize = mType.getCount() * mType.getElement().getBytesSize(); if (t != null) { + // TODO: A3D doesn't have Type info during creation, so we can't + // calculate the size ahead of time. We can possibly add a method + // to update the size in the future if it seems reasonable. + mSize = mType.getCount() * mType.getElement().getBytesSize(); updateCacheInfo(t); } try { |