summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLucas CHOLLET <lucas.chollet@free.fr>2023-04-30 20:30:50 -0400
committerAndreas Kling <kling@serenityos.org>2023-05-09 11:18:46 +0200
commita08de199226d1cc13ed320b5f994d2b24eb50000 (patch)
treeb2521a33b4fa5ad44e73ee470539d3de3db98764
parent4a2ef231b84cc5b118366d20ccbb6427e9fb0805 (diff)
downloadserenity-a08de199226d1cc13ed320b5f994d2b24eb50000.zip
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.
-rw-r--r--Userland/Libraries/LibGfx/ImageFormats/PortableFormatWriter.cpp6
1 files 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<void> 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()));