diff options
| author | Scott Shawcroft <scott@tannewt.org> | 2019-05-10 10:09:56 -0700 |
|---|---|---|
| committer | Scott Shawcroft <scott@tannewt.org> | 2019-05-10 10:09:56 -0700 |
| commit | 80a752da87b070dcabd2b3c93b3beb9913653ba8 (patch) | |
| tree | ff6509722e8980caf514a8333f5f3225c8358a9b /shared-module | |
| parent | 1d0c61642b6fff2251c6b65a9fc18afd0ac255d5 (diff) | |
Merge latest adafruit/master in.
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--) { |
