mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 03:17:35 +00:00
LibGfx: Use ErrorOr<T> for Bitmap::try_load_from_file()
This was used in a lot of places, so this patch makes liberal use of ErrorOr<T>::release_value_but_fixme_should_propagate_errors().
This commit is contained in:
parent
16f064d9be
commit
235f39e449
104 changed files with 412 additions and 397 deletions
|
@ -75,14 +75,14 @@ void Canvas::paint_event(GUI::PaintEvent& event)
|
|||
|
||||
void Canvas::draw(Gfx::Painter& painter)
|
||||
{
|
||||
auto active_window_icon = Gfx::Bitmap::try_load_from_file("/res/icons/16x16/window.png");
|
||||
auto active_window_icon = Gfx::Bitmap::try_load_from_file("/res/icons/16x16/window.png").release_value_but_fixme_should_propagate_errors();
|
||||
Gfx::WindowTheme::current().paint_normal_frame(painter, Gfx::WindowTheme::WindowState::Active, { 4, 18, WIDTH - 8, HEIGHT - 29 }, "Well hello friends 🐞", *active_window_icon, palette(), { WIDTH - 20, 6, 16, 16 }, 0, false);
|
||||
|
||||
painter.draw_rect({ 20, 34, WIDTH - 40, HEIGHT - 45 }, palette().color(Gfx::ColorRole::Selection), true);
|
||||
painter.draw_rect({ 24, 38, WIDTH - 48, HEIGHT - 53 }, palette().color(Gfx::ColorRole::Selection));
|
||||
|
||||
// buggie.png has an alpha channel.
|
||||
auto buggie = Gfx::Bitmap::try_load_from_file("/res/graphics/buggie.png");
|
||||
auto buggie = Gfx::Bitmap::try_load_from_file("/res/graphics/buggie.png").release_value_but_fixme_should_propagate_errors();
|
||||
painter.blit({ 25, 39 }, *buggie, { 2, 30, 62, 20 });
|
||||
painter.draw_scaled_bitmap({ 88, 39, 62 * 2, 20 * 2 }, *buggie, Gfx::IntRect { 2, 30, 62, 20 });
|
||||
painter.draw_scaled_bitmap({ 202, 39, 80, 40 }, *buggie, Gfx::IntRect { 2, 30, 62, 20 });
|
||||
|
@ -92,7 +92,7 @@ void Canvas::draw(Gfx::Painter& painter)
|
|||
painter.blit({ 25, 101 }, *buggie, { 2, 30, 3 * buggie->width(), 20 });
|
||||
|
||||
// grid does not have an alpha channel.
|
||||
auto grid = Gfx::Bitmap::try_load_from_file("/res/wallpapers/grid.png");
|
||||
auto grid = Gfx::Bitmap::try_load_from_file("/res/wallpapers/grid.png").release_value_but_fixme_should_propagate_errors();
|
||||
VERIFY(!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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue