new backend: glx: implement IMAGE_OP_APPLY_ALPHA

Slight change to the backend_operations::fill interface.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
This commit is contained in:
Yuxuan Shui
2019-05-10 08:34:58 +01:00
parent 18b1fc95ff
commit 80c7b2f7ec
6 changed files with 46 additions and 19 deletions

View File

@@ -107,17 +107,17 @@ static void compose(backend_t *base, void *img_data, int dst_x, int dst_y,
}
static void
fill(backend_t *base, double r, double g, double b, double a, const region_t *clip) {
fill(backend_t *base, struct color c, const region_t *clip) {
struct _xrender_data *xd = (void *)base;
const rect_t *extent = pixman_region32_extents((region_t *)clip);
x_set_picture_clip_region(base->c, xd->back[xd->curr_back], 0, 0, clip);
// color is in X fixed point representation
xcb_render_fill_rectangles(
base->c, XCB_RENDER_PICT_OP_OVER, xd->back[xd->curr_back],
(xcb_render_color_t){.red = (uint16_t)(r * 0xffff),
.green = (uint16_t)(g * 0xffff),
.blue = (uint16_t)(b * 0xffff),
.alpha = (uint16_t)(a * 0xffff)},
(xcb_render_color_t){.red = (uint16_t)(c.red * 0xffff),
.green = (uint16_t)(c.green * 0xffff),
.blue = (uint16_t)(c.blue * 0xffff),
.alpha = (uint16_t)(c.alpha * 0xffff)},
1,
(xcb_rectangle_t[]){{.x = to_i16_checked(extent->x1),
.y = to_i16_checked(extent->y1),