MCPcopy Create free account
hub / github.com/BohemiaInteractive/CWR / rgb565ToRGBA

Function rgb565ToRGBA

engine/Poseidon/Graphics/Textures/Image.cpp:148–162  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

146}
147
148static void rgb565ToRGBA(const uint8_t* src, uint8_t* dst, int w, int h)
149{
150 const auto* in = reinterpret_cast<const uint16_t*>(src);
151 for (int i = 0; i < w * h; ++i)
152 {
153 uint16_t p = in[i];
154 uint8_t r = (p >> 11) & 0x1F;
155 uint8_t g = (p >> 5) & 0x3F;
156 uint8_t b = p & 0x1F;
157 dst[i * 4 + 0] = (r << 3) | (r >> 2);
158 dst[i * 4 + 1] = (g << 2) | (g >> 4);
159 dst[i * 4 + 2] = (b << 3) | (b >> 2);
160 dst[i * 4 + 3] = 255;
161 }
162}
163
164static void ai88ToRGBA(const uint8_t* src, uint8_t* dst, int w, int h)
165{

Callers 1

ConvertPixelsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected