Added double buffering simulation to "simu"

This commit is contained in:
Raphael Coeffic
2021-05-23 11:52:19 +02:00
parent aff9b3f1e4
commit d44e1005f1
5 changed files with 123 additions and 86 deletions
+11 -2
View File
@@ -86,7 +86,7 @@ FXIMPLEMENT(OpenTxSim, FXMainWindow, OpenTxSimMap, ARRAYNUMBER(OpenTxSimMap))
OpenTxSim::OpenTxSim(FXApp* a):
FXMainWindow(a, "OpenTX Simu", nullptr, nullptr, DECOR_ALL, 20, 90, 0, 0)
{
memset(displayBuf, 0, DISPLAY_BUFFER_SIZE * sizeof(pixel_t));
lcdInit();
bmp = new FXPPMImage(getApp(), nullptr, IMAGE_OWNED|IMAGE_KEEP|IMAGE_SHMI|IMAGE_SHMP, W2, H2);
#if defined(SIMU_AUDIO)
@@ -500,8 +500,17 @@ void OpenTxSim::setPixel(int x, int y, FXColor color)
void OpenTxSim::refreshDisplay()
{
if (simuLcdRefresh) {
static bool lightEnabled = (bool)isBacklightEnabled();
if ((bool(isBacklightEnabled()) != lightEnabled) || simuLcdRefresh) {
simuLcdRefresh = false;
if (bool(isBacklightEnabled()) != lightEnabled) {
lightEnabled = (bool)isBacklightEnabled();
TRACE("backlight %s", lightEnabled ? "ON" : "OFF");
}
FXColor offColor = isBacklightEnabled() ? BL_COLOR : FXRGB(200, 200, 200);
#if LCD_DEPTH == 1
FXColor onColor = FXRGB(0, 0, 0);