mirror of
https://github.com/sle118/squeezelite-esp32.git
synced 2025-12-06 19:47:02 +03:00
VU bitmap is 8bits grayscale, not RGB332 - release
This commit is contained in:
@@ -215,13 +215,21 @@ void GDS_DrawRGB16( struct GDS_Device* Device, uint16_t *Image, int x, int y, in
|
|||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************************
|
/****************************************************************************************
|
||||||
* Simply draw a RGB 8 bits image (R:3,G:3,B:2)
|
* Simply draw a RGB 8 bits image (R:3,G:3,B:2) or plain grayscale
|
||||||
* monochrome (0.2125 * color.r) + (0.7154 * color.g) + (0.0721 * color.b)
|
* monochrome (0.2125 * color.r) + (0.7154 * color.g) + (0.0721 * color.b)
|
||||||
* grayscale (0.3 * R) + (0.59 * G) + (0.11 * B) )
|
* grayscale (0.3 * R) + (0.59 * G) + (0.11 * B) )
|
||||||
*/
|
*/
|
||||||
void GDS_DrawRGB8( struct GDS_Device* Device, uint8_t *Image, int x, int y, int Width, int Height ) {
|
void GDS_DrawRGB8( struct GDS_Device* Device, uint8_t *Image, int x, int y, int Width, int Height, int RGB_Mode ) {
|
||||||
if (Device->DrawRGB8) {
|
if (Device->DrawRGB8) {
|
||||||
Device->DrawRGB8( Device, Image, x, y, Width, Height );
|
Device->DrawRGB8( Device, Image, x, y, Width, Height, RGB_Mode );
|
||||||
|
} else if (RGB_Mode == GDS_GRAYSCALE) {
|
||||||
|
// 8 bits pixels
|
||||||
|
int Scale = 8 - Device->Depth;
|
||||||
|
for (int r = 0; r < Height; r++) {
|
||||||
|
for (int c = 0; c < Width; c++) {
|
||||||
|
GDS_DrawPixel( Device, c + x, r + y, *Image++ >> Scale);
|
||||||
|
}
|
||||||
|
}
|
||||||
} else if (Device->Depth < 3) {
|
} else if (Device->Depth < 3) {
|
||||||
// 3 bits pixels to be placed
|
// 3 bits pixels to be placed
|
||||||
int Scale = 3 - Device->Depth;
|
int Scale = 3 - Device->Depth;
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
|
|
||||||
struct GDS_Device;
|
struct GDS_Device;
|
||||||
|
|
||||||
enum { GDS_RGB565, GDS_RGB555, GDS_RGB444 };
|
enum { GDS_RGB565, GDS_RGB555, GDS_RGB444, GDS_RGB332, GDS_GRAYSCALE };
|
||||||
|
|
||||||
// Fit options for GDS_DrawJPEG
|
// Fit options for GDS_DrawJPEG
|
||||||
#define GDS_IMAGE_LEFT 0x00
|
#define GDS_IMAGE_LEFT 0x00
|
||||||
@@ -24,4 +24,4 @@ uint16_t* GDS_DecodeJPEG(uint8_t *Source, int *Width, int *Height, float Scale)
|
|||||||
void GDS_GetJPEGSize(uint8_t *Source, int *Width, int *Height);
|
void GDS_GetJPEGSize(uint8_t *Source, int *Width, int *Height);
|
||||||
bool GDS_DrawJPEG( struct GDS_Device* Device, uint8_t *Source, int x, int y, int Fit);
|
bool GDS_DrawJPEG( struct GDS_Device* Device, uint8_t *Source, int x, int y, int Fit);
|
||||||
void GDS_DrawRGB16( struct GDS_Device* Device, uint16_t *Image, int x, int y, int Width, int Height, int RGB_Mode );
|
void GDS_DrawRGB16( struct GDS_Device* Device, uint16_t *Image, int x, int y, int Width, int Height, int RGB_Mode );
|
||||||
void GDS_DrawRGB8( struct GDS_Device* Device, uint8_t *Image, int x, int y, int Width, int Height );
|
void GDS_DrawRGB8( struct GDS_Device* Device, uint8_t *Image, int x, int y, int Width, int Height, int RGB_Mode );
|
||||||
@@ -112,7 +112,7 @@ struct GDS_Device {
|
|||||||
void (*DrawBitmapCBR)(struct GDS_Device* Device, uint8_t *Data, int Width, int Height, int Color );
|
void (*DrawBitmapCBR)(struct GDS_Device* Device, uint8_t *Data, int Width, int Height, int Color );
|
||||||
// may provide for optimization
|
// may provide for optimization
|
||||||
void (*DrawRGB16)( struct GDS_Device* Device, uint16_t *Image,int x, int y, int Width, int Height, int RGB_Mode );
|
void (*DrawRGB16)( struct GDS_Device* Device, uint16_t *Image,int x, int y, int Width, int Height, int RGB_Mode );
|
||||||
void (*DrawRGB8)( struct GDS_Device* Device, uint8_t *Image, int x, int y, int Width, int Height );
|
void (*DrawRGB8)( struct GDS_Device* Device, uint8_t *Image, int x, int y, int Width, int Height, int RGB_Mode );
|
||||||
void (*ClearWindow)( struct GDS_Device* Device, int x1, int y1, int x2, int y2, int Color );
|
void (*ClearWindow)( struct GDS_Device* Device, int x1, int y1, int x2, int y2, int Color );
|
||||||
|
|
||||||
// interface-specific methods
|
// interface-specific methods
|
||||||
|
|||||||
@@ -589,29 +589,15 @@ void draw_VU(struct GDS_Device * display, const uint8_t *data, int level, int x,
|
|||||||
data += (VU_WIDTH - width) / 2 * VU_HEIGHT;
|
data += (VU_WIDTH - width) / 2 * VU_HEIGHT;
|
||||||
}
|
}
|
||||||
|
|
||||||
// this is RGB332, so pixel will be 3 bits deep
|
// this is 8 bits grayscale
|
||||||
int depth = GDS_GetDepth(display);
|
int scale = 8 - GDS_GetDepth(display);
|
||||||
|
|
||||||
// use "fast" version as we are not beyond screen boundaries
|
// use "fast" version as we are not beyond screen boundaries
|
||||||
if (depth < 3) {
|
for (int r = 0; r < width; r++) {
|
||||||
int scale = 3 - depth;
|
for (int c = 0; c < VU_HEIGHT; c++) {
|
||||||
for (int r = 0; r < width; r++) {
|
GDS_DrawPixelFast(display, r + x, c + y, *data++ >> scale);
|
||||||
for (int c = 0; c < VU_HEIGHT; c++) {
|
|
||||||
int pixel = *data++;
|
|
||||||
pixel = ((((pixel & 0x3) * 11) << 1) + ((pixel >> 2) & 0x7) * 59 + (pixel >> 5) * 30 + 1) / 100;
|
|
||||||
GDS_DrawPixelFast(display, r + x, c + y, pixel >> scale);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
} else {
|
}
|
||||||
int scale = depth - 3;
|
|
||||||
for (int r = 0; r < width; r++) {
|
|
||||||
for (int c = 0; c < VU_HEIGHT; c++) {
|
|
||||||
int pixel = *data++;
|
|
||||||
pixel = ((((pixel & 0x3) * 11) << 1) + ((pixel >> 2) & 0x7) * 59 + (pixel >> 5) * 30 + 1) / 100;
|
|
||||||
GDS_DrawPixelFast(display, r + x, c + y, pixel << scale);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// need to manually set dirty flag as DrawPixel does not do it
|
// need to manually set dirty flag as DrawPixel does not do it
|
||||||
GDS_SetDirty(display);
|
GDS_SetDirty(display);
|
||||||
@@ -934,7 +920,7 @@ static void visu_update(void) {
|
|||||||
if (visu.bars[i].current > visu.bars[i].max) visu.bars[i].max = visu.bars[i].current;
|
if (visu.bars[i].current > visu.bars[i].max) visu.bars[i].max = visu.bars[i].current;
|
||||||
else if (visu.bars[i].max) visu.bars[i].max--;
|
else if (visu.bars[i].max) visu.bars[i].max--;
|
||||||
else if (!clear) continue;
|
else if (!clear) continue;
|
||||||
|
|
||||||
for (int j = 0; j <= visu.bars[i].current; j += 2)
|
for (int j = 0; j <= visu.bars[i].current; j += 2)
|
||||||
GDS_DrawLine(display, x1, y1 - j, x1 + visu.bar_width - 1, y1 - j, GDS_COLOR_WHITE);
|
GDS_DrawLine(display, x1, y1 - j, x1 + visu.bar_width - 1, y1 - j, GDS_COLOR_WHITE);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user