diff options
author | Wieland Hagen <wieland.hagen@kdab.com> | 2017-07-06 17:53:40 +0200 |
---|---|---|
committer | Sean Harmer <sean.harmer@kdab.com> | 2017-07-07 09:35:40 +0000 |
commit | cadfd44c77de9ad3d66e936df140e4ba6efb0d74 (patch) | |
tree | 497b402e26fa578b1f444b52f6d191d134de7a6c /src/extras/text | |
parent | 29a6f78653c5b651590cbca98b5bc7e143c3747c (diff) |
Apply slight z-offsets to distance field glyphs
When rendering distance field text, z-fighting may occur between
adjacent glyphs. To prevent this, we apply a very slight Z offset
to each rendered glyph.
Change-Id: I19f9808267547ae9521757c6022b4f65c1ca4ba5
Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
Diffstat (limited to 'src/extras/text')
-rw-r--r-- | src/extras/text/qtext2dentity.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/extras/text/qtext2dentity.cpp b/src/extras/text/qtext2dentity.cpp index dbd4368bc..1dfd171cd 100644 --- a/src/extras/text/qtext2dentity.cpp +++ b/src/extras/text/qtext2dentity.cpp @@ -209,10 +209,10 @@ void QText2DEntityPrivate::setCurrentGlyphRuns(const QVector<QGlyphRun> &runs) texCoords.setWidth(texCoords.width() * insideRatio); } - data.vertex << x1 << y1 << 0.f << texCoords.left() << texCoords.bottom(); - data.vertex << x1 << y2 << 0.f << texCoords.left() << texCoords.top(); - data.vertex << x2 << y1 << 0.f << texCoords.right() << texCoords.bottom(); - data.vertex << x2 << y2 << 0.f << texCoords.right() << texCoords.top(); + data.vertex << x1 << y1 << i << texCoords.left() << texCoords.bottom(); + data.vertex << x1 << y2 << i << texCoords.left() << texCoords.top(); + data.vertex << x2 << y1 << i << texCoords.right() << texCoords.bottom(); + data.vertex << x2 << y2 << i << texCoords.right() << texCoords.top(); data.index << data.vertexCount << data.vertexCount+3 << data.vertexCount+1; data.index << data.vertexCount << data.vertexCount+2 << data.vertexCount+3; |