1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 01:17:35 +00:00

LibGfx: Don't write blended pixel if the alpha is zero

This commit is contained in:
MacDue 2022-11-28 22:26:46 +00:00 committed by Linus Groh
parent e575339564
commit 0e65de2e11

View file

@ -1833,11 +1833,10 @@ void Painter::set_pixel(IntPoint const& p, Color color, bool blend)
if (!clip_rect().contains(point / scale())) if (!clip_rect().contains(point / scale()))
return; return;
auto& dst = m_target->scanline(point.y())[point.x()]; auto& dst = m_target->scanline(point.y())[point.x()];
if (!blend) { if (!blend)
dst = color.value(); dst = color.value();
} else { else if (color.alpha())
dst = Color::from_argb(dst).blend(color).value(); dst = Color::from_argb(dst).blend(color).value();
}
} }
Optional<Color> Painter::get_pixel(IntPoint const& p) Optional<Color> Painter::get_pixel(IntPoint const& p)