Add config for swapping bytes when using pushImage
This commit is contained in:
@ -4,4 +4,8 @@ config ESPGUI_MENUDISPLAY_ROWS
|
|||||||
int "Number of rows for MenuDisplays"
|
int "Number of rows for MenuDisplays"
|
||||||
default 10
|
default 10
|
||||||
|
|
||||||
|
config ESPGUI_ICONS_SWAPBYTES
|
||||||
|
bool "Swap bytes in icons"
|
||||||
|
default n
|
||||||
|
|
||||||
endmenu
|
endmenu
|
||||||
|
@ -161,7 +161,16 @@ void MenuDisplay::redraw(TftInterface &tft)
|
|||||||
labelsIter->start(tft);
|
labelsIter->start(tft);
|
||||||
|
|
||||||
if (auto icon = item.selectedIcon())
|
if (auto icon = item.selectedIcon())
|
||||||
tft.pushImage(tft.width() - 6 - icon->WIDTH, labelsIter->y() + 1, icon->WIDTH, icon->HEIGHT, icon->buffer);
|
{
|
||||||
|
#ifdef CONFIG_ESPGUI_ICONS_SWAPBYTES
|
||||||
|
tft.setSwapBytes(true);
|
||||||
|
#endif
|
||||||
|
tft.pushImage(tft.width() - 6 - icon->WIDTH, labelsIter->y() + 1, icon->WIDTH, icon->HEIGHT,
|
||||||
|
icon->buffer);
|
||||||
|
#ifdef CONFIG_ESPGUI_ICONS_SWAPBYTES
|
||||||
|
tft.setSwapBytes(false);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (relativeIndex == m_highlightedIndex)
|
else if (relativeIndex == m_highlightedIndex)
|
||||||
@ -177,7 +186,15 @@ void MenuDisplay::redraw(TftInterface &tft)
|
|||||||
{
|
{
|
||||||
auto icon = item.icon();
|
auto icon = item.icon();
|
||||||
if (icon)
|
if (icon)
|
||||||
|
{
|
||||||
|
#ifdef CONFIG_ESPGUI_ICONS_SWAPBYTES
|
||||||
|
tft.setSwapBytes(true);
|
||||||
|
#endif
|
||||||
tft.pushImage(6, labelsIter->y() + 1, icon->WIDTH, icon->HEIGHT, icon->buffer);
|
tft.pushImage(6, labelsIter->y() + 1, icon->WIDTH, icon->HEIGHT, icon->buffer);
|
||||||
|
#ifdef CONFIG_ESPGUI_ICONS_SWAPBYTES
|
||||||
|
tft.setSwapBytes(false);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
else if (*iconsIter)
|
else if (*iconsIter)
|
||||||
tft.fillRect(6, labelsIter->y() + 1, 24, 24, selected ? TFT_GREY : TFT_BLACK);
|
tft.fillRect(6, labelsIter->y() + 1, 24, 24, selected ? TFT_GREY : TFT_BLACK);
|
||||||
*iconsIter = icon;
|
*iconsIter = icon;
|
||||||
|
Reference in New Issue
Block a user