fix(nv14): fix QT simulator display
This commit is contained in:
@@ -132,7 +132,8 @@ void SimulatedUIWidget::onLcdChange(bool backlightEnable)
|
|||||||
if (!m_lcd || !m_lcd->isVisible())
|
if (!m_lcd || !m_lcd->isVisible())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
m_lcd->onLcdChanged(backlightEnable);
|
uint8_t* lcdBuf = m_simulator->getLcd();
|
||||||
|
m_lcd->onLcdChanged(lcdBuf, backlightEnable);
|
||||||
m_simulator->lcdFlushed();
|
m_simulator->lcdFlushed();
|
||||||
|
|
||||||
setLightOn(backlightEnable);
|
setLightOn(backlightEnable);
|
||||||
@@ -189,7 +190,11 @@ void SimulatedUIWidget::setLcd(LcdWidget * lcd)
|
|||||||
{
|
{
|
||||||
m_lcd = lcd;
|
m_lcd = lcd;
|
||||||
Firmware * firmware = getCurrentFirmware();
|
Firmware * firmware = getCurrentFirmware();
|
||||||
m_lcd->setData(m_simulator->getLcd(), firmware->getCapability(LcdWidth), firmware->getCapability(LcdHeight), firmware->getCapability(LcdDepth));
|
|
||||||
|
auto width = firmware->getCapability(LcdWidth);
|
||||||
|
auto height = firmware->getCapability(LcdHeight);
|
||||||
|
auto depth = firmware->getCapability(LcdDepth);
|
||||||
|
m_lcd->setData(width, height, depth);
|
||||||
|
|
||||||
if (!m_backlightColors.size())
|
if (!m_backlightColors.size())
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -21,9 +21,8 @@
|
|||||||
|
|
||||||
#include "lcdwidget.h"
|
#include "lcdwidget.h"
|
||||||
|
|
||||||
void LcdWidget::setData(unsigned char *buf, int width, int height, int depth)
|
void LcdWidget::setData(int width, int height, int depth)
|
||||||
{
|
{
|
||||||
lcdBuf = buf;
|
|
||||||
lcdWidth = width;
|
lcdWidth = width;
|
||||||
lcdHeight = height;
|
lcdHeight = height;
|
||||||
lcdDepth = depth;
|
lcdDepth = depth;
|
||||||
@@ -65,11 +64,11 @@ void LcdWidget::makeScreenshot(const QString &fileName)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void LcdWidget::onLcdChanged(bool light)
|
void LcdWidget::onLcdChanged(uint8_t* lcdBuf, bool light)
|
||||||
{
|
{
|
||||||
QMutexLocker locker(&lcdMtx);
|
QMutexLocker locker(&lcdMtx);
|
||||||
lightEnable = light;
|
lightEnable = light;
|
||||||
memcpy(localBuf, lcdBuf, lcdSize);
|
if (lcdBuf) memcpy(localBuf, lcdBuf, lcdSize);
|
||||||
if (!redrawTimer.isValid() ||
|
if (!redrawTimer.isValid() ||
|
||||||
redrawTimer.hasExpired(LCD_WIDGET_REFRESH_PERIOD)) {
|
redrawTimer.hasExpired(LCD_WIDGET_REFRESH_PERIOD)) {
|
||||||
update();
|
update();
|
||||||
|
|||||||
@@ -44,7 +44,6 @@ class LcdWidget : public QWidget
|
|||||||
|
|
||||||
LcdWidget(QWidget *parent = 0) :
|
LcdWidget(QWidget *parent = 0) :
|
||||||
QWidget(parent),
|
QWidget(parent),
|
||||||
lcdBuf(NULL),
|
|
||||||
localBuf(NULL),
|
localBuf(NULL),
|
||||||
lightEnable(false),
|
lightEnable(false),
|
||||||
bgDefaultColor(QColor(198, 208, 199))
|
bgDefaultColor(QColor(198, 208, 199))
|
||||||
@@ -58,13 +57,13 @@ class LcdWidget : public QWidget
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void setData(unsigned char *buf, int width, int height, int depth = 1);
|
void setData(int width, int height, int depth = 1);
|
||||||
void setBgDefaultColor(const QColor &color);
|
void setBgDefaultColor(const QColor &color);
|
||||||
void setBackgroundColor(const QColor &color);
|
void setBackgroundColor(const QColor &color);
|
||||||
|
|
||||||
void makeScreenshot(const QString &fileName);
|
void makeScreenshot(const QString &fileName);
|
||||||
|
|
||||||
void onLcdChanged(bool light);
|
void onLcdChanged(uint8_t* lcdBuf, bool light);
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void touchEvent(int type, int x, int y);
|
void touchEvent(int type, int x, int y);
|
||||||
@@ -75,7 +74,6 @@ class LcdWidget : public QWidget
|
|||||||
int lcdDepth;
|
int lcdDepth;
|
||||||
int lcdSize;
|
int lcdSize;
|
||||||
|
|
||||||
unsigned char *lcdBuf;
|
|
||||||
unsigned char *localBuf;
|
unsigned char *localBuf;
|
||||||
|
|
||||||
bool lightEnable;
|
bool lightEnable;
|
||||||
|
|||||||
Reference in New Issue
Block a user