Skip to content

Commit

Permalink
Preview: copy construct QImage for each frame
Browse files Browse the repository at this point in the history
When a reference is passed to QImage instead, it works with VS R54 (so, why?) but breaks down with R55. The old COMPATBGR32 implementation took a mirror() (equivalent to FlipVertical) after QImage construction, which indeed copied the frame data.
  • Loading branch information
YomikoR committed Aug 27, 2021
1 parent e15452b commit 1e7eccb
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions vsedit/src/preview/preview_dialog.cpp
Expand Up @@ -10,6 +10,7 @@
#include "preview_advanced_settings_dialog.h"

#include <vapoursynth/VapourSynth.h>
#include <vapoursynth/VSHelper.h>

#include <QEvent>
#include <QCloseEvent>
Expand Down Expand Up @@ -2012,9 +2013,13 @@ QPixmap PreviewDialog::pixmapFromRGB(
int height = m_cpVSAPI->getFrameHeight(a_cpFrameRef, 0);
int stride = m_cpVSAPI->getStride(a_cpFrameRef, 0);

const void * pData = m_cpVSAPI->getReadPtr(a_cpFrameRef, 0);
QImage frameImage((const uchar *)pData, width, height, stride,
is_10_bits ? QImage::Format_RGB30 : QImage::Format_RGB32);
const uint8_t * pData = m_cpVSAPI->getReadPtr(a_cpFrameRef, 0);

QImage frameImage(width, height, is_10_bits ?
QImage::Format_RGB30 : QImage::Format_RGB32);

vs_bitblt(frameImage.bits(), frameImage.bytesPerLine(), pData, stride,
wwidth, height);

QPixmap framePixmap = QPixmap::fromImage(frameImage, Qt::NoFormatConversion);
return framePixmap;
Expand Down

0 comments on commit 1e7eccb

Please sign in to comment.