diff options
author | Tor Arne Vestbø <tor.arne.vestbo@digia.com> | 2014-02-10 13:59:44 +0100 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2014-02-19 19:36:25 +0100 |
commit | 4de3c5db238f45404feb6c6ce60810a3e11eae84 (patch) | |
tree | bc0a4d7af2f757fed94c1b52ca6bcd0e74bae25f /src/gui/painting/qpaintengine_raster.cpp | |
parent | 30fd22b9574def54726e7b193127cc0c901c1b4c (diff) |
Unify glyph format between QFontEngine and QFontEngineGlyphCache
Instead of the glyph cache having its own cache type that always mapped
one to one to a font engine glyph format, causing confusion and needless
conversions, the glyph caches now use QFontEngine's glyph format enum.
This also removes the iffy use of an int for the glyphFormat in the font
engines.
Change-Id: I529bad5c179e004f63e152f7dcc311d298c3db98
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Diffstat (limited to 'src/gui/painting/qpaintengine_raster.cpp')
-rw-r--r-- | src/gui/painting/qpaintengine_raster.cpp | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/src/gui/painting/qpaintengine_raster.cpp b/src/gui/painting/qpaintengine_raster.cpp index 9a2e49618c..67896f786d 100644 --- a/src/gui/painting/qpaintengine_raster.cpp +++ b/src/gui/painting/qpaintengine_raster.cpp @@ -523,7 +523,7 @@ bool QRasterPaintEngine::begin(QPaintDevice *device) #endif if (d->mono_surface) - d->glyphCacheType = QFontEngineGlyphCache::Raster_Mono; + d->glyphCacheFormat = QFontEngine::Format_Mono; #if defined(Q_OS_WIN) else if (clearTypeFontsEnabled()) #else @@ -532,11 +532,11 @@ bool QRasterPaintEngine::begin(QPaintDevice *device) { QImage::Format format = static_cast<QImage *>(d->device)->format(); if (format == QImage::Format_ARGB32_Premultiplied || format == QImage::Format_RGB32) - d->glyphCacheType = QFontEngineGlyphCache::Raster_RGBMask; + d->glyphCacheFormat = QFontEngine::Format_A32; else - d->glyphCacheType = QFontEngineGlyphCache::Raster_A8; + d->glyphCacheFormat = QFontEngine::Format_A8; } else - d->glyphCacheType = QFontEngineGlyphCache::Raster_A8; + d->glyphCacheFormat = QFontEngine::Format_A8; setActive(true); return true; @@ -2819,12 +2819,12 @@ bool QRasterPaintEngine::drawCachedGlyphs(int numGlyphs, const glyph_t *glyphs, } } else { - QFontEngineGlyphCache::Type glyphType = fontEngine->glyphFormat >= 0 ? QFontEngineGlyphCache::Type(fontEngine->glyphFormat) : d->glyphCacheType; + QFontEngine::GlyphFormat glyphFormat = fontEngine->glyphFormat != QFontEngine::Format_None ? fontEngine->glyphFormat : d->glyphCacheFormat; QImageTextureGlyphCache *cache = - static_cast<QImageTextureGlyphCache *>(fontEngine->glyphCache(0, glyphType, s->matrix)); + static_cast<QImageTextureGlyphCache *>(fontEngine->glyphCache(0, glyphFormat, s->matrix)); if (!cache) { - cache = new QImageTextureGlyphCache(glyphType, s->matrix); + cache = new QImageTextureGlyphCache(glyphFormat, s->matrix); fontEngine->setGlyphCache(0, cache); } @@ -2842,7 +2842,7 @@ bool QRasterPaintEngine::drawCachedGlyphs(int numGlyphs, const glyph_t *glyphs, else if (depth == 1) rightShift = 3; // divide by 8 - int margin = fontEngine->glyphMargin(glyphType); + int margin = fontEngine->glyphMargin(glyphFormat); const uchar *bits = image.bits(); for (int i=0; i<numGlyphs; ++i) { @@ -2865,7 +2865,7 @@ bool QRasterPaintEngine::drawCachedGlyphs(int numGlyphs, const glyph_t *glyphs, const uchar *glyphBits = bits + ((c.x << leftShift) >> rightShift) + c.y * bpl; - if (glyphType == QFontEngineGlyphCache::Raster_ARGB) { + if (glyphFormat == QFontEngine::Format_ARGB) { // The current state transform has already been applied to the positions, // so we prevent drawImage() from re-applying the transform by clearing // the state for the duration of the call. @@ -3064,7 +3064,7 @@ void QRasterPaintEngine::drawTextItem(const QPointF &p, const QTextItem &textIte Q_D(QRasterPaintEngine); fprintf(stderr," - QRasterPaintEngine::drawTextItem(), (%.2f,%.2f), string=%s ct=%d\n", p.x(), p.y(), QString::fromRawData(ti.chars, ti.num_chars).toLatin1().data(), - d->glyphCacheType); + d->glyphCacheFormat); #endif if (ti.glyphs.numGlyphs == 0) |