From 0af969543d1d898c071c82e15e003ba428ba1178 Mon Sep 17 00:00:00 2001 From: Norman Feske Date: Tue, 8 Sep 2020 17:05:38 +0200 Subject: [PATCH] nitpicker: preserve alpha channel during resize This patch reduces flickering artifacts that appear during the resizing of clients that use an alpha channel. Issue #3812 --- .../os/src/server/nitpicker/resizeable_texture.h | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/repos/os/src/server/nitpicker/resizeable_texture.h b/repos/os/src/server/nitpicker/resizeable_texture.h index 2907f6c537..942d22a841 100644 --- a/repos/os/src/server/nitpicker/resizeable_texture.h +++ b/repos/os/src/server/nitpicker/resizeable_texture.h @@ -16,6 +16,7 @@ /* Genode includes */ #include +#include /* local includes */ #include "chunky_texture.h" @@ -80,6 +81,20 @@ class Nitpicker::Resizeable_texture Texture const &texture = *_textures[_current]; Blit_painter::paint(surface, texture, Point(0, 0)); + + /* copy alpha channel */ + if (_textures[_current]->alpha() && _textures[next]->alpha()) { + + typedef Pixel_alpha8 AT; + + Surface surface((AT *)_textures[next]->alpha(), + _textures[next]->Texture_base::size()); + + Texture const texture((AT *)_textures[_current]->alpha(), nullptr, + _textures[_current]->Texture_base::size()); + + Blit_painter::paint(surface, texture, Point(0, 0)); + } } _textures[_current].destruct();