dlo: add render_to_rgba

This commit is contained in:
Andy Green 2023-02-10 06:03:40 +00:00
parent ec6d5ac6d5
commit e8eb7d6bd6
2 changed files with 6 additions and 2 deletions

View File

@ -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 {

View File

@ -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;
}
/*