backend interface: prepare is optional

Also remove xrender's prepare since it overwrite part of the screen
outside the damage region, causing rendering problems.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
This commit is contained in:
Yuxuan Shui 2019-03-05 20:27:03 +00:00
parent de30ef14ae
commit c387a266dc
No known key found for this signature in database
GPG Key ID: 37C999F617EA1A47
3 changed files with 3 additions and 16 deletions

View File

@ -71,7 +71,7 @@ void paint_all_new(session_t *ps, win *const t, bool ignore_damage) {
// TODO Bind root pixmap
if (ps->backend_data->ops->prepare) {
ps->backend_data->ops->prepare(ps->backend_data, &reg_visible);
ps->backend_data->ops->prepare(ps->backend_data, &reg_damage);
}
if (ps->root_image) {

View File

@ -67,8 +67,8 @@ struct backend_operations {
/// Usually the backend should clear the buffer, or paint a background
/// on the buffer (usually the wallpaper).
///
/// Optional?
void (*prepare)(backend_t *backend_data, const region_t *reg_paint);
/// Optional
void (*prepare)(backend_t *backend_data, const region_t *reg_damage);
/**
* Paint the content of an image onto the (possibly buffered)

View File

@ -260,18 +260,6 @@ static void deinit(backend_t *backend_data) {
free(xd);
}
static void prepare(backend_t *base, const region_t *reg_paint) {
struct _xrender_data *xd = (void *)base;
// Paint the root pixmap (i.e. wallpaper)
// Limit the paint area
x_set_picture_clip_region(base->c, xd->back[xd->curr_back], 0, 0, reg_paint);
xcb_render_composite(base->c, XCB_RENDER_PICT_OP_SRC, xd->root_pict, XCB_NONE,
xd->back[xd->curr_back], 0, 0, 0, 0, 0, 0, xd->target_width,
xd->target_height);
}
static void present(backend_t *base) {
struct _xrender_data *xd = (void *)base;
@ -457,7 +445,6 @@ static struct backend_operations xrender_ops = {
.deinit = deinit,
.blur = blur,
.present = present,
.prepare = prepare,
.compose = compose,
.bind_pixmap = bind_pixmap,
.release_image = release_image,