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

Fix 13060 loop gradient #13061

Merged
merged 1 commit into from
Apr 7, 2024
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
25 changes: 16 additions & 9 deletions src/waveform/renderers/allshader/waveformrendermark.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -169,22 +169,26 @@ void allshader::WaveformRenderMark::paintGL() {

const double samplePosition = pMark->getSamplePosition();
if (samplePosition != Cue::kNoPosition) {
float currentMarkPoint = static_cast<float>(
m_waveformRenderer->transformSamplePositionInRendererWorld(
samplePosition));
const float currentMarkPoint =
std::round(
static_cast<float>(
m_waveformRenderer
->transformSamplePositionInRendererWorld(
samplePosition)) *
devicePixelRatio) /
devicePixelRatio;
const double sampleEndPosition = pMark->getSampleEndPosition();

// Pixmaps are expected to have the mark stroke at the center,
// and preferably have an odd width in order to have the stroke
// exactly at the sample position.
const float markHalfWidth = pTexture->width() / devicePixelRatio / 2.f;
const float drawOffset = currentMarkPoint - markHalfWidth;
currentMarkPoint = qRound(drawOffset * devicePixelRatio) / devicePixelRatio;

bool visible = false;
// Check if the current point needs to be displayed.
if (currentMarkPoint > -markHalfWidth &&
currentMarkPoint < m_waveformRenderer->getLength() +
if (drawOffset > -markHalfWidth &&
drawOffset < m_waveformRenderer->getLength() +
markHalfWidth) {
drawTexture(drawOffset, 0, pTexture);
visible = true;
Expand Down Expand Up @@ -222,9 +226,12 @@ void allshader::WaveformRenderMark::paintGL() {
}
m_waveformRenderer->setMarkPositions(marksOnScreen);

const float currentMarkPoint = std::floor(
static_cast<float>(m_waveformRenderer->getPlayMarkerPosition() *
m_waveformRenderer->getLength()));
const float currentMarkPoint =
std::round(static_cast<float>(
m_waveformRenderer->getPlayMarkerPosition() *
m_waveformRenderer->getLength()) *
devicePixelRatio) /
devicePixelRatio;

const float markHalfWidth = m_pPlayPosMarkTexture->width() / devicePixelRatio / 2.f;
const float drawOffset = currentMarkPoint - markHalfWidth;
Expand Down