Round window and geometry positions in OpenGL scene

This rounds the position of geometry in the OpenGL scene, which means
things that are fractionally scaled and end up between pixel boundaries
are instead aligned to pixels. This doesn't fully solve the fractional
scaling blurriness, as we still need the application to provide a buffer
with the correct size. If we do have a buffer with the correct size, we
will now render properly aligned. For example, internal clients should
now be correct.
This commit is contained in:
Arjen Hiemstra 2022-07-28 14:09:33 +02:00
parent b8b9236ec4
commit 64e42bbd04
2 changed files with 4 additions and 4 deletions

View file

@ -1087,7 +1087,7 @@ void WindowQuadList::makeInterleavedArrays(unsigned int type, GLVertex2D *vertic
for (int j = 0; j < 4; j++) {
const WindowVertex &wv = quad[j];
auto vertexPos = QVector2D(wv.x(), wv.y()) * scale;
auto vertexPos = roundVector(QVector2D(wv.x(), wv.y()) * scale);
GLVertex2D v;
v.position = vertexPos;
v.texcoord = QVector2D(wv.u(), wv.v()) * coeff + offset;
@ -1104,7 +1104,7 @@ void WindowQuadList::makeInterleavedArrays(unsigned int type, GLVertex2D *vertic
for (int j = 0; j < 4; j++) {
const WindowVertex &wv = quad[j];
auto vertexPos = QVector2D(wv.x(), wv.y()) * scale;
auto vertexPos = roundVector(QVector2D(wv.x(), wv.y()) * scale);
v[j].position = vertexPos;
v[j].texcoord = QVector2D(wv.u(), wv.v()) * coeff + offset;
}

View file

@ -326,9 +326,9 @@ void SceneOpenGL::createRenderNode(Item *item, RenderContext *context)
const QList<Item *> sortedChildItems = item->sortedChildItems();
QMatrix4x4 matrix;
const auto logicalPosition = QVector3D(item->position().x(), item->position().y(), 0.0);
const auto logicalPosition = QVector2D(item->position().x(), item->position().y());
const auto scale = context->renderTargetScale;
matrix.translate(logicalPosition * scale);
matrix.translate(roundVector(logicalPosition * scale).toVector3D());
matrix *= item->transform();
context->transformStack.push(context->transformStack.top() * matrix);