Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add RGB565 and RGB888 color support to Quantum Painter #19382

Merged
merged 6 commits into from
Jan 14, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
code fixes from sigprof requested changes
  • Loading branch information
infinityis committed Jan 2, 2023
commit 785a85577ffb4f61952cbd45f13d6920da600148
4 changes: 2 additions & 2 deletions quantum/painter/qp_draw_codec.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ bool qp_internal_decode_palette(painter_device_t device, uint32_t pixel_count, u
const uint8_t pixels_per_byte = 8 / bits_per_pixel;
uint32_t remaining_pixels = pixel_count; // don't try to derive from byte_count, we may not use an entire byte
while (remaining_pixels > 0) {
uint8_t byteval = input_callback(input_arg);
infinityis marked this conversation as resolved.
Show resolved Hide resolved
uint16_t byteval = input_callback(input_arg);
if (byteval < 0) {
return false;
}
Expand Down Expand Up @@ -68,7 +68,7 @@ bool qp_internal_decode_recolor(painter_device_t device, uint32_t pixel_count, u
bool qp_internal_send_bytes(painter_device_t device, uint32_t byte_count, qp_internal_byte_input_callback input_callback, void* input_arg, qp_internal_byte_output_callback output_callback, void* output_arg) {
uint32_t remaining_bytes = byte_count;
while (remaining_bytes > 0) {
uint8_t byteval = input_callback(input_arg);
uint16_t byteval = input_callback(input_arg);
infinityis marked this conversation as resolved.
Show resolved Hide resolved
if (byteval < 0) {
return false;
}
Expand Down
6 changes: 5 additions & 1 deletion quantum/painter/qp_draw_image.c
Original file line number Diff line number Diff line change
Expand Up @@ -275,11 +275,15 @@ static bool qp_drawimage_recolor_impl(painter_device_t device, uint16_t x, uint1
}
} else {
// Set up the output state
struct qp_internal_byte_output_state output_state = {.device = device, .byte_write_pos = 0, .max_bytes = QUANTUM_PAINTER_PIXDATA_BUFFER_SIZE};
struct qp_internal_byte_output_state output_state = {.device = device, .byte_write_pos = 0, .max_bytes = qp_internal_num_pixels_in_buffer(device) * driver->native_bits_per_pixel / 8};

// Stream the raw pixel data to the display
uint32_t byte_count = pixel_count * frame_info->bpp / 8;
ret = qp_internal_send_bytes(device, byte_count, input_callback, &input_state, qp_internal_byte_appender, &output_state);
infinityis marked this conversation as resolved.
Show resolved Hide resolved
// Any leftovers need transmission as well.
if (ret && output_state.byte_write_pos > 0) {
ret &= driver->driver_vtable->pixdata(device, qp_internal_global_pixdata_buffer, output_state.byte_write_pos * 8 / driver->native_bits_per_pixel);
}
}

qp_dprintf("qp_drawimage_recolor: %s\n", ret ? "ok" : "fail");
Expand Down