summaryrefslogtreecommitdiffstats
path: root/src/platformsupport/fontdatabases/freetype/qfontengine_ft.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/platformsupport/fontdatabases/freetype/qfontengine_ft.cpp')
-rw-r--r--src/platformsupport/fontdatabases/freetype/qfontengine_ft.cpp41
1 files changed, 6 insertions, 35 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 &currentlyLockedAlphaMap;
-}
-
-void QFontEngineFT::unlockAlphaMapForGlyph()
-{
- QFontEngine::unlockAlphaMapForGlyph();
+ return glyph;
}
static inline bool is2dRotation(const QTransform &t)