From a08de199226d1cc13ed320b5f994d2b24eb50000 Mon Sep 17 00:00:00 2001 From: Lucas CHOLLET Date: Sun, 30 Apr 2023 20:30:50 -0400 Subject: [PATCH] LibGfx/PortableFormat: Use `FixedArray::unchecked_at` This allows us to drop from 7% to 5% passed on `add_pixels` when using `image` to do conversions from JPEG to PPM. --- .../Libraries/LibGfx/ImageFormats/PortableFormatWriter.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Userland/Libraries/LibGfx/ImageFormats/PortableFormatWriter.cpp b/Userland/Libraries/LibGfx/ImageFormats/PortableFormatWriter.cpp index 018b2e45d1..81d78153d5 100644 --- a/Userland/Libraries/LibGfx/ImageFormats/PortableFormatWriter.cpp +++ b/Userland/Libraries/LibGfx/ImageFormats/PortableFormatWriter.cpp @@ -39,9 +39,9 @@ ErrorOr PortableFormatWriter::add_pixels(Stream& output, Options const& op for (int j = 0; j < bitmap.width(); ++j) { auto const color = bitmap.get_pixel(j, i); - row[j * 3 + 0] = color.red(); - row[j * 3 + 1] = color.green(); - row[j * 3 + 2] = color.blue(); + row.unchecked_at(j * 3 + 0) = color.red(); + row.unchecked_at(j * 3 + 1) = color.green(); + row.unchecked_at(j * 3 + 2) = color.blue(); } TRY(output.write_until_depleted(row.span()));