From b16c462bd31835c9ee50647429e582ee78a118ba Mon Sep 17 00:00:00 2001 From: ronso0 Date: Thu, 3 Jun 2021 00:33:04 +0200 Subject: [PATCH] Waveform: fix markers whe using odd scale factors --- src/waveform/renderers/waveformrendermark.cpp | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/src/waveform/renderers/waveformrendermark.cpp b/src/waveform/renderers/waveformrendermark.cpp index aeb885b1d9d..69ebd958412 100644 --- a/src/waveform/renderers/waveformrendermark.cpp +++ b/src/waveform/renderers/waveformrendermark.cpp @@ -146,6 +146,7 @@ void WaveformRenderMark::slotCuesUpdated() { void WaveformRenderMark::generateMarkImage(WaveformMarkPointer pMark) { // Load the pixmap from file -- takes precedence over text. + float devicePixelRatio = m_waveformRenderer->getDevicePixelRatio(); if (!pMark->m_pixmapPath.isEmpty()) { QString path = pMark->m_pixmapPath; QImage image = *WImageStore::getImage(path, scaleFactor()); @@ -174,10 +175,8 @@ void WaveformRenderMark::generateMarkImage(WaveformMarkPointer pMark) { } } - //QFont font("Bitstream Vera Sans"); - //QFont font("Helvetica"); - QFont font; // Uses the application default - font.setPointSizeF(10 * scaleFactor()); + QFont font; // Uses the application default, if not set per skin + font.setPointSizeF(10 * devicePixelRatio); font.setStretch(100); font.setWeight(75); @@ -210,11 +209,10 @@ void WaveformRenderMark::generateMarkImage(WaveformMarkPointer pMark) { } pMark->m_image = QImage( - width * static_cast(m_waveformRenderer->getDevicePixelRatio()), - height * static_cast(m_waveformRenderer->getDevicePixelRatio()), + static_cast(width * devicePixelRatio), + static_cast(height * devicePixelRatio), QImage::Format_ARGB32_Premultiplied); - pMark->m_image.setDevicePixelRatio( - m_waveformRenderer->getDevicePixelRatio()); + pMark->m_image.setDevicePixelRatio(devicePixelRatio); Qt::Alignment markAlignH = pMark->m_align & Qt::AlignHorizontal_Mask; Qt::Alignment markAlignV = pMark->m_align & Qt::AlignVertical_Mask;