mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 07:57:46 +00:00
LibGfx: Remove try_
prefix from bitmap creation functions
Those don't have any non-try counterpart, so we might as well just omit it.
This commit is contained in:
parent
1971bff314
commit
82a152b696
186 changed files with 598 additions and 598 deletions
|
@ -19,7 +19,7 @@ namespace Cards {
|
|||
ErrorOr<NonnullRefPtr<GUI::Action>> make_cards_settings_action(GUI::Window* parent)
|
||||
{
|
||||
auto action = GUI::Action::create(
|
||||
"&Cards Settings", {}, TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/games.png"sv)), [parent](auto&) {
|
||||
"&Cards Settings", {}, TRY(Gfx::Bitmap::load_from_file("/res/icons/16x16/games.png"sv)), [parent](auto&) {
|
||||
GUI::Process::spawn_or_show_error(parent, "/bin/GamesSettings"sv, Array { "--open-tab", "cards" });
|
||||
},
|
||||
parent);
|
||||
|
|
|
@ -168,7 +168,7 @@ void CardPainter::set_background_color(Color background_color)
|
|||
|
||||
NonnullRefPtr<Gfx::Bitmap> CardPainter::create_card_bitmap()
|
||||
{
|
||||
return Gfx::Bitmap::try_create(Gfx::BitmapFormat::BGRA8888, { Card::width, Card::height }).release_value_but_fixme_should_propagate_errors();
|
||||
return Gfx::Bitmap::create(Gfx::BitmapFormat::BGRA8888, { Card::width, Card::height }).release_value_but_fixme_should_propagate_errors();
|
||||
}
|
||||
|
||||
void CardPainter::paint_card_front(Gfx::Bitmap& bitmap, Cards::Suit suit, Cards::Rank rank)
|
||||
|
@ -225,7 +225,7 @@ void CardPainter::paint_card_back(Gfx::Bitmap& bitmap)
|
|||
auto inner_paint_rect = paint_rect.shrunken(2, 2);
|
||||
painter.fill_rect_with_rounded_corners(inner_paint_rect, Color::White, Card::card_radius - 1);
|
||||
|
||||
auto image = Gfx::Bitmap::try_load_from_file(m_background_image_path).release_value_but_fixme_should_propagate_errors();
|
||||
auto image = Gfx::Bitmap::load_from_file(m_background_image_path).release_value_but_fixme_should_propagate_errors();
|
||||
painter.blit({ (bitmap.width() - image->width()) / 2, (bitmap.height() - image->height()) / 2 }, image, image->rect());
|
||||
}
|
||||
|
||||
|
|
|
@ -21,12 +21,12 @@ namespace GUI {
|
|||
AbstractThemePreview::AbstractThemePreview(Gfx::Palette const& preview_palette)
|
||||
: m_preview_palette(preview_palette)
|
||||
{
|
||||
m_active_window_icon = Gfx::Bitmap::try_load_from_file("/res/icons/16x16/window.png"sv).release_value_but_fixme_should_propagate_errors();
|
||||
m_inactive_window_icon = Gfx::Bitmap::try_load_from_file("/res/icons/16x16/window.png"sv).release_value_but_fixme_should_propagate_errors();
|
||||
m_active_window_icon = Gfx::Bitmap::load_from_file("/res/icons/16x16/window.png"sv).release_value_but_fixme_should_propagate_errors();
|
||||
m_inactive_window_icon = Gfx::Bitmap::load_from_file("/res/icons/16x16/window.png"sv).release_value_but_fixme_should_propagate_errors();
|
||||
|
||||
m_default_close_bitmap = Gfx::Bitmap::try_load_from_file("/res/icons/16x16/window-close.png"sv).release_value_but_fixme_should_propagate_errors();
|
||||
m_default_maximize_bitmap = Gfx::Bitmap::try_load_from_file("/res/icons/16x16/upward-triangle.png"sv).release_value_but_fixme_should_propagate_errors();
|
||||
m_default_minimize_bitmap = Gfx::Bitmap::try_load_from_file("/res/icons/16x16/downward-triangle.png"sv).release_value_but_fixme_should_propagate_errors();
|
||||
m_default_close_bitmap = Gfx::Bitmap::load_from_file("/res/icons/16x16/window-close.png"sv).release_value_but_fixme_should_propagate_errors();
|
||||
m_default_maximize_bitmap = Gfx::Bitmap::load_from_file("/res/icons/16x16/upward-triangle.png"sv).release_value_but_fixme_should_propagate_errors();
|
||||
m_default_minimize_bitmap = Gfx::Bitmap::load_from_file("/res/icons/16x16/downward-triangle.png"sv).release_value_but_fixme_should_propagate_errors();
|
||||
|
||||
VERIFY(m_active_window_icon);
|
||||
VERIFY(m_inactive_window_icon);
|
||||
|
@ -44,7 +44,7 @@ void AbstractThemePreview::load_theme_bitmaps()
|
|||
last_path = DeprecatedString::empty();
|
||||
bitmap = nullptr;
|
||||
} else if (last_path != path) {
|
||||
auto bitmap_or_error = Gfx::Bitmap::try_load_from_file(path);
|
||||
auto bitmap_or_error = Gfx::Bitmap::load_from_file(path);
|
||||
if (bitmap_or_error.is_error()) {
|
||||
last_path = DeprecatedString::empty();
|
||||
bitmap = nullptr;
|
||||
|
|
|
@ -52,13 +52,13 @@ public:
|
|||
if (index.column() == Column::Icon) {
|
||||
if (suggestion.language == CodeComprehension::Language::Cpp) {
|
||||
if (!s_cpp_identifier_icon) {
|
||||
s_cpp_identifier_icon = Gfx::Bitmap::try_load_from_file("/res/icons/16x16/completion/cpp-identifier.png"sv).release_value_but_fixme_should_propagate_errors();
|
||||
s_cpp_identifier_icon = Gfx::Bitmap::load_from_file("/res/icons/16x16/completion/cpp-identifier.png"sv).release_value_but_fixme_should_propagate_errors();
|
||||
}
|
||||
return *s_cpp_identifier_icon;
|
||||
}
|
||||
if (suggestion.language == CodeComprehension::Language::Unspecified) {
|
||||
if (!s_unspecified_identifier_icon) {
|
||||
s_unspecified_identifier_icon = Gfx::Bitmap::try_load_from_file("/res/icons/16x16/completion/unspecified-identifier.png"sv).release_value_but_fixme_should_propagate_errors();
|
||||
s_unspecified_identifier_icon = Gfx::Bitmap::load_from_file("/res/icons/16x16/completion/unspecified-identifier.png"sv).release_value_but_fixme_should_propagate_errors();
|
||||
}
|
||||
return *s_unspecified_identifier_icon;
|
||||
}
|
||||
|
|
|
@ -185,7 +185,7 @@ void Button::set_icon(RefPtr<Gfx::Bitmap> icon)
|
|||
|
||||
void Button::set_icon_from_path(DeprecatedString const& path)
|
||||
{
|
||||
auto maybe_bitmap = Gfx::Bitmap::try_load_from_file(path);
|
||||
auto maybe_bitmap = Gfx::Bitmap::load_from_file(path);
|
||||
if (maybe_bitmap.is_error()) {
|
||||
dbgln("Unable to load bitmap `{}` for button icon", path);
|
||||
return;
|
||||
|
|
|
@ -103,12 +103,12 @@ RefPtr<Gfx::Bitmap> Clipboard::DataAndType::as_bitmap() const
|
|||
|
||||
// We won't actually write to the clipping_bitmap, so casting away the const is okay.
|
||||
auto clipping_data = const_cast<u8*>(data.data());
|
||||
auto clipping_bitmap_or_error = Gfx::Bitmap::try_create_wrapper(bitmap_format, { (int)width.value(), (int)height.value() }, scale.value(), pitch.value(), clipping_data);
|
||||
auto clipping_bitmap_or_error = Gfx::Bitmap::create_wrapper(bitmap_format, { (int)width.value(), (int)height.value() }, scale.value(), pitch.value(), clipping_data);
|
||||
if (clipping_bitmap_or_error.is_error())
|
||||
return nullptr;
|
||||
auto clipping_bitmap = clipping_bitmap_or_error.release_value_but_fixme_should_propagate_errors();
|
||||
|
||||
auto bitmap_or_error = Gfx::Bitmap::try_create(Gfx::BitmapFormat::BGRA8888, { (int)width.value(), (int)height.value() }, scale.value());
|
||||
auto bitmap_or_error = Gfx::Bitmap::create(Gfx::BitmapFormat::BGRA8888, { (int)width.value(), (int)height.value() }, scale.value());
|
||||
if (bitmap_or_error.is_error())
|
||||
return nullptr;
|
||||
auto bitmap = bitmap_or_error.release_value_but_fixme_should_propagate_errors();
|
||||
|
|
|
@ -187,7 +187,7 @@ ColorPicker::ColorPicker(Color color, Window* parent_window, DeprecatedString ti
|
|||
: Dialog(parent_window)
|
||||
, m_color(color)
|
||||
{
|
||||
set_icon(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/color-chooser.png"sv).release_value_but_fixme_should_propagate_errors());
|
||||
set_icon(Gfx::Bitmap::load_from_file("/res/icons/16x16/color-chooser.png"sv).release_value_but_fixme_should_propagate_errors());
|
||||
set_title(title);
|
||||
set_resizable(false);
|
||||
resize(480, 326);
|
||||
|
@ -552,7 +552,7 @@ ColorField::ColorField(Color color)
|
|||
|
||||
void ColorField::create_color_bitmap()
|
||||
{
|
||||
m_color_bitmap = Gfx::Bitmap::try_create(Gfx::BitmapFormat::BGRx8888, { 256, 256 }).release_value_but_fixme_should_propagate_errors();
|
||||
m_color_bitmap = Gfx::Bitmap::create(Gfx::BitmapFormat::BGRx8888, { 256, 256 }).release_value_but_fixme_should_propagate_errors();
|
||||
auto painter = Gfx::Painter(*m_color_bitmap);
|
||||
|
||||
Gfx::HSV hsv;
|
||||
|
@ -678,7 +678,7 @@ void ColorField::resize_event(ResizeEvent&)
|
|||
ColorSlider::ColorSlider(double value)
|
||||
: m_value(value)
|
||||
{
|
||||
m_color_bitmap = Gfx::Bitmap::try_create(Gfx::BitmapFormat::BGRx8888, { 32, 360 }).release_value_but_fixme_should_propagate_errors();
|
||||
m_color_bitmap = Gfx::Bitmap::create(Gfx::BitmapFormat::BGRx8888, { 32, 360 }).release_value_but_fixme_should_propagate_errors();
|
||||
auto painter = Gfx::Painter(*m_color_bitmap);
|
||||
|
||||
for (int h = 0; h < 360; h++) {
|
||||
|
|
|
@ -102,7 +102,7 @@ ComboBox::ComboBox()
|
|||
|
||||
m_open_button = add<Button>();
|
||||
m_open_button->set_button_style(Gfx::ButtonStyle::ThickCap);
|
||||
m_open_button->set_icon(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/downward-triangle.png"sv).release_value_but_fixme_should_propagate_errors());
|
||||
m_open_button->set_icon(Gfx::Bitmap::load_from_file("/res/icons/16x16/downward-triangle.png"sv).release_value_but_fixme_should_propagate_errors());
|
||||
m_open_button->set_focus_policy(GUI::FocusPolicy::NoFocus);
|
||||
m_open_button->on_click = [this](auto) {
|
||||
if (!m_list_view->item_count())
|
||||
|
|
|
@ -29,78 +29,78 @@ NonnullRefPtr<Action> make_about_action(DeprecatedString const& app_name, Icon c
|
|||
|
||||
NonnullRefPtr<Action> make_open_action(Function<void(Action&)> callback, Core::Object* parent)
|
||||
{
|
||||
auto action = Action::create("&Open...", { Mod_Ctrl, Key_O }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/open.png"sv).release_value_but_fixme_should_propagate_errors(), move(callback), parent);
|
||||
auto action = Action::create("&Open...", { Mod_Ctrl, Key_O }, Gfx::Bitmap::load_from_file("/res/icons/16x16/open.png"sv).release_value_but_fixme_should_propagate_errors(), move(callback), parent);
|
||||
action->set_status_tip("Open an existing file");
|
||||
return action;
|
||||
}
|
||||
|
||||
NonnullRefPtr<Action> make_save_action(Function<void(Action&)> callback, Core::Object* parent)
|
||||
{
|
||||
auto action = Action::create("&Save", { Mod_Ctrl, Key_S }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/save.png"sv).release_value_but_fixme_should_propagate_errors(), move(callback), parent);
|
||||
auto action = Action::create("&Save", { Mod_Ctrl, Key_S }, Gfx::Bitmap::load_from_file("/res/icons/16x16/save.png"sv).release_value_but_fixme_should_propagate_errors(), move(callback), parent);
|
||||
action->set_status_tip("Save the current file");
|
||||
return action;
|
||||
}
|
||||
|
||||
NonnullRefPtr<Action> make_save_as_action(Function<void(Action&)> callback, Core::Object* parent)
|
||||
{
|
||||
auto action = Action::create("Save &As...", { Mod_Ctrl | Mod_Shift, Key_S }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/save-as.png"sv).release_value_but_fixme_should_propagate_errors(), move(callback), parent);
|
||||
auto action = Action::create("Save &As...", { Mod_Ctrl | Mod_Shift, Key_S }, Gfx::Bitmap::load_from_file("/res/icons/16x16/save-as.png"sv).release_value_but_fixme_should_propagate_errors(), move(callback), parent);
|
||||
action->set_status_tip("Save the current file with a new name");
|
||||
return action;
|
||||
}
|
||||
|
||||
NonnullRefPtr<Action> make_move_to_front_action(Function<void(Action&)> callback, Core::Object* parent)
|
||||
{
|
||||
auto action = Action::create("Move to &Front", { Mod_Ctrl | Mod_Shift, Key_Up }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/move-to-front.png"sv).release_value_but_fixme_should_propagate_errors(), move(callback), parent);
|
||||
auto action = Action::create("Move to &Front", { Mod_Ctrl | Mod_Shift, Key_Up }, Gfx::Bitmap::load_from_file("/res/icons/16x16/move-to-front.png"sv).release_value_but_fixme_should_propagate_errors(), move(callback), parent);
|
||||
action->set_status_tip("Move to the top of the stack");
|
||||
return action;
|
||||
}
|
||||
|
||||
NonnullRefPtr<Action> make_move_to_back_action(Function<void(Action&)> callback, Core::Object* parent)
|
||||
{
|
||||
auto action = Action::create("Move to &Back", { Mod_Ctrl | Mod_Shift, Key_Down }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/move-to-back.png"sv).release_value_but_fixme_should_propagate_errors(), move(callback), parent);
|
||||
auto action = Action::create("Move to &Back", { Mod_Ctrl | Mod_Shift, Key_Down }, Gfx::Bitmap::load_from_file("/res/icons/16x16/move-to-back.png"sv).release_value_but_fixme_should_propagate_errors(), move(callback), parent);
|
||||
action->set_status_tip("Move to the bottom of the stack");
|
||||
return action;
|
||||
}
|
||||
|
||||
NonnullRefPtr<Action> make_undo_action(Function<void(Action&)> callback, Core::Object* parent)
|
||||
{
|
||||
return Action::create("&Undo", { Mod_Ctrl, Key_Z }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/undo.png"sv).release_value_but_fixme_should_propagate_errors(), move(callback), parent);
|
||||
return Action::create("&Undo", { Mod_Ctrl, Key_Z }, Gfx::Bitmap::load_from_file("/res/icons/16x16/undo.png"sv).release_value_but_fixme_should_propagate_errors(), move(callback), parent);
|
||||
}
|
||||
|
||||
NonnullRefPtr<Action> make_redo_action(Function<void(Action&)> callback, Core::Object* parent)
|
||||
{
|
||||
return Action::create("&Redo", { Mod_Ctrl | Mod_Shift, Key_Z }, { Mod_Ctrl, Key_Y }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/redo.png"sv).release_value_but_fixme_should_propagate_errors(), move(callback), parent);
|
||||
return Action::create("&Redo", { Mod_Ctrl | Mod_Shift, Key_Z }, { Mod_Ctrl, Key_Y }, Gfx::Bitmap::load_from_file("/res/icons/16x16/redo.png"sv).release_value_but_fixme_should_propagate_errors(), move(callback), parent);
|
||||
}
|
||||
|
||||
NonnullRefPtr<Action> make_delete_action(Function<void(Action&)> callback, Core::Object* parent)
|
||||
{
|
||||
return Action::create("&Delete", { Mod_None, Key_Delete }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/delete.png"sv).release_value_but_fixme_should_propagate_errors(), move(callback), parent);
|
||||
return Action::create("&Delete", { Mod_None, Key_Delete }, Gfx::Bitmap::load_from_file("/res/icons/16x16/delete.png"sv).release_value_but_fixme_should_propagate_errors(), move(callback), parent);
|
||||
}
|
||||
|
||||
NonnullRefPtr<Action> make_cut_action(Function<void(Action&)> callback, Core::Object* parent)
|
||||
{
|
||||
auto action = Action::create("Cu&t", { Mod_Ctrl, Key_X }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/edit-cut.png"sv).release_value_but_fixme_should_propagate_errors(), move(callback), parent);
|
||||
auto action = Action::create("Cu&t", { Mod_Ctrl, Key_X }, Gfx::Bitmap::load_from_file("/res/icons/16x16/edit-cut.png"sv).release_value_but_fixme_should_propagate_errors(), move(callback), parent);
|
||||
action->set_status_tip("Cut to clipboard");
|
||||
return action;
|
||||
}
|
||||
|
||||
NonnullRefPtr<Action> make_copy_action(Function<void(Action&)> callback, Core::Object* parent)
|
||||
{
|
||||
auto action = Action::create("&Copy", { Mod_Ctrl, Key_C }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/edit-copy.png"sv).release_value_but_fixme_should_propagate_errors(), move(callback), parent);
|
||||
auto action = Action::create("&Copy", { Mod_Ctrl, Key_C }, Gfx::Bitmap::load_from_file("/res/icons/16x16/edit-copy.png"sv).release_value_but_fixme_should_propagate_errors(), move(callback), parent);
|
||||
action->set_status_tip("Copy to clipboard");
|
||||
return action;
|
||||
}
|
||||
|
||||
NonnullRefPtr<Action> make_paste_action(Function<void(Action&)> callback, Core::Object* parent)
|
||||
{
|
||||
auto action = Action::create("&Paste", { Mod_Ctrl, Key_V }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/paste.png"sv).release_value_but_fixme_should_propagate_errors(), move(callback), parent);
|
||||
auto action = Action::create("&Paste", { Mod_Ctrl, Key_V }, Gfx::Bitmap::load_from_file("/res/icons/16x16/paste.png"sv).release_value_but_fixme_should_propagate_errors(), move(callback), parent);
|
||||
action->set_status_tip("Paste from clipboard");
|
||||
return action;
|
||||
}
|
||||
|
||||
NonnullRefPtr<Action> make_insert_emoji_action(Function<void(Action&)> callback, Core::Object* parent)
|
||||
{
|
||||
auto action = Action::create("&Insert Emoji...", { Mod_Ctrl | Mod_Alt, Key_Space }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/emoji.png"sv).release_value_but_fixme_should_propagate_errors(), move(callback), parent);
|
||||
auto action = Action::create("&Insert Emoji...", { Mod_Ctrl | Mod_Alt, Key_Space }, Gfx::Bitmap::load_from_file("/res/icons/16x16/emoji.png"sv).release_value_but_fixme_should_propagate_errors(), move(callback), parent);
|
||||
action->set_status_tip("Open the Emoji Picker");
|
||||
return action;
|
||||
}
|
||||
|
@ -109,7 +109,7 @@ NonnullRefPtr<Action> make_fullscreen_action(Function<void(Action&)> callback, C
|
|||
{
|
||||
auto action = Action::create("&Fullscreen", { Mod_None, Key_F11 }, move(callback), parent);
|
||||
action->set_status_tip("Enter fullscreen mode");
|
||||
action->set_icon(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/fullscreen.png"sv).release_value_but_fixme_should_propagate_errors());
|
||||
action->set_icon(Gfx::Bitmap::load_from_file("/res/icons/16x16/fullscreen.png"sv).release_value_but_fixme_should_propagate_errors());
|
||||
return action;
|
||||
}
|
||||
|
||||
|
@ -122,85 +122,85 @@ NonnullRefPtr<Action> make_quit_action(Function<void(Action&)> callback)
|
|||
|
||||
NonnullRefPtr<Action> make_help_action(Function<void(Action&)> callback, Core::Object* parent)
|
||||
{
|
||||
auto action = Action::create("&Manual", { Mod_None, Key_F1 }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/app-help.png"sv).release_value_but_fixme_should_propagate_errors(), move(callback), parent);
|
||||
auto action = Action::create("&Manual", { Mod_None, Key_F1 }, Gfx::Bitmap::load_from_file("/res/icons/16x16/app-help.png"sv).release_value_but_fixme_should_propagate_errors(), move(callback), parent);
|
||||
action->set_status_tip("Show help contents");
|
||||
return action;
|
||||
}
|
||||
|
||||
NonnullRefPtr<Action> make_go_back_action(Function<void(Action&)> callback, Core::Object* parent)
|
||||
{
|
||||
auto action = Action::create("Go &Back", { Mod_Alt, Key_Left }, { MouseButton::Backward }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/go-back.png"sv).release_value_but_fixme_should_propagate_errors(), move(callback), parent);
|
||||
auto action = Action::create("Go &Back", { Mod_Alt, Key_Left }, { MouseButton::Backward }, Gfx::Bitmap::load_from_file("/res/icons/16x16/go-back.png"sv).release_value_but_fixme_should_propagate_errors(), move(callback), parent);
|
||||
action->set_status_tip("Move one step backward in history");
|
||||
return action;
|
||||
}
|
||||
|
||||
NonnullRefPtr<Action> make_go_forward_action(Function<void(Action&)> callback, Core::Object* parent)
|
||||
{
|
||||
auto action = Action::create("Go &Forward", { Mod_Alt, Key_Right }, { MouseButton::Forward }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/go-forward.png"sv).release_value_but_fixme_should_propagate_errors(), move(callback), parent);
|
||||
auto action = Action::create("Go &Forward", { Mod_Alt, Key_Right }, { MouseButton::Forward }, Gfx::Bitmap::load_from_file("/res/icons/16x16/go-forward.png"sv).release_value_but_fixme_should_propagate_errors(), move(callback), parent);
|
||||
action->set_status_tip("Move one step forward in history");
|
||||
return action;
|
||||
}
|
||||
|
||||
NonnullRefPtr<Action> make_go_home_action(Function<void(Action&)> callback, Core::Object* parent)
|
||||
{
|
||||
return Action::create("Go &Home", { Mod_Alt, Key_Home }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/go-home.png"sv).release_value_but_fixme_should_propagate_errors(), move(callback), parent);
|
||||
return Action::create("Go &Home", { Mod_Alt, Key_Home }, Gfx::Bitmap::load_from_file("/res/icons/16x16/go-home.png"sv).release_value_but_fixme_should_propagate_errors(), move(callback), parent);
|
||||
}
|
||||
|
||||
NonnullRefPtr<Action> make_close_tab_action(Function<void(Action&)> callback, Core::Object* parent)
|
||||
{
|
||||
auto action = Action::create("&Close Tab", { Mod_Ctrl, Key_W }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/close-tab.png"sv).release_value_but_fixme_should_propagate_errors(), move(callback), parent);
|
||||
auto action = Action::create("&Close Tab", { Mod_Ctrl, Key_W }, Gfx::Bitmap::load_from_file("/res/icons/16x16/close-tab.png"sv).release_value_but_fixme_should_propagate_errors(), move(callback), parent);
|
||||
action->set_status_tip("Close current tab");
|
||||
return action;
|
||||
}
|
||||
|
||||
NonnullRefPtr<Action> make_reload_action(Function<void(Action&)> callback, Core::Object* parent)
|
||||
{
|
||||
return Action::create("&Reload", { Mod_Ctrl, Key_R }, Key_F5, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/reload.png"sv).release_value_but_fixme_should_propagate_errors(), move(callback), parent);
|
||||
return Action::create("&Reload", { Mod_Ctrl, Key_R }, Key_F5, Gfx::Bitmap::load_from_file("/res/icons/16x16/reload.png"sv).release_value_but_fixme_should_propagate_errors(), move(callback), parent);
|
||||
}
|
||||
|
||||
NonnullRefPtr<Action> make_select_all_action(Function<void(Action&)> callback, Core::Object* parent)
|
||||
{
|
||||
return Action::create("Select &All", { Mod_Ctrl, Key_A }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/select-all.png"sv).release_value_but_fixme_should_propagate_errors(), move(callback), parent);
|
||||
return Action::create("Select &All", { Mod_Ctrl, Key_A }, Gfx::Bitmap::load_from_file("/res/icons/16x16/select-all.png"sv).release_value_but_fixme_should_propagate_errors(), move(callback), parent);
|
||||
}
|
||||
|
||||
NonnullRefPtr<Action> make_rename_action(Function<void(Action&)> callback, Core::Object* parent)
|
||||
{
|
||||
return Action::create("Re&name", Key_F2, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/rename.png"sv).release_value_but_fixme_should_propagate_errors(), move(callback), parent);
|
||||
return Action::create("Re&name", Key_F2, Gfx::Bitmap::load_from_file("/res/icons/16x16/rename.png"sv).release_value_but_fixme_should_propagate_errors(), move(callback), parent);
|
||||
}
|
||||
|
||||
NonnullRefPtr<Action> make_properties_action(Function<void(Action&)> callback, Core::Object* parent)
|
||||
{
|
||||
return Action::create("P&roperties", { Mod_Alt, Key_Return }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/properties.png"sv).release_value_but_fixme_should_propagate_errors(), move(callback), parent);
|
||||
return Action::create("P&roperties", { Mod_Alt, Key_Return }, Gfx::Bitmap::load_from_file("/res/icons/16x16/properties.png"sv).release_value_but_fixme_should_propagate_errors(), move(callback), parent);
|
||||
}
|
||||
|
||||
NonnullRefPtr<Action> make_zoom_in_action(Function<void(Action&)> callback, Core::Object* parent)
|
||||
{
|
||||
return GUI::Action::create("Zoom &In", { Mod_Ctrl, Key_Equal }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/zoom-in.png"sv).release_value_but_fixme_should_propagate_errors(), move(callback), parent);
|
||||
return GUI::Action::create("Zoom &In", { Mod_Ctrl, Key_Equal }, Gfx::Bitmap::load_from_file("/res/icons/16x16/zoom-in.png"sv).release_value_but_fixme_should_propagate_errors(), move(callback), parent);
|
||||
}
|
||||
|
||||
NonnullRefPtr<Action> make_reset_zoom_action(Function<void(Action&)> callback, Core::Object* parent)
|
||||
{
|
||||
return GUI::Action::create("&Reset Zoom", { Mod_Ctrl, Key_0 }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/zoom-reset.png"sv).release_value_but_fixme_should_propagate_errors(), move(callback), parent);
|
||||
return GUI::Action::create("&Reset Zoom", { Mod_Ctrl, Key_0 }, Gfx::Bitmap::load_from_file("/res/icons/16x16/zoom-reset.png"sv).release_value_but_fixme_should_propagate_errors(), move(callback), parent);
|
||||
}
|
||||
|
||||
NonnullRefPtr<Action> make_zoom_out_action(Function<void(Action&)> callback, Core::Object* parent)
|
||||
{
|
||||
return GUI::Action::create("Zoom &Out", { Mod_Ctrl, Key_Minus }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/zoom-out.png"sv).release_value_but_fixme_should_propagate_errors(), move(callback), parent);
|
||||
return GUI::Action::create("Zoom &Out", { Mod_Ctrl, Key_Minus }, Gfx::Bitmap::load_from_file("/res/icons/16x16/zoom-out.png"sv).release_value_but_fixme_should_propagate_errors(), move(callback), parent);
|
||||
}
|
||||
|
||||
NonnullRefPtr<Action> make_rotate_clockwise_action(Function<void(Action&)> callback, Core::Object* parent)
|
||||
{
|
||||
return GUI::Action::create("Rotate Clock&wise", { Mod_Ctrl | Mod_Shift, Key_GreaterThan }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/edit-rotate-cw.png"sv).release_value_but_fixme_should_propagate_errors(), move(callback), parent);
|
||||
return GUI::Action::create("Rotate Clock&wise", { Mod_Ctrl | Mod_Shift, Key_GreaterThan }, Gfx::Bitmap::load_from_file("/res/icons/16x16/edit-rotate-cw.png"sv).release_value_but_fixme_should_propagate_errors(), move(callback), parent);
|
||||
}
|
||||
|
||||
NonnullRefPtr<Action> make_rotate_counterclockwise_action(Function<void(Action&)> callback, Core::Object* parent)
|
||||
{
|
||||
return GUI::Action::create("Rotate &Counterclockwise", { Mod_Ctrl | Mod_Shift, Key_LessThan }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/edit-rotate-ccw.png"sv).release_value_but_fixme_should_propagate_errors(), move(callback), parent);
|
||||
return GUI::Action::create("Rotate &Counterclockwise", { Mod_Ctrl | Mod_Shift, Key_LessThan }, Gfx::Bitmap::load_from_file("/res/icons/16x16/edit-rotate-ccw.png"sv).release_value_but_fixme_should_propagate_errors(), move(callback), parent);
|
||||
}
|
||||
|
||||
NonnullRefPtr<Action> make_command_palette_action(Window* window)
|
||||
{
|
||||
auto action = Action::create("&Commands...", { Mod_Ctrl | Mod_Shift, Key_A }, MUST(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/find.png"sv)), [=](auto&) {
|
||||
auto action = Action::create("&Commands...", { Mod_Ctrl | Mod_Shift, Key_A }, MUST(Gfx::Bitmap::load_from_file("/res/icons/16x16/find.png"sv)), [=](auto&) {
|
||||
auto command_palette = CommandPalette::construct(*window);
|
||||
if (command_palette->exec() != GUI::Dialog::ExecResult::OK)
|
||||
return;
|
||||
|
|
|
@ -30,7 +30,7 @@ DragOperation::Outcome DragOperation::exec()
|
|||
Gfx::ShareableBitmap drag_bitmap;
|
||||
if (m_mime_data->has_format("image/x-raw-bitmap")) {
|
||||
auto data = m_mime_data->data("image/x-raw-bitmap");
|
||||
auto bitmap = Gfx::Bitmap::try_create_from_serialized_byte_buffer(move(data)).release_value_but_fixme_should_propagate_errors();
|
||||
auto bitmap = Gfx::Bitmap::create_from_serialized_byte_buffer(move(data)).release_value_but_fixme_should_propagate_errors();
|
||||
drag_bitmap = bitmap->to_shareable_bitmap();
|
||||
}
|
||||
|
||||
|
|
|
@ -70,8 +70,8 @@ static void initialize_if_needed()
|
|||
|
||||
auto config = Core::ConfigFile::open("/etc/FileIconProvider.ini").release_value_but_fixme_should_propagate_errors();
|
||||
|
||||
s_symlink_emblem = Gfx::Bitmap::try_load_from_file("/res/icons/symlink-emblem.png"sv).release_value_but_fixme_should_propagate_errors();
|
||||
s_symlink_emblem_small = Gfx::Bitmap::try_load_from_file("/res/icons/symlink-emblem-small.png"sv).release_value_but_fixme_should_propagate_errors();
|
||||
s_symlink_emblem = Gfx::Bitmap::load_from_file("/res/icons/symlink-emblem.png"sv).release_value_but_fixme_should_propagate_errors();
|
||||
s_symlink_emblem_small = Gfx::Bitmap::load_from_file("/res/icons/symlink-emblem-small.png"sv).release_value_but_fixme_should_propagate_errors();
|
||||
|
||||
s_hard_disk_icon = Icon::default_icon("hard-disk"sv);
|
||||
s_directory_icon = Icon::default_icon("filetype-folder"sv);
|
||||
|
|
|
@ -75,11 +75,11 @@ FilePicker::FilePicker(Window* parent_window, Mode mode, StringView filename, St
|
|||
case Mode::OpenMultiple:
|
||||
case Mode::OpenFolder:
|
||||
set_title("Open");
|
||||
set_icon(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/open.png"sv).release_value_but_fixme_should_propagate_errors());
|
||||
set_icon(Gfx::Bitmap::load_from_file("/res/icons/16x16/open.png"sv).release_value_but_fixme_should_propagate_errors());
|
||||
break;
|
||||
case Mode::Save:
|
||||
set_title("Save as");
|
||||
set_icon(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/save-as.png"sv).release_value_but_fixme_should_propagate_errors());
|
||||
set_icon(Gfx::Bitmap::load_from_file("/res/icons/16x16/save-as.png"sv).release_value_but_fixme_should_propagate_errors());
|
||||
break;
|
||||
}
|
||||
resize(560, 320);
|
||||
|
@ -113,7 +113,7 @@ FilePicker::FilePicker(Window* parent_window, Mode mode, StringView filename, St
|
|||
};
|
||||
|
||||
auto open_parent_directory_action = Action::create(
|
||||
"Open parent directory", { Mod_Alt, Key_Up }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/open-parent-directory.png"sv).release_value_but_fixme_should_propagate_errors(), [this](Action const&) {
|
||||
"Open parent directory", { Mod_Alt, Key_Up }, Gfx::Bitmap::load_from_file("/res/icons/16x16/open-parent-directory.png"sv).release_value_but_fixme_should_propagate_errors(), [this](Action const&) {
|
||||
set_path(DeprecatedString::formatted("{}/..", m_model->root_path()));
|
||||
},
|
||||
this);
|
||||
|
@ -127,7 +127,7 @@ FilePicker::FilePicker(Window* parent_window, Mode mode, StringView filename, St
|
|||
toolbar.add_separator();
|
||||
|
||||
auto mkdir_action = Action::create(
|
||||
"New directory...", { Mod_Ctrl | Mod_Shift, Key_N }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/mkdir.png"sv).release_value_but_fixme_should_propagate_errors(), [this](Action const&) {
|
||||
"New directory...", { Mod_Ctrl | Mod_Shift, Key_N }, Gfx::Bitmap::load_from_file("/res/icons/16x16/mkdir.png"sv).release_value_but_fixme_should_propagate_errors(), [this](Action const&) {
|
||||
DeprecatedString value;
|
||||
if (InputBox::show(this, value, "Enter name:"sv, "New directory"sv) == InputBox::ExecResult::OK && !value.is_empty()) {
|
||||
auto new_dir_path = LexicalPath::canonicalized_path(DeprecatedString::formatted("{}/{}", m_model->root_path(), value));
|
||||
|
|
|
@ -633,8 +633,8 @@ static HashMap<DeprecatedString, RefPtr<Gfx::Bitmap>> s_thumbnail_cache;
|
|||
|
||||
static ErrorOr<NonnullRefPtr<Gfx::Bitmap>> render_thumbnail(StringView path)
|
||||
{
|
||||
auto bitmap = TRY(Gfx::Bitmap::try_load_from_file(path));
|
||||
auto thumbnail = TRY(Gfx::Bitmap::try_create(Gfx::BitmapFormat::BGRA8888, { 32, 32 }));
|
||||
auto bitmap = TRY(Gfx::Bitmap::load_from_file(path));
|
||||
auto thumbnail = TRY(Gfx::Bitmap::create(Gfx::BitmapFormat::BGRA8888, { 32, 32 }));
|
||||
|
||||
double scale = min(32 / (double)bitmap->width(), 32 / (double)bitmap->height());
|
||||
auto destination = Gfx::IntRect(0, 0, (int)(bitmap->width() * scale), (int)(bitmap->height() * scale)).centered_within(thumbnail->rect());
|
||||
|
|
|
@ -24,7 +24,7 @@ FontPicker::FontPicker(Window* parent_window, Gfx::Font const* current_font, boo
|
|||
{
|
||||
set_title("Font picker");
|
||||
resize(430, 280);
|
||||
set_icon(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/app-font-editor.png"sv).release_value_but_fixme_should_propagate_errors());
|
||||
set_icon(Gfx::Bitmap::load_from_file("/res/icons/16x16/app-font-editor.png"sv).release_value_but_fixme_should_propagate_errors());
|
||||
|
||||
auto widget = set_main_widget<GUI::Widget>().release_value_but_fixme_should_propagate_errors();
|
||||
widget->load_from_gml(font_picker_dialog_gml).release_value_but_fixme_should_propagate_errors();
|
||||
|
|
|
@ -82,9 +82,9 @@ ErrorOr<Icon> Icon::try_create_default_icon(StringView name)
|
|||
{
|
||||
RefPtr<Gfx::Bitmap> bitmap16;
|
||||
RefPtr<Gfx::Bitmap> bitmap32;
|
||||
if (auto bitmap_or_error = Gfx::Bitmap::try_load_from_file(DeprecatedString::formatted("/res/icons/16x16/{}.png", name)); !bitmap_or_error.is_error())
|
||||
if (auto bitmap_or_error = Gfx::Bitmap::load_from_file(DeprecatedString::formatted("/res/icons/16x16/{}.png", name)); !bitmap_or_error.is_error())
|
||||
bitmap16 = bitmap_or_error.release_value();
|
||||
if (auto bitmap_or_error = Gfx::Bitmap::try_load_from_file(DeprecatedString::formatted("/res/icons/32x32/{}.png", name)); !bitmap_or_error.is_error())
|
||||
if (auto bitmap_or_error = Gfx::Bitmap::load_from_file(DeprecatedString::formatted("/res/icons/32x32/{}.png", name)); !bitmap_or_error.is_error())
|
||||
bitmap32 = bitmap_or_error.release_value();
|
||||
|
||||
if (!bitmap16 && !bitmap32) {
|
||||
|
|
|
@ -56,7 +56,7 @@ void Label::set_icon(Gfx::Bitmap const* icon)
|
|||
|
||||
void Label::set_icon_from_path(DeprecatedString const& path)
|
||||
{
|
||||
auto maybe_bitmap = Gfx::Bitmap::try_load_from_file(path);
|
||||
auto maybe_bitmap = Gfx::Bitmap::load_from_file(path);
|
||||
if (maybe_bitmap.is_error()) {
|
||||
dbgln("Unable to load bitmap `{}` for label icon", path);
|
||||
return;
|
||||
|
|
|
@ -29,7 +29,7 @@ LinkLabel::LinkLabel(DeprecatedString text)
|
|||
|
||||
void LinkLabel::setup_actions()
|
||||
{
|
||||
m_open_action = GUI::Action::create("Show in File Manager", {}, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/app-file-manager.png"sv).release_value_but_fixme_should_propagate_errors(), [&](const GUI::Action&) {
|
||||
m_open_action = GUI::Action::create("Show in File Manager", {}, Gfx::Bitmap::load_from_file("/res/icons/16x16/app-file-manager.png"sv).release_value_but_fixme_should_propagate_errors(), [&](const GUI::Action&) {
|
||||
if (on_click)
|
||||
on_click();
|
||||
});
|
||||
|
|
|
@ -76,13 +76,13 @@ RefPtr<Gfx::Bitmap> MessageBox::icon() const
|
|||
{
|
||||
switch (m_type) {
|
||||
case Type::Information:
|
||||
return Gfx::Bitmap::try_load_from_file("/res/icons/32x32/msgbox-information.png"sv).release_value_but_fixme_should_propagate_errors();
|
||||
return Gfx::Bitmap::load_from_file("/res/icons/32x32/msgbox-information.png"sv).release_value_but_fixme_should_propagate_errors();
|
||||
case Type::Warning:
|
||||
return Gfx::Bitmap::try_load_from_file("/res/icons/32x32/msgbox-warning.png"sv).release_value_but_fixme_should_propagate_errors();
|
||||
return Gfx::Bitmap::load_from_file("/res/icons/32x32/msgbox-warning.png"sv).release_value_but_fixme_should_propagate_errors();
|
||||
case Type::Error:
|
||||
return Gfx::Bitmap::try_load_from_file("/res/icons/32x32/msgbox-error.png"sv).release_value_but_fixme_should_propagate_errors();
|
||||
return Gfx::Bitmap::load_from_file("/res/icons/32x32/msgbox-error.png"sv).release_value_but_fixme_should_propagate_errors();
|
||||
case Type::Question:
|
||||
return Gfx::Bitmap::try_load_from_file("/res/icons/32x32/msgbox-question.png"sv).release_value_but_fixme_should_propagate_errors();
|
||||
return Gfx::Bitmap::load_from_file("/res/icons/32x32/msgbox-question.png"sv).release_value_but_fixme_should_propagate_errors();
|
||||
default:
|
||||
return nullptr;
|
||||
}
|
||||
|
|
|
@ -101,19 +101,19 @@ void MultiView::set_column_visible(int column_index, bool visible)
|
|||
void MultiView::build_actions()
|
||||
{
|
||||
m_view_as_icons_action = Action::create_checkable(
|
||||
"Icon view", { Mod_Ctrl, KeyCode::Key_1 }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/icon-view.png"sv).release_value_but_fixme_should_propagate_errors(), [this](auto&) {
|
||||
"Icon view", { Mod_Ctrl, KeyCode::Key_1 }, Gfx::Bitmap::load_from_file("/res/icons/16x16/icon-view.png"sv).release_value_but_fixme_should_propagate_errors(), [this](auto&) {
|
||||
set_view_mode(ViewMode::Icon);
|
||||
},
|
||||
this);
|
||||
|
||||
m_view_as_table_action = Action::create_checkable(
|
||||
"Table view", { Mod_Ctrl, KeyCode::Key_2 }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/table-view.png"sv).release_value_but_fixme_should_propagate_errors(), [this](auto&) {
|
||||
"Table view", { Mod_Ctrl, KeyCode::Key_2 }, Gfx::Bitmap::load_from_file("/res/icons/16x16/table-view.png"sv).release_value_but_fixme_should_propagate_errors(), [this](auto&) {
|
||||
set_view_mode(ViewMode::Table);
|
||||
},
|
||||
this);
|
||||
|
||||
m_view_as_columns_action = Action::create_checkable(
|
||||
"Columns view", { Mod_Ctrl, KeyCode::Key_3 }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/columns-view.png"sv).release_value_but_fixme_should_propagate_errors(), [this](auto&) {
|
||||
"Columns view", { Mod_Ctrl, KeyCode::Key_3 }, Gfx::Bitmap::load_from_file("/res/icons/16x16/columns-view.png"sv).release_value_but_fixme_should_propagate_errors(), [this](auto&) {
|
||||
set_view_mode(ViewMode::Columns);
|
||||
},
|
||||
this);
|
||||
|
|
|
@ -27,7 +27,7 @@ PasswordInputDialog::PasswordInputDialog(Window* parent_window, DeprecatedString
|
|||
|
||||
auto& key_icon_label = *widget->find_descendant_of_type_named<GUI::Label>("key_icon_label");
|
||||
|
||||
key_icon_label.set_icon(Gfx::Bitmap::try_load_from_file("/res/icons/32x32/key.png"sv).release_value_but_fixme_should_propagate_errors());
|
||||
key_icon_label.set_icon(Gfx::Bitmap::load_from_file("/res/icons/32x32/key.png"sv).release_value_but_fixme_should_propagate_errors());
|
||||
|
||||
auto& server_label = *widget->find_descendant_of_type_named<GUI::Label>("server_label");
|
||||
server_label.set_text(move(server));
|
||||
|
|
|
@ -48,13 +48,13 @@ SpinBox::SpinBox()
|
|||
|
||||
m_increment_button = add<Button>();
|
||||
m_increment_button->set_button_style(Gfx::ButtonStyle::ThickCap);
|
||||
m_increment_button->set_icon(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/upward-triangle.png"sv).release_value_but_fixme_should_propagate_errors());
|
||||
m_increment_button->set_icon(Gfx::Bitmap::load_from_file("/res/icons/16x16/upward-triangle.png"sv).release_value_but_fixme_should_propagate_errors());
|
||||
m_increment_button->set_focus_policy(GUI::FocusPolicy::NoFocus);
|
||||
m_increment_button->on_click = [this](auto) { set_value(m_value + 1); };
|
||||
m_increment_button->set_auto_repeat_interval(150);
|
||||
m_decrement_button = add<Button>();
|
||||
m_decrement_button->set_button_style(Gfx::ButtonStyle::ThickCap);
|
||||
m_decrement_button->set_icon(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/downward-triangle.png"sv).release_value_but_fixme_should_propagate_errors());
|
||||
m_decrement_button->set_icon(Gfx::Bitmap::load_from_file("/res/icons/16x16/downward-triangle.png"sv).release_value_but_fixme_should_propagate_errors());
|
||||
m_decrement_button->set_focus_policy(GUI::FocusPolicy::NoFocus);
|
||||
m_decrement_button->on_click = [this](auto) { set_value(m_value - 1); };
|
||||
m_decrement_button->set_auto_repeat_interval(150);
|
||||
|
|
|
@ -93,7 +93,7 @@ void TextEditor::create_actions()
|
|||
m_paste_action->set_enabled(is_editable() && Clipboard::the().fetch_mime_type().starts_with("text/"sv));
|
||||
if (is_multi_line()) {
|
||||
m_go_to_line_action = Action::create(
|
||||
"Go to line...", { Mod_Ctrl, Key_L }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/go-to.png"sv).release_value_but_fixme_should_propagate_errors(), [this](auto&) {
|
||||
"Go to line...", { Mod_Ctrl, Key_L }, Gfx::Bitmap::load_from_file("/res/icons/16x16/go-to.png"sv).release_value_but_fixme_should_propagate_errors(), [this](auto&) {
|
||||
DeprecatedString value;
|
||||
if (InputBox::show(window(), value, "Line:"sv, "Go to line"sv) == InputBox::ExecResult::OK) {
|
||||
auto line_target = value.to_uint();
|
||||
|
|
|
@ -170,7 +170,7 @@ Optional<UISize> Toolbar::calculated_min_size() const
|
|||
|
||||
ErrorOr<void> Toolbar::create_overflow_objects()
|
||||
{
|
||||
m_overflow_action = Action::create("Overflow Menu", { Mod_Ctrl | Mod_Shift, Key_O }, TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/overflow-menu.png"sv)), [&](auto&) {
|
||||
m_overflow_action = Action::create("Overflow Menu", { Mod_Ctrl | Mod_Shift, Key_O }, TRY(Gfx::Bitmap::load_from_file("/res/icons/16x16/overflow-menu.png"sv)), [&](auto&) {
|
||||
m_overflow_menu->popup(m_overflow_button->screen_relative_rect().bottom_left(), {}, m_overflow_button->rect());
|
||||
});
|
||||
m_overflow_action->set_status_tip("Show hidden toolbar actions");
|
||||
|
|
|
@ -42,8 +42,8 @@ TreeView::TreeView()
|
|||
set_background_role(ColorRole::Base);
|
||||
set_foreground_role(ColorRole::BaseText);
|
||||
set_column_headers_visible(false);
|
||||
m_expand_bitmap = Gfx::Bitmap::try_load_from_file("/res/icons/serenity/treeview-expand.png"sv).release_value_but_fixme_should_propagate_errors();
|
||||
m_collapse_bitmap = Gfx::Bitmap::try_load_from_file("/res/icons/serenity/treeview-collapse.png"sv).release_value_but_fixme_should_propagate_errors();
|
||||
m_expand_bitmap = Gfx::Bitmap::load_from_file("/res/icons/serenity/treeview-expand.png"sv).release_value_but_fixme_should_propagate_errors();
|
||||
m_collapse_bitmap = Gfx::Bitmap::load_from_file("/res/icons/serenity/treeview-collapse.png"sv).release_value_but_fixme_should_propagate_errors();
|
||||
}
|
||||
|
||||
ModelIndex TreeView::index_at_event_position(Gfx::IntPoint a_position, bool& is_toggle) const
|
||||
|
|
|
@ -964,7 +964,7 @@ ErrorOr<NonnullOwnPtr<WindowBackingStore>> Window::create_backing_store(Gfx::Int
|
|||
auto buffer = TRY(Core::AnonymousBuffer::create_with_size(round_up_to_power_of_two(size_in_bytes, PAGE_SIZE)));
|
||||
|
||||
// FIXME: Plumb scale factor here eventually.
|
||||
auto bitmap = TRY(Gfx::Bitmap::try_create_with_anonymous_buffer(format, buffer, size, 1, {}));
|
||||
auto bitmap = TRY(Gfx::Bitmap::create_with_anonymous_buffer(format, buffer, size, 1, {}));
|
||||
return make<WindowBackingStore>(bitmap);
|
||||
}
|
||||
|
||||
|
@ -987,7 +987,7 @@ void Window::set_icon(Gfx::Bitmap const* icon)
|
|||
|
||||
Gfx::IntSize icon_size = icon ? icon->size() : Gfx::IntSize(16, 16);
|
||||
|
||||
m_icon = Gfx::Bitmap::try_create(Gfx::BitmapFormat::BGRA8888, icon_size).release_value_but_fixme_should_propagate_errors();
|
||||
m_icon = Gfx::Bitmap::create(Gfx::BitmapFormat::BGRA8888, icon_size).release_value_but_fixme_should_propagate_errors();
|
||||
if (icon) {
|
||||
Painter painter(*m_icon);
|
||||
painter.blit({ 0, 0 }, *icon, icon->rect());
|
||||
|
|
|
@ -364,7 +364,7 @@ void AntiAliasingPainter::draw_ellipse(IntRect const& a_rect, Color color, int t
|
|||
auto color_no_alpha = color;
|
||||
color_no_alpha.set_alpha(255);
|
||||
auto outline_ellipse_bitmap = ({
|
||||
auto bitmap = Bitmap::try_create(BitmapFormat::BGRA8888, a_rect.size());
|
||||
auto bitmap = Bitmap::create(BitmapFormat::BGRA8888, a_rect.size());
|
||||
if (bitmap.is_error())
|
||||
return warnln("Failed to allocate temporary bitmap for antialiased outline ellipse!");
|
||||
bitmap.release_value();
|
||||
|
|
|
@ -1205,7 +1205,7 @@ static ErrorOr<void> decode_bmp_pixel_data(BMPLoadingContext& context)
|
|||
const u32 width = abs(context.dib.core.width);
|
||||
const u32 height = !context.is_included_in_ico ? context.dib.core.height : (context.dib.core.height / 2);
|
||||
|
||||
context.bitmap = TRY(Bitmap::try_create(format, { static_cast<int>(width), static_cast<int>(height) }));
|
||||
context.bitmap = TRY(Bitmap::create(format, { static_cast<int>(width), static_cast<int>(height) }));
|
||||
|
||||
ByteBuffer rle_buffer;
|
||||
ReadonlyBytes bytes { context.file_bytes + context.data_offset, context.file_size - context.data_offset };
|
||||
|
|
|
@ -65,22 +65,22 @@ static bool size_would_overflow(BitmapFormat format, IntSize size, int scale_fac
|
|||
return Checked<size_t>::multiplication_would_overflow(pitch, size.height() * scale_factor);
|
||||
}
|
||||
|
||||
ErrorOr<NonnullRefPtr<Bitmap>> Bitmap::try_create(BitmapFormat format, IntSize size, int scale_factor)
|
||||
ErrorOr<NonnullRefPtr<Bitmap>> Bitmap::create(BitmapFormat format, IntSize size, int scale_factor)
|
||||
{
|
||||
auto backing_store = TRY(Bitmap::allocate_backing_store(format, size, scale_factor));
|
||||
return AK::adopt_nonnull_ref_or_enomem(new (nothrow) Bitmap(format, size, scale_factor, backing_store));
|
||||
}
|
||||
|
||||
ErrorOr<NonnullRefPtr<Bitmap>> Bitmap::try_create_shareable(BitmapFormat format, IntSize size, int scale_factor)
|
||||
ErrorOr<NonnullRefPtr<Bitmap>> Bitmap::create_shareable(BitmapFormat format, IntSize size, int scale_factor)
|
||||
{
|
||||
if (size_would_overflow(format, size, scale_factor))
|
||||
return Error::from_string_literal("Gfx::Bitmap::try_create_shareable size overflow");
|
||||
return Error::from_string_literal("Gfx::Bitmap::create_shareable size overflow");
|
||||
|
||||
auto const pitch = minimum_pitch(size.width() * scale_factor, format);
|
||||
auto const data_size = size_in_bytes(pitch, size.height() * scale_factor);
|
||||
|
||||
auto buffer = TRY(Core::AnonymousBuffer::create_with_size(round_up_to_power_of_two(data_size, PAGE_SIZE)));
|
||||
auto bitmap = TRY(Bitmap::try_create_with_anonymous_buffer(format, buffer, size, scale_factor, {}));
|
||||
auto bitmap = TRY(Bitmap::create_with_anonymous_buffer(format, buffer, size, scale_factor, {}));
|
||||
return bitmap;
|
||||
}
|
||||
|
||||
|
@ -99,14 +99,14 @@ Bitmap::Bitmap(BitmapFormat format, IntSize size, int scale_factor, BackingStore
|
|||
m_needs_munmap = true;
|
||||
}
|
||||
|
||||
ErrorOr<NonnullRefPtr<Bitmap>> Bitmap::try_create_wrapper(BitmapFormat format, IntSize size, int scale_factor, size_t pitch, void* data)
|
||||
ErrorOr<NonnullRefPtr<Bitmap>> Bitmap::create_wrapper(BitmapFormat format, IntSize size, int scale_factor, size_t pitch, void* data)
|
||||
{
|
||||
if (size_would_overflow(format, size, scale_factor))
|
||||
return Error::from_string_literal("Gfx::Bitmap::try_create_wrapper size overflow");
|
||||
return Error::from_string_literal("Gfx::Bitmap::create_wrapper size overflow");
|
||||
return adopt_ref(*new Bitmap(format, size, scale_factor, pitch, data));
|
||||
}
|
||||
|
||||
ErrorOr<NonnullRefPtr<Bitmap>> Bitmap::try_load_from_file(StringView path, int scale_factor)
|
||||
ErrorOr<NonnullRefPtr<Bitmap>> Bitmap::load_from_file(StringView path, int scale_factor)
|
||||
{
|
||||
if (scale_factor > 1 && path.starts_with("/res/"sv)) {
|
||||
auto load_scaled_bitmap = [](StringView path, int scale_factor) -> ErrorOr<NonnullRefPtr<Bitmap>> {
|
||||
|
@ -117,9 +117,9 @@ ErrorOr<NonnullRefPtr<Bitmap>> Bitmap::try_load_from_file(StringView path, int s
|
|||
auto highdpi_icon_string = highdpi_icon_path.string_view();
|
||||
auto fd = TRY(Core::System::open(highdpi_icon_string, O_RDONLY));
|
||||
|
||||
auto bitmap = TRY(try_load_from_fd_and_close(fd, highdpi_icon_string));
|
||||
auto bitmap = TRY(load_from_fd_and_close(fd, highdpi_icon_string));
|
||||
if (bitmap->width() % scale_factor != 0 || bitmap->height() % scale_factor != 0)
|
||||
return Error::from_string_literal("Bitmap::try_load_from_file: HighDPI image size should be divisible by scale factor");
|
||||
return Error::from_string_literal("Bitmap::load_from_file: HighDPI image size should be divisible by scale factor");
|
||||
bitmap->m_size.set_width(bitmap->width() / scale_factor);
|
||||
bitmap->m_size.set_height(bitmap->height() / scale_factor);
|
||||
bitmap->m_scale = scale_factor;
|
||||
|
@ -138,10 +138,10 @@ ErrorOr<NonnullRefPtr<Bitmap>> Bitmap::try_load_from_file(StringView path, int s
|
|||
}
|
||||
|
||||
auto fd = TRY(Core::System::open(path, O_RDONLY));
|
||||
return try_load_from_fd_and_close(fd, path);
|
||||
return load_from_fd_and_close(fd, path);
|
||||
}
|
||||
|
||||
ErrorOr<NonnullRefPtr<Bitmap>> Bitmap::try_load_from_fd_and_close(int fd, StringView path)
|
||||
ErrorOr<NonnullRefPtr<Bitmap>> Bitmap::load_from_fd_and_close(int fd, StringView path)
|
||||
{
|
||||
auto file = TRY(Core::MappedFile::map_from_fd_and_close(fd, path));
|
||||
auto mime_type = Core::guess_mime_type_based_on_filename(path);
|
||||
|
@ -188,17 +188,17 @@ static bool check_size(IntSize size, int scale_factor, BitmapFormat format, unsi
|
|||
return true;
|
||||
}
|
||||
|
||||
ErrorOr<NonnullRefPtr<Bitmap>> Bitmap::try_create_with_anonymous_buffer(BitmapFormat format, Core::AnonymousBuffer buffer, IntSize size, int scale_factor, Vector<ARGB32> const& palette)
|
||||
ErrorOr<NonnullRefPtr<Bitmap>> Bitmap::create_with_anonymous_buffer(BitmapFormat format, Core::AnonymousBuffer buffer, IntSize size, int scale_factor, Vector<ARGB32> const& palette)
|
||||
{
|
||||
if (size_would_overflow(format, size, scale_factor))
|
||||
return Error::from_string_literal("Gfx::Bitmap::try_create_with_anonymous_buffer size overflow");
|
||||
return Error::from_string_literal("Gfx::Bitmap::create_with_anonymous_buffer size overflow");
|
||||
|
||||
return adopt_nonnull_ref_or_enomem(new (nothrow) Bitmap(format, move(buffer), size, scale_factor, palette));
|
||||
}
|
||||
|
||||
ErrorOr<NonnullRefPtr<Bitmap>> Bitmap::try_create_from_serialized_byte_buffer(ByteBuffer&& buffer)
|
||||
ErrorOr<NonnullRefPtr<Bitmap>> Bitmap::create_from_serialized_byte_buffer(ByteBuffer&& buffer)
|
||||
{
|
||||
return try_create_from_serialized_bytes(buffer.bytes());
|
||||
return create_from_serialized_bytes(buffer.bytes());
|
||||
}
|
||||
|
||||
/// Read a bitmap as described by:
|
||||
|
@ -210,7 +210,7 @@ ErrorOr<NonnullRefPtr<Bitmap>> Bitmap::try_create_from_serialized_byte_buffer(By
|
|||
/// - palette count
|
||||
/// - palette data (= palette count * BGRA8888)
|
||||
/// - image data (= actual size * u8)
|
||||
ErrorOr<NonnullRefPtr<Bitmap>> Bitmap::try_create_from_serialized_bytes(ReadonlyBytes bytes)
|
||||
ErrorOr<NonnullRefPtr<Bitmap>> Bitmap::create_from_serialized_bytes(ReadonlyBytes bytes)
|
||||
{
|
||||
InputMemoryStream stream { bytes };
|
||||
size_t actual_size;
|
||||
|
@ -228,26 +228,26 @@ ErrorOr<NonnullRefPtr<Bitmap>> Bitmap::try_create_from_serialized_bytes(Readonly
|
|||
};
|
||||
|
||||
if (!read(actual_size) || !read(width) || !read(height) || !read(scale_factor) || !read(format) || !read(palette_size))
|
||||
return Error::from_string_literal("Gfx::Bitmap::try_create_from_serialized_byte_buffer: decode failed");
|
||||
return Error::from_string_literal("Gfx::Bitmap::create_from_serialized_byte_buffer: decode failed");
|
||||
|
||||
if (format > BitmapFormat::BGRA8888 || format < BitmapFormat::Indexed1)
|
||||
return Error::from_string_literal("Gfx::Bitmap::try_create_from_serialized_byte_buffer: decode failed");
|
||||
return Error::from_string_literal("Gfx::Bitmap::create_from_serialized_byte_buffer: decode failed");
|
||||
|
||||
if (!check_size({ width, height }, scale_factor, format, actual_size))
|
||||
return Error::from_string_literal("Gfx::Bitmap::try_create_from_serialized_byte_buffer: decode failed");
|
||||
return Error::from_string_literal("Gfx::Bitmap::create_from_serialized_byte_buffer: decode failed");
|
||||
|
||||
palette.ensure_capacity(palette_size);
|
||||
for (size_t i = 0; i < palette_size; ++i) {
|
||||
if (!read(palette[i]))
|
||||
return Error::from_string_literal("Gfx::Bitmap::try_create_from_serialized_byte_buffer: decode failed");
|
||||
return Error::from_string_literal("Gfx::Bitmap::create_from_serialized_byte_buffer: decode failed");
|
||||
}
|
||||
|
||||
if (stream.remaining() < actual_size)
|
||||
return Error::from_string_literal("Gfx::Bitmap::try_create_from_serialized_byte_buffer: decode failed");
|
||||
return Error::from_string_literal("Gfx::Bitmap::create_from_serialized_byte_buffer: decode failed");
|
||||
|
||||
auto data = stream.bytes().slice(stream.offset(), actual_size);
|
||||
|
||||
auto bitmap = TRY(Bitmap::try_create(format, { width, height }, scale_factor));
|
||||
auto bitmap = TRY(Bitmap::create(format, { width, height }, scale_factor));
|
||||
|
||||
bitmap->m_palette = new ARGB32[palette_size];
|
||||
memcpy(bitmap->m_palette, palette.data(), palette_size * sizeof(ARGB32));
|
||||
|
@ -303,7 +303,7 @@ Bitmap::Bitmap(BitmapFormat format, Core::AnonymousBuffer buffer, IntSize size,
|
|||
|
||||
ErrorOr<NonnullRefPtr<Gfx::Bitmap>> Bitmap::clone() const
|
||||
{
|
||||
auto new_bitmap = TRY(Bitmap::try_create(format(), size(), scale()));
|
||||
auto new_bitmap = TRY(Bitmap::create(format(), size(), scale()));
|
||||
|
||||
VERIFY(size_in_bytes() == new_bitmap->size_in_bytes());
|
||||
memcpy(new_bitmap->scanline(0), scanline(0), size_in_bytes());
|
||||
|
@ -313,7 +313,7 @@ ErrorOr<NonnullRefPtr<Gfx::Bitmap>> Bitmap::clone() const
|
|||
|
||||
ErrorOr<NonnullRefPtr<Gfx::Bitmap>> Bitmap::rotated(Gfx::RotationDirection rotation_direction) const
|
||||
{
|
||||
auto new_bitmap = TRY(Gfx::Bitmap::try_create(this->format(), { height(), width() }, scale()));
|
||||
auto new_bitmap = TRY(Gfx::Bitmap::create(this->format(), { height(), width() }, scale()));
|
||||
|
||||
auto w = this->physical_width();
|
||||
auto h = this->physical_height();
|
||||
|
@ -334,7 +334,7 @@ ErrorOr<NonnullRefPtr<Gfx::Bitmap>> Bitmap::rotated(Gfx::RotationDirection rotat
|
|||
|
||||
ErrorOr<NonnullRefPtr<Gfx::Bitmap>> Bitmap::flipped(Gfx::Orientation orientation) const
|
||||
{
|
||||
auto new_bitmap = TRY(Gfx::Bitmap::try_create(this->format(), { width(), height() }, scale()));
|
||||
auto new_bitmap = TRY(Gfx::Bitmap::create(this->format(), { width(), height() }, scale()));
|
||||
|
||||
auto w = this->physical_width();
|
||||
auto h = this->physical_height();
|
||||
|
@ -357,7 +357,7 @@ ErrorOr<NonnullRefPtr<Gfx::Bitmap>> Bitmap::scaled(int sx, int sy) const
|
|||
if (sx == 1 && sy == 1)
|
||||
return NonnullRefPtr { *this };
|
||||
|
||||
auto new_bitmap = TRY(Gfx::Bitmap::try_create(format(), { width() * sx, height() * sy }, scale()));
|
||||
auto new_bitmap = TRY(Gfx::Bitmap::create(format(), { width() * sx, height() * sy }, scale()));
|
||||
|
||||
auto old_width = physical_width();
|
||||
auto old_height = physical_height();
|
||||
|
@ -389,7 +389,7 @@ ErrorOr<NonnullRefPtr<Gfx::Bitmap>> Bitmap::scaled(float sx, float sy) const
|
|||
int scaled_width = (int)ceilf(sx * (float)width());
|
||||
int scaled_height = (int)ceilf(sy * (float)height());
|
||||
|
||||
auto new_bitmap = TRY(Gfx::Bitmap::try_create(format(), { scaled_width, scaled_height }, scale()));
|
||||
auto new_bitmap = TRY(Gfx::Bitmap::create(format(), { scaled_width, scaled_height }, scale()));
|
||||
|
||||
auto old_width = physical_width();
|
||||
auto old_height = physical_height();
|
||||
|
@ -461,7 +461,7 @@ ErrorOr<NonnullRefPtr<Gfx::Bitmap>> Bitmap::scaled(float sx, float sy) const
|
|||
|
||||
ErrorOr<NonnullRefPtr<Gfx::Bitmap>> Bitmap::cropped(Gfx::IntRect crop, Optional<BitmapFormat> new_bitmap_format) const
|
||||
{
|
||||
auto new_bitmap = TRY(Gfx::Bitmap::try_create(new_bitmap_format.value_or(format()), { crop.width(), crop.height() }, scale()));
|
||||
auto new_bitmap = TRY(Gfx::Bitmap::create(new_bitmap_format.value_or(format()), { crop.width(), crop.height() }, scale()));
|
||||
auto scaled_crop = crop * scale();
|
||||
|
||||
for (int y = 0; y < scaled_crop.height(); ++y) {
|
||||
|
@ -483,7 +483,7 @@ ErrorOr<NonnullRefPtr<Bitmap>> Bitmap::to_bitmap_backed_by_anonymous_buffer() co
|
|||
if (m_buffer.is_valid())
|
||||
return NonnullRefPtr { *this };
|
||||
auto buffer = TRY(Core::AnonymousBuffer::create_with_size(round_up_to_power_of_two(size_in_bytes(), PAGE_SIZE)));
|
||||
auto bitmap = TRY(Bitmap::try_create_with_anonymous_buffer(m_format, move(buffer), size(), scale(), palette_to_vector()));
|
||||
auto bitmap = TRY(Bitmap::create_with_anonymous_buffer(m_format, move(buffer), size(), scale(), palette_to_vector()));
|
||||
memcpy(bitmap->scanline(0), scanline(0), size_in_bytes());
|
||||
return bitmap;
|
||||
}
|
||||
|
|
|
@ -93,14 +93,14 @@ enum RotationDirection {
|
|||
|
||||
class Bitmap : public RefCounted<Bitmap> {
|
||||
public:
|
||||
[[nodiscard]] static ErrorOr<NonnullRefPtr<Bitmap>> try_create(BitmapFormat, IntSize, int intrinsic_scale = 1);
|
||||
[[nodiscard]] static ErrorOr<NonnullRefPtr<Bitmap>> try_create_shareable(BitmapFormat, IntSize, int intrinsic_scale = 1);
|
||||
[[nodiscard]] static ErrorOr<NonnullRefPtr<Bitmap>> try_create_wrapper(BitmapFormat, IntSize, int intrinsic_scale, size_t pitch, void*);
|
||||
[[nodiscard]] static ErrorOr<NonnullRefPtr<Bitmap>> try_load_from_file(StringView path, int scale_factor = 1);
|
||||
[[nodiscard]] static ErrorOr<NonnullRefPtr<Bitmap>> try_load_from_fd_and_close(int fd, StringView path);
|
||||
[[nodiscard]] static ErrorOr<NonnullRefPtr<Bitmap>> try_create_with_anonymous_buffer(BitmapFormat, Core::AnonymousBuffer, IntSize, int intrinsic_scale, Vector<ARGB32> const& palette);
|
||||
static ErrorOr<NonnullRefPtr<Bitmap>> try_create_from_serialized_bytes(ReadonlyBytes);
|
||||
static ErrorOr<NonnullRefPtr<Bitmap>> try_create_from_serialized_byte_buffer(ByteBuffer&&);
|
||||
[[nodiscard]] static ErrorOr<NonnullRefPtr<Bitmap>> create(BitmapFormat, IntSize, int intrinsic_scale = 1);
|
||||
[[nodiscard]] static ErrorOr<NonnullRefPtr<Bitmap>> create_shareable(BitmapFormat, IntSize, int intrinsic_scale = 1);
|
||||
[[nodiscard]] static ErrorOr<NonnullRefPtr<Bitmap>> create_wrapper(BitmapFormat, IntSize, int intrinsic_scale, size_t pitch, void*);
|
||||
[[nodiscard]] static ErrorOr<NonnullRefPtr<Bitmap>> load_from_file(StringView path, int scale_factor = 1);
|
||||
[[nodiscard]] static ErrorOr<NonnullRefPtr<Bitmap>> load_from_fd_and_close(int fd, StringView path);
|
||||
[[nodiscard]] static ErrorOr<NonnullRefPtr<Bitmap>> create_with_anonymous_buffer(BitmapFormat, Core::AnonymousBuffer, IntSize, int intrinsic_scale, Vector<ARGB32> const& palette);
|
||||
static ErrorOr<NonnullRefPtr<Bitmap>> create_from_serialized_bytes(ReadonlyBytes);
|
||||
static ErrorOr<NonnullRefPtr<Bitmap>> create_from_serialized_byte_buffer(ByteBuffer&&);
|
||||
|
||||
static bool is_path_a_supported_image_format(StringView path)
|
||||
{
|
||||
|
|
|
@ -790,7 +790,7 @@ static ErrorOr<void> decode_dds(DDSLoadingContext& context)
|
|||
dbgln_if(DDS_DEBUG, "There are {} bytes remaining, we need {} for mipmap level {} of the image", stream.remaining(), needed_bytes, mipmap_level);
|
||||
VERIFY(stream.remaining() >= needed_bytes);
|
||||
|
||||
context.bitmap = TRY(Bitmap::try_create(BitmapFormat::BGRA8888, { width, height }));
|
||||
context.bitmap = TRY(Bitmap::create(BitmapFormat::BGRA8888, { width, height }));
|
||||
|
||||
decode_bitmap(stream, context, format, width, height);
|
||||
}
|
||||
|
|
|
@ -95,7 +95,7 @@ public:
|
|||
if (&target == &source && (!apply_cache.m_target || !apply_cache.m_target->size().contains(source_rect.size()))) {
|
||||
// TODO: We probably don't need the entire source_rect, we could inflate
|
||||
// the target_rect appropriately
|
||||
apply_cache.m_target = Gfx::Bitmap::try_create(source.format(), source_rect.size()).release_value_but_fixme_should_propagate_errors();
|
||||
apply_cache.m_target = Gfx::Bitmap::create(source.format(), source_rect.size()).release_value_but_fixme_should_propagate_errors();
|
||||
target_rect.translate_by(-target_rect.location());
|
||||
}
|
||||
|
||||
|
|
|
@ -34,7 +34,7 @@ Bitmap const* Emoji::emoji_for_code_points(Span<u32 const> const& code_points)
|
|||
if (it != s_emojis.end())
|
||||
return (*it).value.ptr();
|
||||
|
||||
auto bitmap_or_error = Bitmap::try_load_from_file(DeprecatedString::formatted("/res/emoji/{}.png", basename));
|
||||
auto bitmap_or_error = Bitmap::load_from_file(DeprecatedString::formatted("/res/emoji/{}.png", basename));
|
||||
if (bitmap_or_error.is_error()) {
|
||||
s_emojis.set(basename, nullptr);
|
||||
return nullptr;
|
||||
|
|
|
@ -25,7 +25,7 @@ void PathRasterizer::draw_path(Gfx::Path& path)
|
|||
|
||||
RefPtr<Gfx::Bitmap> PathRasterizer::accumulate()
|
||||
{
|
||||
auto bitmap_or_error = Gfx::Bitmap::try_create(Gfx::BitmapFormat::BGRA8888, m_size);
|
||||
auto bitmap_or_error = Gfx::Bitmap::create(Gfx::BitmapFormat::BGRA8888, m_size);
|
||||
if (bitmap_or_error.is_error())
|
||||
return {};
|
||||
auto bitmap = bitmap_or_error.release_value_but_fixme_should_propagate_errors();
|
||||
|
|
|
@ -273,8 +273,8 @@ static ErrorOr<void> decode_frame(GIFLoadingContext& context, size_t frame_index
|
|||
size_t start_frame = context.current_frame + 1;
|
||||
if (context.state < GIFLoadingContext::State::FrameComplete) {
|
||||
start_frame = 0;
|
||||
context.frame_buffer = TRY(Bitmap::try_create(BitmapFormat::BGRA8888, { context.logical_screen.width, context.logical_screen.height }));
|
||||
context.prev_frame_buffer = TRY(Bitmap::try_create(BitmapFormat::BGRA8888, { context.logical_screen.width, context.logical_screen.height }));
|
||||
context.frame_buffer = TRY(Bitmap::create(BitmapFormat::BGRA8888, { context.logical_screen.width, context.logical_screen.height }));
|
||||
context.prev_frame_buffer = TRY(Bitmap::create(BitmapFormat::BGRA8888, { context.logical_screen.width, context.logical_screen.height }));
|
||||
|
||||
} else if (frame_index < context.current_frame) {
|
||||
start_frame = 0;
|
||||
|
|
|
@ -967,7 +967,7 @@ static void ycbcr_to_rgb(JPGLoadingContext const& context, Vector<Macroblock>& m
|
|||
|
||||
static ErrorOr<void> compose_bitmap(JPGLoadingContext& context, Vector<Macroblock> const& macroblocks)
|
||||
{
|
||||
context.bitmap = TRY(Bitmap::try_create(BitmapFormat::BGRx8888, { context.frame.width, context.frame.height }));
|
||||
context.bitmap = TRY(Bitmap::create(BitmapFormat::BGRx8888, { context.frame.width, context.frame.height }));
|
||||
|
||||
for (u32 y = context.frame.height - 1; y < context.frame.height; y--) {
|
||||
const u32 block_row = y / 8;
|
||||
|
|
|
@ -574,7 +574,7 @@ static ErrorOr<void> decode_png_bitmap_simple(PNGLoadingContext& context)
|
|||
}
|
||||
}
|
||||
|
||||
context.bitmap = TRY(Bitmap::try_create(context.has_alpha() ? BitmapFormat::BGRA8888 : BitmapFormat::BGRx8888, { context.width, context.height }));
|
||||
context.bitmap = TRY(Bitmap::create(context.has_alpha() ? BitmapFormat::BGRA8888 : BitmapFormat::BGRx8888, { context.width, context.height }));
|
||||
return unfilter(context);
|
||||
}
|
||||
|
||||
|
@ -669,7 +669,7 @@ static ErrorOr<void> decode_adam7_pass(PNGLoadingContext& context, Streamer& str
|
|||
}
|
||||
}
|
||||
|
||||
subimage_context.bitmap = TRY(Bitmap::try_create(context.bitmap->format(), { subimage_context.width, subimage_context.height }));
|
||||
subimage_context.bitmap = TRY(Bitmap::create(context.bitmap->format(), { subimage_context.width, subimage_context.height }));
|
||||
TRY(unfilter(subimage_context));
|
||||
|
||||
// Copy the subimage data into the main image according to the pass pattern
|
||||
|
@ -684,7 +684,7 @@ static ErrorOr<void> decode_adam7_pass(PNGLoadingContext& context, Streamer& str
|
|||
static ErrorOr<void> decode_png_adam7(PNGLoadingContext& context)
|
||||
{
|
||||
Streamer streamer(context.decompression_buffer->data(), context.decompression_buffer->size());
|
||||
context.bitmap = TRY(Bitmap::try_create(context.has_alpha() ? BitmapFormat::BGRA8888 : BitmapFormat::BGRx8888, { context.width, context.height }));
|
||||
context.bitmap = TRY(Bitmap::create(context.has_alpha() ? BitmapFormat::BGRA8888 : BitmapFormat::BGRx8888, { context.width, context.height }));
|
||||
for (int pass = 1; pass <= 7; ++pass)
|
||||
TRY(decode_adam7_pass(context, streamer, pass));
|
||||
return {};
|
||||
|
|
|
@ -175,7 +175,7 @@ static bool read_max_val(TContext& context, Streamer& streamer)
|
|||
template<typename TContext>
|
||||
static bool create_bitmap(TContext& context)
|
||||
{
|
||||
auto bitmap_or_error = Bitmap::try_create(BitmapFormat::BGRx8888, { context.width, context.height });
|
||||
auto bitmap_or_error = Bitmap::create(BitmapFormat::BGRx8888, { context.width, context.height });
|
||||
if (bitmap_or_error.is_error()) {
|
||||
context.state = TContext::State::Error;
|
||||
return false;
|
||||
|
|
|
@ -126,7 +126,7 @@ static ErrorOr<NonnullRefPtr<Bitmap>> decode_qoi_image(Core::Stream::Stream& str
|
|||
if (height > NumericLimits<int>::max())
|
||||
return Error::from_string_literal("Cannot create bitmap for QOI image of valid size, height exceeds maximum Gfx::Bitmap height");
|
||||
|
||||
auto bitmap = TRY(Bitmap::try_create(BitmapFormat::BGRA8888, { width, height }));
|
||||
auto bitmap = TRY(Bitmap::create(BitmapFormat::BGRA8888, { width, height }));
|
||||
|
||||
u8 run = 0;
|
||||
Color pixel = { 0, 0, 0, 255 };
|
||||
|
|
|
@ -62,7 +62,7 @@ ErrorOr<Gfx::ShareableBitmap> decode(Decoder& decoder)
|
|||
palette = TRY(decoder.decode<decltype(palette)>());
|
||||
|
||||
auto buffer = TRY(Core::AnonymousBuffer::create_from_anon_fd(anon_file.take_fd(), Gfx::Bitmap::size_in_bytes(Gfx::Bitmap::minimum_pitch(size.width() * scale, bitmap_format), size.height() * scale)));
|
||||
auto bitmap = TRY(Gfx::Bitmap::try_create_with_anonymous_buffer(bitmap_format, move(buffer), size, scale, palette));
|
||||
auto bitmap = TRY(Gfx::Bitmap::create_with_anonymous_buffer(bitmap_format, move(buffer), size, scale, palette));
|
||||
|
||||
return Gfx::ShareableBitmap { move(bitmap), Gfx::ShareableBitmap::ConstructWithKnownGoodBitmap };
|
||||
}
|
||||
|
|
|
@ -285,11 +285,11 @@ ErrorOr<ImageFrameDescriptor> TGAImageDecoderPlugin::frame(size_t index)
|
|||
RefPtr<Gfx::Bitmap> bitmap;
|
||||
switch (bits_per_pixel) {
|
||||
case 24:
|
||||
bitmap = TRY(Bitmap::try_create(BitmapFormat::BGRx8888, { m_context->header.width, m_context->header.height }));
|
||||
bitmap = TRY(Bitmap::create(BitmapFormat::BGRx8888, { m_context->header.width, m_context->header.height }));
|
||||
break;
|
||||
|
||||
case 32:
|
||||
bitmap = TRY(Bitmap::try_create(BitmapFormat::BGRA8888, { m_context->header.width, m_context->header.height }));
|
||||
bitmap = TRY(Bitmap::create(BitmapFormat::BGRA8888, { m_context->header.width, m_context->header.height }));
|
||||
break;
|
||||
|
||||
default:
|
||||
|
|
|
@ -812,10 +812,10 @@ PDFErrorOr<NonnullRefPtr<Gfx::Bitmap>> Renderer::load_image(NonnullRefPtr<Stream
|
|||
|
||||
if (is_filter(CommonNames::DCTDecode)) {
|
||||
// TODO: stream objects could store Variant<bytes/Bitmap> to avoid seialisation/deserialisation here
|
||||
return TRY(Gfx::Bitmap::try_create_from_serialized_bytes(image->bytes()));
|
||||
return TRY(Gfx::Bitmap::create_from_serialized_bytes(image->bytes()));
|
||||
}
|
||||
|
||||
auto bitmap = MUST(Gfx::Bitmap::try_create(Gfx::BitmapFormat::BGRA8888, { width, height }));
|
||||
auto bitmap = MUST(Gfx::Bitmap::create(Gfx::BitmapFormat::BGRA8888, { width, height }));
|
||||
int x = 0;
|
||||
int y = 0;
|
||||
int const n_components = color_space->number_of_components();
|
||||
|
|
|
@ -151,7 +151,7 @@ void Image::regenerate_mipmaps()
|
|||
|
||||
auto empty_bitmap_for_level = [&](u32 level) -> NonnullRefPtr<Gfx::Bitmap> {
|
||||
Gfx::IntSize size = { width_at_level(level), height_at_level(level) };
|
||||
return MUST(Gfx::Bitmap::try_create(Gfx::BitmapFormat::BGRA8888, size));
|
||||
return MUST(Gfx::Bitmap::create(Gfx::BitmapFormat::BGRA8888, size));
|
||||
};
|
||||
auto copy_image_into_bitmap = [&](u32 level) -> NonnullRefPtr<Gfx::Bitmap> {
|
||||
auto bitmap = empty_bitmap_for_level(level);
|
||||
|
|
|
@ -125,12 +125,12 @@ TerminalWidget::TerminalWidget(int ptm_fd, bool automatic_size_policy)
|
|||
|
||||
m_terminal.set_size(Config::read_i32("Terminal"sv, "Window"sv, "Width"sv, 80), Config::read_i32("Terminal"sv, "Window"sv, "Height"sv, 25));
|
||||
|
||||
m_copy_action = GUI::Action::create("&Copy", { Mod_Ctrl | Mod_Shift, Key_C }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/edit-copy.png"sv).release_value_but_fixme_should_propagate_errors(), [this](auto&) {
|
||||
m_copy_action = GUI::Action::create("&Copy", { Mod_Ctrl | Mod_Shift, Key_C }, Gfx::Bitmap::load_from_file("/res/icons/16x16/edit-copy.png"sv).release_value_but_fixme_should_propagate_errors(), [this](auto&) {
|
||||
copy();
|
||||
});
|
||||
m_copy_action->set_swallow_key_event_when_disabled(true);
|
||||
|
||||
m_paste_action = GUI::Action::create("&Paste", { Mod_Ctrl | Mod_Shift, Key_V }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/paste.png"sv).release_value_but_fixme_should_propagate_errors(), [this](auto&) {
|
||||
m_paste_action = GUI::Action::create("&Paste", { Mod_Ctrl | Mod_Shift, Key_V }, Gfx::Bitmap::load_from_file("/res/icons/16x16/paste.png"sv).release_value_but_fixme_should_propagate_errors(), [this](auto&) {
|
||||
paste();
|
||||
});
|
||||
m_paste_action->set_swallow_key_event_when_disabled(true);
|
||||
|
|
|
@ -23,7 +23,7 @@ public:
|
|||
virtual DecoderErrorOr<void> output_to_bitmap(Gfx::Bitmap& bitmap) = 0;
|
||||
virtual DecoderErrorOr<NonnullRefPtr<Gfx::Bitmap>> to_bitmap()
|
||||
{
|
||||
auto bitmap = DECODER_TRY_ALLOC(Gfx::Bitmap::try_create(Gfx::BitmapFormat::BGRx8888, m_size));
|
||||
auto bitmap = DECODER_TRY_ALLOC(Gfx::Bitmap::create(Gfx::BitmapFormat::BGRx8888, m_size));
|
||||
TRY(output_to_bitmap(bitmap));
|
||||
return bitmap;
|
||||
}
|
||||
|
|
|
@ -167,7 +167,7 @@ bool HTMLCanvasElement::create_bitmap(size_t minimum_width, size_t minimum_heigh
|
|||
return false;
|
||||
}
|
||||
if (!m_bitmap || m_bitmap->size() != size) {
|
||||
auto bitmap_or_error = Gfx::Bitmap::try_create(Gfx::BitmapFormat::BGRA8888, size);
|
||||
auto bitmap_or_error = Gfx::Bitmap::create(Gfx::BitmapFormat::BGRA8888, size);
|
||||
if (bitmap_or_error.is_error())
|
||||
return false;
|
||||
m_bitmap = bitmap_or_error.release_value_but_fixme_should_propagate_errors();
|
||||
|
|
|
@ -25,7 +25,7 @@ JS::GCPtr<ImageData> ImageData::create_with_size(JS::Realm& realm, int width, in
|
|||
return nullptr;
|
||||
auto data = JS::NonnullGCPtr<JS::Uint8ClampedArray>(*data_or_error.release_value());
|
||||
|
||||
auto bitmap_or_error = Gfx::Bitmap::try_create_wrapper(Gfx::BitmapFormat::RGBA8888, Gfx::IntSize(width, height), 1, width * sizeof(u32), data->data().data());
|
||||
auto bitmap_or_error = Gfx::Bitmap::create_wrapper(Gfx::BitmapFormat::RGBA8888, Gfx::IntSize(width, height), 1, width * sizeof(u32), data->data().data());
|
||||
if (bitmap_or_error.is_error())
|
||||
return nullptr;
|
||||
return realm.heap().allocate<ImageData>(realm, realm, bitmap_or_error.release_value(), move(data));
|
||||
|
|
|
@ -39,7 +39,7 @@ FrameLoader::FrameLoader(HTML::BrowsingContext& browsing_context)
|
|||
: m_browsing_context(browsing_context)
|
||||
{
|
||||
if (!s_default_favicon_bitmap) {
|
||||
s_default_favicon_bitmap = Gfx::Bitmap::try_load_from_file(s_default_favicon_path).release_value_but_fixme_should_propagate_errors();
|
||||
s_default_favicon_bitmap = Gfx::Bitmap::load_from_file(s_default_favicon_path).release_value_but_fixme_should_propagate_errors();
|
||||
VERIFY(s_default_favicon_bitmap);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -210,7 +210,7 @@ void paint_border(PaintContext& context, BorderEdge edge, DevicePixelRect const&
|
|||
RefPtr<Gfx::Bitmap> get_cached_corner_bitmap(DevicePixelSize corners_size)
|
||||
{
|
||||
auto allocate_mask_bitmap = [&]() -> RefPtr<Gfx::Bitmap> {
|
||||
auto bitmap = Gfx::Bitmap::try_create(Gfx::BitmapFormat::BGRA8888, corners_size.to_type<int>());
|
||||
auto bitmap = Gfx::Bitmap::create(Gfx::BitmapFormat::BGRA8888, corners_size.to_type<int>());
|
||||
if (!bitmap.is_error())
|
||||
return bitmap.release_value();
|
||||
return nullptr;
|
||||
|
|
|
@ -34,7 +34,7 @@ ErrorOr<BorderRadiusCornerClipper> BorderRadiusCornerClipper::create(PaintContex
|
|||
if (!corner_bitmap)
|
||||
return Error::from_errno(ENOMEM);
|
||||
} else {
|
||||
corner_bitmap = TRY(Gfx::Bitmap::try_create(Gfx::BitmapFormat::BGRA8888, corners_bitmap_size.to_type<int>()));
|
||||
corner_bitmap = TRY(Gfx::Bitmap::create(Gfx::BitmapFormat::BGRA8888, corners_bitmap_size.to_type<int>()));
|
||||
}
|
||||
|
||||
CornerData corner_data {
|
||||
|
|
|
@ -164,7 +164,7 @@ void paint_box_shadow(PaintContext& context, CSSPixelRect const& content_rect, B
|
|||
DevicePixelRect top_edge_rect { top_left_corner_rect.width(), 0, 1, horizontal_top_edge_width };
|
||||
DevicePixelRect bottom_edge_rect { bottom_left_corner_rect.width(), shadow_bitmap_rect.height() - horizontal_edge_width, 1, horizontal_edge_width };
|
||||
|
||||
auto shadows_bitmap = Gfx::Bitmap::try_create(Gfx::BitmapFormat::BGRA8888, shadow_bitmap_rect.size().to_type<int>());
|
||||
auto shadows_bitmap = Gfx::Bitmap::create(Gfx::BitmapFormat::BGRA8888, shadow_bitmap_rect.size().to_type<int>());
|
||||
if (shadows_bitmap.is_error()) {
|
||||
dbgln("Unable to allocate temporary bitmap {} for box-shadow rendering: {}", shadow_bitmap_rect, shadows_bitmap.error());
|
||||
return;
|
||||
|
@ -361,7 +361,7 @@ void paint_text_shadow(PaintContext& context, Layout::LineBoxFragment const& fra
|
|||
text_rect.height() + margin + margin
|
||||
};
|
||||
// FIXME: Figure out the maximum bitmap size for all shadows and then allocate it once and reuse it?
|
||||
auto maybe_shadow_bitmap = Gfx::Bitmap::try_create(Gfx::BitmapFormat::BGRA8888, bounding_rect.size().to_type<int>());
|
||||
auto maybe_shadow_bitmap = Gfx::Bitmap::create(Gfx::BitmapFormat::BGRA8888, bounding_rect.size().to_type<int>());
|
||||
if (maybe_shadow_bitmap.is_error()) {
|
||||
dbgln("Unable to allocate temporary bitmap {} for text-shadow rendering: {}", bounding_rect.size(), maybe_shadow_bitmap.error());
|
||||
return;
|
||||
|
|
|
@ -20,9 +20,9 @@ DOMTreeModel::DOMTreeModel(JsonObject dom_tree, GUI::TreeView* tree_view)
|
|||
{
|
||||
// FIXME: Get these from the outside somehow instead of hard-coding paths here.
|
||||
#ifdef AK_OS_SERENITY
|
||||
m_document_icon.set_bitmap_for_size(16, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/filetype-html.png"sv).release_value_but_fixme_should_propagate_errors());
|
||||
m_element_icon.set_bitmap_for_size(16, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/inspector-object.png"sv).release_value_but_fixme_should_propagate_errors());
|
||||
m_text_icon.set_bitmap_for_size(16, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/filetype-unknown.png"sv).release_value_but_fixme_should_propagate_errors());
|
||||
m_document_icon.set_bitmap_for_size(16, Gfx::Bitmap::load_from_file("/res/icons/16x16/filetype-html.png"sv).release_value_but_fixme_should_propagate_errors());
|
||||
m_element_icon.set_bitmap_for_size(16, Gfx::Bitmap::load_from_file("/res/icons/16x16/inspector-object.png"sv).release_value_but_fixme_should_propagate_errors());
|
||||
m_text_icon.set_bitmap_for_size(16, Gfx::Bitmap::load_from_file("/res/icons/16x16/filetype-unknown.png"sv).release_value_but_fixme_should_propagate_errors());
|
||||
#endif
|
||||
|
||||
map_dom_nodes_to_parent(nullptr, &m_dom_tree);
|
||||
|
|
|
@ -126,13 +126,13 @@ void OutOfProcessWebView::handle_resize()
|
|||
if (available_size().is_empty())
|
||||
return;
|
||||
|
||||
if (auto new_bitmap_or_error = Gfx::Bitmap::try_create_shareable(Gfx::BitmapFormat::BGRx8888, available_size()); !new_bitmap_or_error.is_error()) {
|
||||
if (auto new_bitmap_or_error = Gfx::Bitmap::create_shareable(Gfx::BitmapFormat::BGRx8888, available_size()); !new_bitmap_or_error.is_error()) {
|
||||
m_client_state.front_bitmap.bitmap = new_bitmap_or_error.release_value();
|
||||
m_client_state.front_bitmap.id = m_client_state.next_bitmap_id++;
|
||||
client().async_add_backing_store(m_client_state.front_bitmap.id, m_client_state.front_bitmap.bitmap->to_shareable_bitmap());
|
||||
}
|
||||
|
||||
if (auto new_bitmap_or_error = Gfx::Bitmap::try_create_shareable(Gfx::BitmapFormat::BGRx8888, available_size()); !new_bitmap_or_error.is_error()) {
|
||||
if (auto new_bitmap_or_error = Gfx::Bitmap::create_shareable(Gfx::BitmapFormat::BGRx8888, available_size()); !new_bitmap_or_error.is_error()) {
|
||||
m_client_state.back_bitmap.bitmap = new_bitmap_or_error.release_value();
|
||||
m_client_state.back_bitmap.id = m_client_state.next_bitmap_id++;
|
||||
client().async_add_backing_store(m_client_state.back_bitmap.id, m_client_state.back_bitmap.bitmap->to_shareable_bitmap());
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue