From cb5f67875762ec2fc88b3469b23274ea19509fee Mon Sep 17 00:00:00 2001 From: Filip Leonarski Date: Thu, 29 Jan 2026 23:49:42 +0100 Subject: [PATCH] jfjoch_viewer: Use RGB32 format, which gives still a small improvement in coloring time --- viewer/image_viewer/JFJochImage.cpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/viewer/image_viewer/JFJochImage.cpp b/viewer/image_viewer/JFJochImage.cpp index f84bca71..f102ebda 100644 --- a/viewer/image_viewer/JFJochImage.cpp +++ b/viewer/image_viewer/JFJochImage.cpp @@ -14,6 +14,7 @@ #include #include #include +#include #include JFJochImage::JFJochImage(QWidget *parent) : QGraphicsView(parent) { @@ -578,7 +579,7 @@ void JFJochImage::Redraw() { } void JFJochImage::GeneratePixmap() { - QImage qimg(int(W), int(H), QImage::Format_RGB888); + QImage qimg(int(W), int(H), QImage::Format_RGB32); image_rgb.resize(W * H); // Bad pixel color @@ -604,7 +605,7 @@ void JFJochImage::GeneratePixmap() { rgb gap_color = color_scale.Apply(ColorScaleSpecial::Gap); for (int y = 0; y < H; ++y) { - uchar *scanLine = qimg.scanLine(y); + QRgb *scanLine = reinterpret_cast(qimg.scanLine(y)); const float *row = &image_fp[y * W]; rgb *out = &image_rgb[y * W]; @@ -626,9 +627,7 @@ void JFJochImage::GeneratePixmap() { } out[x] = c; - scanLine[x * 3 + 0] = c.r; - scanLine[x * 3 + 1] = c.g; - scanLine[x * 3 + 2] = c.b; + scanLine[x] = qRgb(c.r, c.g, c.b); } }