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

Function rgbaToRGB565

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

Source from the content-addressed store, hash-verified

73}
74
75static void rgbaToRGB565(const uint8_t* src, uint8_t* dst, int w, int h)
76{
77 auto* out = reinterpret_cast<uint16_t*>(dst);
78 for (int i = 0; i < w * h; ++i)
79 {
80 uint8_t r = src[i * 4 + 0] >> 3;
81 uint8_t g = src[i * 4 + 1] >> 2;
82 uint8_t b = src[i * 4 + 2] >> 3;
83 out[i] = (r << 11) | (g << 5) | b;
84 }
85}
86
87static void rgbaToAI88(const uint8_t* src, uint8_t* dst, int w, int h)
88{

Callers 1

ConvertPixelsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected