mirror of
https://github.com/trezor/trezor-firmware.git
synced 2024-12-16 19:38:09 +00:00
modtrezorui/unix: make sure display is initialized
This commit is contained in:
parent
c254758c83
commit
99d3ae5e8b
@ -19,6 +19,9 @@ static int DATAODD = 0;
|
|||||||
static int POSX, POSY, SX, SY, EX, EY = 0;
|
static int POSX, POSY, SX, SY, EX, EY = 0;
|
||||||
|
|
||||||
void DATA(uint8_t x) {
|
void DATA(uint8_t x) {
|
||||||
|
if (!RENDERER) {
|
||||||
|
display_init();
|
||||||
|
}
|
||||||
if (POSX <= EX && POSY <= EY) {
|
if (POSX <= EX && POSY <= EY) {
|
||||||
((uint8_t *)BUFFER->pixels)[POSX * 2 + POSY * BUFFER->pitch + (DATAODD ^ 1)] = x;
|
((uint8_t *)BUFFER->pixels)[POSX * 2 + POSY * BUFFER->pitch + (DATAODD ^ 1)] = x;
|
||||||
}
|
}
|
||||||
@ -65,6 +68,9 @@ int display_init(void)
|
|||||||
static void display_set_window_raw(uint16_t x0, uint16_t y0, uint16_t x1, uint16_t y1)
|
static void display_set_window_raw(uint16_t x0, uint16_t y0, uint16_t x1, uint16_t y1)
|
||||||
{
|
{
|
||||||
#ifndef TREZOR_NOUI
|
#ifndef TREZOR_NOUI
|
||||||
|
if (!RENDERER) {
|
||||||
|
display_init();
|
||||||
|
}
|
||||||
SX = x0; SY = y0;
|
SX = x0; SY = y0;
|
||||||
EX = x1; EY = y1;
|
EX = x1; EY = y1;
|
||||||
POSX = SX; POSY = SY;
|
POSX = SX; POSY = SY;
|
||||||
@ -80,6 +86,9 @@ static void display_set_window(uint16_t x0, uint16_t y0, uint16_t x1, uint16_t y
|
|||||||
void display_refresh(void)
|
void display_refresh(void)
|
||||||
{
|
{
|
||||||
#ifndef TREZOR_NOUI
|
#ifndef TREZOR_NOUI
|
||||||
|
if (!RENDERER) {
|
||||||
|
display_init();
|
||||||
|
}
|
||||||
SDL_RenderClear(RENDERER);
|
SDL_RenderClear(RENDERER);
|
||||||
SDL_UpdateTexture(TEXTURE, NULL, BUFFER->pixels, BUFFER->pitch);
|
SDL_UpdateTexture(TEXTURE, NULL, BUFFER->pixels, BUFFER->pitch);
|
||||||
const SDL_Rect r = {DISPLAY_BORDER, DISPLAY_BORDER, DISPLAY_RESX, DISPLAY_RESY};
|
const SDL_Rect r = {DISPLAY_BORDER, DISPLAY_BORDER, DISPLAY_RESX, DISPLAY_RESY};
|
||||||
@ -95,6 +104,9 @@ static void display_set_orientation(int degrees)
|
|||||||
static void display_set_backlight(int val)
|
static void display_set_backlight(int val)
|
||||||
{
|
{
|
||||||
#ifndef TREZOR_NOUI
|
#ifndef TREZOR_NOUI
|
||||||
|
if (!RENDERER) {
|
||||||
|
display_init();
|
||||||
|
}
|
||||||
SDL_SetRenderDrawColor(RENDERER, val, val, val, 255);
|
SDL_SetRenderDrawColor(RENDERER, val, val, val, 255);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@ -102,6 +114,9 @@ static void display_set_backlight(int val)
|
|||||||
void display_save(const char *filename)
|
void display_save(const char *filename)
|
||||||
{
|
{
|
||||||
#ifndef TREZOR_NOUI
|
#ifndef TREZOR_NOUI
|
||||||
|
if (!RENDERER) {
|
||||||
|
display_init();
|
||||||
|
}
|
||||||
IMG_SavePNG(BUFFER, filename);
|
IMG_SavePNG(BUFFER, filename);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user