Implement monitor repaint in new xrender

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
This commit is contained in:
Yuxuan Shui
2019-03-05 20:27:04 +00:00
parent c387a266dc
commit eed5ea719e
4 changed files with 47 additions and 11 deletions

View File

@@ -103,6 +103,18 @@ static void compose(backend_t *base, void *img_data, int dst_x, int dst_y,
pixman_region32_fini(&reg);
}
static void fill_rectangle(backend_t *base, double r, double g, double b, double a, int x,
int y, int width, int height, const region_t *clip) {
struct _xrender_data *xd = (void *)base;
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 = r * 0xffff, .green = g * 0xffff, .blue = b * 0xffff, .alpha = a * 0xffff},
1, (xcb_rectangle_t[]){{.x = x, .y = y, .width = width, .height = height}});
}
static bool blur(backend_t *backend_data, double opacity, const region_t *reg_blur,
const region_t *reg_visible) {
struct _xrender_data *xd = (void *)backend_data;
@@ -192,8 +204,8 @@ static bool blur(backend_t *backend_data, double opacity, const region_t *reg_bl
// There is only 1 pass
if (i == 1) {
xcb_render_composite(c, XCB_RENDER_PICT_OP_OVER, src_pict, alpha_pict,
xd->back[xd->curr_back], 0, 0, 0, 0, extent->x1, extent->y1,
width, height);
xd->back[xd->curr_back], 0, 0, 0, 0, extent->x1,
extent->y1, width, height);
}
xcb_render_free_picture(c, tmp_picture[0]);
@@ -446,6 +458,7 @@ static struct backend_operations xrender_ops = {
.blur = blur,
.present = present,
.compose = compose,
.fill_rectangle = fill_rectangle,
.bind_pixmap = bind_pixmap,
.release_image = release_image,
.render_shadow = default_backend_render_shadow,