diff --git a/include/libwebsockets/lws-display.h b/include/libwebsockets/lws-display.h index 9e4e8a2d3..6f3dbb0aa 100644 --- a/include/libwebsockets/lws-display.h +++ b/include/libwebsockets/lws-display.h @@ -56,6 +56,7 @@ typedef struct lws_surface_info { lws_surface_type_t type; uint8_t greyscale:1; /* line: 0 = RGBA, 1 = YA */ uint8_t partial:1; /* can handle partial */ + uint8_t render_to_rgba:1; /* render to 32-bit RGBA, not 24-bit RGB */ } lws_surface_info_t; typedef struct lws_greyscale_error { diff --git a/lib/misc/dlo/dlo.c b/lib/misc/dlo/dlo.c index de6642a7a..c67e895c3 100644 --- a/lib/misc/dlo/dlo.c +++ b/lib/misc/dlo/dlo.c @@ -95,7 +95,7 @@ lws_surface_set_px(const lws_surface_info_t *ic, uint8_t *line, int x, /* line composition buffer is 24-bit RGB per pixel */ - line += 3 * x; + line += (ic->render_to_rgba ? 4 : 3) * x; alpha = LWSDC_ALPHA(*c); ialpha = 255 - alpha; @@ -109,7 +109,10 @@ lws_surface_set_px(const lws_surface_info_t *ic, uint8_t *line, int x, *line++ = rgb[0]; *line++ = rgb[1]; - *line = rgb[2]; + *line++ = rgb[2]; + + if (ic->render_to_rgba) + *line = 0xff; } /*