Skip to content

Conversation

@tronical
Copy link
Member

The layer clips (by being a texture), so we must make sure to size it
beyond its intrinsic size and include the bounding rect of the children,
in size and position.

Fixes #9808

tronical and others added 3 commits November 18, 2025 15:35
…ng rect

The layer clips (by being a texture), so we must make sure to size it
beyond its intrinsic size and include the bounding rect of the children,
in size **and** position.

cc #9808
Copy link
Member

@ogoffart ogoffart left a comment

Choose a reason for hiding this comment

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

My commit called

Femtovg: Align the layer on the pixel grid

Doesn't work as expected. Because rounded position are not aligned on the pixel grid because there could be a non-integer translation, and as a result, adding an opactiy makes the text blury.

if let Some((layer_offset, layer_image)) = self.render_layer(item_rc, &|| {
// We don't need to include the size of the "layer" item itself, since it has no content.
let children_rect = i_slint_core::properties::evaluate_no_tracking(|| {
item_rc.geometry().union(
Copy link
Member

Choose a reason for hiding this comment

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

As the comment two line earlier say, you don't need this union (and i've removed it for femtovg in one of my commits)

Copy link
Member Author

Choose a reason for hiding this comment

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

Done :)

ogoffart and others added 3 commits November 18, 2025 17:15
The layer_origin should normally always be 0,0 for the Clip element
since the Clip element always cover its parent.
But the correct thing to do is anyway to translate by the origin.
…rect

The layer clips (by being a texture), so we must make sure to size it
beyond its intrinsic size and include the bounding rect of the children,
in size **and** position.

cc #9808
(as advised by Olivier and also done in femtovg)
@tronical tronical force-pushed the simon/layer-transform branch from 4e03326 to 0cd1112 Compare November 18, 2025 16:15
@tronical
Copy link
Member Author

My commit called

Femtovg: Align the layer on the pixel grid

Doesn't work as expected. Because rounded position are not aligned on the pixel grid because there could be a non-integer translation, and as a result, adding an opactiy makes the text blury.

ACK, I've removed the commit.

Copy link
Contributor

@expenses expenses left a comment

Choose a reason for hiding this comment

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

Looks good


pub enum ItemGraphicsCacheEntry<R: femtovg::Renderer + TextureImporter> {
Texture(Rc<Texture<R>>),
TextureWithOrigin {
Copy link
Contributor

Choose a reason for hiding this comment

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

Could do with a line of documentation here

cached_image
});
let image_id = match cache_entry {
Some(ItemGraphicsCacheEntry::Texture(image)) => image.id,
Copy link
Contributor

Choose a reason for hiding this comment

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

this should probably be texture.id as well.

@tronical tronical force-pushed the simon/layer-transform branch from 59285c1 to 5ff952c Compare November 19, 2025 08:07
@tronical tronical requested a review from expenses November 20, 2025 07:41
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.

FemtoVG doesn't render things inside a empty element (no clip) when it has opacity

4 participants