Update cute_png.c

This commit is contained in:
blueloveTH 2025-12-07 21:47:25 +08:00
parent cc95299cb4
commit f95b765207

View File

@ -159,8 +159,9 @@ static bool cute_png_Image__to_rgb565_bytes(int argc, py_Ref argv) {
uint16_t g = (pixel.g >> 2) & 0x3F; uint16_t g = (pixel.g >> 2) & 0x3F;
uint16_t b = (pixel.b >> 3) & 0x1F; uint16_t b = (pixel.b >> 3) & 0x1F;
uint16_t rgb565 = (r << 11) | (g << 5) | b; uint16_t rgb565 = (r << 11) | (g << 5) | b;
data[idx * 2 + 0] = (rgb565 >> 8) & 0xFF; // use little-endian
data[idx * 2 + 1] = (rgb565 >> 0) & 0xFF; data[idx * 2 + 0] = rgb565 & 0xFF;
data[idx * 2 + 1] = (rgb565 >> 8) & 0xFF;
} }
} }
return true; return true;