diff options
-rw-r--r-- | res/linux/mixxx.appdata.xml | 12 | ||||
-rw-r--r-- | src/library/coverartcache.cpp | 12 | ||||
-rw-r--r-- | src/library/coverartdelegate.cpp | 14 | ||||
-rw-r--r-- | src/library/dlgcoverartfullsize.cpp | 6 | ||||
-rw-r--r-- | src/widget/wcoverart.cpp | 7 | ||||
-rw-r--r-- | src/widget/wcoverartlabel.cpp | 16 | ||||
-rw-r--r-- | src/widget/wspinny.cpp | 12 |
7 files changed, 48 insertions, 31 deletions
diff --git a/res/linux/mixxx.appdata.xml b/res/linux/mixxx.appdata.xml index b089901998..39bb082aeb 100644 --- a/res/linux/mixxx.appdata.xml +++ b/res/linux/mixxx.appdata.xml @@ -38,14 +38,14 @@ </description> <screenshots> <screenshot type="default"> - <image>http://www.mixxx.org/static/images/press_art/mixxx_200_deere_skin.png</image> + <image>https://www.mixxx.org/static/images/press_art/mixxx_200_deere_skin.png</image> <caption>Mixxx with the default Deere skin</caption> </screenshot> </screenshots> - <url type="homepage">http://mixxx.org</url> - <url type="bugtracker">https://bugs.launchpad.net/mixxx/</url> - <url type="donation">http://www.mixxx.org/support/</url> - <url type="help">http://www.mixxx.org/support/</url> - <url type="translate">https://www.transifex.com/mixxx-dj-software/public/</url> + <url type="homepage">https://mixxx.org</url> + <url type="bugtracker">https://bugs.launchpad.net/mixxx</url> + <url type="donation">https://www.mixxx.org/support</url> + <url type="help">https://www.mixxx.org/support</url> + <url type="translate">https://www.transifex.com/mixxx-dj-software/public</url> <update_contact>mixxx-devel@lists.sourceforge.net</update_contact> </component> diff --git a/src/library/coverartcache.cpp b/src/library/coverartcache.cpp index 6aeaa11074..ea16b7a38b 100644 --- a/src/library/coverartcache.cpp +++ b/src/library/coverartcache.cpp @@ -15,7 +15,7 @@ mixxx::Logger kLogger("CoverArtCache"); QString pixmapCacheKey(quint16 hash, int width) { return QString("CoverArtCache_%1_%2") - .arg(QString::number(hash)).arg(width); + .arg(QString::number(hash), QString::number(width)); } // The transformation mode when scaling images @@ -26,10 +26,10 @@ inline QImage resizeImageWidth(const QImage& image, int width) { return image.scaledToWidth(width, kTransformationMode); } -} // anonymous namespace - const bool sDebug = false; +} // anonymous namespace + CoverArtCache::CoverArtCache() { // The initial QPixmapCache limit is 10MB. // But it is not used just by the coverArt stuff, @@ -80,6 +80,9 @@ QPixmap CoverArtCache::requestCover(const CoverInfo& requestInfo, QPixmap pixmap; if (QPixmapCache::find(cacheKey, &pixmap)) { + if (sDebug) { + kLogger.debug() << "CoverArtCache::requestCover cover found in cache" << requestInfo << signalWhenDone; + } if (signalWhenDone) { emit(coverFound(pRequestor, requestInfo, pixmap, true)); } @@ -93,6 +96,9 @@ QPixmap CoverArtCache::requestCover(const CoverInfo& requestInfo, return QPixmap(); } + if (sDebug) { + kLogger.debug() << "CoverArtCache::requestCover starting future for" << requestInfo; + } m_runningRequests.insert(requestId); // The watcher will be deleted in coverLoaded() QFutureWatcher<FutureResult>* watcher = new QFutureWatcher<FutureResult>(this); diff --git a/src/library/coverartdelegate.cpp b/src/library/coverartdelegate.cpp index db399862bb..fcfa0bd9c9 100644 --- a/src/library/coverartdelegate.cpp +++ b/src/library/coverartdelegate.cpp @@ -4,9 +4,8 @@ #include "library/coverartcache.h" #include "library/dao/trackschema.h" #include "library/trackmodel.h" - #include "widget/wlibrarytableview.h" - +#include "util/compatibility.h" #include "util/math.h" @@ -110,17 +109,14 @@ void CoverArtDelegate::paintItem(QPainter *painter, info.hash = index.sibling(index.row(), m_iCoverHashColumn).data().toUInt(); info.trackLocation = index.sibling(index.row(), m_iTrackLocationColumn).data().toString(); + double scaleFactor = getDevicePixelRatioF(static_cast<QWidget*>(parent())); // We listen for updates via slotCoverFound above and signal to // BaseSqlTableModel when a row's cover is ready. - QPixmap pixmap = pCache->requestCover(info, this, option.rect.width(), + QPixmap pixmap = pCache->requestCover(info, this, option.rect.width() * scaleFactor, m_bOnlyCachedCover, true); if (!pixmap.isNull()) { - int width = math_min(pixmap.width(), option.rect.width()); - int height = math_min(pixmap.height(), option.rect.height()); - QRect target(option.rect.x(), option.rect.y(), - width, height); - QRect source(0, 0, target.width(), target.height()); - painter->drawPixmap(target, pixmap, source); + pixmap.setDevicePixelRatio(scaleFactor); + painter->drawPixmap(option.rect.topLeft(), pixmap); } else if (!m_bOnlyCachedCover) { // If we asked for a non-cache image and got a null pixmap, then our // request was queued. diff --git a/src/library/dlgcoverartfullsize.cpp b/src/library/dlgcoverartfullsize.cpp index 1269d4ebf6..3cc573d700 100644 --- a/src/library/dlgcoverartfullsize.cpp +++ b/src/library/dlgcoverartfullsize.cpp @@ -150,8 +150,9 @@ void DlgCoverArtFullSize::slotCoverFound(const QObject* pRequestor, dialogSize.scale(availableScreenSpace.width(), dialogSize.height(), Qt::KeepAspectRatio); } - QPixmap resizedPixmap = m_pixmap.scaled(size(), + QPixmap resizedPixmap = m_pixmap.scaled(size() * getDevicePixelRatioF(this), Qt::KeepAspectRatio, Qt::SmoothTransformation); + resizedPixmap.setDevicePixelRatio(getDevicePixelRatioF(this)); coverArt->setPixmap(resizedPixmap); // center the window @@ -225,8 +226,9 @@ void DlgCoverArtFullSize::resizeEvent(QResizeEvent* event) { return; } // qDebug() << "DlgCoverArtFullSize::resizeEvent" << size(); - QPixmap resizedPixmap = m_pixmap.scaled(size(), + QPixmap resizedPixmap = m_pixmap.scaled(size() * getDevicePixelRatioF(this), Qt::KeepAspectRatio, Qt::SmoothTransformation); + resizedPixmap.setDevicePixelRatio(getDevicePixelRatioF(this)); coverArt->setPixmap(resizedPixmap); } diff --git a/src/widget/wcoverart.cpp b/src/widget/wcoverart.cpp index 4d64463b67..99471be430 100644 --- a/src/widget/wcoverart.cpp +++ b/src/widget/wcoverart.cpp @@ -12,6 +12,7 @@ #include "library/coverartcache.h" #include "library/coverartutils.h" #include "library/dlgcoverartfullsize.h" +#include "util/compatibility.h" #include "util/dnd.h" #include "util/math.h" @@ -190,7 +191,11 @@ QPixmap WCoverArt::scaledCoverArt(const QPixmap& normal) { if (normal.isNull()) { return QPixmap(); } - return normal.scaled(size(), Qt::KeepAspectRatio, Qt::SmoothTransformation); + QPixmap scaled; + scaled = normal.scaled(size() * getDevicePixelRatioF(this), + Qt::KeepAspectRatio, Qt::SmoothTransformation); + scaled.setDevicePixelRatio(getDevicePixelRatioF(this)); + return scaled; } void WCoverArt::paintEvent(QPaintEvent* /*unused*/) { diff --git a/src/widget/wcoverartlabel.cpp b/src/widget/wcoverartlabel.cpp index 6c5df337b4..c2637ad71a 100644 --- a/src/widget/wcoverartlabel.cpp +++ b/src/widget/wcoverartlabel.cpp @@ -4,6 +4,7 @@ #include "library/dlgcoverartfullsize.h" #include "library/coverartutils.h" +#include "util/compatibility.h" static const QSize s_labelDisplaySize = QSize(100, 100); @@ -23,7 +24,8 @@ WCoverArtLabel::WCoverArtLabel(QWidget* parent) connect(m_pCoverMenu, SIGNAL(reloadCoverArt()), this, SIGNAL(reloadCoverArt())); - m_defaultCover = m_defaultCover.scaled(s_labelDisplaySize, + m_defaultCover.setDevicePixelRatio(getDevicePixelRatioF(this)); + m_defaultCover = m_defaultCover.scaled(s_labelDisplaySize * getDevicePixelRatioF(this), Qt::KeepAspectRatio, Qt::SmoothTransformation); setPixmap(m_defaultCover); @@ -37,18 +39,18 @@ void WCoverArtLabel::setCoverArt(const CoverInfo& coverInfo, QPixmap px) { qDebug() << "WCoverArtLabel::setCoverArt" << coverInfo << px.size(); - m_loadedCover = px; + m_loadedCover = px.scaled(s_labelDisplaySize * getDevicePixelRatioF(this), + Qt::KeepAspectRatio, Qt::SmoothTransformation); + m_loadedCover.setDevicePixelRatio(getDevicePixelRatioF(this)); m_pCoverMenu->setCoverArt(coverInfo); - - if (px.isNull()) { + if (m_loadedCover.isNull()) { setPixmap(m_defaultCover); } else { - setPixmap(px.scaled(s_labelDisplaySize, Qt::KeepAspectRatio, - Qt::SmoothTransformation)); + setPixmap(m_loadedCover); } - QSize frameSize = pixmap()->size(); + QSize frameSize = pixmap()->size() / getDevicePixelRatioF(this); frameSize += QSize(2,2); // margin setMinimumSize(frameSize); setMaximumSize(frameSize); diff --git a/src/widget/wspinny.cpp b/src/widget/wspinny.cpp index 4a1c647f0c..5aa9ea420f 100644 --- a/src/widget/wspinny.cpp +++ b/src/widget/wspinny.cpp @@ -8,6 +8,7 @@ #include "control/controlobject.h" #include "control/controlproxy.h" #include "library/coverartcache.h" +#include "util/compatibility.h" #include "util/dnd.h" #include "waveform/sharedglcontext.h" #include "util/math.h" @@ -320,6 +321,8 @@ void WSpinny::render(VSyncThread* vSyncThread) { &m_dGhostAngleCurrentPlaypos); } + double scaleFactor = getDevicePixelRatioF(this); + QPainter p(this); p.setRenderHint(QPainter::Antialiasing); p.setRenderHint(QPainter::HighQualityAntialiasing); @@ -331,8 +334,8 @@ void WSpinny::render(VSyncThread* vSyncThread) { if (m_bShowCover && !m_loadedCoverScaled.isNull()) { // Some covers aren't square, so center them. - int x = (width() - m_loadedCoverScaled.width()) / 2; - int y = (height() - m_loadedCoverScaled.height()) / 2; + int x = (width() - m_loadedCoverScaled.width() / scaleFactor) / 2; + int y = (height() - m_loadedCoverScaled.height() / scaleFactor) / 2; p.drawPixmap(x, y, m_loadedCoverScaled); } @@ -405,7 +408,10 @@ QPixmap WSpinny::scaledCoverArt(const QPixmap& normal) { if (normal.isNull()) { return QPixmap(); } - return normal.scaled(size(), Qt::KeepAspectRatio, Qt::SmoothTransformation); + QPixmap scaled = normal.scaled(size() * getDevicePixelRatioF(this), + Qt::KeepAspectRatio, Qt::SmoothTransformation); + scaled.setDevicePixelRatio(getDevicePixelRatioF(this)); + return scaled; } void WSpinny::resizeEvent(QResizeEvent* /*unused*/) { |