From: Rudolf Polzer Date: Wed, 13 Jul 2011 15:10:58 +0000 (+0200) Subject: fix BGRA and parameter passing X-Git-Tag: android-x86-6.0-r1~152 X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=5690c68b36c059a4239c729e1c673da9d77bbbff;p=android-x86%2Fexternal-s2tc.git fix BGRA and parameter passing --- diff --git a/s2tc.cpp b/s2tc.cpp index 082f7d7..f665081 100644 --- a/s2tc.cpp +++ b/s2tc.cpp @@ -4,6 +4,7 @@ #include #include #include +#include #include "libtxc_dxtn.h" #include "s2tc_common.h" @@ -562,6 +563,9 @@ int main(int argc, char **argv) } pic = LoadTGA_BGRA(picdata, piclen); + for(int x = 0; x < image_width*image_height; ++x) + std::swap(pic[4*x], pic[4*x+2]); + int mipcount = 0; while(image_width >= (1 << mipcount) || image_height >= (1 << mipcount)) ++mipcount; diff --git a/s2tc_libtxc_dxtn.cpp b/s2tc_libtxc_dxtn.cpp index 2446846..6b412ad 100644 --- a/s2tc_libtxc_dxtn.cpp +++ b/s2tc_libtxc_dxtn.cpp @@ -191,7 +191,7 @@ void tx_compress_dxtn(GLint srccomps, GLint width, GLint height, for (i = 0; i < width; i += 4) { if (width > i + 3) numxpixels = 4; else numxpixels = width - i; - encode_block(blkaddr, srcaddr, width, numxpixels, numypixels, -1); + encode_block(blkaddr, srcaddr, width, numxpixels, numypixels, nrandom); srcaddr += 4 * numxpixels; blkaddr += 8; } @@ -209,7 +209,7 @@ void tx_compress_dxtn(GLint srccomps, GLint width, GLint height, for (i = 0; i < width; i += 4) { if (width > i + 3) numxpixels = 4; else numxpixels = width - i; - encode_block(blkaddr, srcaddr, width, numxpixels, numypixels, -1); + encode_block(blkaddr, srcaddr, width, numxpixels, numypixels, nrandom); srcaddr += 4 * numxpixels; blkaddr += 16; } @@ -227,7 +227,7 @@ void tx_compress_dxtn(GLint srccomps, GLint width, GLint height, for (i = 0; i < width; i += 4) { if (width > i + 3) numxpixels = 4; else numxpixels = width - i; - encode_block(blkaddr, srcaddr, width, numxpixels, numypixels, -1); + encode_block(blkaddr, srcaddr, width, numxpixels, numypixels, nrandom); srcaddr += 4 * numxpixels; blkaddr += 16; }