new backend: add interface for query blur size
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
This commit is contained in:
parent
9cb7fcf645
commit
4c9ded837f
|
@ -213,6 +213,7 @@ struct backend_operations {
|
|||
/// Create a blur context that can be used to call `blur`
|
||||
void *(*create_blur_context)(backend_t *base, enum blur_method, void *args);
|
||||
void (*destroy_blur_context)(backend_t *base, void *ctx);
|
||||
void (*get_blur_size)(void *blur_context, int *width, int *height);
|
||||
|
||||
// =========== Hooks ============
|
||||
/// Let the backend hook into the event handling queue
|
||||
|
|
|
@ -907,6 +907,12 @@ out:
|
|||
return ctx;
|
||||
}
|
||||
|
||||
void gl_get_blur_size(void *blur_context, int *width, int *height) {
|
||||
struct gl_blur_context *ctx = blur_context;
|
||||
*width = ctx->resize_width;
|
||||
*height = ctx->resize_height;
|
||||
}
|
||||
|
||||
// clang-format off
|
||||
const char *win_shader_glsl = GLSL(330,
|
||||
uniform float opacity;
|
||||
|
|
|
@ -105,6 +105,7 @@ bool gl_blur(backend_t *base, double opacity, void *, const region_t *reg_blur,
|
|||
const region_t *reg_visible);
|
||||
void *gl_create_blur_context(backend_t *base, enum blur_method, void *args);
|
||||
void gl_destroy_blur_context(backend_t *base, void *ctx);
|
||||
void gl_get_blur_size(void *blur_context, int *width, int *height);
|
||||
|
||||
bool gl_is_image_transparent(backend_t *base, void *image_data);
|
||||
void gl_fill(backend_t *base, struct color, const region_t *clip);
|
||||
|
|
|
@ -472,6 +472,7 @@ struct backend_operations glx_ops = {
|
|||
.fill = gl_fill,
|
||||
.create_blur_context = gl_create_blur_context,
|
||||
.destroy_blur_context = gl_destroy_blur_context,
|
||||
.get_blur_size = gl_get_blur_size,
|
||||
.max_buffer_age = 5, // Why?
|
||||
};
|
||||
|
||||
|
|
|
@ -530,6 +530,12 @@ void destroy_blur_context(backend_t *base, void *ctx_) {
|
|||
free(ctx);
|
||||
}
|
||||
|
||||
void get_blur_size(void *blur_context, int *width, int *height) {
|
||||
struct _xrender_blur_context *ctx = blur_context;
|
||||
*width = ctx->resize_width;
|
||||
*height = ctx->resize_height;
|
||||
}
|
||||
|
||||
backend_t *backend_xrender_init(session_t *ps) {
|
||||
auto xd = ccalloc(1, struct _xrender_data);
|
||||
init_backend_base(&xd->base, ps);
|
||||
|
@ -632,6 +638,7 @@ struct backend_operations xrender_ops = {
|
|||
.copy = copy,
|
||||
.create_blur_context = create_blur_context,
|
||||
.destroy_blur_context = destroy_blur_context,
|
||||
.get_blur_size = get_blur_size,
|
||||
};
|
||||
|
||||
// vim: set noet sw=8 ts=8:
|
||||
|
|
Loading…
Reference in New Issue