No unnecessary mem copy for thumbnails, ensure width % 2

BUG: 365883
parent 3ebe091b
......@@ -65,7 +65,7 @@ Q_OBJECT public:
/** @brief Someone needs us to send again a frame. */
void sendFrameUpdate() {}
void emitFrameUpdated(Mlt::Frame&);
void emitFrameNumber(double position);
void emitConsumerStopped();
......
......@@ -83,11 +83,11 @@ QImage KThumb::getFrame(Mlt::Frame *frame, int width, int height)
int oh = height;
mlt_image_format format = mlt_image_rgb24a;
//frame->set("progressive", "1");
//if (ow % 2 == 1) ow++;
ow += ow % 2;
const uchar* imagedata = frame->get_image(format, ow, oh);
if (imagedata) {
QImage image(ow, oh, QImage::Format_RGBA8888);
memcpy(image.bits(), imagedata, ow * oh * 4);
QImage image(imagedata, ow, oh, QImage::Format_RGBA8888);
//memcpy(image.bits(), imagedata, ow * oh * 4);
if (!image.isNull()) {
if (ow > (2 * width)) {
// there was a scaling problem, do it manually
......
......@@ -459,21 +459,16 @@ QPixmap ClipController::pixmap(int framePosition, int width, int height)
height = m_masterProducer->get_int("height");
}
}
// int ow = frameWidth;
// int oh = height;
mlt_image_format format = mlt_image_rgb24a;
QImage image(width, height, QImage::Format_RGBA8888);
width += width % 2;
height += height % 2;
const uchar* imagedata = frame->get_image(format, width, height);
if (imagedata) {
memcpy(image.bits(), imagedata, width * height * 4);
}
else image.fill(QColor(Qt::red).rgb());
QImage image(imagedata, width, height, QImage::Format_RGBA8888);
delete frame;
QPixmap pixmap;;
QPixmap pixmap;
pixmap.convertFromImage(image);
return pixmap;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment