mirror of
https://github.com/warmcat/libwebsockets.git
synced 2025-03-30 00:00:16 +01:00
dlo: add render_to_rgba
This commit is contained in:
parent
ec6d5ac6d5
commit
e8eb7d6bd6
2 changed files with 6 additions and 2 deletions
|
@ -56,6 +56,7 @@ typedef struct lws_surface_info {
|
||||||
lws_surface_type_t type;
|
lws_surface_type_t type;
|
||||||
uint8_t greyscale:1; /* line: 0 = RGBA, 1 = YA */
|
uint8_t greyscale:1; /* line: 0 = RGBA, 1 = YA */
|
||||||
uint8_t partial:1; /* can handle partial */
|
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;
|
} lws_surface_info_t;
|
||||||
|
|
||||||
typedef struct lws_greyscale_error {
|
typedef struct lws_greyscale_error {
|
||||||
|
|
|
@ -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 composition buffer is 24-bit RGB per pixel */
|
||||||
|
|
||||||
line += 3 * x;
|
line += (ic->render_to_rgba ? 4 : 3) * x;
|
||||||
|
|
||||||
alpha = LWSDC_ALPHA(*c);
|
alpha = LWSDC_ALPHA(*c);
|
||||||
ialpha = 255 - alpha;
|
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[0];
|
||||||
*line++ = rgb[1];
|
*line++ = rgb[1];
|
||||||
*line = rgb[2];
|
*line++ = rgb[2];
|
||||||
|
|
||||||
|
if (ic->render_to_rgba)
|
||||||
|
*line = 0xff;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
Loading…
Add table
Reference in a new issue