1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 06:27:45 +00:00

VirGLDemo: Make a factory function for Demo and propagate errors

This removes a measly 1 FIXME :))
This commit is contained in:
Baitinq 2022-12-15 12:35:52 +01:00 committed by Linus Groh
parent d4f74d6c48
commit c4f68bde57
3 changed files with 13 additions and 4 deletions

View file

@ -9,11 +9,18 @@
#include "Widget.h"
ErrorOr<NonnullRefPtr<Demo>> Demo::create()
{
auto demo = TRY(adopt_nonnull_ref_or_enomem(new (nothrow) Demo));
demo->m_bitmap = TRY(Gfx::Bitmap::try_create(Gfx::BitmapFormat::BGRx8888, { DRAWTARGET_WIDTH, DRAWTARGET_HEIGHT }));
demo->m_bitmap->fill(Gfx::Color::Black);
return demo;
}
Demo::Demo()
{
m_bitmap = Gfx::Bitmap::try_create(Gfx::BitmapFormat::BGRx8888, { DRAWTARGET_WIDTH, DRAWTARGET_HEIGHT }).release_value_but_fixme_should_propagate_errors();
m_bitmap->fill(Gfx::Color::Black);
m_cycles = 0;
stop_timer();