Skip to content

Commit

Permalink
dlo: add render_to_rgba
Browse files Browse the repository at this point in the history
  • Loading branch information
lws-team committed Feb 10, 2023
1 parent ec6d5ac commit e8eb7d6
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
1 change: 1 addition & 0 deletions include/libwebsockets/lws-display.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
7 changes: 5 additions & 2 deletions lib/misc/dlo/dlo.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
}

/*
Expand Down

0 comments on commit e8eb7d6

Please sign in to comment.