diff options
| author | Tim Murray <timmurray@google.com> | 2012-11-26 13:52:04 -0800 |
|---|---|---|
| committer | Tim Murray <timmurray@google.com> | 2012-11-27 14:57:22 -0800 |
| commit | 358747a3118301c5faeee73c98dd5f839bbfb54a (patch) | |
| tree | 75e852bf7c2d51b5beebddc07c7729e464a5f79c /cpp/Allocation.cpp | |
| parent | 7b3e3093f745134345dadf89498ad16e1f9c0e71 (diff) | |
| download | android_frameworks_rs-358747a3118301c5faeee73c98dd5f839bbfb54a.tar.gz android_frameworks_rs-358747a3118301c5faeee73c98dd5f839bbfb54a.tar.bz2 android_frameworks_rs-358747a3118301c5faeee73c98dd5f839bbfb54a.zip | |
Add support for 2D strided copies to/from an allocation with the C++ API.
Change-Id: I55cd7512f683f8d36d2b75f894931fd0657521bc
Diffstat (limited to 'cpp/Allocation.cpp')
| -rw-r--r-- | cpp/Allocation.cpp | 27 |
1 files changed, 25 insertions, 2 deletions
diff --git a/cpp/Allocation.cpp b/cpp/Allocation.cpp index 2e3597e8..d6dfa942 100644 --- a/cpp/Allocation.cpp +++ b/cpp/Allocation.cpp @@ -221,7 +221,7 @@ void Allocation::copy2DRangeFrom(uint32_t xoff, uint32_t yoff, uint32_t w, uint3 const void *data) { validate2DRange(xoff, yoff, w, h); rsAllocation2DData(mRS->getContext(), getIDSafe(), xoff, yoff, mSelectedLOD, mSelectedFace, - w, h, data, w * h * mType->getElement()->getSizeBytes()); + w, h, data, w * h * mType->getElement()->getSizeBytes(), w * mType->getElement()->getSizeBytes()); } void Allocation::copy2DRangeFrom(uint32_t xoff, uint32_t yoff, uint32_t w, uint32_t h, @@ -237,9 +237,32 @@ void Allocation::copy2DRangeTo(uint32_t xoff, uint32_t yoff, uint32_t w, uint32_ void* data) { validate2DRange(xoff, yoff, w, h); rsAllocation2DRead(mRS->getContext(), getIDSafe(), xoff, yoff, mSelectedLOD, mSelectedFace, - w, h, data, w * h * mType->getElement()->getSizeBytes()); + w, h, data, w * h * mType->getElement()->getSizeBytes(), w * mType->getElement()->getSizeBytes()); } +void Allocation::copy2DStridedFrom(uint32_t xoff, uint32_t yoff, uint32_t w, uint32_t h, + const void *data, size_t stride) { + validate2DRange(xoff, yoff, w, h); + rsAllocation2DData(mRS->getContext(), getIDSafe(), xoff, yoff, mSelectedLOD, mSelectedFace, + w, h, data, w * h * mType->getElement()->getSizeBytes(), stride); +} + +void Allocation::copy2DStridedFrom(const void* data, size_t stride) { + copy2DStridedFrom(0, 0, mCurrentDimX, mCurrentDimY, data, stride); +} + +void Allocation::copy2DStridedTo(uint32_t xoff, uint32_t yoff, uint32_t w, uint32_t h, + void *data, size_t stride) { + validate2DRange(xoff, yoff, w, h); + rsAllocation2DRead(mRS->getContext(), getIDSafe(), xoff, yoff, mSelectedLOD, mSelectedFace, + w, h, data, w * h * mType->getElement()->getSizeBytes(), stride); +} + +void Allocation::copy2DStridedTo(void* data, size_t stride) { + copy2DStridedTo(0, 0, mCurrentDimX, mCurrentDimY, data, stride); +} + + /* void resize(int dimX) { if ((mType.getY() > 0)|| (mType.getZ() > 0) || mType.hasFaces() || mType.hasMipmaps()) { |
