mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 18:27:35 +00:00
LibGfx: Use "try_" prefix for static factory functions
Also mark them as [[nodiscard]].
This commit is contained in:
parent
f0409081f5
commit
c7d891765c
131 changed files with 422 additions and 421 deletions
|
@ -64,7 +64,7 @@ static RefPtr<Gfx::Bitmap> s_background_inverted;
|
|||
|
||||
Card::Card(Type type, uint8_t value)
|
||||
: m_rect(Gfx::IntRect({}, { width, height }))
|
||||
, m_front(*Gfx::Bitmap::create(Gfx::BitmapFormat::BGRA8888, { width, height }))
|
||||
, m_front(*Gfx::Bitmap::try_create(Gfx::BitmapFormat::BGRA8888, { width, height }))
|
||||
, m_type(type)
|
||||
, m_value(value)
|
||||
{
|
||||
|
@ -72,10 +72,10 @@ Card::Card(Type type, uint8_t value)
|
|||
Gfx::IntRect paint_rect({ 0, 0 }, { width, height });
|
||||
|
||||
if (s_background.is_null()) {
|
||||
s_background = Gfx::Bitmap::create(Gfx::BitmapFormat::BGRA8888, { width, height });
|
||||
s_background = Gfx::Bitmap::try_create(Gfx::BitmapFormat::BGRA8888, { width, height });
|
||||
Gfx::Painter bg_painter(*s_background);
|
||||
|
||||
auto image = Gfx::Bitmap::load_from_file("/res/icons/cards/buggie-deck.png");
|
||||
auto image = Gfx::Bitmap::try_load_from_file("/res/icons/cards/buggie-deck.png");
|
||||
VERIFY(!image.is_null());
|
||||
|
||||
float aspect_ratio = image->width() / static_cast<float>(image->height());
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue