mousemark: Account for render target scale when creating geometry

This commit is contained in:
Arjen Hiemstra 2022-08-05 10:54:53 +02:00
parent b730308e2f
commit dea0383719

View file

@ -87,6 +87,7 @@ void MouseMarkEffect::paintScreen(int mask, const QRegion &region, ScreenPaintDa
vbo->reset(); vbo->reset();
vbo->setUseColor(true); vbo->setUseColor(true);
vbo->setColor(color); vbo->setColor(color);
const auto scale = effects->renderTargetScale();
ShaderBinder binder(ShaderTrait::UniformColor); ShaderBinder binder(ShaderTrait::UniformColor);
binder.shader()->setUniform(GLShader::ModelViewProjectionMatrix, data.projectionMatrix()); binder.shader()->setUniform(GLShader::ModelViewProjectionMatrix, data.projectionMatrix());
QVector<float> verts; QVector<float> verts;
@ -94,7 +95,7 @@ void MouseMarkEffect::paintScreen(int mask, const QRegion &region, ScreenPaintDa
verts.clear(); verts.clear();
verts.reserve(mark.size() * 2); verts.reserve(mark.size() * 2);
for (const QPoint &p : qAsConst(mark)) { for (const QPoint &p : qAsConst(mark)) {
verts << p.x() << p.y(); verts << p.x() * scale << p.y() * scale;
} }
vbo->setData(verts.size() / 2, 2, verts.data(), nullptr); vbo->setData(verts.size() / 2, 2, verts.data(), nullptr);
vbo->render(GL_LINE_STRIP); vbo->render(GL_LINE_STRIP);
@ -103,7 +104,7 @@ void MouseMarkEffect::paintScreen(int mask, const QRegion &region, ScreenPaintDa
verts.clear(); verts.clear();
verts.reserve(drawing.size() * 2); verts.reserve(drawing.size() * 2);
for (const QPoint &p : qAsConst(drawing)) { for (const QPoint &p : qAsConst(drawing)) {
verts << p.x() << p.y(); verts << p.x() * scale << p.y() * scale;
} }
vbo->setData(verts.size() / 2, 2, verts.data(), nullptr); vbo->setData(verts.size() / 2, 2, verts.data(), nullptr);
vbo->render(GL_LINE_STRIP); vbo->render(GL_LINE_STRIP);