MCPcopy Create free account
hub / github.com/TorqueGameEngines/Torque3D / Unpack565

Function Unpack565

Engine/lib/squish/colourblock.cpp:140–158  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

138}
139
140static 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
160void DecompressColour( u8* rgba, void const* block, bool isDxt1 )
161{

Callers 1

DecompressColourFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected