diff options
author | Anton Kudryavtsev <anton.kudryavtsev@vk.team> | 2023-09-15 14:31:50 +0300 |
---|---|---|
committer | Anton Kudryavtsev <anton.kudryavtsev@vk.team> | 2023-10-04 21:42:50 +0300 |
commit | 694f4f3a3be5b5239dac95477fe9f6cb380fba42 (patch) | |
tree | fff5ee8a932707296cc709dbdb1444796bceb410 /src/gui/image/qppmhandler.cpp | |
parent | ec7f06fa623a95e2f9c676d6ad475fe99a066111 (diff) |
write_pbm_image: use QBAV more
to reduce allocations
Change-Id: I99351a8042a315b4b0742567ba77082b576cbece
Reviewed-by: MÃ¥rten Nordheim <marten.nordheim@qt.io>
Diffstat (limited to 'src/gui/image/qppmhandler.cpp')
-rw-r--r-- | src/gui/image/qppmhandler.cpp | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/src/gui/image/qppmhandler.cpp b/src/gui/image/qppmhandler.cpp index a4689a99f3..9e999e87a2 100644 --- a/src/gui/image/qppmhandler.cpp +++ b/src/gui/image/qppmhandler.cpp @@ -265,13 +265,12 @@ static bool read_pbm_body(QIODevice *device, char type, int w, int h, int mcc, Q return true; } -static bool write_pbm_image(QIODevice *out, const QImage &sourceImage, const QByteArray &sourceFormat) +static bool write_pbm_image(QIODevice *out, const QImage &sourceImage, QByteArrayView sourceFormat) { QByteArray str; QImage image = sourceImage; - QByteArray format = sourceFormat; + const QByteArrayView format = sourceFormat.left(3); // ignore RAW part - format = format.left(3); // ignore RAW part bool gray = format == "pgm"; if (format == "pbm") { |