1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 18:17:44 +00:00

WindowServer: Implement simple window shadows

This implements simple window shadows around most windows, including
tooltips. Because this method uses a bitmap for the shadow bits,
it is limited to rectangular window frames. For non-rectangular
window frames we'll need to implement a more sophisticated algorithm.
This commit is contained in:
Tom 2021-02-08 17:27:51 -07:00 committed by Andreas Kling
parent 72fdab7bfb
commit 0ce4b9d7db
14 changed files with 234 additions and 70 deletions

View file

@ -735,13 +735,13 @@ void Painter::blit_with_alpha(const IntPoint& position, const Gfx::Bitmap& sourc
}
}
void Painter::blit(const IntPoint& position, const Gfx::Bitmap& source, const IntRect& a_src_rect, float opacity)
void Painter::blit(const IntPoint& position, const Gfx::Bitmap& source, const IntRect& a_src_rect, float opacity, bool apply_alpha)
{
ASSERT(scale() >= source.scale() && "painter doesn't support downsampling scale factors");
if (opacity < 1.0f)
return blit_with_opacity(position, source, a_src_rect, opacity);
if (source.has_alpha_channel())
if (source.has_alpha_channel() && apply_alpha)
return blit_with_alpha(position, source, a_src_rect);
auto safe_src_rect = a_src_rect.intersected(source.rect());