summaryrefslogtreecommitdiffstats
path: root/libs/rs/rsAllocation.cpp
diff options
context:
space:
mode:
authorAlex Sakhartchouk <alexst@google.com>2011-01-10 15:57:57 -0800
committerAlex Sakhartchouk <alexst@google.com>2011-01-10 15:57:57 -0800
commitfe852e216fdfab20e7b3d3e55247f70634d267b9 (patch)
treea0d83f8e4b74f40a5e53704ca0ba9bcf8c06df03 /libs/rs/rsAllocation.cpp
parent3045bbaf58574ad3168466b198b835b29d174c18 (diff)
downloadframeworks_base-fe852e216fdfab20e7b3d3e55247f70634d267b9.zip
frameworks_base-fe852e216fdfab20e7b3d3e55247f70634d267b9.tar.gz
frameworks_base-fe852e216fdfab20e7b3d3e55247f70634d267b9.tar.bz2
Updating cubemap loading code.
Change-Id: I93bb00e5fd1ccc622d17eba70a510664c2093723
Diffstat (limited to 'libs/rs/rsAllocation.cpp')
-rw-r--r--libs/rs/rsAllocation.cpp11
1 files changed, 8 insertions, 3 deletions
diff --git a/libs/rs/rsAllocation.cpp b/libs/rs/rsAllocation.cpp
index 3608e43..673ade2 100644
--- a/libs/rs/rsAllocation.cpp
+++ b/libs/rs/rsAllocation.cpp
@@ -831,16 +831,21 @@ RsAllocation rsaAllocationCubeCreateFromBitmap(RsContext con, RsType vtype,
return NULL;
}
+ uint32_t faceSize = t->getDimX();
+ uint32_t strideBytes = faceSize * 6 * t->getElementSizeBytes();
+ uint32_t copySize = faceSize * t->getElementSizeBytes();
+
uint8_t *sourcePtr = (uint8_t*)data;
for (uint32_t face = 0; face < 6; face ++) {
Adapter2D faceAdapter(rsc, texAlloc);
faceAdapter.setFace(face);
- size_t cpySize = t->getDimX() * t->getDimX() * t->getElementSizeBytes();
- memcpy(faceAdapter.getElement(0, 0), sourcePtr, cpySize);
+ for (uint32_t dI = 0; dI < faceSize; dI ++) {
+ memcpy(faceAdapter.getElement(0, dI), sourcePtr + strideBytes * dI, copySize);
+ }
// Move the data pointer to the next cube face
- sourcePtr += cpySize;
+ sourcePtr += copySize;
if (mips == RS_ALLOCATION_MIPMAP_FULL) {
Adapter2D adapt(rsc, texAlloc);