diff options
| author | Radomir Dopieralski <openstack@sheep.art.pl> | 2018-03-11 12:01:48 +0100 |
|---|---|---|
| committer | Radomir Dopieralski <openstack@sheep.art.pl> | 2018-03-11 12:07:23 +0100 |
| commit | 493c1452f38f185b48d3cebf94f3670d03c6b20a (patch) | |
| tree | 10ceed30dbad347c45244013352a0bf414c12745 /shared-module/_stage | |
| parent | dde5ade524b4adfd3e264ec38de0b2bf3514ad59 (diff) | |
_stage: use 16 bit for coordinates to support larger screens
Diffstat (limited to 'shared-module/_stage')
| -rw-r--r-- | shared-module/_stage/Layer.c | 2 | ||||
| -rw-r--r-- | shared-module/_stage/Layer.h | 2 | ||||
| -rw-r--r-- | shared-module/_stage/Text.c | 2 | ||||
| -rw-r--r-- | shared-module/_stage/Text.h | 2 | ||||
| -rw-r--r-- | shared-module/_stage/__init__.c | 9 | ||||
| -rw-r--r-- | shared-module/_stage/__init__.h | 2 |
6 files changed, 8 insertions, 11 deletions
diff --git a/shared-module/_stage/Layer.c b/shared-module/_stage/Layer.c index 4c9c46d7c..d958f0d19 100644 --- a/shared-module/_stage/Layer.c +++ b/shared-module/_stage/Layer.c @@ -29,7 +29,7 @@ // Get the color of the pixel on the layer. -uint16_t get_layer_pixel(layer_obj_t *layer, int16_t x, uint16_t y) { +uint16_t get_layer_pixel(layer_obj_t *layer, uint16_t x, uint16_t y) { // Shift by the layer's position offset. x -= layer->x; diff --git a/shared-module/_stage/Layer.h b/shared-module/_stage/Layer.h index c46f71349..17d101263 100644 --- a/shared-module/_stage/Layer.h +++ b/shared-module/_stage/Layer.h @@ -43,6 +43,6 @@ typedef struct { uint8_t rotation; } layer_obj_t; -uint16_t get_layer_pixel(layer_obj_t *layer, int16_t x, uint16_t y); +uint16_t get_layer_pixel(layer_obj_t *layer, uint16_t x, uint16_t y); #endif // MICROPY_INCLUDED_SHARED_MODULE__STAGE_LAYER diff --git a/shared-module/_stage/Text.c b/shared-module/_stage/Text.c index 307f9bbfa..df5bf8008 100644 --- a/shared-module/_stage/Text.c +++ b/shared-module/_stage/Text.c @@ -29,7 +29,7 @@ // Get the color of the pixel on the text. -uint16_t get_text_pixel(text_obj_t *text, int16_t x, uint16_t y) { +uint16_t get_text_pixel(text_obj_t *text, uint16_t x, uint16_t y) { // Shift by the text's position offset. x -= text->x; diff --git a/shared-module/_stage/Text.h b/shared-module/_stage/Text.h index bc111e49c..b263fc710 100644 --- a/shared-module/_stage/Text.h +++ b/shared-module/_stage/Text.h @@ -41,6 +41,6 @@ typedef struct { uint8_t width, height; } text_obj_t; -uint16_t get_text_pixel(text_obj_t *text, int16_t x, uint16_t y); +uint16_t get_text_pixel(text_obj_t *text, uint16_t x, uint16_t y); #endif // MICROPY_INCLUDED_SHARED_MODULE__STAGE_TEXT diff --git a/shared-module/_stage/__init__.c b/shared-module/_stage/__init__.c index 1931b8940..86f5ee795 100644 --- a/shared-module/_stage/__init__.c +++ b/shared-module/_stage/__init__.c @@ -31,17 +31,14 @@ #include "shared-bindings/_stage/Text.h" -bool render_stage(uint8_t x0, uint8_t y0, uint8_t x1, uint8_t y1, +bool render_stage(uint16_t x0, uint16_t y0, uint16_t x1, uint16_t y1, mp_obj_t *layers, size_t layers_size, uint16_t *buffer, size_t buffer_size, busio_spi_obj_t *spi) { - // TODO(deshipu): Do a collision check of each layer with the - // rectangle, and only process the layers that overlap with it. - size_t index = 0; - for (uint8_t y = y0; y < y1; ++y) { - for (uint8_t x = x0; x < x1; ++x) { + for (uint16_t y = y0; y < y1; ++y) { + for (uint16_t x = x0; x < x1; ++x) { for (size_t layer = 0; layer < layers_size; ++layer) { uint16_t c = TRANSPARENT; layer_obj_t *obj = MP_OBJ_TO_PTR(layers[layer]); diff --git a/shared-module/_stage/__init__.h b/shared-module/_stage/__init__.h index 326c72559..d56a26940 100644 --- a/shared-module/_stage/__init__.h +++ b/shared-module/_stage/__init__.h @@ -34,7 +34,7 @@ #define TRANSPARENT (0x1ff8) -bool render_stage(uint8_t x0, uint8_t y0, uint8_t x1, uint8_t y1, +bool render_stage(uint16_t x0, uint16_t y0, uint16_t x1, uint16_t y1, mp_obj_t *layers, size_t layers_size, uint16_t *buffer, size_t buffer_size, busio_spi_obj_t *spi); |
