MCPcopy Create free account
hub / github.com/axmolengine/axmol / convertR8ToRGB565

Function convertR8ToRGB565

core/renderer/backend/PixelFormatUtils.cpp:162–171  ·  view source on GitHub ↗

IIIIIIII -> RRRRRGGGGGGBBBBB

Source from the content-addressed store, hash-verified

160
161// IIIIIIII -> RRRRRGGGGGGBBBBB
162static void convertR8ToRGB565(const unsigned char* data, size_t dataLen, unsigned char* outData)
163{
164 unsigned short* out16 = (unsigned short*)outData;
165 for (size_t i = 0; i < dataLen; ++i)
166 {
167 *out16++ = (data[i] & 0x00F8) << 8 // R
168 | (data[i] & 0x00FC) << 3 // G
169 | (data[i] & 0x00F8) >> 3; // B
170 }
171}
172
173// IIIIIIIIAAAAAAAA -> RRRRRGGGGGGBBBBB
174static void convertRG8ToRGB565(const unsigned char* data, size_t dataLen, unsigned char* outData)

Callers 1

convertR8ToFormatFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected