MCPcopy Create free account
hub / github.com/carbonengine/trinity / InterpolatedColor

Function InterpolatedColor

trinityal/BcDecompress.cpp:18–31  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

16}
17
18inline uint32_t InterpolatedColor( uint32_t color0, uint32_t weight0, uint32_t color1, uint32_t weight1, uint32_t offset, uint32_t divisor )
19{
20 uint32_t r0 = ( color0 >> 16 ) & 0xff;
21 uint32_t g0 = ( color0 >> 8 ) & 0xff;
22 uint32_t b0 = ( color0 >> 0 ) & 0xff;
23 uint32_t r1 = ( color1 >> 16 ) & 0xff;
24 uint32_t g1 = ( color1 >> 8 ) & 0xff;
25 uint32_t b1 = ( color1 >> 0 ) & 0xff;
26
27 uint32_t r = ( r0 * weight0 + r1 * weight1 + offset ) / divisor & 0xff;
28 uint32_t g = ( g0 * weight0 + g1 * weight1 + offset ) / divisor & 0xff;
29 uint32_t b = ( b0 * weight0 + b1 * weight1 + offset ) / divisor & 0xff;
30 return ( r << 16 ) | ( g << 8 ) | b;
31}
32
33void DecompressBc1( uint32_t width, uint32_t height, uint32_t depth, const Tr2SubresourceData& src, uint8_t* decompressed )
34{

Callers 3

DecompressBc1Function · 0.85
DecompressBc2Function · 0.85
DecompressBc3Function · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected