diff options
| author | Pablo MartÃnez <58857054+elpekenin@users.noreply.github.com> | 2025-10-08 04:10:38 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-10-07 19:10:38 -0700 |
| commit | 0550830909e854d2ac0203905c861a868e82b289 (patch) | |
| tree | 67e5a1ce8e82d1be81f1ee89f175856e1c149aff /quantum | |
| parent | 8f86f9794e13b6a2078f07d01ca7529d54dd676e (diff) | |
[QP] Minor cleanup and support for RGB888 surface (#25706)
Co-authored-by: Drashna Jaelre <drashna@live.com>
Diffstat (limited to 'quantum')
| -rw-r--r-- | quantum/painter/qff.h | 10 | ||||
| -rw-r--r-- | quantum/painter/qgf.c | 2 | ||||
| -rw-r--r-- | quantum/painter/qgf.h | 16 | ||||
| -rw-r--r-- | quantum/painter/qp_draw_core.c | 22 | ||||
| -rw-r--r-- | quantum/painter/qp_draw_ellipse.c | 2 | ||||
| -rw-r--r-- | quantum/painter/qp_internal.h | 8 | ||||
| -rw-r--r-- | quantum/painter/qp_internal_formats.h | 17 | ||||
| -rw-r--r-- | quantum/painter/rules.mk | 3 |
8 files changed, 34 insertions, 46 deletions
diff --git a/quantum/painter/qff.h b/quantum/painter/qff.h index ed88508d73..f5c59b315b 100644 --- a/quantum/painter/qff.h +++ b/quantum/painter/qff.h | |||
| @@ -22,7 +22,7 @@ | |||
| 22 | 22 | ||
| 23 | #define QFF_FONT_DESCRIPTOR_TYPEID 0x00 | 23 | #define QFF_FONT_DESCRIPTOR_TYPEID 0x00 |
| 24 | 24 | ||
| 25 | typedef struct QP_PACKED qff_font_descriptor_v1_t { | 25 | typedef struct PACKED qff_font_descriptor_v1_t { |
| 26 | qgf_block_header_v1_t header; // = { .type_id = 0x00, .neg_type_id = (~0x00), .length = 20 } | 26 | qgf_block_header_v1_t header; // = { .type_id = 0x00, .neg_type_id = (~0x00), .length = 20 } |
| 27 | uint32_t magic : 24; // constant, equal to 0x464651 ("QFF") | 27 | uint32_t magic : 24; // constant, equal to 0x464651 ("QFF") |
| 28 | uint8_t qff_version; // constant, equal to 0x01 | 28 | uint8_t qff_version; // constant, equal to 0x01 |
| @@ -51,13 +51,13 @@ STATIC_ASSERT(sizeof(qff_font_descriptor_v1_t) == (sizeof(qgf_block_header_v1_t) | |||
| 51 | #define QFF_GLYPH_OFFSET_BITS 18 | 51 | #define QFF_GLYPH_OFFSET_BITS 18 |
| 52 | #define QFF_GLYPH_OFFSET_MASK (((1 << QFF_GLYPH_OFFSET_BITS) - 1) << QFF_GLYPH_WIDTH_BITS) | 52 | #define QFF_GLYPH_OFFSET_MASK (((1 << QFF_GLYPH_OFFSET_BITS) - 1) << QFF_GLYPH_WIDTH_BITS) |
| 53 | 53 | ||
| 54 | typedef struct QP_PACKED qff_ascii_glyph_v1_t { | 54 | typedef struct PACKED qff_ascii_glyph_v1_t { |
| 55 | uint32_t value : 24; // Uses QFF_GLYPH_*_(BITS|MASK) as bitfield ordering is compiler-defined | 55 | uint32_t value : 24; // Uses QFF_GLYPH_*_(BITS|MASK) as bitfield ordering is compiler-defined |
| 56 | } qff_ascii_glyph_v1_t; | 56 | } qff_ascii_glyph_v1_t; |
| 57 | 57 | ||
| 58 | STATIC_ASSERT(sizeof(qff_ascii_glyph_v1_t) == 3, "qff_ascii_glyph_v1_t must be 3 bytes in v1 of QFF"); | 58 | STATIC_ASSERT(sizeof(qff_ascii_glyph_v1_t) == 3, "qff_ascii_glyph_v1_t must be 3 bytes in v1 of QFF"); |
| 59 | 59 | ||
| 60 | typedef struct QP_PACKED qff_ascii_glyph_table_v1_t { | 60 | typedef struct PACKED qff_ascii_glyph_table_v1_t { |
| 61 | qgf_block_header_v1_t header; // = { .type_id = 0x01, .neg_type_id = (~0x01), .length = 285 } | 61 | qgf_block_header_v1_t header; // = { .type_id = 0x01, .neg_type_id = (~0x01), .length = 285 } |
| 62 | qff_ascii_glyph_v1_t glyph[95]; // 95 glyphs, 0x20..0x7E | 62 | qff_ascii_glyph_v1_t glyph[95]; // 95 glyphs, 0x20..0x7E |
| 63 | } qff_ascii_glyph_table_v1_t; | 63 | } qff_ascii_glyph_table_v1_t; |
| @@ -69,14 +69,14 @@ STATIC_ASSERT(sizeof(qff_ascii_glyph_table_v1_t) == (sizeof(qgf_block_header_v1_ | |||
| 69 | 69 | ||
| 70 | #define QFF_UNICODE_GLYPH_DESCRIPTOR_TYPEID 0x02 | 70 | #define QFF_UNICODE_GLYPH_DESCRIPTOR_TYPEID 0x02 |
| 71 | 71 | ||
| 72 | typedef struct QP_PACKED qff_unicode_glyph_v1_t { | 72 | typedef struct PACKED qff_unicode_glyph_v1_t { |
| 73 | uint32_t code_point : 24; | 73 | uint32_t code_point : 24; |
| 74 | uint32_t value : 24; // Uses QFF_GLYPH_*_(BITS|MASK) as bitfield ordering is compiler-defined | 74 | uint32_t value : 24; // Uses QFF_GLYPH_*_(BITS|MASK) as bitfield ordering is compiler-defined |
| 75 | } qff_unicode_glyph_v1_t; | 75 | } qff_unicode_glyph_v1_t; |
| 76 | 76 | ||
| 77 | STATIC_ASSERT(sizeof(qff_unicode_glyph_v1_t) == 6, "qff_unicode_glyph_v1_t must be 6 bytes in v1 of QFF"); | 77 | STATIC_ASSERT(sizeof(qff_unicode_glyph_v1_t) == 6, "qff_unicode_glyph_v1_t must be 6 bytes in v1 of QFF"); |
| 78 | 78 | ||
| 79 | typedef struct QP_PACKED qff_unicode_glyph_table_v1_t { | 79 | typedef struct PACKED qff_unicode_glyph_table_v1_t { |
| 80 | qgf_block_header_v1_t header; // = { .type_id = 0x02, .neg_type_id = (~0x02), .length = (N * 6) } | 80 | qgf_block_header_v1_t header; // = { .type_id = 0x02, .neg_type_id = (~0x02), .length = (N * 6) } |
| 81 | qff_unicode_glyph_v1_t glyph[0]; // Extent of '0' signifies that this struct is immediately followed by the glyph data | 81 | qff_unicode_glyph_v1_t glyph[0]; // Extent of '0' signifies that this struct is immediately followed by the glyph data |
| 82 | } qff_unicode_glyph_table_v1_t; | 82 | } qff_unicode_glyph_table_v1_t; |
diff --git a/quantum/painter/qgf.c b/quantum/painter/qgf.c index 07c3f80314..e5a1895b74 100644 --- a/quantum/painter/qgf.c +++ b/quantum/painter/qgf.c | |||
| @@ -26,7 +26,7 @@ bool qgf_validate_block_header(qgf_block_header_v1_t *desc, uint8_t expected_typ | |||
| 26 | 26 | ||
| 27 | bool qgf_parse_format(qp_image_format_t format, uint8_t *bpp, bool *has_palette, bool *is_panel_native) { | 27 | bool qgf_parse_format(qp_image_format_t format, uint8_t *bpp, bool *has_palette, bool *is_panel_native) { |
| 28 | // clang-format off | 28 | // clang-format off |
| 29 | static const struct QP_PACKED { | 29 | static const struct PACKED { |
| 30 | uint8_t bpp; | 30 | uint8_t bpp; |
| 31 | bool has_palette; | 31 | bool has_palette; |
| 32 | bool is_panel_native; | 32 | bool is_panel_native; |
diff --git a/quantum/painter/qgf.h b/quantum/painter/qgf.h index a1e245f15d..87a9124f27 100644 --- a/quantum/painter/qgf.h +++ b/quantum/painter/qgf.h | |||
| @@ -19,7 +19,7 @@ | |||
| 19 | ///////////////////////////////////////// | 19 | ///////////////////////////////////////// |
| 20 | // Common block header | 20 | // Common block header |
| 21 | 21 | ||
| 22 | typedef struct QP_PACKED qgf_block_header_v1_t { | 22 | typedef struct PACKED qgf_block_header_v1_t { |
| 23 | uint8_t type_id; // See each respective block type below. | 23 | uint8_t type_id; // See each respective block type below. |
| 24 | uint8_t neg_type_id; // Negated type ID, used for detecting parsing errors. | 24 | uint8_t neg_type_id; // Negated type ID, used for detecting parsing errors. |
| 25 | uint32_t length : 24; // 24-bit blob length, allowing for block sizes of a maximum of 16MB. | 25 | uint32_t length : 24; // 24-bit blob length, allowing for block sizes of a maximum of 16MB. |
| @@ -32,7 +32,7 @@ STATIC_ASSERT(sizeof(qgf_block_header_v1_t) == 5, "qgf_block_header_v1_t must be | |||
| 32 | 32 | ||
| 33 | #define QGF_GRAPHICS_DESCRIPTOR_TYPEID 0x00 | 33 | #define QGF_GRAPHICS_DESCRIPTOR_TYPEID 0x00 |
| 34 | 34 | ||
| 35 | typedef struct QP_PACKED qgf_graphics_descriptor_v1_t { | 35 | typedef struct PACKED qgf_graphics_descriptor_v1_t { |
| 36 | qgf_block_header_v1_t header; // = { .type_id = 0x00, .neg_type_id = (~0x00), .length = 18 } | 36 | qgf_block_header_v1_t header; // = { .type_id = 0x00, .neg_type_id = (~0x00), .length = 18 } |
| 37 | uint32_t magic : 24; // constant, equal to 0x464751 ("QGF") | 37 | uint32_t magic : 24; // constant, equal to 0x464751 ("QGF") |
| 38 | uint8_t qgf_version; // constant, equal to 0x01 | 38 | uint8_t qgf_version; // constant, equal to 0x01 |
| @@ -52,7 +52,7 @@ STATIC_ASSERT(sizeof(qgf_graphics_descriptor_v1_t) == (sizeof(qgf_block_header_v | |||
| 52 | 52 | ||
| 53 | #define QGF_FRAME_OFFSET_DESCRIPTOR_TYPEID 0x01 | 53 | #define QGF_FRAME_OFFSET_DESCRIPTOR_TYPEID 0x01 |
| 54 | 54 | ||
| 55 | typedef struct QP_PACKED qgf_frame_offsets_v1_t { | 55 | typedef struct PACKED qgf_frame_offsets_v1_t { |
| 56 | qgf_block_header_v1_t header; // = { .type_id = 0x01, .neg_type_id = (~0x01), .length = (N * sizeof(uint32_t)) } | 56 | qgf_block_header_v1_t header; // = { .type_id = 0x01, .neg_type_id = (~0x01), .length = (N * sizeof(uint32_t)) } |
| 57 | uint32_t offset[0]; // '0' signifies that this struct is immediately followed by the frame offsets | 57 | uint32_t offset[0]; // '0' signifies that this struct is immediately followed by the frame offsets |
| 58 | } qgf_frame_offsets_v1_t; | 58 | } qgf_frame_offsets_v1_t; |
| @@ -64,7 +64,7 @@ STATIC_ASSERT(sizeof(qgf_frame_offsets_v1_t) == sizeof(qgf_block_header_v1_t), " | |||
| 64 | 64 | ||
| 65 | #define QGF_FRAME_DESCRIPTOR_TYPEID 0x02 | 65 | #define QGF_FRAME_DESCRIPTOR_TYPEID 0x02 |
| 66 | 66 | ||
| 67 | typedef struct QP_PACKED qgf_frame_v1_t { | 67 | typedef struct PACKED qgf_frame_v1_t { |
| 68 | qgf_block_header_v1_t header; // = { .type_id = 0x02, .neg_type_id = (~0x02), .length = 6 } | 68 | qgf_block_header_v1_t header; // = { .type_id = 0x02, .neg_type_id = (~0x02), .length = 6 } |
| 69 | qp_image_format_t format : 8; // Frame format, see qp_internal_formats.h. | 69 | qp_image_format_t format : 8; // Frame format, see qp_internal_formats.h. |
| 70 | uint8_t flags; // Frame flags, see below. | 70 | uint8_t flags; // Frame flags, see below. |
| @@ -83,7 +83,7 @@ STATIC_ASSERT(sizeof(qgf_frame_v1_t) == (sizeof(qgf_block_header_v1_t) + 6), "qg | |||
| 83 | 83 | ||
| 84 | #define QGF_FRAME_PALETTE_DESCRIPTOR_TYPEID 0x03 | 84 | #define QGF_FRAME_PALETTE_DESCRIPTOR_TYPEID 0x03 |
| 85 | 85 | ||
| 86 | typedef struct QP_PACKED qgf_palette_entry_v1_t { | 86 | typedef struct PACKED qgf_palette_entry_v1_t { |
| 87 | uint8_t h; // hue component: `[0,360)` degrees is mapped to `[0,255]` uint8_t. | 87 | uint8_t h; // hue component: `[0,360)` degrees is mapped to `[0,255]` uint8_t. |
| 88 | uint8_t s; // saturation component: `[0,1]` is mapped to `[0,255]` uint8_t. | 88 | uint8_t s; // saturation component: `[0,1]` is mapped to `[0,255]` uint8_t. |
| 89 | uint8_t v; // value component: `[0,1]` is mapped to `[0,255]` uint8_t. | 89 | uint8_t v; // value component: `[0,1]` is mapped to `[0,255]` uint8_t. |
| @@ -91,7 +91,7 @@ typedef struct QP_PACKED qgf_palette_entry_v1_t { | |||
| 91 | 91 | ||
| 92 | STATIC_ASSERT(sizeof(qgf_palette_entry_v1_t) == 3, "Palette entry is not 3 bytes in size"); | 92 | STATIC_ASSERT(sizeof(qgf_palette_entry_v1_t) == 3, "Palette entry is not 3 bytes in size"); |
| 93 | 93 | ||
| 94 | typedef struct QP_PACKED qgf_palette_v1_t { | 94 | typedef struct PACKED qgf_palette_v1_t { |
| 95 | qgf_block_header_v1_t header; // = { .type_id = 0x03, .neg_type_id = (~0x03), .length = (N * 3 * sizeof(uint8_t)) } | 95 | qgf_block_header_v1_t header; // = { .type_id = 0x03, .neg_type_id = (~0x03), .length = (N * 3 * sizeof(uint8_t)) } |
| 96 | qgf_palette_entry_v1_t hsv[0]; // N * hsv, where N is the number of palette entries depending on the frame format in the descriptor | 96 | qgf_palette_entry_v1_t hsv[0]; // N * hsv, where N is the number of palette entries depending on the frame format in the descriptor |
| 97 | } qgf_palette_v1_t; | 97 | } qgf_palette_v1_t; |
| @@ -103,7 +103,7 @@ STATIC_ASSERT(sizeof(qgf_palette_v1_t) == sizeof(qgf_block_header_v1_t), "qgf_pa | |||
| 103 | 103 | ||
| 104 | #define QGF_FRAME_DELTA_DESCRIPTOR_TYPEID 0x04 | 104 | #define QGF_FRAME_DELTA_DESCRIPTOR_TYPEID 0x04 |
| 105 | 105 | ||
| 106 | typedef struct QP_PACKED qgf_delta_v1_t { | 106 | typedef struct PACKED qgf_delta_v1_t { |
| 107 | qgf_block_header_v1_t header; // = { .type_id = 0x04, .neg_type_id = (~0x04), .length = 8 } | 107 | qgf_block_header_v1_t header; // = { .type_id = 0x04, .neg_type_id = (~0x04), .length = 8 } |
| 108 | uint16_t left; // The left pixel location to draw the delta image | 108 | uint16_t left; // The left pixel location to draw the delta image |
| 109 | uint16_t top; // The top pixel location to draw the delta image | 109 | uint16_t top; // The top pixel location to draw the delta image |
| @@ -118,7 +118,7 @@ STATIC_ASSERT(sizeof(qgf_delta_v1_t) == (sizeof(qgf_block_header_v1_t) + 8), "qg | |||
| 118 | 118 | ||
| 119 | #define QGF_FRAME_DATA_DESCRIPTOR_TYPEID 0x05 | 119 | #define QGF_FRAME_DATA_DESCRIPTOR_TYPEID 0x05 |
| 120 | 120 | ||
| 121 | typedef struct QP_PACKED qgf_data_v1_t { | 121 | typedef struct PACKED qgf_data_v1_t { |
| 122 | qgf_block_header_v1_t header; // = { .type_id = 0x05, .neg_type_id = (~0x05), .length = N } | 122 | qgf_block_header_v1_t header; // = { .type_id = 0x05, .neg_type_id = (~0x05), .length = N } |
| 123 | uint8_t data[0]; // 0 signifies that this struct is immediately followed by the length of data specified in the header | 123 | uint8_t data[0]; // 0 signifies that this struct is immediately followed by the length of data specified in the header |
| 124 | } qgf_data_v1_t; | 124 | } qgf_data_v1_t; |
diff --git a/quantum/painter/qp_draw_core.c b/quantum/painter/qp_draw_core.c index 852abb19e8..3958045943 100644 --- a/quantum/painter/qp_draw_core.c +++ b/quantum/painter/qp_draw_core.c | |||
| @@ -52,7 +52,7 @@ bool qp_internal_setpixel_impl(painter_device_t device, uint16_t x, uint16_t y) | |||
| 52 | void qp_internal_fill_pixdata(painter_device_t device, uint32_t num_pixels, uint8_t hue, uint8_t sat, uint8_t val) { | 52 | void qp_internal_fill_pixdata(painter_device_t device, uint32_t num_pixels, uint8_t hue, uint8_t sat, uint8_t val) { |
| 53 | painter_driver_t *driver = (painter_driver_t *)device; | 53 | painter_driver_t *driver = (painter_driver_t *)device; |
| 54 | uint32_t pixels_in_pixdata = qp_internal_num_pixels_in_buffer(device); | 54 | uint32_t pixels_in_pixdata = qp_internal_num_pixels_in_buffer(device); |
| 55 | num_pixels = QP_MIN(pixels_in_pixdata, num_pixels); | 55 | num_pixels = MIN(pixels_in_pixdata, num_pixels); |
| 56 | 56 | ||
| 57 | // Convert the color to native pixel format | 57 | // Convert the color to native pixel format |
| 58 | qp_pixel_t color = {.hsv888 = {.h = hue, .s = sat, .v = val}}; | 58 | qp_pixel_t color = {.hsv888 = {.h = hue, .s = sat, .v = val}}; |
| @@ -232,17 +232,17 @@ bool qp_internal_fillrect_helper_impl(painter_device_t device, uint16_t left, ui | |||
| 232 | uint32_t pixels_in_pixdata = qp_internal_num_pixels_in_buffer(device); | 232 | uint32_t pixels_in_pixdata = qp_internal_num_pixels_in_buffer(device); |
| 233 | painter_driver_t *driver = (painter_driver_t *)device; | 233 | painter_driver_t *driver = (painter_driver_t *)device; |
| 234 | 234 | ||
| 235 | uint16_t l = QP_MIN(left, right); | 235 | uint16_t l = MIN(left, right); |
| 236 | uint16_t r = QP_MAX(left, right); | 236 | uint16_t r = MAX(left, right); |
| 237 | uint16_t t = QP_MIN(top, bottom); | 237 | uint16_t t = MIN(top, bottom); |
| 238 | uint16_t b = QP_MAX(top, bottom); | 238 | uint16_t b = MAX(top, bottom); |
| 239 | uint16_t w = r - l + 1; | 239 | uint16_t w = r - l + 1; |
| 240 | uint16_t h = b - t + 1; | 240 | uint16_t h = b - t + 1; |
| 241 | 241 | ||
| 242 | uint32_t remaining = w * h; | 242 | uint32_t remaining = w * h; |
| 243 | driver->driver_vtable->viewport(device, l, t, r, b); | 243 | driver->driver_vtable->viewport(device, l, t, r, b); |
| 244 | while (remaining > 0) { | 244 | while (remaining > 0) { |
| 245 | uint32_t transmit = QP_MIN(remaining, pixels_in_pixdata); | 245 | uint32_t transmit = MIN(remaining, pixels_in_pixdata); |
| 246 | if (!driver->driver_vtable->pixdata(device, qp_internal_global_pixdata_buffer, transmit)) { | 246 | if (!driver->driver_vtable->pixdata(device, qp_internal_global_pixdata_buffer, transmit)) { |
| 247 | return false; | 247 | return false; |
| 248 | } | 248 | } |
| @@ -260,10 +260,10 @@ bool qp_rect(painter_device_t device, uint16_t left, uint16_t top, uint16_t righ | |||
| 260 | } | 260 | } |
| 261 | 261 | ||
| 262 | // Cater for cases where people have submitted the coordinates backwards | 262 | // Cater for cases where people have submitted the coordinates backwards |
| 263 | uint16_t l = QP_MIN(left, right); | 263 | uint16_t l = MIN(left, right); |
| 264 | uint16_t r = QP_MAX(left, right); | 264 | uint16_t r = MAX(left, right); |
| 265 | uint16_t t = QP_MIN(top, bottom); | 265 | uint16_t t = MIN(top, bottom); |
| 266 | uint16_t b = QP_MAX(top, bottom); | 266 | uint16_t b = MAX(top, bottom); |
| 267 | uint16_t w = r - l + 1; | 267 | uint16_t w = r - l + 1; |
| 268 | uint16_t h = b - t + 1; | 268 | uint16_t h = b - t + 1; |
| 269 | 269 | ||
| @@ -281,7 +281,7 @@ bool qp_rect(painter_device_t device, uint16_t left, uint16_t top, uint16_t righ | |||
| 281 | ret = qp_internal_fillrect_helper_impl(device, l, t, r, b); | 281 | ret = qp_internal_fillrect_helper_impl(device, l, t, r, b); |
| 282 | } else { | 282 | } else { |
| 283 | // Fill up the pixdata buffer with the required number of native pixels | 283 | // Fill up the pixdata buffer with the required number of native pixels |
| 284 | qp_internal_fill_pixdata(device, QP_MAX(w, h), hue, sat, val); | 284 | qp_internal_fill_pixdata(device, MAX(w, h), hue, sat, val); |
| 285 | 285 | ||
| 286 | // Draw 4x filled single-width rects to create an outline | 286 | // Draw 4x filled single-width rects to create an outline |
| 287 | if (!qp_internal_fillrect_helper_impl(device, l, t, r, t) || !qp_internal_fillrect_helper_impl(device, l, b, r, b) || !qp_internal_fillrect_helper_impl(device, l, t + 1, l, b - 1) || !qp_internal_fillrect_helper_impl(device, r, t + 1, r, b - 1)) { | 287 | if (!qp_internal_fillrect_helper_impl(device, l, t, r, t) || !qp_internal_fillrect_helper_impl(device, l, b, r, b) || !qp_internal_fillrect_helper_impl(device, l, t + 1, l, b - 1) || !qp_internal_fillrect_helper_impl(device, r, t + 1, r, b - 1)) { |
diff --git a/quantum/painter/qp_draw_ellipse.c b/quantum/painter/qp_draw_ellipse.c index 9e77bca8b0..22f019d179 100644 --- a/quantum/painter/qp_draw_ellipse.c +++ b/quantum/painter/qp_draw_ellipse.c | |||
| @@ -75,7 +75,7 @@ bool qp_ellipse(painter_device_t device, uint16_t x, uint16_t y, uint16_t sizex, | |||
| 75 | int16_t dx = 0; | 75 | int16_t dx = 0; |
| 76 | int16_t dy = ((int16_t)sizey); | 76 | int16_t dy = ((int16_t)sizey); |
| 77 | 77 | ||
| 78 | qp_internal_fill_pixdata(device, QP_MAX(sizex, sizey), hue, sat, val); | 78 | qp_internal_fill_pixdata(device, MAX(sizex, sizey), hue, sat, val); |
| 79 | 79 | ||
| 80 | if (!qp_comms_start(device)) { | 80 | if (!qp_comms_start(device)) { |
| 81 | qp_dprintf("qp_ellipse: fail (could not start comms)\n"); | 81 | qp_dprintf("qp_ellipse: fail (could not start comms)\n"); |
diff --git a/quantum/painter/qp_internal.h b/quantum/painter/qp_internal.h index e7a6d113c5..52b1b5c69d 100644 --- a/quantum/painter/qp_internal.h +++ b/quantum/painter/qp_internal.h | |||
| @@ -5,17 +5,11 @@ | |||
| 5 | 5 | ||
| 6 | #include "quantum.h" | 6 | #include "quantum.h" |
| 7 | #include "qp.h" | 7 | #include "qp.h" |
| 8 | #include "util.h" // PACKED/MIN/MAX | ||
| 8 | 9 | ||
| 9 | //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// | 10 | //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// |
| 10 | // Helpers | 11 | // Helpers |
| 11 | 12 | ||
| 12 | // Mark certain types that there should be no padding bytes between members. | ||
| 13 | #define QP_PACKED __attribute__((packed)) | ||
| 14 | |||
| 15 | // Min/max defines | ||
| 16 | #define QP_MIN(X, Y) (((X) < (Y)) ? (X) : (Y)) | ||
| 17 | #define QP_MAX(X, Y) (((X) > (Y)) ? (X) : (Y)) | ||
| 18 | |||
| 19 | #ifdef QUANTUM_PAINTER_DEBUG | 13 | #ifdef QUANTUM_PAINTER_DEBUG |
| 20 | # include <debug.h> | 14 | # include <debug.h> |
| 21 | # include <print.h> | 15 | # include <print.h> |
diff --git a/quantum/painter/qp_internal_formats.h b/quantum/painter/qp_internal_formats.h index bd7105cab2..28cff0cd61 100644 --- a/quantum/painter/qp_internal_formats.h +++ b/quantum/painter/qp_internal_formats.h | |||
| @@ -3,6 +3,7 @@ | |||
| 3 | 3 | ||
| 4 | #pragma once | 4 | #pragma once |
| 5 | 5 | ||
| 6 | #include "color.h" | ||
| 6 | #include "compiler_support.h" | 7 | #include "compiler_support.h" |
| 7 | #include "qp_internal.h" | 8 | #include "qp_internal.h" |
| 8 | 9 | ||
| @@ -10,21 +11,13 @@ | |||
| 10 | // Quantum Painter pixel formats | 11 | // Quantum Painter pixel formats |
| 11 | 12 | ||
| 12 | // Datatype containing a pixel's color. The internal member used is dependent on the external context. | 13 | // Datatype containing a pixel's color. The internal member used is dependent on the external context. |
| 13 | typedef union QP_PACKED qp_pixel_t { | 14 | typedef union PACKED qp_pixel_t { |
| 14 | uint8_t mono; | 15 | uint8_t mono; |
| 15 | uint8_t palette_idx; | 16 | uint8_t palette_idx; |
| 16 | 17 | ||
| 17 | struct QP_PACKED { | 18 | hsv_t hsv888; |
| 18 | uint8_t h; | 19 | |
| 19 | uint8_t s; | 20 | rgb_t rgb888; |
| 20 | uint8_t v; | ||
| 21 | } hsv888; | ||
| 22 | |||
| 23 | struct QP_PACKED { | ||
| 24 | uint8_t r; | ||
| 25 | uint8_t g; | ||
| 26 | uint8_t b; | ||
| 27 | } rgb888; | ||
| 28 | 21 | ||
| 29 | uint16_t rgb565; | 22 | uint16_t rgb565; |
| 30 | 23 | ||
diff --git a/quantum/painter/rules.mk b/quantum/painter/rules.mk index 10c2698092..2c5bc17eed 100644 --- a/quantum/painter/rules.mk +++ b/quantum/painter/rules.mk | |||
| @@ -247,7 +247,8 @@ ifeq ($(strip $(QUANTUM_PAINTER_NEEDS_SURFACE)), yes) | |||
| 247 | SRC += \ | 247 | SRC += \ |
| 248 | $(DRIVER_PATH)/painter/generic/qp_surface_common.c \ | 248 | $(DRIVER_PATH)/painter/generic/qp_surface_common.c \ |
| 249 | $(DRIVER_PATH)/painter/generic/qp_surface_mono1bpp.c \ | 249 | $(DRIVER_PATH)/painter/generic/qp_surface_mono1bpp.c \ |
| 250 | $(DRIVER_PATH)/painter/generic/qp_surface_rgb565.c | 250 | $(DRIVER_PATH)/painter/generic/qp_surface_rgb565.c \ |
| 251 | $(DRIVER_PATH)/painter/generic/qp_surface_rgb888.c | ||
| 251 | endif | 252 | endif |
| 252 | 253 | ||
| 253 | # If dummy comms is needed, set up the required files | 254 | # If dummy comms is needed, set up the required files |
