| 138 | } |
| 139 | |
| 140 | static int Unpack565( u8 const* packed, u8* colour ) |
| 141 | { |
| 142 | // build the packed value |
| 143 | int value = ( int )packed[0] | ( ( int )packed[1] << 8 ); |
| 144 | |
| 145 | // get the components in the stored range |
| 146 | u8 red = ( u8 )( ( value >> 11 ) & 0x1f ); |
| 147 | u8 green = ( u8 )( ( value >> 5 ) & 0x3f ); |
| 148 | u8 blue = ( u8 )( value & 0x1f ); |
| 149 | |
| 150 | // scale up to 8 bits |
| 151 | colour[0] = ( red << 3 ) | ( red >> 2 ); |
| 152 | colour[1] = ( green << 2 ) | ( green >> 4 ); |
| 153 | colour[2] = ( blue << 3 ) | ( blue >> 2 ); |
| 154 | colour[3] = 255; |
| 155 | |
| 156 | // return the value |
| 157 | return value; |
| 158 | } |
| 159 | |
| 160 | void DecompressColour( u8* rgba, void const* block, bool isDxt1 ) |
| 161 | { |