new backends: blur interface update

To prepare for different blur methods, the blur interface of backends
has been splitted into two parts.

Now to use blur, a blur context must be created first; then, the blur
method should be called with the blur context created.

Updated the existing backends to the new interface. Also implemented
handling of the new blur options.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
This commit is contained in:
Yuxuan Shui
2019-06-09 19:25:34 +01:00
parent 1eba43f888
commit 67f0ec773a
8 changed files with 274 additions and 141 deletions

View File

@@ -130,8 +130,9 @@ struct backend_operations {
void (*fill)(backend_t *backend_data, struct color, const region_t *clip);
/// Blur a given region of the target.
bool (*blur)(backend_t *backend_data, double opacity, const region_t *reg_blur,
const region_t *reg_visible) attr_nonnull(1, 3, 4);
bool (*blur)(backend_t *backend_data, double opacity, void *blur_ctx,
const region_t *reg_blur, const region_t *reg_visible)
attr_nonnull(1, 3, 4, 5);
/// Present the back buffer onto the screen.
///
@@ -209,6 +210,10 @@ struct backend_operations {
/// returned image should not affect the original image
void *(*copy)(backend_t *base, const void *image_data, const region_t *reg_visible);
/// 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);
// =========== Hooks ============
/// Let the backend hook into the event handling queue
void (*set_ready_callback)(backend_t *, backend_ready_callback_t cb);