Skip to content

Commit 22e5c46

Browse files
committed
format code
1 parent 2975057 commit 22e5c46

File tree

4 files changed

+46
-46
lines changed

4 files changed

+46
-46
lines changed

shared-bindings/displayio/TileGrid.c

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -389,35 +389,35 @@ MP_PROPERTY_GETSET(displayio_tilegrid_bitmap_obj,
389389
//| """Returns True if the tile at the given x, y coordinates is inverted."""
390390
//|
391391
static mp_obj_t displayio_tilegrid_obj_get_inverted(mp_obj_t self_in, mp_obj_t tile_coords) {
392-
displayio_tilegrid_t *self = MP_OBJ_TO_PTR(self_in);
392+
displayio_tilegrid_t *self = MP_OBJ_TO_PTR(self_in);
393393

394-
mp_obj_t *tile_coords_items;
395-
mp_obj_get_array_fixed_n(tile_coords, 2, &tile_coords_items);
396-
uint16_t x = 0;
397-
uint16_t y = 0;
398-
x = mp_obj_get_int(tile_coords_items[0]);
399-
y = mp_obj_get_int(tile_coords_items[1]);
394+
mp_obj_t *tile_coords_items;
395+
mp_obj_get_array_fixed_n(tile_coords, 2, &tile_coords_items);
396+
uint16_t x = 0;
397+
uint16_t y = 0;
398+
x = mp_obj_get_int(tile_coords_items[0]);
399+
y = mp_obj_get_int(tile_coords_items[1]);
400400

401-
return mp_obj_new_bool(common_hal_displayio_tilegrid_get_inverted(self, x, y));
401+
return mp_obj_new_bool(common_hal_displayio_tilegrid_get_inverted(self, x, y));
402402
}
403403
MP_DEFINE_CONST_FUN_OBJ_2(displayio_tilegrid_get_inverted_obj, displayio_tilegrid_obj_get_inverted);
404404

405405
//| def set_inverted(self, tile_coords: tuple, inverted: bool) -> None:
406406
//| """Set the tile at the given x, y coordinates to be inverted or not."""
407407
//|
408408
static mp_obj_t displayio_tilegrid_obj_set_inverted(mp_obj_t self_in, mp_obj_t tile_coords, mp_obj_t inverted_obj) {
409-
displayio_tilegrid_t *self = MP_OBJ_TO_PTR(self_in);
410-
411-
mp_obj_t *tile_coords_items;
412-
mp_obj_get_array_fixed_n(tile_coords, 2, &tile_coords_items);
413-
uint16_t x = 0;
414-
uint16_t y = 0;
415-
x = mp_obj_get_int(tile_coords_items[0]);
416-
y = mp_obj_get_int(tile_coords_items[1]);
417-
bool inverted = mp_obj_is_true(inverted_obj);
418-
419-
common_hal_displayio_tilegrid_set_inverted(self, x, y, inverted);
420-
return mp_const_none;
409+
displayio_tilegrid_t *self = MP_OBJ_TO_PTR(self_in);
410+
411+
mp_obj_t *tile_coords_items;
412+
mp_obj_get_array_fixed_n(tile_coords, 2, &tile_coords_items);
413+
uint16_t x = 0;
414+
uint16_t y = 0;
415+
x = mp_obj_get_int(tile_coords_items[0]);
416+
y = mp_obj_get_int(tile_coords_items[1]);
417+
bool inverted = mp_obj_is_true(inverted_obj);
418+
419+
common_hal_displayio_tilegrid_set_inverted(self, x, y, inverted);
420+
return mp_const_none;
421421
}
422422
MP_DEFINE_CONST_FUN_OBJ_3(displayio_tilegrid_set_inverted_obj, displayio_tilegrid_obj_set_inverted);
423423

shared-module/displayio/TileGrid.c

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -68,11 +68,11 @@ bool displayio_tilegrid_get_rendered_hidden(displayio_tilegrid_t *self) {
6868
}
6969

7070
void displayio_tilegird_clear_inverts(displayio_tilegrid_t *self) {
71-
for (uint16_t x = 0; x < self->width_in_tiles; x++) {
72-
for (uint16_t y = 0; y < self->height_in_tiles; y++) {
73-
self->inverts[y * self->width_in_tiles + x] = false;
71+
for (uint16_t x = 0; x < self->width_in_tiles; x++) {
72+
for (uint16_t y = 0; y < self->height_in_tiles; y++) {
73+
self->inverts[y * self->width_in_tiles + x] = false;
74+
}
7475
}
75-
}
7676
}
7777

7878
void common_hal_displayio_tilegrid_set_hidden(displayio_tilegrid_t *self, bool hidden) {
@@ -366,13 +366,13 @@ bool common_hal_displayio_tilegrid_contains(displayio_tilegrid_t *self, uint16_t
366366
}
367367

368368
bool common_hal_displayio_tilegrid_get_inverted(displayio_tilegrid_t *self, uint16_t x, uint16_t y) {
369-
uint16_t tile_location = y * self->width_in_tiles + x;
370-
return self->inverts[tile_location];
369+
uint16_t tile_location = y * self->width_in_tiles + x;
370+
return self->inverts[tile_location];
371371
}
372372

373373
void common_hal_displayio_tilegrid_set_inverted(displayio_tilegrid_t *self, uint16_t x, uint16_t y, bool inverted) {
374-
uint16_t tile_location = y * self->width_in_tiles + x;
375-
self->inverts[tile_location] = inverted;
374+
uint16_t tile_location = y * self->width_in_tiles + x;
375+
self->inverts[tile_location] = inverted;
376376
}
377377

378378
void common_hal_displayio_tilegrid_set_top_left(displayio_tilegrid_t *self, uint16_t x, uint16_t y) {
@@ -505,13 +505,13 @@ bool displayio_tilegrid_fill_area(displayio_tilegrid_t *self,
505505
}
506506

507507
if (mp_obj_is_type(self->pixel_shader, &displayio_palette_type) && common_hal_displayio_palette_get_len(self->pixel_shader) == 2) {
508-
if (self->inverts[tile_location]) {
509-
if (input_pixel.pixel == 0) {
510-
input_pixel.pixel = 1;
511-
}else if (input_pixel.pixel == 1) {
512-
input_pixel.pixel = 0;
508+
if (self->inverts[tile_location]) {
509+
if (input_pixel.pixel == 0) {
510+
input_pixel.pixel = 1;
511+
} else if (input_pixel.pixel == 1) {
512+
input_pixel.pixel = 0;
513+
}
513514
}
514-
}
515515
}
516516

517517
output_pixel.opaque = true;

shared-module/displayio/TileGrid.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,4 +69,4 @@ void displayio_tilegrid_finish_refresh(displayio_tilegrid_t *self);
6969

7070
bool displayio_tilegrid_get_rendered_hidden(displayio_tilegrid_t *self);
7171

72-
void displayio_tilegird_clear_inverts(displayio_tilegrid_t *self);
72+
void displayio_tilegird_clear_inverts(displayio_tilegrid_t *self);

supervisor/shared/display.c

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -95,19 +95,19 @@ void supervisor_start_terminal(uint16_t width_px, uint16_t height_px) {
9595
}
9696
}
9797
if (tilegrid_inverts) {
98-
if (tilegrid_tiles_size != total_tiles) {
99-
port_free(tilegrid_inverts);
100-
tilegrid_inverts = NULL;
101-
tilegrid_tiles_size = 0;
102-
reset_tiles = true;
103-
}
98+
if (tilegrid_tiles_size != total_tiles) {
99+
port_free(tilegrid_inverts);
100+
tilegrid_inverts = NULL;
101+
tilegrid_tiles_size = 0;
102+
reset_tiles = true;
103+
}
104104
}
105105
if (!tilegrid_inverts) {
106-
tilegrid_inverts = port_malloc(total_tiles, false);
107-
reset_tiles = true;
108-
if (!tilegrid_inverts) {
109-
return;
110-
}
106+
tilegrid_inverts = port_malloc(total_tiles, false);
107+
reset_tiles = true;
108+
if (!tilegrid_inverts) {
109+
return;
110+
}
111111
}
112112

113113
if (reset_tiles) {

0 commit comments

Comments
 (0)