new backend: add interface for query blur size

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
This commit is contained in:
Yuxuan Shui 2019-07-13 16:55:26 +01:00
parent 9cb7fcf645
commit 4c9ded837f
No known key found for this signature in database
GPG Key ID: 37C999F617EA1A47
5 changed files with 16 additions and 0 deletions

View File

@ -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

View File

@ -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;

View File

@ -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);

View File

@ -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?
};

View File

@ -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: