Make sure to handle 0 bit depth a bit more gracefully

This commit is contained in:
Pavel Krajcevski 2013-08-31 16:05:28 -04:00
parent 9a0fbebac3
commit 1ffbdea2b8

View file

@ -112,7 +112,7 @@ namespace PVRTCC {
assert(newDepth <= 8); assert(newDepth <= 8);
assert(oldDepth <= 8); assert(oldDepth <= 8);
if(oldDepth == newDepth) { if(oldDepth == newDepth || oldDepth == 0) {
// Do nothing // Do nothing
return val; return val;
} else if(newDepth > oldDepth) { } else if(newDepth > oldDepth) {
@ -128,8 +128,12 @@ namespace PVRTCC {
} else { } else {
// oldDepth > newDepth // oldDepth > newDepth
uint8 bitsWasted = oldDepth - newDepth; if(newDepth == 0) {
return val >> bitsWasted; return 0xFF;
} else {
uint8 bitsWasted = oldDepth - newDepth;
return val >> bitsWasted;
}
} }
assert(!"We shouldn't get here."); assert(!"We shouldn't get here.");