mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 14:47:44 +00:00
LibGfx: Fix opacity handling in Painter::draw_scaled_bitmap
If the source image had no alpha channel we'd ignore opacity < 1.0 and blit the image as if it was fully opaque. With this fix, adjusting the opacity of windows with mousewheel while holding super works in hidpi mode.
This commit is contained in:
parent
dfb12e2a73
commit
ea8baaa1ab
2 changed files with 6 additions and 5 deletions
|
@ -108,10 +108,11 @@ void Canvas::draw(Gfx::Painter& painter)
|
|||
|
||||
painter.blit({ 25, 101 }, *buggie, { 2, 30, 3 * buggie->width(), 20 });
|
||||
|
||||
// banner does not have an alpha channel.
|
||||
auto banner = Gfx::Bitmap::load_from_file("/res/graphics/brand-banner.png");
|
||||
painter.fill_rect({ 25, 122, 28, 20 }, Color::Green);
|
||||
painter.blit({ 25, 122 }, *banner, { 314, 12, 28, 20 }, 0.8);
|
||||
// grid does not have an alpha channel.
|
||||
auto grid = Gfx::Bitmap::load_from_file("/res/wallpapers/grid.png");
|
||||
ASSERT(!grid->has_alpha_channel());
|
||||
painter.fill_rect({ 25, 122, 62, 20 }, Color::Green);
|
||||
painter.blit({ 25, 122 }, *grid, { (grid->width() - 62) / 2, (grid->height() - 20) / 2 + 40, 62, 20 }, 0.9);
|
||||
}
|
||||
|
||||
int main(int argc, char** argv)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue