Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Opacity layers #1074

Merged
merged 2 commits into from Mar 18, 2022
Merged

Opacity layers #1074

merged 2 commits into from Mar 18, 2022

Conversation

tronical
Copy link
Member

Use layers in the GL and Qt backend for rendering the opacity element, to apply it evenly.

Closes #725

@tronical tronical requested a review from ogoffart March 18, 2022 15:05
children_index as usize
}
crate::item_tree::ItemTreeNode::DynamicTree { .. } => panic!(
"internal error: compiler placed Opacity element as a parent for a repeater!"
Copy link
Member

Choose a reason for hiding this comment

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

Maybe this can happen with the useless rectangle removal pass:

a := Rectangle {
   b := Rectangle {
       opacity: 0.5;
       for x in 45: Rectangle { background: red;  } 
    }
}

This will create an opacity element between a and b, and b might be removed. I did not test if this happens, but it really happen in the future.

children_index,
..
} => {
debug_assert_eq!(_children_count, 1);
Copy link
Member

Choose a reason for hiding this comment

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

can also not be the case if there was a useless rectangle optimisation.

target_item.children_count() != Some(0)
};

target_has_children
Copy link
Member

Choose a reason for hiding this comment

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

I guess the best here would be to visit the children of the children. and see if there is overlap.
Then again, we don't know what item really has contents or if they are just transparent TouchArea or other nodes.

Maybe we can leave this optimization out for now.

Copy link
Member Author

Choose a reason for hiding this comment

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

Sure, I'll remove the commit. No objections there :)

This also separates the blend-to-screen part of render_layer into a
helper function, as that will be useful in the future with public layer
elements.

Relates to #725
@tronical tronical merged commit a72aa9f into master Mar 18, 2022
@tronical tronical deleted the simon/opacity-layer branch March 18, 2022 15:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants