Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WaveformRenderMark: fix scaling for high DPI screens #2331

Merged
merged 1 commit into from
Oct 24, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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