Merge pull request #6088 from dhalbert/merge-7.2.x-to-main

Merge 7.2.x to main
This commit is contained in:
Scott Shawcroft 2022-02-25 09:46:23 -08:00 committed by GitHub
commit c68b7a20fb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 33 additions and 20 deletions

View File

@ -43,7 +43,7 @@ setup(
"root": "..", "root": "..",
"relative_to": __file__, "relative_to": __file__,
"local_scheme": local_scheme, "local_scheme": local_scheme,
"git_describe_command": "tools/describe", "git_describe_command": "tools/describe --long",
}, },
zip_safe=False, zip_safe=False,
) )

View File

@ -169,8 +169,9 @@ bool displayio_display_core_show(displayio_display_core_t *self, displayio_group
// force the circuit_python_splash out of any group (Note: could cause problems with the parent group) // force the circuit_python_splash out of any group (Note: could cause problems with the parent group)
circuitpython_splash.x = 0; // reset position in case someone moved it. circuitpython_splash.x = 0; // reset position in case someone moved it.
circuitpython_splash.y = 0; circuitpython_splash.y = 0;
supervisor_stop_terminal();
supervisor_start_terminal(self->width, self->height); supervisor_start_terminal(self->width, self->height);
root_group = &circuitpython_splash; root_group = &circuitpython_splash;
} }
if (root_group == self->current_group) { if (root_group == self->current_group) {

View File

@ -36,7 +36,6 @@ void common_hal_terminalio_terminal_construct(terminalio_terminal_obj_t *self, d
self->font = font; self->font = font;
self->tilegrid = tilegrid; self->tilegrid = tilegrid;
self->first_row = 0; self->first_row = 0;
for (uint16_t x = 0; x < self->tilegrid->width_in_tiles; x++) { for (uint16_t x = 0; x < self->tilegrid->width_in_tiles; x++) {
for (uint16_t y = 0; y < self->tilegrid->height_in_tiles; y++) { for (uint16_t y = 0; y < self->tilegrid->height_in_tiles; y++) {
common_hal_displayio_tilegrid_set_tile(self->tilegrid, x, y, 0); common_hal_displayio_tilegrid_set_tile(self->tilegrid, x, y, 0);

View File

@ -61,6 +61,7 @@ void supervisor_start_terminal(uint16_t width_px, uint16_t height_px) {
#if CIRCUITPY_TERMINALIO #if CIRCUITPY_TERMINALIO
displayio_tilegrid_t *grid = &supervisor_terminal_text_grid; displayio_tilegrid_t *grid = &supervisor_terminal_text_grid;
bool tall = height_px > width_px; bool tall = height_px > width_px;
bool reset_tiles = false;
uint16_t terminal_width_px = tall ? width_px : width_px - blinka_bitmap.width; uint16_t terminal_width_px = tall ? width_px : width_px - blinka_bitmap.width;
uint16_t terminal_height_px = tall ? height_px - blinka_bitmap.height : height_px; uint16_t terminal_height_px = tall ? height_px - blinka_bitmap.height : height_px;
uint16_t width_in_tiles = terminal_width_px / grid->tile_width; uint16_t width_in_tiles = terminal_width_px / grid->tile_width;
@ -81,37 +82,48 @@ void supervisor_start_terminal(uint16_t width_px, uint16_t height_px) {
uint16_t total_tiles = width_in_tiles * height_in_tiles; uint16_t total_tiles = width_in_tiles * height_in_tiles;
// check if the terminal tile dimensions are the same
if ((grid->width_in_tiles != width_in_tiles) ||
(grid->height_in_tiles != height_in_tiles)) {
reset_tiles = true;
}
// Reuse the previous allocation if possible // Reuse the previous allocation if possible
if (tilegrid_tiles) { if (tilegrid_tiles) {
if (get_allocation_length(tilegrid_tiles) != align32_size(total_tiles)) { if (get_allocation_length(tilegrid_tiles) != align32_size(total_tiles)) {
free_memory(tilegrid_tiles); free_memory(tilegrid_tiles);
tilegrid_tiles = NULL; tilegrid_tiles = NULL;
reset_tiles = true;
} }
} }
if (!tilegrid_tiles) { if (!tilegrid_tiles) {
tilegrid_tiles = allocate_memory(align32_size(total_tiles), false, true); tilegrid_tiles = allocate_memory(align32_size(total_tiles), false, true);
reset_tiles = true;
if (!tilegrid_tiles) { if (!tilegrid_tiles) {
return; return;
} }
} }
uint8_t *tiles = (uint8_t *)tilegrid_tiles->ptr;
grid->y = tall ? blinka_bitmap.height : 0; if (reset_tiles) {
grid->x = tall ? 0 : blinka_bitmap.width; uint8_t *tiles = (uint8_t *)tilegrid_tiles->ptr;
grid->top_left_y = 0;
if (remaining_pixels > 0) { grid->y = tall ? blinka_bitmap.height : 0;
grid->y -= (grid->tile_height - remaining_pixels); grid->x = tall ? 0 : blinka_bitmap.width;
grid->top_left_y = 0;
if (remaining_pixels > 0) {
grid->y -= (grid->tile_height - remaining_pixels);
}
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;
grid->full_change = true;
common_hal_terminalio_terminal_construct(&supervisor_terminal, grid, &supervisor_terminal_font);
} }
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;
grid->full_change = true;
common_hal_terminalio_terminal_construct(&supervisor_terminal, grid, &supervisor_terminal_font);
#endif #endif
circuitpython_splash.scale = scale; circuitpython_splash.scale = scale;

View File

@ -1,2 +1,3 @@
#!/bin/sh #!/bin/sh
git describe --first-parent --dirty --tags --always --match "[1-9].*" # Add any supplied arguments.
git describe --first-parent --dirty --tags --always --match "[1-9].*" "$@"