mirror of
https://github.com/slint-ui/slint.git
synced 2025-09-30 05:44:52 +00:00
Improve performance of opacity rendering
Avoid an opacity layer also in the case where it is applied to an element with no children.
This commit is contained in:
parent
d6a569b8f8
commit
033cf3721e
3 changed files with 47 additions and 2 deletions
|
@ -690,9 +690,10 @@ impl ItemRenderer for GLItemRenderer {
|
|||
|
||||
fn visit_opacity(&mut self, opacity_item: Pin<&Opacity>, self_rc: &ItemRc) -> RenderingResult {
|
||||
let opacity = opacity_item.opacity();
|
||||
if opacity != 1.0 {
|
||||
if Opacity::need_layer(self_rc, opacity) {
|
||||
self.render_and_blend_layer(&opacity_item.cached_rendering_data, opacity, self_rc)
|
||||
} else {
|
||||
self.apply_opacity(opacity);
|
||||
opacity_item
|
||||
.cached_rendering_data
|
||||
.release(&mut self.graphics_window.graphics_cache.borrow_mut());
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue