mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 19:38:12 +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
|
@ -410,7 +410,7 @@ void WindowFrame::PerScaleRenderedCache::render(WindowFrame& frame, Screen& scre
|
|||
if (tmp_it != s_tmp_bitmap_cache.end())
|
||||
tmp_it->value = nullptr;
|
||||
|
||||
auto bitmap = Gfx::Bitmap::create(Gfx::BitmapFormat::BGRA8888, frame_rect_including_shadow.size(), scale);
|
||||
auto bitmap = Gfx::Bitmap::try_create(Gfx::BitmapFormat::BGRA8888, frame_rect_including_shadow.size(), scale);
|
||||
if (!bitmap) {
|
||||
s_tmp_bitmap_cache.remove(scale);
|
||||
dbgln("Could not create bitmap of size {}", frame_rect_including_shadow.size());
|
||||
|
@ -433,14 +433,14 @@ void WindowFrame::PerScaleRenderedCache::render(WindowFrame& frame, Screen& scre
|
|||
|
||||
if (!m_top_bottom || m_top_bottom->width() != frame_rect_including_shadow.width() || m_top_bottom->height() != top_bottom_height || m_top_bottom->scale() != scale) {
|
||||
if (top_bottom_height > 0)
|
||||
m_top_bottom = Gfx::Bitmap::create(Gfx::BitmapFormat::BGRA8888, { frame_rect_including_shadow.width(), top_bottom_height }, scale);
|
||||
m_top_bottom = Gfx::Bitmap::try_create(Gfx::BitmapFormat::BGRA8888, { frame_rect_including_shadow.width(), top_bottom_height }, scale);
|
||||
else
|
||||
m_top_bottom = nullptr;
|
||||
m_shadow_dirty = true;
|
||||
}
|
||||
if (!m_left_right || m_left_right->height() != frame_rect_including_shadow.height() || m_left_right->width() != left_right_width || m_left_right->scale() != scale) {
|
||||
if (left_right_width > 0)
|
||||
m_left_right = Gfx::Bitmap::create(Gfx::BitmapFormat::BGRA8888, { left_right_width, frame_rect_including_shadow.height() }, scale);
|
||||
m_left_right = Gfx::Bitmap::try_create(Gfx::BitmapFormat::BGRA8888, { left_right_width, frame_rect_including_shadow.height() }, scale);
|
||||
else
|
||||
m_left_right = nullptr;
|
||||
m_shadow_dirty = true;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue