From 5e2bfbfc059a108f74e64fac3046272ab6094988 Mon Sep 17 00:00:00 2001 From: Jean-Baptiste Mardelle Date: Fri, 26 Mar 2010 14:34:14 +0000 Subject: [PATCH] Small fix in thumbnail creation svn path=/trunk/kdenlive/; revision=4358 --- src/kthumb.cpp | 2 +- src/projectlist.h | 5 ++--- src/renderer.cpp | 11 +++++------ 3 files changed, 8 insertions(+), 10 deletions(-) diff --git a/src/kthumb.cpp b/src/kthumb.cpp index dcbb27ce..358e4223 100644 --- a/src/kthumb.cpp +++ b/src/kthumb.cpp @@ -194,8 +194,8 @@ void KThumb::extractImage(int frame, int frame2) void KThumb::doGetThumbs() { - const int twidth = (int)(KdenliveSettings::trackheight() * m_dar); const int theight = KdenliveSettings::trackheight(); + const int twidth = (int)(theight * m_dar + 0.5); while (!m_requestedThumbs.isEmpty()) { int frame = m_requestedThumbs.takeFirst(); diff --git a/src/projectlist.h b/src/projectlist.h index 6ac386be..e9951fd8 100644 --- a/src/projectlist.h +++ b/src/projectlist.h @@ -82,7 +82,7 @@ public: painter->setPen(option.palette.highlightedText().color()); } const int textMargin = style->pixelMetric(QStyle::PM_FocusFrameHMargin) + 1; - QPixmap pixmap = index.data(Qt::DecorationRole).value(); + QPixmap pixmap = qVariantValue(index.data(Qt::DecorationRole)); if ((index.flags() & (Qt::ItemIsDragEnabled)) == false) { KIcon icon("dialog-close"); QPainter p(&pixmap); @@ -90,8 +90,7 @@ public: p.end(); } - QPoint point(r1.left() + textMargin, r1.top() + (r1.height() - pixmap.height()) / 2); - painter->drawPixmap(point, pixmap); + painter->drawPixmap(r1.left() + textMargin, r1.top() + (r1.height() - pixmap.height()) / 2, pixmap); int decoWidth = pixmap.width() + 2 * textMargin; QFont font = painter->font(); diff --git a/src/renderer.cpp b/src/renderer.cpp index 6eb6b50c..f90ecd36 100644 --- a/src/renderer.cpp +++ b/src/renderer.cpp @@ -357,7 +357,7 @@ char *Render::decodedString(QString str) */ int Render::renderWidth() const { - return (int)(m_mltProfile->height() * m_mltProfile->dar()); + return (int)(m_mltProfile->height() * m_mltProfile->dar() + 0.5); } int Render::renderHeight() const @@ -608,7 +608,7 @@ void Render::getFileProperties(const QDomElement xml, const QString &clipId, int char *tmp = decodedString("kdenlivetitle:" + xml.attribute("resource")); producer = new Mlt::Producer(*m_mltProfile, 0, tmp); delete[] tmp; - if (xml.hasAttribute("xmldata")) { + if (producer && xml.hasAttribute("xmldata")) { char *tmp = decodedString(xml.attribute("xmldata")); producer->set("xmldata", tmp); delete[] tmp; @@ -682,7 +682,7 @@ void Render::getFileProperties(const QDomElement xml, const QString &clipId, int return; } - int width = (int)(imageHeight * m_mltProfile->dar()); + int width = (int)(imageHeight * m_mltProfile->dar() + 0.5); QMap < QString, QString > filePropertyMap; QMap < QString, QString > metadataPropertyMap; @@ -738,9 +738,9 @@ void Render::getFileProperties(const QDomElement xml, const QString &clipId, int mlt_image_format format = mlt_image_rgb24a; int frame_width = width; int frame_height = imageHeight; - QPixmap pix(width, imageHeight); uint8_t *data = frame->get_image(format, frame_width, frame_height, 0); QImage image((uchar *)data, frame_width, frame_height, QImage::Format_ARGB32); + QPixmap pix(frame_width, frame_height); if (!image.isNull()) { pix = QPixmap::fromImage(image.rgbSwapped()); @@ -755,7 +755,7 @@ void Render::getFileProperties(const QDomElement xml, const QString &clipId, int filePropertyMap["type"] = "audio"; } } - + delete frame; // Retrieve audio / video codec name // If there is a @@ -835,7 +835,6 @@ void Render::getFileProperties(const QDomElement xml, const QString &clipId, int producer->seek(0); emit replyGetFileProperties(clipId, producer, filePropertyMap, metadataPropertyMap, replaceProducer); kDebug() << "REquested fuile info for: " << url.path(); - delete frame; // FIXME: should delete this to avoid a leak... //delete producer; } -- 2.39.2