Support for cubemaps.

Change-Id: Iaf6087f614451a8e233b3e5bc49c834ab0ad08ee
diff --git a/rsAdapter.cpp b/rsAdapter.cpp
index 2a705a1..8d363fd 100644
--- a/rsAdapter.cpp
+++ b/rsAdapter.cpp
@@ -143,8 +143,19 @@
     rsAssert(mAllocation.get());
     rsAssert(mAllocation->getPtr());
     rsAssert(mAllocation->getType());
+    if (mFace != 0 && !mAllocation->getType()->getDimFaces()) {
+        LOGE("Adapter wants cubemap face, but allocation has none");
+        return NULL;
+    }
+
     uint8_t * ptr = static_cast<uint8_t *>(mAllocation->getPtr());
     ptr += mAllocation->getType()->getLODOffset(mLOD, x, y);
+
+    if (mFace != 0) {
+        uint32_t totalSizeBytes = mAllocation->getType()->getSizeBytes();
+        uint32_t faceOffset = totalSizeBytes / 6;
+        ptr += faceOffset * mFace;
+    }
     return ptr;
 }