MCPcopy Create free account
hub / github.com/DentonW/DevIL / DxtcReadColors

Function DxtcReadColors

DevIL/src-IL/src/il_dds.cpp:983–1002  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

981
982
983void DxtcReadColors(const ILubyte* Data, Color8888* Out)
984{
985 ILubyte r0, g0, b0, r1, g1, b1;
986
987 b0 = Data[0] & 0x1F;
988 g0 = ((Data[0] & 0xE0) >> 5) | ((Data[1] & 0x7) << 3);
989 r0 = (Data[1] & 0xF8) >> 3;
990
991 b1 = Data[2] & 0x1F;
992 g1 = ((Data[2] & 0xE0) >> 5) | ((Data[3] & 0x7) << 3);
993 r1 = (Data[3] & 0xF8) >> 3;
994
995 Out[0].r = r0 << 3 | r0 >> 2;
996 Out[0].g = g0 << 2 | g0 >> 3;
997 Out[0].b = b0 << 3 | b0 >> 2;
998
999 Out[1].r = r1 << 3 | r1 >> 2;
1000 Out[1].g = g1 << 2 | g1 >> 3;
1001 Out[1].b = b1 << 3 | b1 >> 2;
1002}
1003
1004//@TODO: Probably not safe on Big Endian.
1005void DxtcReadColor(ILushort Data, Color8888* Out)

Callers 2

DecompressDXT3Function · 0.85
DecompressDXT5Function · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected