1
0
Fork 0
mirror of https://github.com/yshui/picom.git synced 2024-11-11 13:51:02 -05:00

Merge pull request #1107 from absolutelynothelix/name-default-backend-operation-implementations-consistently

This commit is contained in:
Yuxuan Shui 2023-12-16 22:03:14 +00:00 committed by GitHub
commit e90757a6ec
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 9 additions and 19 deletions

View file

@ -211,18 +211,18 @@ struct backend_operations {
struct xvisual_info fmt, bool owned); struct xvisual_info fmt, bool owned);
/// Create a shadow context for rendering shadows with radius `radius`. /// Create a shadow context for rendering shadows with radius `radius`.
/// Default implementation: default_backend_create_shadow_context /// Default implementation: default_create_shadow_context
struct backend_shadow_context *(*create_shadow_context)(backend_t *backend_data, struct backend_shadow_context *(*create_shadow_context)(backend_t *backend_data,
double radius); double radius);
/// Destroy a shadow context /// Destroy a shadow context
/// Default implementation: default_backend_destroy_shadow_context /// Default implementation: default_destroy_shadow_context
void (*destroy_shadow_context)(backend_t *backend_data, void (*destroy_shadow_context)(backend_t *backend_data,
struct backend_shadow_context *ctx); struct backend_shadow_context *ctx);
/// Create a shadow image based on the parameters. Resulting image should have a /// Create a shadow image based on the parameters. Resulting image should have a
/// size of `width + radisu * 2` x `height + radius * 2`. Radius is set when the /// size of `width + radisu * 2` x `height + radius * 2`. Radius is set when the
/// shadow context is created. /// shadow context is created.
/// Default implementation: default_backend_render_shadow /// Default implementation: default_render_shadow
/// ///
/// Required. /// Required.
void *(*render_shadow)(backend_t *backend_data, int width, int height, void *(*render_shadow)(backend_t *backend_data, int width, int height,

View file

@ -293,8 +293,8 @@ shadow_picture_err:
return false; return false;
} }
void *default_backend_render_shadow(backend_t *backend_data, int width, int height, void *default_render_shadow(backend_t *backend_data, int width, int height,
struct backend_shadow_context *sctx, struct color color) { struct backend_shadow_context *sctx, struct color color) {
const conv *kernel = (void *)sctx; const conv *kernel = (void *)sctx;
xcb_render_picture_t shadow_pixel = xcb_render_picture_t shadow_pixel =
solid_picture(backend_data->c, true, 1, color.red, color.green, color.blue); solid_picture(backend_data->c, true, 1, color.red, color.green, color.blue);

View file

@ -54,16 +54,8 @@ solid_picture(struct x_connection *, bool argb, double a, double r, double g, do
xcb_image_t *make_shadow(struct x_connection *c, const conv *kernel, double opacity, xcb_image_t *make_shadow(struct x_connection *c, const conv *kernel, double opacity,
int width, int height); int width, int height);
/// The default implementation of `is_win_transparent`, it simply looks at win::mode. So void *default_render_shadow(backend_t *backend_data, int width, int height,
/// this is not suitable for backends that alter the content of windows struct backend_shadow_context *sctx, struct color color);
bool default_is_win_transparent(void *, win *, void *);
/// The default implementation of `is_frame_transparent`, it uses win::frame_opacity. Same
/// caveat as `default_is_win_transparent` applies.
bool default_is_frame_transparent(void *, win *, void *);
void *default_backend_render_shadow(backend_t *backend_data, int width, int height,
struct backend_shadow_context *sctx, struct color color);
/// Implement `render_shadow` with `shadow_from_mask`. /// Implement `render_shadow` with `shadow_from_mask`.
void * void *

View file

@ -184,7 +184,7 @@ struct backend_operations dummy_ops = {
.bind_pixmap = dummy_bind_pixmap, .bind_pixmap = dummy_bind_pixmap,
.create_shadow_context = default_create_shadow_context, .create_shadow_context = default_create_shadow_context,
.destroy_shadow_context = default_destroy_shadow_context, .destroy_shadow_context = default_destroy_shadow_context,
.render_shadow = default_backend_render_shadow, .render_shadow = default_render_shadow,
.make_mask = dummy_make_mask, .make_mask = dummy_make_mask,
.release_image = dummy_release_image, .release_image = dummy_release_image,
.is_image_transparent = dummy_is_image_transparent, .is_image_transparent = dummy_is_image_transparent,

View file

@ -984,10 +984,8 @@ struct backend_operations xrender_ops = {
.release_image = release_image, .release_image = release_image,
.create_shadow_context = default_create_shadow_context, .create_shadow_context = default_create_shadow_context,
.destroy_shadow_context = default_destroy_shadow_context, .destroy_shadow_context = default_destroy_shadow_context,
.render_shadow = default_backend_render_shadow, .render_shadow = default_render_shadow,
.make_mask = make_mask, .make_mask = make_mask,
//.prepare_win = prepare_win,
//.release_win = release_win,
.is_image_transparent = default_is_image_transparent, .is_image_transparent = default_is_image_transparent,
.buffer_age = buffer_age, .buffer_age = buffer_age,
.max_buffer_age = 2, .max_buffer_age = 2,