jfjoch_viewer: fix error in updating the pixmap

This commit is contained in:
2026-04-15 10:32:57 +02:00
parent 9acbff0644
commit ae0c4a7d01
+3 -5
View File
@@ -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<QRgb*>(qimg_buffer_.scanLine(y));
QRgb *scanLine = reinterpret_cast<QRgb*>(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);
}