mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 05:27:45 +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
|
@ -25,8 +25,8 @@ BENCHMARK_CASE(diagonal_lines)
|
|||
const int run_count = 50;
|
||||
const int bitmap_size = 2000;
|
||||
|
||||
auto bitmap = Gfx::Bitmap::try_create(Gfx::BitmapFormat::BGRx8888, { bitmap_size, bitmap_size });
|
||||
Gfx::Painter painter(*bitmap);
|
||||
auto bitmap = Gfx::Bitmap::try_create(Gfx::BitmapFormat::BGRx8888, { bitmap_size, bitmap_size }).release_value_but_fixme_should_propagate_errors();
|
||||
Gfx::Painter painter(bitmap);
|
||||
|
||||
for (int run = 0; run < run_count; run++) {
|
||||
for (int i = 0; i < bitmap_size; i++) {
|
||||
|
@ -41,8 +41,8 @@ BENCHMARK_CASE(fill)
|
|||
const int run_count = 1000;
|
||||
const int bitmap_size = 2000;
|
||||
|
||||
auto bitmap = Gfx::Bitmap::try_create(Gfx::BitmapFormat::BGRx8888, { bitmap_size, bitmap_size });
|
||||
Gfx::Painter painter(*bitmap);
|
||||
auto bitmap = Gfx::Bitmap::try_create(Gfx::BitmapFormat::BGRx8888, { bitmap_size, bitmap_size }).release_value_but_fixme_should_propagate_errors();
|
||||
Gfx::Painter painter(bitmap);
|
||||
|
||||
for (int run = 0; run < run_count; run++) {
|
||||
painter.fill_rect(bitmap->rect(), Color::Blue);
|
||||
|
@ -54,8 +54,8 @@ BENCHMARK_CASE(fill_with_gradient)
|
|||
const int run_count = 50;
|
||||
const int bitmap_size = 2000;
|
||||
|
||||
auto bitmap = Gfx::Bitmap::try_create(Gfx::BitmapFormat::BGRx8888, { bitmap_size, bitmap_size });
|
||||
Gfx::Painter painter(*bitmap);
|
||||
auto bitmap = Gfx::Bitmap::try_create(Gfx::BitmapFormat::BGRx8888, { bitmap_size, bitmap_size }).release_value_but_fixme_should_propagate_errors();
|
||||
Gfx::Painter painter(bitmap);
|
||||
|
||||
for (int run = 0; run < run_count; run++) {
|
||||
painter.fill_rect_with_gradient(bitmap->rect(), Color::Blue, Color::Red);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue