From: Rudolf Polzer Date: Fri, 15 Jul 2011 11:08:46 +0000 (+0200) Subject: make encoding of DXT3/5 "more friendly" (don't use the swapped-colors case of DXT1) X-Git-Tag: android-x86-6.0-r1~72 X-Git-Url: http://git.osdn.net/view?p=android-x86%2Fexternal-s2tc.git;a=commitdiff_plain;h=74e3c93055a532979c3468a93c6ae6188fe07bb2 make encoding of DXT3/5 "more friendly" (don't use the swapped-colors case of DXT1) --- diff --git a/s2tc_compressor.cpp b/s2tc_compressor.cpp index e3312ef..aebf469 100644 --- a/s2tc_compressor.cpp +++ b/s2tc_compressor.cpp @@ -482,12 +482,15 @@ namespace { if(ca[1] < ca[0]) { + // select mode with 6 = 0, 7 = 255 ca[2] = ca[0]; ca[0] = ca[1]; ca[1] = ca[2]; } } - if(c[1] < c[0]) + if((dxt == DXT1) ? (c[1] < c[0]) : (c[0] < c[1])) + // DXT1: select mode with 3 = transparent + // other: don't select this mode { c[2] = c[0]; c[0] = c[1]; @@ -733,7 +736,9 @@ namespace } } } - if(c[1] < c[0]) + if((dxt == DXT1) ? (c[1] < c[0]) : (c[0] < c[1])) + // DXT1: select mode with 3 = transparent + // other: don't select this mode { c[2] = c[0]; c[0] = c[1];