mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 23:27:43 +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
|
@ -189,7 +189,7 @@ NonnullRefPtr<Gfx::Bitmap> BrushTool::build_cursor()
|
|||
m_scale_last_created_cursor = m_editor ? m_editor->scale() : 1;
|
||||
auto scaled_size = size() * m_scale_last_created_cursor;
|
||||
auto containing_box_size = 2 * scaled_size;
|
||||
NonnullRefPtr<Gfx::Bitmap> new_cursor = Gfx::Bitmap::try_create(Gfx::BitmapFormat::BGRA8888, Gfx::IntSize(containing_box_size, containing_box_size)).release_value_but_fixme_should_propagate_errors();
|
||||
NonnullRefPtr<Gfx::Bitmap> new_cursor = Gfx::Bitmap::create(Gfx::BitmapFormat::BGRA8888, Gfx::IntSize(containing_box_size, containing_box_size)).release_value_but_fixme_should_propagate_errors();
|
||||
|
||||
Gfx::Painter painter { new_cursor };
|
||||
Gfx::AntiAliasingPainter aa_painter { painter };
|
||||
|
|
|
@ -24,7 +24,7 @@ namespace PixelPaint {
|
|||
|
||||
BucketTool::BucketTool()
|
||||
{
|
||||
m_cursor = Gfx::Bitmap::try_load_from_file("/res/icons/pixelpaint/bucket.png"sv).release_value_but_fixme_should_propagate_errors();
|
||||
m_cursor = Gfx::Bitmap::load_from_file("/res/icons/pixelpaint/bucket.png"sv).release_value_but_fixme_should_propagate_errors();
|
||||
}
|
||||
|
||||
static void flood_fill(Gfx::Bitmap& bitmap, Gfx::IntPoint start_position, Color fill_color, int threshold)
|
||||
|
|
|
@ -144,7 +144,7 @@ NonnullRefPtr<Gfx::Bitmap> EraseTool::build_cursor()
|
|||
m_scale_last_created_cursor = m_editor ? m_editor->scale() : 1;
|
||||
int scaled_size = size() * m_scale_last_created_cursor;
|
||||
|
||||
NonnullRefPtr<Gfx::Bitmap> new_cursor = Gfx::Bitmap::try_create(Gfx::BitmapFormat::BGRA8888, Gfx::IntSize(scaled_size, scaled_size)).release_value_but_fixme_should_propagate_errors();
|
||||
NonnullRefPtr<Gfx::Bitmap> new_cursor = Gfx::Bitmap::create(Gfx::BitmapFormat::BGRA8888, Gfx::IntSize(scaled_size, scaled_size)).release_value_but_fixme_should_propagate_errors();
|
||||
|
||||
Gfx::IntRect rect { 0, 0, scaled_size, scaled_size };
|
||||
Gfx::Painter painter { new_cursor };
|
||||
|
|
|
@ -135,7 +135,7 @@ void GuideTool::on_context_menu(Layer*, GUI::ContextMenuEvent& event)
|
|||
if (!m_context_menu) {
|
||||
m_context_menu = GUI::Menu::construct();
|
||||
m_context_menu->add_action(GUI::Action::create(
|
||||
"Set &Offset", Gfx::Bitmap::try_load_from_file("/res/icons/16x16/gear.png"sv).release_value_but_fixme_should_propagate_errors(), [this](auto&) {
|
||||
"Set &Offset", Gfx::Bitmap::load_from_file("/res/icons/16x16/gear.png"sv).release_value_but_fixme_should_propagate_errors(), [this](auto&) {
|
||||
if (!m_context_menu_guide)
|
||||
return;
|
||||
auto dialog = EditGuideDialog::construct(
|
||||
|
@ -153,7 +153,7 @@ void GuideTool::on_context_menu(Layer*, GUI::ContextMenuEvent& event)
|
|||
},
|
||||
editor()));
|
||||
m_context_menu->add_action(GUI::Action::create(
|
||||
"&Delete Guide", Gfx::Bitmap::try_load_from_file("/res/icons/16x16/delete.png"sv).release_value_but_fixme_should_propagate_errors(), [this](auto&) {
|
||||
"&Delete Guide", Gfx::Bitmap::load_from_file("/res/icons/16x16/delete.png"sv).release_value_but_fixme_should_propagate_errors(), [this](auto&) {
|
||||
if (!m_context_menu_guide)
|
||||
return;
|
||||
editor()->remove_guide(*m_context_menu_guide);
|
||||
|
|
|
@ -28,7 +28,7 @@ void LassoSelectTool::on_mousedown(Layer* layer, MouseEvent& event)
|
|||
if (!layer->rect().contains(layer_event.position()))
|
||||
return;
|
||||
|
||||
auto selection_bitmap_result = Gfx::Bitmap::try_create(Gfx::BitmapFormat::BGRA8888, layer->content_bitmap().size());
|
||||
auto selection_bitmap_result = Gfx::Bitmap::create(Gfx::BitmapFormat::BGRA8888, layer->content_bitmap().size());
|
||||
if (selection_bitmap_result.is_error())
|
||||
return;
|
||||
|
||||
|
@ -99,7 +99,7 @@ void LassoSelectTool::on_mouseup(Layer*, MouseEvent&)
|
|||
auto cropped_selection = cropped_selection_result.release_value();
|
||||
|
||||
// We create a bitmap that is bigger by 1 pixel on each side
|
||||
auto lasso_bitmap_or_error = Gfx::Bitmap::try_create(Gfx::BitmapFormat::BGRA8888, { (m_bottom_right.x() - m_top_left.x()) + 2, (m_bottom_right.y() - m_top_left.y()) + 2 });
|
||||
auto lasso_bitmap_or_error = Gfx::Bitmap::create(Gfx::BitmapFormat::BGRA8888, { (m_bottom_right.x() - m_top_left.x()) + 2, (m_bottom_right.y() - m_top_left.y()) + 2 });
|
||||
if (lasso_bitmap_or_error.is_error())
|
||||
return;
|
||||
|
||||
|
|
|
@ -207,7 +207,7 @@ ErrorOr<void> MoveTool::update_cached_preview_bitmap(Layer const* layer)
|
|||
auto const& source_bitmap = layer->content_bitmap();
|
||||
auto preview_bitmap_size = editor_rect_size.contains(source_bitmap.size()) ? source_bitmap.size() : editor_rect_size;
|
||||
|
||||
m_cached_preview_bitmap = TRY(Gfx::Bitmap::try_create(source_bitmap.format(), preview_bitmap_size));
|
||||
m_cached_preview_bitmap = TRY(Gfx::Bitmap::create(source_bitmap.format(), preview_bitmap_size));
|
||||
GUI::Painter preview_painter(*m_cached_preview_bitmap);
|
||||
preview_painter.draw_scaled_bitmap(m_cached_preview_bitmap->rect(), source_bitmap, source_bitmap.rect(), 0.8f, Gfx::Painter::ScalingMode::BilinearBlend);
|
||||
Gfx::ContrastFilter preview_filter(0.5f);
|
||||
|
|
|
@ -57,7 +57,7 @@ void PolygonalSelectTool::process_polygon()
|
|||
|
||||
// We create a bitmap that is bigger by 1 pixel on each side (+2) and need to account for the 0 indexed
|
||||
// pixel positions (+1) so we make the bitmap size the delta of x/y min/max + 3.
|
||||
auto polygon_bitmap_or_error = Gfx::Bitmap::try_create(Gfx::BitmapFormat::BGRA8888, { (max_x_seen - min_x_seen) + 3, (max_y_seen - min_y_seen) + 3 });
|
||||
auto polygon_bitmap_or_error = Gfx::Bitmap::create(Gfx::BitmapFormat::BGRA8888, { (max_x_seen - min_x_seen) + 3, (max_y_seen - min_y_seen) + 3 });
|
||||
if (polygon_bitmap_or_error.is_error())
|
||||
return;
|
||||
|
||||
|
|
|
@ -134,7 +134,7 @@ void TextTool::on_second_paint(Layer const* layer, GUI::PaintEvent& event)
|
|||
// Since ImageEditor can be zoomed in/out, we need to be able to render the preview properly scaled
|
||||
// GUI::Painter doesn't have a way to draw a font scaled directly, so we draw the text to a bitmap
|
||||
// and then scale the bitmap and blit the result to the ImageEditor.
|
||||
auto text_bitmap_result = Gfx::Bitmap::try_create(Gfx::BitmapFormat::BGRA8888, { text_width, text_height });
|
||||
auto text_bitmap_result = Gfx::Bitmap::create(Gfx::BitmapFormat::BGRA8888, { text_width, text_height });
|
||||
if (text_bitmap_result.is_error())
|
||||
return;
|
||||
auto text_bitmap = text_bitmap_result.release_value();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue