From ae0c4a7d01acc7dbe965704af8d29f7f7bd3f6a3 Mon Sep 17 00:00:00 2001 From: Filip Leonarski Date: Wed, 15 Apr 2026 10:32:57 +0200 Subject: [PATCH] jfjoch_viewer: fix error in updating the pixmap --- viewer/image_viewer/JFJochImage.cpp | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/viewer/image_viewer/JFJochImage.cpp b/viewer/image_viewer/JFJochImage.cpp index 463421bd..d2fb126c 100644 --- a/viewer/image_viewer/JFJochImage.cpp +++ b/viewer/image_viewer/JFJochImage.cpp @@ -596,9 +596,7 @@ void JFJochImage::Redraw() { } void JFJochImage::GeneratePixmap() { - // Reuse buffer if size matches, otherwise reallocate - if (qimg_buffer_.width() != int(W) || qimg_buffer_.height() != int(H)) - qimg_buffer_ = QImage(int(W), int(H), QImage::Format_RGB32); + QImage qimg(int(W), int(H), QImage::Format_RGB32); image_rgb.resize(W * H); @@ -632,7 +630,7 @@ void JFJochImage::GeneratePixmap() { for (int y = 0; y < H; ++y) rows.push_back(y); QtConcurrent::blockingMap(rows, [&](int y) { - QRgb *scanLine = reinterpret_cast(qimg_buffer_.scanLine(y)); + QRgb *scanLine = reinterpret_cast(qimg.scanLine(y)); const float *row = &image_fp[y * W]; rgb *out = &image_rgb[y * W]; @@ -673,7 +671,7 @@ void JFJochImage::GeneratePixmap() { } }); - pixmap = QPixmap::fromImage(qimg_buffer_); + pixmap = QPixmap::fromImage(qimg); pixmap.setDevicePixelRatio(1.0); }