return expression instead of if statement

Co-authored-by: Scott Shawcroft <scott@tannewt.org>
This commit is contained in:
foamyguy 2022-06-03 16:21:50 -05:00 committed by GitHub
parent db318726a2
commit 87f4cd6bca
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 6 deletions

View File

@ -345,12 +345,8 @@ void common_hal_displayio_tilegrid_set_transpose_xy(displayio_tilegrid_t *self,
bool common_hal_displayio_tilegrid_contains(displayio_tilegrid_t *self, uint16_t x, uint16_t y) {
uint16_t right_edge = self->x + (self->width_in_tiles * self->tile_width);
uint16_t bottom_edge = self->y + (self->height_in_tiles * self->tile_height);
if (x >= self->x && x <= right_edge &&
y >= self->y && y <= bottom_edge) {
return true;
} else {
return false;
}
return x >= self->x && x <= right_edge &&
y >= self->y && y <= bottom_edge;
}
void common_hal_displayio_tilegrid_set_top_left(displayio_tilegrid_t *self, uint16_t x, uint16_t y) {