Skip to content

WIP: shell: Add a ClutterEffect for rounded clipping

This adds a new ClutterOffscreenEffect subclass to do rounded clipping of the edges of ClutterActors: ShellRoundedClipEffect

The way it works is by painting the actor to an offscreen framebuffer, and then painting that framebuffer using a custom fragment shader that modifies the color of each pixel, also performing anti-aliasing around the edges.

The shader code is taken completely from GTKs GSK and its GskRoundedRect clipping fragment shader, see gskSetOutputColor() [1].

The new effect has two properties, radius and bounds. The radius property allows conveniently specifying a floating point corner radius value for all four corners of the texture and can easily be animated, the bounds property allows setting a graphene_rect_t that's used as the basis clip rectangle that the rounding gets applied on top of.

[1] https://gitlab.gnome.org/GNOME/gtk/-/blob/master/gsk/resources/glsl/preamble.fs.glsl

Edited by Jonas Dreßler

Merge request reports