diff options
| author | microDev <70126934+microDev1@users.noreply.github.com> | 2021-03-15 19:27:36 +0530 |
|---|---|---|
| committer | microDev <70126934+microDev1@users.noreply.github.com> | 2021-03-15 19:27:36 +0530 |
| commit | a52eb88031620a81521b937f2a0651dbac2bb350 (patch) | |
| tree | 017cbf8f686b252241182ef61ce48e8457aa1577 /shared-module/displayio/Bitmap.c | |
| parent | 090b6ba42fcdfbb16844f77892087f91aa6ea201 (diff) | |
run code formatting script
Diffstat (limited to 'shared-module/displayio/Bitmap.c')
| -rw-r--r-- | shared-module/displayio/Bitmap.c | 54 |
1 files changed, 27 insertions, 27 deletions
diff --git a/shared-module/displayio/Bitmap.c b/shared-module/displayio/Bitmap.c index 1831ac697..f03ade84b 100644 --- a/shared-module/displayio/Bitmap.c +++ b/shared-module/displayio/Bitmap.c @@ -57,7 +57,7 @@ void common_hal_displayio_bitmap_construct(displayio_bitmap_t *self, uint32_t wi self->x_shift = 0; // Used to divide the index by the number of pixels per word. Its used in a // shift which effectively divides by 2 ** x_shift. uint32_t power_of_two = 1; - while (power_of_two < align_bits / bits_per_value ) { + while (power_of_two < align_bits / bits_per_value) { self->x_shift++; power_of_two <<= 1; } @@ -93,13 +93,13 @@ uint32_t common_hal_displayio_bitmap_get_pixel(displayio_bitmap_t *self, int16_t return (word >> (sizeof(size_t) * 8 - ((x & self->x_mask) + 1) * self->bits_per_value)) & self->bitmask; } else { - size_t* row = self->data + row_start; + size_t *row = self->data + row_start; if (bytes_per_value == 1) { - return ((uint8_t*) row)[x]; + return ((uint8_t *)row)[x]; } else if (bytes_per_value == 2) { - return ((uint16_t*) row)[x]; + return ((uint16_t *)row)[x]; } else if (bytes_per_value == 4) { - return ((uint32_t*) row)[x]; + return ((uint32_t *)row)[x]; } } return 0; @@ -157,19 +157,19 @@ void displayio_bitmap_write_pixel(displayio_bitmap_t *self, int16_t x, int16_t y word |= (value & self->bitmask) << bit_position; self->data[index] = word; } else { - size_t* row = self->data + row_start; + size_t *row = self->data + row_start; if (bytes_per_value == 1) { - ((uint8_t*) row)[x] = value; + ((uint8_t *)row)[x] = value; } else if (bytes_per_value == 2) { - ((uint16_t*) row)[x] = value; + ((uint16_t *)row)[x] = value; } else if (bytes_per_value == 4) { - ((uint32_t*) row)[x] = value; + ((uint32_t *)row)[x] = value; } } } void common_hal_displayio_bitmap_blit(displayio_bitmap_t *self, int16_t x, int16_t y, displayio_bitmap_t *source, - int16_t x1, int16_t y1, int16_t x2, int16_t y2, uint32_t skip_index, bool skip_index_none) { + int16_t x1, int16_t y1, int16_t x2, int16_t y2, uint32_t skip_index, bool skip_index_none) { // Copy region of "source" bitmap into "self" bitmap at location x,y in the "self" // If skip_value is encountered in the source bitmap, it will not be copied. // If skip_value is `None`, then all pixels are copied. @@ -180,11 +180,11 @@ void common_hal_displayio_bitmap_blit(displayio_bitmap_t *self, int16_t x, int16 } // Update the dirty area - int16_t dirty_x_max = (x + (x2-x1)); + int16_t dirty_x_max = (x + (x2 - x1)); if (dirty_x_max > self->width) { dirty_x_max = self->width; } - int16_t dirty_y_max = y + (y2-y1); + int16_t dirty_y_max = y + (y2 - y1); if (dirty_y_max > self->height) { dirty_y_max = self->height; } @@ -203,21 +203,21 @@ void common_hal_displayio_bitmap_blit(displayio_bitmap_t *self, int16_t x, int16 } // simplest version - use internal functions for get/set pixels - for (int16_t i=0; i < (x2-x1); i++) { + for (int16_t i = 0; i < (x2 - x1); i++) { - const int xs_index = x_reverse ? ( (x2) - i - 1) : x1+i; // x-index into the source bitmap - const int xd_index = x_reverse ? ((x + (x2-x1)) - i - 1) : x+i; // x-index into the destination bitmap + const int xs_index = x_reverse ? ((x2) - i - 1) : x1 + i; // x-index into the source bitmap + const int xd_index = x_reverse ? ((x + (x2 - x1)) - i - 1) : x + i; // x-index into the destination bitmap - if ( (xd_index >= 0) && (xd_index < self->width) ) { - for (int16_t j=0; j < (y2-y1) ; j++){ + if ((xd_index >= 0) && (xd_index < self->width)) { + for (int16_t j = 0; j < (y2 - y1); j++) { - const int ys_index = y_reverse ? ( (y2 ) - j - 1) : y1+j ; // y-index into the source bitmap - const int yd_index = y_reverse ? ((y + (y2-y1)) - j - 1) : y+j ; // y-index into the destination bitmap + const int ys_index = y_reverse ? ((y2) - j - 1) : y1 + j; // y-index into the source bitmap + const int yd_index = y_reverse ? ((y + (y2 - y1)) - j - 1) : y + j; // y-index into the destination bitmap - if ((yd_index >= 0) && (yd_index < self->height) ) { + if ((yd_index >= 0) && (yd_index < self->height)) { uint32_t value = common_hal_displayio_bitmap_get_pixel(source, xs_index, ys_index); - if ( (skip_index_none) || (value != skip_index) ) { // write if skip_value_none is True - displayio_bitmap_write_pixel(self, xd_index, yd_index, value); + if ((skip_index_none) || (value != skip_index)) { // write if skip_value_none is True + displayio_bitmap_write_pixel(self, xd_index, yd_index, value); } } } @@ -231,14 +231,14 @@ void common_hal_displayio_bitmap_set_pixel(displayio_bitmap_t *self, int16_t x, } // update the dirty region - displayio_bitmap_set_dirty_area(self, x, y, x+1, y+1); + displayio_bitmap_set_dirty_area(self, x, y, x + 1, y + 1); // write the pixel displayio_bitmap_write_pixel(self, x, y, value); } -displayio_area_t* displayio_bitmap_get_refresh_areas(displayio_bitmap_t *self, displayio_area_t* tail) { +displayio_area_t *displayio_bitmap_get_refresh_areas(displayio_bitmap_t *self, displayio_area_t *tail) { if (self->dirty_area.x1 == self->dirty_area.x2) { return tail; } @@ -263,11 +263,11 @@ void common_hal_displayio_bitmap_fill(displayio_bitmap_t *self, uint32_t value) // build the packed word uint32_t word = 0; - for (uint8_t i=0; i<32 / self->bits_per_value; i++) { - word |= (value & self->bitmask) << (32 - ((i+1)*self->bits_per_value)); + for (uint8_t i = 0; i < 32 / self->bits_per_value; i++) { + word |= (value & self->bitmask) << (32 - ((i + 1) * self->bits_per_value)); } // copy it in - for (uint32_t i=0; i<self->stride * self->height; i++) { + for (uint32_t i = 0; i < self->stride * self->height; i++) { self->data[i] = word; } } |
