1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 04:58:13 +00:00

WindowServer: Factor out some parts of compose().

The main compositing loop was getting pretty unwieldy. Break out some parts
into functions so it's more understandable.
This commit is contained in:
Andreas Kling 2019-04-10 13:51:47 +02:00
parent f6543c5946
commit 30e2d62c38
4 changed files with 85 additions and 71 deletions

View file

@ -271,8 +271,10 @@ void Painter::blit_with_alpha(const Point& position, const GraphicsBitmap& sourc
}
}
void Painter::blit(const Point& position, const GraphicsBitmap& source, const Rect& src_rect)
void Painter::blit(const Point& position, const GraphicsBitmap& source, const Rect& src_rect, float opacity)
{
if (opacity < 1.0f)
return blit_with_opacity(position, source, src_rect, opacity);
if (source.has_alpha_channel())
return blit_with_alpha(position, source, src_rect);
auto safe_src_rect = Rect::intersection(src_rect, source.rect());