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
Opacity layers #1074
Conversation
internal/core/items.rs
Outdated
children_index as usize | ||
} | ||
crate::item_tree::ItemTreeNode::DynamicTree { .. } => panic!( | ||
"internal error: compiler placed Opacity element as a parent for a repeater!" |
There was a problem hiding this comment.
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.
internal/core/items.rs
Outdated
children_index, | ||
.. | ||
} => { | ||
debug_assert_eq!(_children_count, 1); |
There was a problem hiding this comment.
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.
internal/core/items.rs
Outdated
target_item.children_count() != Some(0) | ||
}; | ||
|
||
target_has_children |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
beaf5e4
to
9a7cc17
Compare
Use layers in the GL and Qt backend for rendering the opacity element, to apply it evenly.
Closes #725