| 60 | } |
| 61 | |
| 62 | static 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 | |
| 75 | static void rgbaToRGB565(const uint8_t* src, uint8_t* dst, int w, int h) |
| 76 | { |