QPaintBuffer paints drawGlyphRun with wrong font

If QRawFont and and drawGlyphRun is used on a QPaintBuffer it will lose
the QRawFont and end up painting with primary font at the time.

With this patch, QStaticTextItem can now indicate that they must be
drawn using the supplied font-engine and that the font information is
not enough.

Change-Id: Id6bd376d797d2bfb457e7de55c48bdcf9f20ae38
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@digia.com>
This commit is contained in:
Allan Sandfeld Jensen 2014-09-18 14:47:35 +02:00
parent 4453bfcb20
commit ca36198251
3 changed files with 11 additions and 1 deletions

View File

@ -1242,6 +1242,11 @@ void QPaintBufferEngine::drawTiledPixmap(const QRectF &r, const QPixmap &pm, con
void QPaintBufferEngine::drawStaticTextItem(QStaticTextItem *staticTextItem)
{
if (staticTextItem->usesRawFont) {
QPaintEngineEx::drawStaticTextItem(staticTextItem); // Draw as path
return;
}
QVariantList variants;
variants << QVariant(staticTextItem->font);

View File

@ -5619,6 +5619,8 @@ void QPainterPrivate::drawGlyphs(const quint32 *glyphArray, QFixedPoint *positio
staticTextItem.numGlyphs = glyphCount;
staticTextItem.glyphs = reinterpret_cast<glyph_t *>(const_cast<glyph_t *>(glyphArray));
staticTextItem.glyphPositions = positions;
// The font property is meaningless, the fontengine must be used directly:
staticTextItem.usesRawFont = true;
extended->drawStaticTextItem(&staticTextItem);
} else {

View File

@ -79,7 +79,8 @@ class Q_GUI_EXPORT QStaticTextItem
{
public:
QStaticTextItem() : chars(0), numChars(0), useBackendOptimizations(false),
userDataNeedsUpdate(0), m_fontEngine(0), m_userData(0) {}
userDataNeedsUpdate(0), usesRawFont(0),
m_fontEngine(0), m_userData(0) {}
QStaticTextItem(const QStaticTextItem &other)
{
@ -97,6 +98,7 @@ public:
color = other.color;
useBackendOptimizations = other.useBackendOptimizations;
userDataNeedsUpdate = other.userDataNeedsUpdate;
usesRawFont = other.usesRawFont;
m_fontEngine = 0;
m_userData = 0;
@ -145,6 +147,7 @@ public:
QColor color; // 10 bytes per item
char useBackendOptimizations : 1; // 1 byte per item
char userDataNeedsUpdate : 1; //
char usesRawFont : 1; //
// ================
// 51 bytes per item