summaryrefslogtreecommitdiff
path: root/supervisor/shared/display.c
diff options
context:
space:
mode:
authorScott Shawcroft <scott@tannewt.org>2019-05-16 16:45:38 -0700
committerScott Shawcroft <scott@tannewt.org>2019-05-21 17:41:06 -0700
commit3fad7de8db7f1f317ab6d00a00a82e406ec6fb33 (patch)
treed3c50c49fdbb62c69feec210531b5b02e3e6304d /supervisor/shared/display.c
parenta888fe4c8e12144141b9c0730d3d25ebea33cbc7 (diff)
Rework the pixel computation to use areas
This changes the displayio pixel computation from per-pixel to per-area. This is precursor work to updating portions of the screen (#1169). It should provide mild speedups because bounds checks are done once per area rather than once per pixel. Filling by area also allows TileGrid to maintain a row-associative fill pattern even when the display's refresh is orthogonal to it.
Diffstat (limited to 'supervisor/shared/display.c')
-rw-r--r--supervisor/shared/display.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/supervisor/shared/display.c b/supervisor/shared/display.c
index 0b3fbe178..cfb9cc1d1 100644
--- a/supervisor/shared/display.c
+++ b/supervisor/shared/display.c
@@ -70,8 +70,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;
- grid->total_width = width_in_tiles * grid->tile_width;
- grid->total_height = height_in_tiles * grid->tile_height;
+ grid->area.x2 = grid->area.x1 + width_in_tiles * grid->tile_width - 1;
+ grid->area.y2 = grid->area.y1 + height_in_tiles * grid->tile_height - 1;
grid->tiles = tiles;
supervisor_terminal.cursor_x = 0;
@@ -157,13 +157,15 @@ displayio_tilegrid_t blinka_sprite = {
.base = {.type = &displayio_tilegrid_type },
.bitmap = &blinka_bitmap,
.pixel_shader = &blinka_palette,
- .x = 0,
- .y = 0,
+ .area = {
+ .x1 = 0,
+ .y1 = 0,
+ .x2 = 16,
+ .y2 = 16
+ },
.bitmap_width_in_tiles = 1,
.width_in_tiles = 1,
.height_in_tiles = 1,
- .total_width = 16,
- .total_height = 16,
.tile_width = 16,
.tile_height = 16,
.top_left_x = 16,