forgot a few backports - release

This commit is contained in:
philippe44
2020-02-26 23:48:18 -08:00
parent 1ae8f80e53
commit c00f513be7
4 changed files with 8 additions and 52 deletions

View File

@@ -268,46 +268,4 @@ void GDS_DrawBitmapCBR(struct GDS_Device* Device, uint8_t *Data, int Width, int
}
Device->Dirty = true;
}
/****************************************************************************************
* Simply draw a RGB565 image
* monoschrome (0.2125 * color.r) + (0.7154 * color.g) + (0.0721 * color.b)
* grayscale (0.3 * R) + (0.59 * G) + (0.11 * B) )
*/
void GDS_DrawRGB16( struct GDS_Device* Device, int x, int y, int Width, int Height, int RGB_Mode, uint16_t **Image ) {
if (Device->DrawRGB16) {
Device->DrawRGB16( Device, x, y, Width, Height, RGB_Mode, Image );
} else {
int Scale = Device->Depth < 5 ? 5 - Device->Depth : 0;
switch(RGB_Mode) {
case GDS_RGB565:
for (int c = 0; c < Width; c++) {
for (int r = 0; r < Height; r++) {
int pixel = Image[r][c];
pixel = ((pixel & 0x1f) * 11 + ((((pixel >> 5) & 0x3f) * 59) >> 1) + (pixel >> 11) * 30) / 100;
GDS_DrawPixel( Device, c + x, r + y, pixel >> Scale);
}
}
break;
case GDS_RGB555:
for (int c = 0; c < Width; c++) {
for (int r = 0; r < Height; r++) {
int pixel = Image[r][c];
pixel = ((pixel & 0x1f) * 11 + ((pixel >> 5) & 0x1f) * 59 + (pixel >> 10) * 30) / 100;
GDS_DrawPixel( Device, c + x, r + y, pixel >> Scale);
}
}
break;
case GDS_RGB444:
for (int c = 0; c < Width; c++) {
for (int r = 0; r < Height; r++) {
int pixel = Image[r][c];
pixel = (pixel & 0x0f) * 11 + ((pixel >> 4) & 0x0f) * 59 + (pixel >> 8) * 30;
GDS_DrawPixel( Device, c + x, r + y, pixel >> (Scale - 1));
}
}
break;
}
}
}
}