diff options
Diffstat (limited to 'quantum/painter/qp_draw_text.c')
-rw-r--r-- | quantum/painter/qp_draw_text.c | 56 |
1 files changed, 28 insertions, 28 deletions
diff --git a/quantum/painter/qp_draw_text.c b/quantum/painter/qp_draw_text.c index 20edeaf379..a70caac6f4 100644 --- a/quantum/painter/qp_draw_text.c +++ b/quantum/painter/qp_draw_text.c @@ -164,7 +164,7 @@ typedef bool (*code_point_handler)(qff_font_handle_t *qff_font, uint32_t code_po // Helper that sets up the palette (if required) and returns the offset in the stream that the data starts static inline bool qp_drawtext_prepare_font_for_render(painter_device_t device, qff_font_handle_t *qff_font, qp_pixel_t fg_hsv888, qp_pixel_t bg_hsv888, uint32_t *data_offset) { - struct painter_driver_t *driver = (struct painter_driver_t *)device; + painter_driver_t *driver = (painter_driver_t *)device; // Drop out if we can't actually place the data we read out anywhere if (!data_offset) { @@ -319,13 +319,13 @@ static inline bool qp_iterate_code_points(qff_font_handle_t *qff_font, const cha // String width calculation // Callback state -struct code_point_iter_calcwidth_state { +typedef struct code_point_iter_calcwidth_state_t { int16_t width; -}; +} code_point_iter_calcwidth_state_t; // Codepoint handler callback: width calc static inline bool qp_font_code_point_handler_calcwidth(qff_font_handle_t *qff_font, uint32_t code_point, uint8_t width, uint8_t height, void *cb_arg) { - struct code_point_iter_calcwidth_state *state = (struct code_point_iter_calcwidth_state *)cb_arg; + code_point_iter_calcwidth_state_t *state = (code_point_iter_calcwidth_state_t *)cb_arg; // Increment the overall width by this glyph's width state->width += width; @@ -337,19 +337,19 @@ static inline bool qp_font_code_point_handler_calcwidth(qff_font_handle_t *qff_f // String drawing implementation // Callback state -struct code_point_iter_drawglyph_state { - painter_device_t device; - int16_t xpos; - int16_t ypos; - qp_internal_byte_input_callback input_callback; - struct qp_internal_byte_input_state * input_state; - struct qp_internal_pixel_output_state *output_state; -}; +typedef struct code_point_iter_drawglyph_state_t { + painter_device_t device; + int16_t xpos; + int16_t ypos; + qp_internal_byte_input_callback input_callback; + qp_internal_byte_input_state_t * input_state; + qp_internal_pixel_output_state_t *output_state; +} code_point_iter_drawglyph_state_t; // Codepoint handler callback: drawing static inline bool qp_font_code_point_handler_drawglyph(qff_font_handle_t *qff_font, uint32_t code_point, uint8_t width, uint8_t height, void *cb_arg) { - struct code_point_iter_drawglyph_state *state = (struct code_point_iter_drawglyph_state *)cb_arg; - struct painter_driver_t * driver = (struct painter_driver_t *)state->device; + code_point_iter_drawglyph_state_t *state = (code_point_iter_drawglyph_state_t *)cb_arg; + painter_driver_t * driver = (painter_driver_t *)state->device; // Reset the input state's RLE mode -- the stream should already be correctly positioned by qp_iterate_code_points() state->input_state->rle.mode = MARKER_BYTE; // ignored if not using RLE @@ -386,7 +386,7 @@ int16_t qp_textwidth(painter_font_handle_t font, const char *str) { } // Create the codepoint iterator state - struct code_point_iter_calcwidth_state state = {.width = 0}; + code_point_iter_calcwidth_state_t state = {.width = 0}; // Iterate each codepoint, return the calculated width if successful. return qp_iterate_code_points(qff_font, str, qp_font_code_point_handler_calcwidth, &state) ? state.width : 0; } @@ -405,7 +405,7 @@ int16_t qp_drawtext(painter_device_t device, uint16_t x, uint16_t y, painter_fon int16_t qp_drawtext_recolor(painter_device_t device, uint16_t x, uint16_t y, painter_font_handle_t font, const char *str, uint8_t hue_fg, uint8_t sat_fg, uint8_t val_fg, uint8_t hue_bg, uint8_t sat_bg, uint8_t val_bg) { qp_dprintf("qp_drawtext_recolor: entry\n"); - struct painter_driver_t *driver = (struct painter_driver_t *)device; + painter_driver_t *driver = (painter_driver_t *)device; if (!driver->validate_ok) { qp_dprintf("qp_drawtext_recolor: fail (validation_ok == false)\n"); return 0; @@ -423,8 +423,8 @@ int16_t qp_drawtext_recolor(painter_device_t device, uint16_t x, uint16_t y, pai } // Set up the byte input state and input callback - struct qp_internal_byte_input_state input_state = {.device = device, .src_stream = &qff_font->stream}; - qp_internal_byte_input_callback input_callback = qp_internal_prepare_input_state(&input_state, qff_font->compression_scheme); + qp_internal_byte_input_state_t input_state = {.device = device, .src_stream = &qff_font->stream}; + qp_internal_byte_input_callback input_callback = qp_internal_prepare_input_state(&input_state, qff_font->compression_scheme); if (input_callback == NULL) { qp_dprintf("qp_drawtext_recolor: fail (invalid font compression scheme)\n"); qp_comms_stop(device); @@ -432,18 +432,18 @@ int16_t qp_drawtext_recolor(painter_device_t device, uint16_t x, uint16_t y, pai } // Set up the pixel output state - struct qp_internal_pixel_output_state output_state = {.device = device, .pixel_write_pos = 0, .max_pixels = qp_internal_num_pixels_in_buffer(device)}; + qp_internal_pixel_output_state_t output_state = {.device = device, .pixel_write_pos = 0, .max_pixels = qp_internal_num_pixels_in_buffer(device)}; // Set up the codepoint iteration state - struct code_point_iter_drawglyph_state state = {// Common - .device = device, - .xpos = x, - .ypos = y, - // Input - .input_callback = input_callback, - .input_state = &input_state, - // Output - .output_state = &output_state}; + code_point_iter_drawglyph_state_t state = {// Common + .device = device, + .xpos = x, + .ypos = y, + // Input + .input_callback = input_callback, + .input_state = &input_state, + // Output + .output_state = &output_state}; qp_pixel_t fg_hsv888 = {.hsv888 = {.h = hue_fg, .s = sat_fg, .v = val_fg}}; qp_pixel_t bg_hsv888 = {.hsv888 = {.h = hue_bg, .s = sat_bg, .v = val_bg}}; |