From: Jean-Baptiste Mardelle Date: Sun, 14 Oct 2012 22:27:34 +0000 (+0200) Subject: Round corners in project tree thumbnails X-Git-Url: https://git.sesse.net/?a=commitdiff_plain;h=57fe61218c3ecab2c5c18bc8e81b55823691540b;p=kdenlive Round corners in project tree thumbnails --- diff --git a/src/clipproperties.cpp b/src/clipproperties.cpp index b0b95709..adb9ad44 100644 --- a/src/clipproperties.cpp +++ b/src/clipproperties.cpp @@ -42,6 +42,8 @@ #include +#include + static const int VIDEOTAB = 0; static const int AUDIOTAB = 1; @@ -437,7 +439,17 @@ ClipProperties::ClipProperties(DocClipBase *clip, Timecode tc, double fps, QWidg int width = 180.0 * KdenliveSettings::project_display_ratio(); if (width % 2 == 1) width++; QPixmap pix = m_clip->thumbProducer()->getImage(url, m_clip->getClipThumbFrame(), width, 180); - m_view.clip_thumb->setPixmap(pix); + QPixmap framedPix(pix.width(), pix.height()); + framedPix.fill(Qt::transparent); + QPainter p(&framedPix); + p.setRenderHint(QPainter::Antialiasing, true); + QPainterPath path; + path.addRoundedRect(0.5, 0.5, framedPix.width() - 1, framedPix.height() - 1, 4, 4); + p.setClipPath(path); + p.drawPixmap(0, 0, pix); + p.end(); + + m_view.clip_thumb->setPixmap(framedPix); if (t == IMAGE || t == VIDEO || t == PLAYLIST) m_view.tabWidget->removeTab(AUDIOTAB); } else { m_view.tabWidget->removeTab(IMAGETAB); diff --git a/src/projectlist.cpp b/src/projectlist.cpp index c1a03f06..069a5853 100644 --- a/src/projectlist.cpp +++ b/src/projectlist.cpp @@ -2316,7 +2316,15 @@ void ProjectList::slotReplyGetImage(const QString &clipId, const QImage &img) { ProjectItem *item = getItemById(clipId); if (item && !img.isNull()) { - QPixmap pix = QPixmap::fromImage(img); + QPixmap pix(img.width(), img.height()); + pix.fill(Qt::transparent); + QPainter p(&pix); + p.setRenderHint(QPainter::Antialiasing, true); + QPainterPath path; + path.addRoundedRect(0.5, 0.5, pix.width() - 1, pix.height() - 1, 2, 2); + p.setClipPath(path); + p.drawImage(0, 0, img); + p.end(); processThumbOverlays(item, pix); monitorItemEditing(false); item->setData(0, Qt::DecorationRole, pix); diff --git a/src/renderer.cpp b/src/renderer.cpp index c163bb12..482384d8 100644 --- a/src/renderer.cpp +++ b/src/renderer.cpp @@ -128,7 +128,7 @@ Render::Render(Kdenlive::MONITORID rendererName, int winid, QString profile, QWi m_mltConsumer->connect(*m_mltProducer); m_mltProducer->set_speed(0.0); m_refreshTimer.setSingleShot(true); - m_refreshTimer.setInterval(70); + m_refreshTimer.setInterval(100); connect(&m_refreshTimer, SIGNAL(timeout()), this, SLOT(refresh())); connect(this, SIGNAL(multiStreamFound(const QString &,QList,QList,stringMap)), this, SLOT(slotMultiStreamProducerFound(const QString &,QList,QList,stringMap))); } @@ -1653,7 +1653,7 @@ void Render::refresh() return; if (m_mltConsumer) { if (m_mltConsumer->is_stopped()) m_mltConsumer->start(); - m_mltConsumer->purge(); + //m_mltConsumer->purge(); m_mltConsumer->set("refresh", 1); } }