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:
Simon Hausmann 2022-03-25 10:25:53 +01:00 committed by Simon Hausmann
parent d6a569b8f8
commit 033cf3721e
3 changed files with 47 additions and 2 deletions

View file

@ -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());