summaryrefslogtreecommitdiff
path: root/quantum
diff options
context:
space:
mode:
authorQMK Bot <hello@qmk.fm>2023-04-03 02:43:23 +0000
committerQMK Bot <hello@qmk.fm>2023-04-03 02:43:23 +0000
commitfe58538b8f471e6a794702ee22248d771603d35b (patch)
tree13012ec7a419f7357720c298b3d9a0d2050c1472 /quantum
parent3ec37f4d55e6f5a30c36001d7f837fb4ca6a919e (diff)
parent15a106b1ef1bb760d6a48b2fd17bc0ed2606541a (diff)
Merge remote-tracking branch 'origin/master' into develop
Diffstat (limited to 'quantum')
-rw-r--r--quantum/painter/qp_draw_image.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/quantum/painter/qp_draw_image.c b/quantum/painter/qp_draw_image.c
index 361c21b906..9f86b29f8b 100644
--- a/quantum/painter/qp_draw_image.c
+++ b/quantum/painter/qp_draw_image.c
@@ -273,6 +273,10 @@ static bool qp_drawimage_recolor_impl(painter_device_t device, uint16_t x, uint1
if (ret && output_state.pixel_write_pos > 0) {
ret &= driver->driver_vtable->pixdata(device, qp_internal_global_pixdata_buffer, output_state.pixel_write_pos);
}
+ } else if (frame_info->bpp != driver->native_bits_per_pixel) {
+ // Prevent stuff like drawing 24bpp images on 16bpp displays
+ qp_dprintf("Image's bpp doesn't match the target display's native_bits_per_pixel\n");
+ return false;
} else {
// Set up the output state
qp_internal_byte_output_state_t output_state = {.device = device, .byte_write_pos = 0, .max_bytes = qp_internal_num_pixels_in_buffer(device) * driver->native_bits_per_pixel / 8};