mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 17:27:35 +00:00
LibWeb: Make computed opacity always available
No need to store opacity as Optional<float> as there's always a value (and the default initial value is 1.)
This commit is contained in:
parent
07f15aa550
commit
ff45eb7fb1
6 changed files with 14 additions and 20 deletions
|
@ -113,10 +113,10 @@ void StackingContext::paint(PaintContext& context)
|
|||
}
|
||||
|
||||
auto opacity = m_box.computed_values().opacity();
|
||||
if (opacity.has_value() && opacity.value() == 0.0f)
|
||||
if (opacity == 0.0f)
|
||||
return;
|
||||
|
||||
if (opacity.has_value() && opacity.value() != 1.0f) {
|
||||
if (opacity < 1.0f) {
|
||||
auto bitmap = context.painter().target();
|
||||
auto new_bitmap = Gfx::Bitmap::try_create(Gfx::BitmapFormat::BGRA8888, bitmap->size());
|
||||
if (!new_bitmap)
|
||||
|
@ -124,7 +124,7 @@ void StackingContext::paint(PaintContext& context)
|
|||
Gfx::Painter painter(*new_bitmap);
|
||||
PaintContext paint_context(painter, context.palette(), context.scroll_offset());
|
||||
paint_internal(paint_context);
|
||||
context.painter().blit(Gfx::IntPoint(m_box.absolute_position()), *new_bitmap, Gfx::IntRect(m_box.absolute_rect()), opacity.value());
|
||||
context.painter().blit(Gfx::IntPoint(m_box.absolute_position()), *new_bitmap, Gfx::IntRect(m_box.absolute_rect()), opacity);
|
||||
} else {
|
||||
paint_internal(context);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue