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.
This commit is contained in:
Lucas CHOLLET 2023-04-30 20:30:50 -04:00 committed by Andreas Kling
parent 4a2ef231b8
commit a08de19922

View file

@ -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()));