Skip to content

Commit

Permalink
Waveform: fix shifted pixmap markers with odd scale factors
Browse files Browse the repository at this point in the history
  • Loading branch information
ronso0 committed Jun 3, 2021
1 parent 9e7e0c7 commit 7c4855a
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/waveform/renderers/waveformrendermark.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -149,14 +149,20 @@ void WaveformRenderMark::generateMarkImage(WaveformMarkPointer pMark) {
float devicePixelRatio = m_waveformRenderer->getDevicePixelRatio();
if (!pMark->m_pixmapPath.isEmpty()) {
QString path = pMark->m_pixmapPath;
QImage image = *WImageStore::getImage(path, scaleFactor());
// Dse devicePixelRatio to properly scale the image
QImage image = *WImageStore::getImage(path, devicePixelRatio);
//QImage image = QImage(path);
// If loading the image didn't fail, then we're done. Otherwise fall
// through and render a label.
if (!image.isNull()) {
pMark->m_image =
image.convertToFormat(QImage::Format_ARGB32_Premultiplied);
//WImageStore::correctImageColors(&pMark->m_image);
// Do this in order to get a truely scaled image, not just a blurry one.
// See https://doc.qt.io/qt-5/qimage.html#setDevicePixelRatio
// Without this some Qt internal issue results in an offset image
// when calculating the center line in draw()
pMark->m_image.setDevicePixelRatio(devicePixelRatio);
return;
}
}
Expand Down

0 comments on commit 7c4855a

Please sign in to comment.