mirror of
https://github.com/sle118/squeezelite-esp32.git
synced 2025-12-06 19:47:02 +03:00
correct some inlining
This commit is contained in:
@@ -130,7 +130,7 @@ static bool Init( struct GDS_Device* Device ) {
|
||||
static const struct GDS_Device SH1106 = {
|
||||
.DisplayOn = DisplayOn, .DisplayOff = DisplayOff, .SetContrast = SetContrast,
|
||||
.SetVFlip = SetVFlip, .SetHFlip = SetHFlip,
|
||||
.DrawPixel = GDS_DrawPixel, .DrawPixelFast = GDS_DrawPixelFast,
|
||||
.DrawPixelFast = GDS_DrawPixelFast,
|
||||
.Update = Update, .Init = Init,
|
||||
};
|
||||
|
||||
|
||||
@@ -131,7 +131,7 @@ static bool Init( struct GDS_Device* Device ) {
|
||||
static const struct GDS_Device SSD1306 = {
|
||||
.DisplayOn = DisplayOn, .DisplayOff = DisplayOff, .SetContrast = SetContrast,
|
||||
.SetVFlip = SetVFlip, .SetHFlip = SetHFlip,
|
||||
.DrawPixel = GDS_DrawPixel, .DrawPixelFast = GDS_DrawPixelFast,
|
||||
.DrawPixelFast = GDS_DrawPixelFast,
|
||||
.Update = Update, .Init = Init,
|
||||
};
|
||||
|
||||
|
||||
@@ -38,23 +38,6 @@ static const unsigned char BitReverseTable256[] =
|
||||
0x0F, 0x8F, 0x4F, 0xCF, 0x2F, 0xAF, 0x6F, 0xEF, 0x1F, 0x9F, 0x5F, 0xDF, 0x3F, 0xBF, 0x7F, 0xFF
|
||||
};
|
||||
|
||||
__attribute__( ( always_inline ) ) static inline bool IsPixelVisible( struct GDS_Device* Device, int x, int y ) {
|
||||
bool Result = (
|
||||
( x >= 0 ) &&
|
||||
( x < Device->Width ) &&
|
||||
( y >= 0 ) &&
|
||||
( y < Device->Height )
|
||||
) ? true : false;
|
||||
|
||||
#if CONFIG_GDS_CLIPDEBUG > 0
|
||||
if ( Result == false ) {
|
||||
ClipDebug( x, y );
|
||||
}
|
||||
#endif
|
||||
|
||||
return Result;
|
||||
}
|
||||
|
||||
__attribute__( ( always_inline ) ) static inline void SwapInt( int* a, int* b ) {
|
||||
int Temp = *b;
|
||||
|
||||
@@ -83,12 +66,6 @@ inline void IRAM_ATTR GDS_DrawPixelFast( struct GDS_Device* Device, int X, int Y
|
||||
}
|
||||
}
|
||||
|
||||
void IRAM_ATTR GDS_DrawPixel( struct GDS_Device* Device, int x, int y, int Color ) {
|
||||
if ( IsPixelVisible( Device, x, y ) == true ) {
|
||||
Device->DrawPixelFast( Device, x, y, Color );
|
||||
}
|
||||
}
|
||||
|
||||
inline void IRAM_ATTR GDS_DrawPixel4Fast( struct GDS_Device* Device, int X, int Y, int Color ) {
|
||||
uint32_t YBit = ( Y & 0x07 );
|
||||
uint8_t* FBOffset = NULL;
|
||||
@@ -110,12 +87,6 @@ inline void IRAM_ATTR GDS_DrawPixel4Fast( struct GDS_Device* Device, int X, int
|
||||
}
|
||||
}
|
||||
|
||||
void IRAM_ATTR GDS_DrawPixel4( struct GDS_Device* Device, int x, int y, int Color ) {
|
||||
if ( IsPixelVisible( Device, x, y ) == true ) {
|
||||
Device->DrawPixelFast( Device, x, y, Color );
|
||||
}
|
||||
}
|
||||
|
||||
void IRAM_ATTR GDS_DrawHLine( struct GDS_Device* Device, int x, int y, int Width, int Color ) {
|
||||
int XEnd = x + Width;
|
||||
|
||||
@@ -128,11 +99,11 @@ void IRAM_ATTR GDS_DrawHLine( struct GDS_Device* Device, int x, int y, int Width
|
||||
else if (y >= Device->Height) x = Device->Height - 1;
|
||||
|
||||
for ( ; x < XEnd; x++ ) {
|
||||
// if ( IsPixelVisible( Device, x, y ) == true ) {
|
||||
if ( IsPixelVisible( Device, x, y ) == true ) {
|
||||
Device->DrawPixelFast( Device, x, y, Color );
|
||||
// } else {
|
||||
// break;
|
||||
// }
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -143,7 +114,7 @@ void IRAM_ATTR GDS_DrawVLine( struct GDS_Device* Device, int x, int y, int Heigh
|
||||
|
||||
for ( ; y < YEnd; y++ ) {
|
||||
if ( IsPixelVisible( Device, x, y ) == true ) {
|
||||
Device->DrawPixel( Device, x, y, Color );
|
||||
GDS_DrawPixel( Device, x, y, Color );
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -89,7 +89,7 @@ void GDS_FontDrawChar( struct GDS_Device* Device, char Character, int x, int y,
|
||||
YBit = ( i + OffsetY ) & 0x07;
|
||||
|
||||
if ( GlyphData[ YByte ] & BIT( YBit ) ) {
|
||||
Device->DrawPixel( Device, x, y, Color );
|
||||
GDS_DrawPixel( Device, x, y, Color );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -44,13 +44,6 @@
|
||||
#define BIT( n ) ( 1 << n )
|
||||
#endif
|
||||
|
||||
typedef enum {
|
||||
AddressMode_Horizontal = 0,
|
||||
AddressMode_Vertical,
|
||||
AddressMode_Page,
|
||||
AddressMode_Invalid
|
||||
} GDS_AddressMode;
|
||||
|
||||
struct GDS_Device;
|
||||
struct GDS_FontDef;
|
||||
|
||||
@@ -106,7 +99,6 @@ struct GDS_Device {
|
||||
void (*DisplayOn)( struct GDS_Device* Device );
|
||||
void (*DisplayOff)( struct GDS_Device* Device );
|
||||
void (*Update)( struct GDS_Device* Device );
|
||||
void (*DrawPixel)( struct GDS_Device* Device, int X, int Y, int Color );
|
||||
void (*DrawPixelFast)( struct GDS_Device* Device, int X, int Y, int Color );
|
||||
void (*SetHFlip)( struct GDS_Device* Device, bool On );
|
||||
void (*SetVFlip)( struct GDS_Device* Device, bool On );
|
||||
@@ -118,13 +110,37 @@ struct GDS_Device {
|
||||
|
||||
bool GDS_Reset( struct GDS_Device* Device );
|
||||
|
||||
/*
|
||||
inline 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 );
|
||||
inline void IRAM_ATTR GDS_DrawPixel4Fast( struct GDS_Device* Device, int X, int Y, int Color );
|
||||
void IRAM_ATTR GDS_DrawPixel4( 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_DrawPixel4Fast( struct GDS_Device* Device, int X, int Y, int Color );
|
||||
void IRAM_ATTR GDS_DrawPixel4( struct GDS_Device* Device, int x, int y, int Color );
|
||||
|
||||
inline bool IsPixelVisible( struct GDS_Device* Device, int x, int y ) {
|
||||
bool Result = (
|
||||
( x >= 0 ) &&
|
||||
( x < Device->Width ) &&
|
||||
( y >= 0 ) &&
|
||||
( y < Device->Height )
|
||||
) ? true : false;
|
||||
|
||||
#if CONFIG_GDS_CLIPDEBUG > 0
|
||||
if ( Result == false ) {
|
||||
ClipDebug( x, y );
|
||||
}
|
||||
#endif
|
||||
|
||||
return Result;
|
||||
}
|
||||
|
||||
inline void IRAM_ATTR GDS_DrawPixel( struct GDS_Device* Device, int x, int y, int Color ) {
|
||||
if ( IsPixelVisible( Device, x, y ) == true ) {
|
||||
Device->DrawPixelFast( Device, x, y, Color );
|
||||
}
|
||||
}
|
||||
|
||||
inline void IRAM_ATTR GDS_DrawPixel4( struct GDS_Device* Device, int x, int y, int Color ) {
|
||||
if ( IsPixelVisible( Device, x, y ) == true ) {
|
||||
Device->DrawPixelFast( Device, x, y, Color );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user