diff options
| author | Scott Shawcroft <scott@tannewt.org> | 2019-05-09 11:38:30 -0700 |
|---|---|---|
| committer | Scott Shawcroft <scott@tannewt.org> | 2019-05-09 11:38:30 -0700 |
| commit | e64bbc41ec0c66f6c6125401ed7a14e1bf303935 (patch) | |
| tree | 0c5333670c62b209ded2e985769299b296dadf1e /shared-module | |
| parent | 9ce042ad07cabbba27f4db90f9c95d0b057b9f51 (diff) | |
Handle -scale to 0 correctly in Group
Fixes #1839
Diffstat (limited to 'shared-module')
| -rw-r--r-- | shared-module/displayio/Group.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/shared-module/displayio/Group.c b/shared-module/displayio/Group.c index 12f80cac4..097edf33b 100644 --- a/shared-module/displayio/Group.c +++ b/shared-module/displayio/Group.c @@ -128,6 +128,14 @@ void displayio_group_construct(displayio_group_t* self, displayio_group_child_t* bool displayio_group_get_pixel(displayio_group_t *self, int16_t x, int16_t y, uint16_t* pixel) { x -= self->x; y -= self->y; + // When we are scaled we need to substract all but one to ensure -scale to 0 divide down to -1. + // Normally -scale to scale both divide down to 0 because 0 is unsigned. + if (x < 0) { + x -= self->scale - 1; + } + if (y < 0) { + y -= self->scale - 1; + } x /= self->scale; y /= self->scale; for (int32_t i = self->size - 1; i >= 0 ; i--) { |
