diff options
author | Tom <tomut@yahoo.com> | 2021-02-10 23:30:55 -0700 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-02-11 13:11:57 +0100 |
commit | e1333724ea7d8f2dd8669ddae6554b925e170281 (patch) | |
tree | c60ba3ef80bb83007faf3fddf10f764165ca3f5c /Userland/Services | |
parent | 130d48fa13eaab1efa64b41cc79e8e3760eea334 (diff) | |
download | serenity-e1333724ea7d8f2dd8669ddae6554b925e170281.zip |
WindowServer: Blit backing bitmap with transparency for hung windows
We should respect the opacity of the window when painting the window
content of a hung application.
Diffstat (limited to 'Userland/Services')
-rw-r--r-- | Userland/Services/WindowServer/Compositor.cpp | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/Userland/Services/WindowServer/Compositor.cpp b/Userland/Services/WindowServer/Compositor.cpp index 7de34140b6..84bb651e5b 100644 --- a/Userland/Services/WindowServer/Compositor.cpp +++ b/Userland/Services/WindowServer/Compositor.cpp @@ -345,9 +345,18 @@ void Compositor::compose() auto dst = backing_rect.location().translated(dirty_rect_in_backing_coordinates.location()); if (window.client() && window.client()->is_unresponsive()) { - painter.blit_filtered(dst, *backing_store, dirty_rect_in_backing_coordinates, [](Color src) { - return src.to_grayscale().darkened(0.75f); - }); + if (window.is_opaque()) { + painter.blit_filtered(dst, *backing_store, dirty_rect_in_backing_coordinates, [](Color src) { + return src.to_grayscale().darkened(0.75f); + }); + } else { + u8 alpha = 255 * window.opacity(); + painter.blit_filtered(dst, *backing_store, dirty_rect_in_backing_coordinates, [&](Color src) { + auto color = src.to_grayscale().darkened(0.75f); + color.set_alpha(alpha); + return color; + }); + } } else { painter.blit(dst, *backing_store, dirty_rect_in_backing_coordinates, window.opacity()); } |