diff options
| author | Scott Shawcroft <scott@adafruit.com> | 2020-09-02 15:32:30 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-09-02 15:32:30 -0700 |
| commit | 786f4ed11477cb62d830ef6f29c349e3bd1d3b39 (patch) | |
| tree | 7dc67a08fad0611565cff15c013c7e57a16d0039 /supervisor/shared | |
| parent | f27b89632de427ffa268d3a9dee4e6e9b5da407b (diff) | |
| parent | 17a5a85528525352ec1821127fafec2acb239196 (diff) | |
Merge pull request #3344 from jepler/issue-3184
Fix RGBMatrix, FrameBufferDisplay bugs
Diffstat (limited to 'supervisor/shared')
| -rw-r--r-- | supervisor/shared/display.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/supervisor/shared/display.c b/supervisor/shared/display.c index 634720d0a..afb3f3a9a 100644 --- a/supervisor/shared/display.c +++ b/supervisor/shared/display.c @@ -65,10 +65,14 @@ void supervisor_start_terminal(uint16_t width_px, uint16_t height_px) { if (width_in_tiles < 80) { scale = 1; } + width_in_tiles = (width_px - blinka_bitmap.width * scale) / (grid->tile_width * scale); + if (width_in_tiles < 1) { + width_in_tiles = 1; + } uint16_t height_in_tiles = height_px / (grid->tile_height * scale); uint16_t remaining_pixels = height_px % (grid->tile_height * scale); - if (remaining_pixels > 0) { + if (height_in_tiles < 1 || remaining_pixels > 0) { height_in_tiles += 1; } @@ -94,6 +98,8 @@ void supervisor_start_terminal(uint16_t width_px, uint16_t height_px) { } grid->width_in_tiles = width_in_tiles; grid->height_in_tiles = height_in_tiles; + assert(width_in_tiles > 0); + assert(height_in_tiles > 0); grid->pixel_width = width_in_tiles * grid->tile_width; grid->pixel_height = height_in_tiles * grid->tile_height; grid->tiles = tiles; |
