diff options
Diffstat (limited to 'src/platformsupport/fontdatabases')
-rw-r--r-- | src/platformsupport/fontdatabases/freetype/qfontengine_ft.cpp | 41 | ||||
-rw-r--r-- | src/platformsupport/fontdatabases/freetype/qfontengine_ft_p.h | 20 |
2 files changed, 8 insertions, 53 deletions
diff --git a/src/platformsupport/fontdatabases/freetype/qfontengine_ft.cpp b/src/platformsupport/fontdatabases/freetype/qfontengine_ft.cpp index b608e7f483..6011941982 100644 --- a/src/platformsupport/fontdatabases/freetype/qfontengine_ft.cpp +++ b/src/platformsupport/fontdatabases/freetype/qfontengine_ft.cpp @@ -106,7 +106,7 @@ static bool ft_getSfntTable(void *user_data, uint tag, uchar *buffer, uint *leng return result; } -static QFontEngineFT::Glyph emptyGlyph = {0, 0, 0, 0, 0, 0, 0, 0}; +static QFontEngineFT::Glyph emptyGlyph; static const QFontEngine::HintStyle ftInitialDefaultHintStyle = #ifdef Q_OS_WIN @@ -550,11 +550,6 @@ void QFreetypeFace::addBitmapToPath(FT_GlyphSlot slot, const QFixedPoint &point, slot->bitmap.buffer, slot->bitmap.pitch, slot->bitmap.width, slot->bitmap.rows, path); } -QFontEngineFT::Glyph::~Glyph() -{ - delete [] data; -} - static inline void convertRGBToARGB(const uchar *src, uint *dst, int width, int height, int src_pitch, bool bgr) { const int offs = bgr ? -1 : 1; @@ -1810,11 +1805,10 @@ static inline QImage alphaMapFromGlyphData(QFontEngineFT::Glyph *glyph, QFontEng return img; } -QImage *QFontEngineFT::lockedAlphaMapForGlyph(glyph_t glyphIndex, QFixed subPixelPosition, - QFontEngine::GlyphFormat neededFormat, - const QTransform &t, QPoint *offset) +QFontEngine::Glyph *QFontEngineFT::glyphData(glyph_t glyphIndex, QFixed subPixelPosition, + QFontEngine::GlyphFormat neededFormat, const QTransform &t) { - Q_ASSERT(currentlyLockedAlphaMap.isNull()); + Q_ASSERT(cacheEnabled); if (isBitmapFont()) neededFormat = Format_Mono; @@ -1824,33 +1818,10 @@ QImage *QFontEngineFT::lockedAlphaMapForGlyph(glyph_t glyphIndex, QFixed subPixe neededFormat = Format_A8; Glyph *glyph = loadGlyphFor(glyphIndex, subPixelPosition, neededFormat, t); - - if (offset != 0 && glyph != 0) - *offset = QPoint(glyph->x, -glyph->y); - - currentlyLockedAlphaMap = alphaMapFromGlyphData(glyph, neededFormat); - - const bool glyphHasGeometry = glyph != nullptr && glyph->height != 0 && glyph->width != 0; - if (!cacheEnabled && glyph != &emptyGlyph) { - currentlyLockedAlphaMap = currentlyLockedAlphaMap.copy(); - delete glyph; - } - - if (!glyphHasGeometry) + if (!glyph || !glyph->width || !glyph->height) return nullptr; - if (currentlyLockedAlphaMap.isNull()) - return QFontEngine::lockedAlphaMapForGlyph(glyphIndex, subPixelPosition, neededFormat, t, offset); - - QImageData *data = currentlyLockedAlphaMap.data_ptr(); - data->is_locked = true; - - return ¤tlyLockedAlphaMap; -} - -void QFontEngineFT::unlockAlphaMapForGlyph() -{ - QFontEngine::unlockAlphaMapForGlyph(); + return glyph; } static inline bool is2dRotation(const QTransform &t) diff --git a/src/platformsupport/fontdatabases/freetype/qfontengine_ft_p.h b/src/platformsupport/fontdatabases/freetype/qfontengine_ft_p.h index b636c42e63..2e3aef6979 100644 --- a/src/platformsupport/fontdatabases/freetype/qfontengine_ft_p.h +++ b/src/platformsupport/fontdatabases/freetype/qfontengine_ft_p.h @@ -129,20 +129,6 @@ private: class QFontEngineFT : public QFontEngine { public: - - /* we don't cache glyphs that are too large anyway, so we can make this struct rather small */ - struct Glyph { - ~Glyph(); - int linearAdvance : 22; - unsigned char width; - unsigned char height; - short x; - short y; - short advance; - signed char format; - uchar *data; - }; - struct GlyphInfo { int linearAdvance; unsigned short width; @@ -241,11 +227,9 @@ private: QFixed subPixelPosition, const QTransform &matrix, QFontEngine::GlyphFormat format) override; - QImage *lockedAlphaMapForGlyph(glyph_t glyph, QFixed subPixelPosition, - GlyphFormat neededFormat, const QTransform &t, - QPoint *offset) override; + Glyph *glyphData(glyph_t glyph, QFixed subPixelPosition, + GlyphFormat neededFormat, const QTransform &t) override; bool hasInternalCaching() const override { return cacheEnabled; } - void unlockAlphaMapForGlyph() override; bool expectsGammaCorrectedBlending() const override; void removeGlyphFromCache(glyph_t glyph) override; |