mirror of
https://github.com/RGBCube/serenity
synced 2025-07-28 01:17:46 +00:00
LibGfx: Use ErrorOr<T> for Bitmap::try_create()
Another one that was used in a fajillion places.
This commit is contained in:
parent
235f39e449
commit
0de33b3d6c
43 changed files with 157 additions and 141 deletions
|
@ -60,7 +60,7 @@ private:
|
|||
|
||||
Cube::Cube()
|
||||
{
|
||||
m_bitmap = Gfx::Bitmap::try_create(Gfx::BitmapFormat::BGRx8888, { WIDTH, HEIGHT });
|
||||
m_bitmap = Gfx::Bitmap::try_create(Gfx::BitmapFormat::BGRx8888, { WIDTH, HEIGHT }).release_value_but_fixme_should_propagate_errors();
|
||||
|
||||
m_accumulated_time = 0;
|
||||
m_cycles = 0;
|
||||
|
|
|
@ -81,7 +81,7 @@ private:
|
|||
|
||||
Fire::Fire()
|
||||
{
|
||||
bitmap = Gfx::Bitmap::try_create(Gfx::BitmapFormat::Indexed8, { FIRE_WIDTH, FIRE_HEIGHT });
|
||||
bitmap = Gfx::Bitmap::try_create(Gfx::BitmapFormat::Indexed8, { FIRE_WIDTH, FIRE_HEIGHT }).release_value_but_fixme_should_propagate_errors();
|
||||
|
||||
/* Initialize fire palette */
|
||||
for (int i = 0; i < 30; i++)
|
||||
|
|
|
@ -36,7 +36,7 @@ private:
|
|||
|
||||
Canvas::Canvas()
|
||||
{
|
||||
m_bitmap = Gfx::Bitmap::try_create(Gfx::BitmapFormat::BGRx8888, { WIDTH, HEIGHT });
|
||||
m_bitmap = Gfx::Bitmap::try_create(Gfx::BitmapFormat::BGRx8888, { WIDTH, HEIGHT }).release_value_but_fixme_should_propagate_errors();
|
||||
draw();
|
||||
}
|
||||
|
||||
|
|
|
@ -41,8 +41,8 @@ private:
|
|||
|
||||
Canvas::Canvas()
|
||||
{
|
||||
m_bitmap_1x = Gfx::Bitmap::try_create(Gfx::BitmapFormat::BGRx8888, { WIDTH, HEIGHT }, 1);
|
||||
m_bitmap_2x = Gfx::Bitmap::try_create(Gfx::BitmapFormat::BGRx8888, { WIDTH, HEIGHT }, 2);
|
||||
m_bitmap_1x = Gfx::Bitmap::try_create(Gfx::BitmapFormat::BGRx8888, { WIDTH, HEIGHT }, 1).release_value_but_fixme_should_propagate_errors();
|
||||
m_bitmap_2x = Gfx::Bitmap::try_create(Gfx::BitmapFormat::BGRx8888, { WIDTH, HEIGHT }, 2).release_value_but_fixme_should_propagate_errors();
|
||||
|
||||
// m_bitmap_1x and m_bitmap_2x have the same logical size, so LibGfx will try to draw them at the same physical size:
|
||||
// When drawing on a 2x backing store it'd scale m_bitmap_1x up 2x and paint m_bitmap_2x at its physical size.
|
||||
|
|
|
@ -35,7 +35,7 @@ public:
|
|||
|
||||
void resize(Gfx::IntSize const& size)
|
||||
{
|
||||
m_bitmap = Gfx::Bitmap::try_create(Gfx::BitmapFormat::BGRx8888, size);
|
||||
m_bitmap = Gfx::Bitmap::try_create(Gfx::BitmapFormat::BGRx8888, size).release_value_but_fixme_should_propagate_errors();
|
||||
correct_aspect();
|
||||
calculate();
|
||||
}
|
||||
|
|
|
@ -35,7 +35,7 @@ private:
|
|||
|
||||
Screensaver::Screensaver(int width, int height, int interval)
|
||||
{
|
||||
m_bitmap = Gfx::Bitmap::try_create(Gfx::BitmapFormat::BGRx8888, { width, height });
|
||||
m_bitmap = Gfx::Bitmap::try_create(Gfx::BitmapFormat::BGRx8888, { width, height }).release_value_but_fixme_should_propagate_errors();
|
||||
srand(time(nullptr));
|
||||
stop_timer();
|
||||
start_timer(interval);
|
||||
|
|
|
@ -58,7 +58,7 @@ Starfield::Starfield(int interval)
|
|||
|
||||
void Starfield::create_stars(int width, int height, int stars)
|
||||
{
|
||||
m_bitmap = Gfx::Bitmap::try_create(Gfx::BitmapFormat::BGRx8888, { width, height });
|
||||
m_bitmap = Gfx::Bitmap::try_create(Gfx::BitmapFormat::BGRx8888, { width, height }).release_value_but_fixme_should_propagate_errors();
|
||||
|
||||
m_stars.grow_capacity(stars);
|
||||
for (int i = 0; i < stars; i++) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue