backend: invert color and dim doesn't need reg_op
We only ever invert color of or dim the entire image, so just remove the ability to do region based inversion and dimming. Making implementing image_op easier. Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
This commit is contained in:
@@ -351,15 +351,10 @@ static bool image_op(backend_t *base, enum image_operations op, void *image,
|
||||
}
|
||||
|
||||
pixman_region32_init(®);
|
||||
pixman_region32_intersect(®, (region_t *)reg_op, (region_t *)reg_visible);
|
||||
if (!pixman_region32_not_empty(®)) {
|
||||
pixman_region32_fini(®);
|
||||
return true;
|
||||
}
|
||||
|
||||
switch (op) {
|
||||
case IMAGE_OP_INVERT_COLOR:
|
||||
x_set_picture_clip_region(base->c, img->pict, 0, 0, ®);
|
||||
case IMAGE_OP_INVERT_COLOR_ALL:
|
||||
x_set_picture_clip_region(base->c, img->pict, 0, 0, reg_visible);
|
||||
if (img->has_alpha) {
|
||||
auto tmp_pict =
|
||||
x_create_picture_with_visual(base->c, base->root, img->width,
|
||||
@@ -383,8 +378,8 @@ static bool image_op(backend_t *base, enum image_operations op, void *image,
|
||||
0, 0, 0, 0, img->width, img->height);
|
||||
}
|
||||
break;
|
||||
case IMAGE_OP_DIM:
|
||||
x_set_picture_clip_region(base->c, img->pict, 0, 0, ®);
|
||||
case IMAGE_OP_DIM_ALL:
|
||||
x_set_picture_clip_region(base->c, img->pict, 0, 0, reg_visible);
|
||||
dim_opacity = *(double *)arg;
|
||||
|
||||
xcb_render_color_t color = {
|
||||
@@ -402,6 +397,12 @@ static bool image_op(backend_t *base, enum image_operations op, void *image,
|
||||
color, 1, &rect);
|
||||
break;
|
||||
case IMAGE_OP_APPLY_ALPHA:
|
||||
assert(reg_op);
|
||||
pixman_region32_intersect(®, (region_t *)reg_op, (region_t *)reg_visible);
|
||||
if (!pixman_region32_not_empty(®)) {
|
||||
break;
|
||||
}
|
||||
|
||||
alpha_multiplier = *(double *)arg;
|
||||
if (alpha_multiplier == 1) {
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user