translate the glyph positions instead of the whole painter viewport from QPaintEngine::drawTextItem()

Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
Ivailo Monev 2022-01-04 19:54:13 +02:00
parent 43a05aba7d
commit f30d28bfa4
2 changed files with 3 additions and 6 deletions

View file

@ -653,13 +653,12 @@ void QPaintEngine::drawTextItem(const QPointF &p, const QTextItem &textItem)
QPainterPath path;
path.setFillRule(Qt::WindingFill);
if (ti.glyphs.numGlyphs)
ti.fontEngine->addOutlineToPath(0, 0, ti.glyphs, &path, ti.flags);
ti.fontEngine->addOutlineToPath(p.x(), p.y(), ti.glyphs, &path, ti.flags);
if (!path.isEmpty()) {
painter()->save();
painter()->setRenderHint(QPainter::Antialiasing,
bool((painter()->renderHints() & QPainter::TextAntialiasing)
&& !(painter()->font().styleStrategy() & QFont::NoAntialias)));
painter()->translate(p.x(), p.y());
painter()->fillPath(path, state->pen().brush());
painter()->restore();
}

View file

@ -220,8 +220,7 @@ void QFontEngine::addOutlineToPath(qreal x, qreal y, const QGlyphLayout &glyphs,
QVarLengthArray<QFixedPoint> positions;
QVarLengthArray<glyph_t> positioned_glyphs;
QTransform matrix = QTransform::fromTranslate(x, y);
getGlyphPositions(glyphs, matrix, flags, positioned_glyphs, positions);
getGlyphPositions(glyphs, QTransform::fromTranslate(x, y), flags, positioned_glyphs, positions);
addGlyphsToPath(positioned_glyphs.data(), positions.data(), positioned_glyphs.size(), path, flags);
}
@ -437,8 +436,7 @@ void QFontEngineBox::addOutlineToPath(qreal x, qreal y, const QGlyphLayout &glyp
QVarLengthArray<QFixedPoint> positions;
QVarLengthArray<glyph_t> positioned_glyphs;
const QTransform matrix = QTransform::fromTranslate(x, y - _size);
getGlyphPositions(glyphs, matrix, flags, positioned_glyphs, positions);
getGlyphPositions(glyphs, QTransform::fromTranslate(x, y - _size), flags, positioned_glyphs, positions);
const QSize s(_size - 3, _size - 3);
for (int k = 0; k < positions.size(); k++) {