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

Function rgbaToARGB1555

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

Source from the content-addressed store, hash-verified

60}
61
62static void rgbaToARGB1555(const uint8_t* src, uint8_t* dst, int w, int h)
63{
64 auto* out = reinterpret_cast<uint16_t*>(dst);
65 for (int i = 0; i < w * h; ++i)
66 {
67 uint8_t r = src[i * 4 + 0] >> 3;
68 uint8_t g = src[i * 4 + 1] >> 3;
69 uint8_t b = src[i * 4 + 2] >> 3;
70 uint8_t a = src[i * 4 + 3] >= 128 ? 1 : 0;
71 out[i] = (a << 15) | (r << 10) | (g << 5) | b;
72 }
73}
74
75static void rgbaToRGB565(const uint8_t* src, uint8_t* dst, int w, int h)
76{

Callers 1

ConvertPixelsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected