am ad822197: Merge change 23380 into eclair

Merge commit 'ad82219718cd1751dcf84bab0cd1aedcb6805eb1' into eclair-plus-aosp

* commit 'ad82219718cd1751dcf84bab0cd1aedcb6805eb1':
  Change util_texSubImage2D to call glCompressedTexImage2D correctly.
This commit is contained in:
Jack Palevich
2009-08-31 17:46:42 -07:00
committed by Android Git Automerger

View File

@@ -665,14 +665,15 @@ static jint util_texImage2D(JNIEnv *env, jclass clazz,
} }
const size_t size = bitmap.getSize(); const size_t size = bitmap.getSize();
const size_t palette_size = 256*sizeof(SkPMColor); const size_t palette_size = 256*sizeof(SkPMColor);
void* const data = malloc(size + palette_size); const size_t imageSize = size + palette_size;
void* const data = malloc(imageSize);
if (data) { if (data) {
void* const pixels = (char*)data + palette_size; void* const pixels = (char*)data + palette_size;
SkColorTable* ctable = bitmap.getColorTable(); SkColorTable* ctable = bitmap.getColorTable();
memcpy(data, ctable->lockColors(), ctable->count() * sizeof(SkPMColor)); memcpy(data, ctable->lockColors(), ctable->count() * sizeof(SkPMColor));
memcpy(pixels, p, size); memcpy(pixels, p, size);
ctable->unlockColors(false); ctable->unlockColors(false);
glCompressedTexImage2D(target, level, internalformat, w, h, border, 0, data); glCompressedTexImage2D(target, level, internalformat, w, h, border, imageSize, data);
free(data); free(data);
} else { } else {
err = -1; err = -1;