From 9027547fa675030c1ac83ed0cab7660d1dce8624 Mon Sep 17 00:00:00 2001 From: Serge Vakulenko Date: Fri, 20 Nov 2015 21:54:34 -0800 Subject: [PATCH] Mend a font direction in ST7781 portrait unside down mode. --- sys/pic32/gpanel-st7781.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/sys/pic32/gpanel-st7781.c b/sys/pic32/gpanel-st7781.c index 33c1d76..2eb80c8 100644 --- a/sys/pic32/gpanel-st7781.c +++ b/sys/pic32/gpanel-st7781.c @@ -126,7 +126,7 @@ static void set_window(int x0, int y0, int x1, int y1) swapi(x0, x1); break; case PORTRAIT_UPSIDE_DOWN: - write_reg(ST7781_Entry_Mode, 0x1010); + write_reg(ST7781_Entry_Mode, 0x1000); x0 = 240 - x0 - 1; x1 = 240 - x1 - 1; swapi(x0, x1); @@ -326,6 +326,9 @@ static void st7781_draw_glyph(const struct gpanel_font_t *font, int h, w, c; unsigned bitmask = 0; + if (x + width > gpanel_width || y + font->height > gpanel_height) + return; + if (background >= 0) { /* * Clear background.