diff options
Diffstat (limited to 'shared-module/displayio/Palette.c')
| -rw-r--r-- | shared-module/displayio/Palette.c | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/shared-module/displayio/Palette.c b/shared-module/displayio/Palette.c index ba5ff665c..6dde3a80f 100644 --- a/shared-module/displayio/Palette.c +++ b/shared-module/displayio/Palette.c @@ -28,26 +28,26 @@ #include "shared-module/displayio/ColorConverter.h" -void common_hal_displayio_palette_construct(displayio_palette_t* self, uint16_t color_count) { +void common_hal_displayio_palette_construct(displayio_palette_t *self, uint16_t color_count) { self->color_count = color_count; - self->colors = (_displayio_color_t *) m_malloc(color_count * sizeof(_displayio_color_t), false); + self->colors = (_displayio_color_t *)m_malloc(color_count * sizeof(_displayio_color_t), false); } -void common_hal_displayio_palette_make_opaque(displayio_palette_t* self, uint32_t palette_index) { +void common_hal_displayio_palette_make_opaque(displayio_palette_t *self, uint32_t palette_index) { self->colors[palette_index].transparent = false; self->needs_refresh = true; } -void common_hal_displayio_palette_make_transparent(displayio_palette_t* self, uint32_t palette_index) { +void common_hal_displayio_palette_make_transparent(displayio_palette_t *self, uint32_t palette_index) { self->colors[palette_index].transparent = true; self->needs_refresh = true; } -uint32_t common_hal_displayio_palette_get_len(displayio_palette_t* self) { +uint32_t common_hal_displayio_palette_get_len(displayio_palette_t *self) { return self->color_count; } -void common_hal_displayio_palette_set_color(displayio_palette_t* self, uint32_t palette_index, uint32_t color) { +void common_hal_displayio_palette_set_color(displayio_palette_t *self, uint32_t palette_index, uint32_t color) { if (self->colors[palette_index].rgb888 == color) { return; } @@ -61,11 +61,11 @@ void common_hal_displayio_palette_set_color(displayio_palette_t* self, uint32_t self->needs_refresh = true; } -uint32_t common_hal_displayio_palette_get_color(displayio_palette_t* self, uint32_t palette_index) { +uint32_t common_hal_displayio_palette_get_color(displayio_palette_t *self, uint32_t palette_index) { return self->colors[palette_index].rgb888; } -bool displayio_palette_get_color(displayio_palette_t *self, const _displayio_colorspace_t* colorspace, uint32_t palette_index, uint32_t* color) { +bool displayio_palette_get_color(displayio_palette_t *self, const _displayio_colorspace_t *colorspace, uint32_t palette_index, uint32_t *color) { if (palette_index > self->color_count || self->colors[palette_index].transparent) { return false; // returns opaque } @@ -74,7 +74,7 @@ bool displayio_palette_get_color(displayio_palette_t *self, const _displayio_col uint8_t luma = self->colors[palette_index].luma; *color = luma >> (8 - colorspace->depth); // Chroma 0 means the color is a gray and has no hue so never color based on it. - if (self->colors[palette_index].chroma <= 16) { + if (self->colors[palette_index].chroma <= 16) { if (!colorspace->grayscale) { *color = 0; } |
