backend interface: add IMAGE_OP_RESIZE_TILE
We need this to paint the wallpaper with repeat to mimic the behavior of Xorg's background pixmap. Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
This commit is contained in:
@ -267,6 +267,7 @@ void gl_compose(backend_t *base, void *image_data, int dst_x, int dst_y,
|
||||
|
||||
// Painting
|
||||
int nrects;
|
||||
|
||||
const rect_t *rects;
|
||||
rects = pixman_region32_rectangles((region_t *)reg_tgt, &nrects);
|
||||
|
||||
@ -291,7 +292,7 @@ void gl_compose(backend_t *base, void *image_data, int dst_x, int dst_y,
|
||||
}
|
||||
|
||||
if (ptex->target == GL_TEXTURE_2D) {
|
||||
// GL_TEXTURE_2D coordinates are 0-1
|
||||
// GL_TEXTURE_2D coordinates are normalized
|
||||
texture_x1 /= ptex->width;
|
||||
texture_y1 /= ptex->height;
|
||||
texture_x2 /= ptex->width;
|
||||
@ -899,6 +900,7 @@ GLuint gl_new_texture(GLenum target) {
|
||||
bool gl_image_op(backend_t *base, enum image_operations op, void *image_data,
|
||||
const region_t *reg_op, const region_t *reg_visible, void *arg) {
|
||||
struct gl_texture *tex = image_data;
|
||||
int *iargs = arg;
|
||||
switch (op) {
|
||||
case IMAGE_OP_INVERT_COLOR_ALL: tex->color_inverted = true; break;
|
||||
case IMAGE_OP_DIM_ALL: log_warn("IMAGE_OP_DIM_ALL not implemented yet"); break;
|
||||
@ -906,7 +908,13 @@ bool gl_image_op(backend_t *base, enum image_operations op, void *image_data,
|
||||
case IMAGE_OP_APPLY_ALPHA:
|
||||
log_warn("IMAGE_OP_APPLY_ALPHA not implemented yet");
|
||||
break;
|
||||
case IMAGE_OP_RESIZE_TILE:
|
||||
// texture is already set to repeat, so nothing else we need to do
|
||||
tex->ewidth = iargs[0];
|
||||
tex->eheight = iargs[1];
|
||||
break;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -46,8 +46,9 @@ typedef struct gl_texture {
|
||||
int *refcount;
|
||||
GLuint texture;
|
||||
GLenum target;
|
||||
unsigned width;
|
||||
unsigned height;
|
||||
int width, height;
|
||||
// The effective size of the texture
|
||||
int ewidth, eheight;
|
||||
unsigned depth;
|
||||
bool y_inverted;
|
||||
bool has_alpha;
|
||||
|
@ -355,8 +355,8 @@ glx_bind_pixmap(backend_t *base, xcb_pixmap_t pixmap, struct xvisual_info fmt, b
|
||||
|
||||
auto wd = ccalloc(1, struct _glx_image_data);
|
||||
wd->pixmap = pixmap;
|
||||
wd->texture.width = r->width;
|
||||
wd->texture.height = r->height;
|
||||
wd->texture.width = wd->texture.ewidth = r->width;
|
||||
wd->texture.height = wd->texture.eheight = r->height;
|
||||
free(r);
|
||||
|
||||
auto fbcfg = glx_find_fbconfig(gd->display, gd->screen, fmt);
|
||||
|
Reference in New Issue
Block a user