diff options
author | Alex Sakhartchouk <alexst@google.com> | 2011-06-14 11:13:19 -0700 |
---|---|---|
committer | Alex Sakhartchouk <alexst@google.com> | 2011-06-14 11:13:19 -0700 |
commit | 304b1f5497155bcf91e7b855cfab7a675e80bf26 (patch) | |
tree | 3a73f3855d29591f9b74f4967d594ec2476262b1 /graphics/java/android/renderscript/Allocation.java | |
parent | bd3e537980027f4502a13c204b3c7b9d10adad31 (diff) |
Allocation copy functions.
Change-Id: Idce6d44a4f4bb2e399284a40c0f90dc1bff912fd
Diffstat (limited to 'graphics/java/android/renderscript/Allocation.java')
-rw-r--r-- | graphics/java/android/renderscript/Allocation.java | 45 |
1 files changed, 41 insertions, 4 deletions
diff --git a/graphics/java/android/renderscript/Allocation.java b/graphics/java/android/renderscript/Allocation.java index 3c8aba36563a..a63abb9f9bc7 100644 --- a/graphics/java/android/renderscript/Allocation.java +++ b/graphics/java/android/renderscript/Allocation.java @@ -588,13 +588,29 @@ public class Allocation extends BaseObj { * * @param off The offset of the first element to be copied. * @param count The number of elements to be copied. - * @param d the source data array + * @param d the source data array. */ public void copy1DRangeFrom(int off, int count, float[] d) { validateIsFloat32(); copy1DRangeFromUnchecked(off, count, d); } + /** + * Copy part of an allocation from another allocation. + * + * @param off The offset of the first element to be copied. + * @param count The number of elements to be copied. + * @param data the source data allocation. + * @param dataOff off The offset of the first element in data to + * be copied. + */ + public void copy1DRangeFrom(int off, int count, Allocation data, int dataOff) { + mRS.nAllocationData2D(getID(), off, 0, + 0, Type.CubemapFace.POSITVE_X.mID, + count, 1, data.getID(), dataOff, 0, + 0, Type.CubemapFace.POSITVE_X.mID); + } + private void validate2DRange(int xoff, int yoff, int w, int h) { if (xoff < 0 || yoff < 0) { throw new RSIllegalArgumentException("Offset cannot be negative."); @@ -609,9 +625,8 @@ public class Allocation extends BaseObj { } /** - * Copy a rectanglular region from the array into the - * allocation. The incoming array is assumed to be tightly - * packed. + * Copy a rectangular region from the array into the allocation. + * The incoming array is assumed to be tightly packed. * * @param xoff X offset of the region to update * @param yoff Y offset of the region to update @@ -644,6 +659,28 @@ public class Allocation extends BaseObj { } /** + * Copy a rectangular region into the allocation from another + * allocation. + * + * @param xoff X offset of the region to update. + * @param yoff Y offset of the region to update. + * @param w Width of the incoming region to update. + * @param h Height of the incoming region to update. + * @param data source allocation. + * @param dataXoff X offset in data of the region to update. + * @param dataYoff Y offset in data of the region to update. + */ + public void copy2DRangeFrom(int xoff, int yoff, int w, int h, + Allocation data, int dataXoff, int dataYoff) { + mRS.validate(); + validate2DRange(xoff, yoff, w, h); + mRS.nAllocationData2D(getID(), xoff, yoff, + 0, Type.CubemapFace.POSITVE_X.mID, + w, h, data.getID(), dataXoff, dataYoff, + 0, Type.CubemapFace.POSITVE_X.mID); + } + + /** * Copy a bitmap into an allocation. The height and width of * the update will use the height and width of the incoming * bitmap. |