Skip to content

Conversation

@the-eater
Copy link
Contributor

@the-eater the-eater commented Nov 24, 2025

This MR removed the enum corner_location and apparently also fixes some issues with scaling.

with SwayFX the changes live look like this:

Settings Before After
transform normal 20251125_16h37m06s_grim 20251125_16h22m42s_grim
transform 90 20251125_16h37m14s_grim 20251125_16h23m13s_grim
transform flipped-90 20251125_16h37m37s_grim 20251125_16h23m21s_grim

Closes #137

@the-eater the-eater marked this pull request as draft November 24, 2025 23:36
@the-eater the-eater marked this pull request as ready for review November 25, 2025 14:20
@the-eater the-eater force-pushed the remove-corner-location branch from 0b31c53 to 283da66 Compare November 25, 2025 16:06
@the-eater
Copy link
Contributor Author

With the last commit, fixing corner rotation on blur (look at the difference in the corners of the buffer)

Before After
20251125_16h22m42s_grim 20251125_17h53m41s_grim
20251125_16h23m13s_grim 20251125_17h53m50s_grim
20251125_16h23m21s_grim 20251125_17h53m55s_grim

@the-eater the-eater force-pushed the remove-corner-location branch from 03a8db9 to ad6afda Compare November 25, 2025 23:18
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems like these changes actually add some LOC over the original implementation overall, I think we should scrap this bit to keep the diff lean

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know we save some LOC in fx_pass.c but I think we add more in shaders.c for a positive overall LOC diff, esp considering the glUniform1f calls in fx_pass can be oneliners now

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as with shaders.h

int corner_radius;
enum corner_location corners;
struct clipped_region clipped_region;
struct fx_corner_radii corners;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

all the other options have a fradii type, why not blur_pass_options?

Comment on lines +277 to +299
static bool apply_clip_region(pixman_region32_t *clip_region,
const struct wlr_box *clipped_region_box, const struct fx_corner_fradii *corners) {
if (!wlr_box_empty(clipped_region_box)) {
float top = fmax(corners->top_left, corners->top_right);
float bottom = fmax(corners->bottom_left, corners->bottom_right);
float left = fmax(corners->top_left, corners->bottom_left);
float right = fmax(corners->top_right, corners->bottom_right);

pixman_region32_t user_clip_region;
pixman_region32_init_rect(
&user_clip_region,
clipped_region_box->x + (left * 0.3),
clipped_region_box->y + (top * 0.3),
fmax(clipped_region_box->width - (left + right) * 0.3, 0),
fmax(clipped_region_box->height - (top + bottom) * 0.3, 0)
);
pixman_region32_subtract(clip_region, clip_region, &user_clip_region);
pixman_region32_fini(&user_clip_region);
return true;
}

return false;
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice!

Comment on lines +16 to +21
struct fx_corner_fradii {
float top_left;
float top_right;
float bottom_right;
float bottom_left;
};
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The fradii stuff is just needed on the scenefx side as far as I could tell, we should move it and its functions to a private header (unless I missed a case)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

error when CORNER_LOCATION_NONE and corner_radius != 0

2 participants