mirror of
https://github.com/sle118/squeezelite-esp32.git
synced 2026-01-31 06:40:58 +03:00
forgot a few backports - release
This commit is contained in:
@@ -269,45 +269,3 @@ void GDS_DrawBitmapCBR(struct GDS_Device* Device, uint8_t *Data, int Width, int
|
|||||||
|
|
||||||
Device->Dirty = true;
|
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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -9,10 +9,6 @@
|
|||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
struct GDS_Device;
|
|
||||||
|
|
||||||
enum { GDS_RGB565, GDS_RGB555, GDS_RGB444 };
|
|
||||||
|
|
||||||
#ifndef _GDS_PRIVATE_H_
|
#ifndef _GDS_PRIVATE_H_
|
||||||
void IRAM_ATTR GDS_DrawPixelFast( struct GDS_Device* Device, int X, int Y, int Color );
|
void IRAM_ATTR GDS_DrawPixelFast( struct GDS_Device* Device, int X, int Y, int Color );
|
||||||
void IRAM_ATTR GDS_DrawPixel( struct GDS_Device* Device, int X, int Y, int Color );
|
void IRAM_ATTR GDS_DrawPixel( struct GDS_Device* Device, int X, int Y, int Color );
|
||||||
@@ -21,7 +17,6 @@ void GDS_DrawHLine( struct GDS_Device* Device, int x, int y, int Width, int Colo
|
|||||||
void GDS_DrawVLine( struct GDS_Device* Device, int x, int y, int Height, int Color );
|
void GDS_DrawVLine( struct GDS_Device* Device, int x, int y, int Height, int Color );
|
||||||
void GDS_DrawLine( struct GDS_Device* Device, int x0, int y0, int x1, int y1, int Color );
|
void GDS_DrawLine( struct GDS_Device* Device, int x0, int y0, int x1, int y1, int Color );
|
||||||
void GDS_DrawBox( struct GDS_Device* Device, int x1, int y1, int x2, int y2, int Color, bool Fill );
|
void GDS_DrawBox( struct GDS_Device* Device, int x1, int y1, int x2, int y2, int Color, bool Fill );
|
||||||
void GDS_DrawRGB16( struct GDS_Device* Device, int x, int y, int Width, int Height, int RGB_Mode, uint16_t **Image );
|
|
||||||
|
|
||||||
// draw a bitmap with source 1-bit depth organized in column and col0 = bit7 of byte 0
|
// draw a bitmap with source 1-bit depth organized in column and col0 = bit7 of byte 0
|
||||||
void GDS_DrawBitmapCBR( struct GDS_Device* Device, uint8_t *Data, int Width, int Height, int Color);
|
void GDS_DrawBitmapCBR( struct GDS_Device* Device, uint8_t *Data, int Width, int Height, int Color);
|
||||||
|
|||||||
@@ -90,10 +90,13 @@ static uint16_t* DecodeJPEG(uint8_t *Source, int *Width, int *Height, float Scal
|
|||||||
Decoder.scale = Scale;
|
Decoder.scale = Scale;
|
||||||
|
|
||||||
if (Res == JDR_OK && !SizeOnly) {
|
if (Res == JDR_OK && !SizeOnly) {
|
||||||
// ready to decode
|
// find the scaling factor
|
||||||
Context.OutData = malloc(Decoder.width * Decoder.height * sizeof(uint16_t));
|
Context.OutData = malloc(Decoder.width * Decoder.height * sizeof(uint16_t));
|
||||||
uint8_t N = 0, iScale = 1.0 / Scale;
|
uint8_t N = 0, ScaleInt = ceil(1.0 / Scale);
|
||||||
while (iScale >>= 1) N++;
|
ScaleInt--; ScaleInt |= ScaleInt >> 1; ScaleInt |= ScaleInt >> 2; ScaleInt++;
|
||||||
|
while (ScaleInt >>= 1) N++;
|
||||||
|
|
||||||
|
// ready to decode
|
||||||
if (Context.OutData) {
|
if (Context.OutData) {
|
||||||
Context.Width = Decoder.width / (1 << N);
|
Context.Width = Decoder.width / (1 << N);
|
||||||
Context.Height = Decoder.height / (1 << N);
|
Context.Height = Decoder.height / (1 << N);
|
||||||
|
|||||||
@@ -105,7 +105,7 @@ struct GDS_Device {
|
|||||||
void (*DrawPixelFast)( struct GDS_Device* Device, int X, int Y, int Color );
|
void (*DrawPixelFast)( struct GDS_Device* Device, int X, int Y, int Color );
|
||||||
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, int x, int y, int Width, int Height, int RGB_Mode, uint16_t **Image );
|
void (*DrawRGB16)( struct GDS_Device* Device, int x, int y, int Width, int Height, int RGB_Mode, uint16_t *Image );
|
||||||
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
|
||||||
|
|||||||
Reference in New Issue
Block a user