Skip to content

Commit

Permalink
WaveformRenderMark: fix scaling for high DPI screens
Browse files Browse the repository at this point in the history
  • Loading branch information
Be-ing committed Oct 24, 2019
1 parent cb9abf2 commit 72c58eb
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/waveform/renderers/waveformrendermark.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,8 @@ void WaveformRenderMark::draw(QPainter* painter, QPaintEvent* /*event*/) {
if (m_waveformRenderer->getOrientation() == Qt::Horizontal) {
// NOTE: vRince I guess image width is odd to display the center on the exact line !
// external image should respect that ...
const int markHalfWidth = pMark->m_image.width() / 2.0;
const int markHalfWidth = pMark->m_image.width() / 2.0
/ m_waveformRenderer->getDevicePixelRatio();

// Check if the current point need to be displayed
if (currentMarkPoint > -markHalfWidth && currentMarkPoint < m_waveformRenderer->getWidth() + markHalfWidth) {
Expand Down Expand Up @@ -196,7 +197,10 @@ void WaveformRenderMark::generateMarkImage(WaveformMark* pMark) {
height = 2 * labelRectHeight + 1;
}

pMark->m_image = QImage(width, height, QImage::Format_ARGB32_Premultiplied);
pMark->m_image = QImage(width * m_waveformRenderer->getDevicePixelRatio(),
height * m_waveformRenderer->getDevicePixelRatio(),
QImage::Format_ARGB32_Premultiplied);
pMark->m_image.setDevicePixelRatio(m_waveformRenderer->getDevicePixelRatio());

Qt::Alignment markAlignH = markProperties.m_align & Qt::AlignHorizontal_Mask;
Qt::Alignment markAlignV = markProperties.m_align & Qt::AlignVertical_Mask;
Expand Down

0 comments on commit 72c58eb

Please sign in to comment.