| 47 | // --- RGBA8888 → format converters --- |
| 48 | |
| 49 | static void rgbaToARGB4444(const uint8_t* src, uint8_t* dst, int w, int h) |
| 50 | { |
| 51 | auto* out = reinterpret_cast<uint16_t*>(dst); |
| 52 | for (int i = 0; i < w * h; ++i) |
| 53 | { |
| 54 | uint8_t r = src[i * 4 + 0] >> 4; |
| 55 | uint8_t g = src[i * 4 + 1] >> 4; |
| 56 | uint8_t b = src[i * 4 + 2] >> 4; |
| 57 | uint8_t a = src[i * 4 + 3] >> 4; |
| 58 | out[i] = (a << 12) | (r << 8) | (g << 4) | b; |
| 59 | } |
| 60 | } |
| 61 | |
| 62 | static void rgbaToARGB1555(const uint8_t* src, uint8_t* dst, int w, int h) |
| 63 | { |