mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 00:47:45 +00:00
LibGfx: Don't write blended pixel if the alpha is zero
This commit is contained in:
parent
e575339564
commit
0e65de2e11
1 changed files with 2 additions and 3 deletions
|
@ -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)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue