Add support for 2D strided copies to/from an allocation with the C++ API.

Change-Id: I55cd7512f683f8d36d2b75f894931fd0657521bc
diff --git a/cpp/Allocation.cpp b/cpp/Allocation.cpp
index 2e3597e..d6dfa94 100644
--- a/cpp/Allocation.cpp
+++ b/cpp/Allocation.cpp
@@ -221,7 +221,7 @@
                                  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* 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()) {
diff --git a/cpp/rsCppStructs.h b/cpp/rsCppStructs.h
index 8d3a9af..a430c35 100644
--- a/cpp/rsCppStructs.h
+++ b/cpp/rsCppStructs.h
@@ -238,6 +238,14 @@
     void copy2DRangeFrom(uint32_t xoff, uint32_t yoff, uint32_t w, uint32_t h,
                          sp<const Allocation> data, uint32_t dataXoff, uint32_t dataYoff);
 
+    void copy2DStridedFrom(uint32_t xoff, uint32_t yoff, uint32_t w, uint32_t h,
+                           const void *data, size_t stride);
+    void copy2DStridedFrom(const void *data, size_t stride);
+
+    void copy2DStridedTo(uint32_t xoff, uint32_t yoff, uint32_t w, uint32_t h,
+                         void *data, size_t stride);
+    void copy2DStridedTo(void *data, size_t stride);
+
     void resize(int dimX);
     void resize(int dimX, int dimY);