backend: make set_image_property take const args

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
This commit is contained in:
Yuxuan Shui 2024-03-19 14:57:24 +00:00
parent f7e538fe88
commit 8a5120ed86
No known key found for this signature in database
GPG Key ID: D3A4405BE6CC17F4
7 changed files with 12 additions and 12 deletions

View File

@ -335,7 +335,7 @@ struct backend_operations {
* @return whether the operation is successful
*/
bool (*set_image_property)(backend_t *backend_data, enum image_properties prop,
image_handle image, void *args) attr_nonnull(1, 3);
image_handle image, const void *args) attr_nonnull(1, 3);
/**
* Manipulate an image. Image properties are untouched.

View File

@ -467,11 +467,11 @@ image_handle default_clone_image(backend_t *base attr_unused, image_handle image
}
bool default_set_image_property(backend_t *base attr_unused, enum image_properties op,
image_handle image, void *arg) {
image_handle image, const void *arg) {
auto tex = (struct backend_image *)image;
int *iargs = arg;
bool *bargs = arg;
double *dargs = arg;
const int *iargs = arg;
const bool *bargs = arg;
const double *dargs = arg;
switch (op) {
case IMAGE_PROPERTY_INVERTED: tex->color_inverted = bargs[0]; break;
case IMAGE_PROPERTY_DIM_LEVEL: tex->dim = dargs[0]; break;

View File

@ -75,5 +75,5 @@ struct dual_kawase_params *generate_dual_kawase_params(void *args);
image_handle default_clone_image(backend_t *base, image_handle image, const region_t *reg);
bool default_is_image_transparent(backend_t *base attr_unused, image_handle image);
bool default_set_image_property(backend_t *base attr_unused, enum image_properties op,
image_handle image, void *arg);
image_handle image, const void *arg);
struct backend_image *default_new_backend_image(int w, int h);

View File

@ -148,7 +148,7 @@ image_handle dummy_make_mask(struct backend_base *base, geometry_t size attr_unu
}
bool dummy_set_image_property(struct backend_base *base, enum image_properties prop attr_unused,
image_handle image, void *arg attr_unused) {
image_handle image, const void *arg attr_unused) {
dummy_check_image(base, image);
return true;
}

View File

@ -1242,7 +1242,7 @@ bool gl_image_op(backend_t *base, enum image_operations op, image_handle image,
}
bool gl_set_image_property(backend_t *backend_data, enum image_properties prop,
image_handle image, void *args) {
image_handle image, const void *args) {
if (prop != IMAGE_PROPERTY_CUSTOM_SHADER) {
return default_set_image_property(backend_data, prop, image, args);
}

View File

@ -86,7 +86,7 @@ struct gl_texture {
// Textures for auxiliary uses.
GLuint auxiliary_texture[2];
gl_win_shader_t *shader;
const gl_win_shader_t *shader;
void *user_data;
};
@ -144,7 +144,7 @@ void *gl_create_window_shader(backend_t *backend_data, const char *source);
void gl_destroy_window_shader(backend_t *backend_data, void *shader);
uint64_t gl_get_shader_attributes(backend_t *backend_data, void *shader);
bool gl_set_image_property(backend_t *backend_data, enum image_properties prop,
image_handle image, void *args);
image_handle image, const void *args);
bool gl_last_render_time(backend_t *backend_data, struct timespec *time);
/**

View File

@ -986,10 +986,10 @@ image_handle xrender_clone_image(backend_t *base attr_unused, image_handle image
}
static bool xrender_set_image_property(backend_t *base, enum image_properties op,
image_handle image, void *args) {
image_handle image, const void *args) {
auto xrimg = (struct xrender_image *)image;
if (op == IMAGE_PROPERTY_CORNER_RADIUS &&
((double *)args)[0] != xrimg->base.corner_radius) {
((const double *)args)[0] != xrimg->base.corner_radius) {
// Free cached rounded rectangle if corner radius changed
xrender_release_rounded_corner_cache(base, xrimg->rounded_rectangle);
xrimg->rounded_rectangle = NULL;