From 694f4f3a3be5b5239dac95477fe9f6cb380fba42 Mon Sep 17 00:00:00 2001 From: Anton Kudryavtsev Date: Fri, 15 Sep 2023 14:31:50 +0300 Subject: [PATCH] write_pbm_image: use QBAV more MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit to reduce allocations Change-Id: I99351a8042a315b4b0742567ba77082b576cbece Reviewed-by: MÃ¥rten Nordheim --- src/gui/image/qppmhandler.cpp | 5 ++--- 1 file 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") {