Move SubpixelAntialiasingType from QFontEngineFT to QFontEngine
To be able to use the SubpixelAntialiasingType enum without depending on QFontEngineFT we need to move it to QFontEngine. The patch also cleans up the left-overs of other enums moved the same way. Change-Id: I025bc8a5b429d376cfab0a643121ed6f99204988 Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>bb10
parent
d147535322
commit
9e1d6eec8e
|
|
@ -813,11 +813,11 @@ int QFontEngineFT::loadFlags(QGlyphSet *set, GlyphFormat format, int flags,
|
|||
if (format == Format_Mono) {
|
||||
load_target = FT_LOAD_TARGET_MONO;
|
||||
} else if (format == Format_A32) {
|
||||
if (subpixelType == QFontEngineFT::Subpixel_RGB || subpixelType == QFontEngineFT::Subpixel_BGR) {
|
||||
if (subpixelType == Subpixel_RGB || subpixelType == Subpixel_BGR) {
|
||||
if (default_hint_style == HintFull)
|
||||
load_target = FT_LOAD_TARGET_LCD;
|
||||
hsubpixel = true;
|
||||
} else if (subpixelType == QFontEngineFT::Subpixel_VRGB || subpixelType == QFontEngineFT::Subpixel_VBGR) {
|
||||
} else if (subpixelType == Subpixel_VRGB || subpixelType == Subpixel_VBGR) {
|
||||
if (default_hint_style == HintFull)
|
||||
load_target = FT_LOAD_TARGET_LCD_V;
|
||||
vfactor = 3;
|
||||
|
|
@ -977,9 +977,9 @@ QFontEngineFT::Glyph *QFontEngineFT::loadGlyph(QGlyphSet *set, uint glyph,
|
|||
glyph_buffer = new uchar[glyph_buffer_size];
|
||||
|
||||
if (hsubpixel)
|
||||
convertRGBToARGB(slot->bitmap.buffer, (uint *)glyph_buffer, info.width, info.height, slot->bitmap.pitch, subpixelType != QFontEngineFT::Subpixel_RGB, false);
|
||||
convertRGBToARGB(slot->bitmap.buffer, (uint *)glyph_buffer, info.width, info.height, slot->bitmap.pitch, subpixelType != Subpixel_RGB, false);
|
||||
else if (vfactor != 1)
|
||||
convertRGBToARGB_V(slot->bitmap.buffer, (uint *)glyph_buffer, info.width, info.height, slot->bitmap.pitch, subpixelType != QFontEngineFT::Subpixel_VRGB, false);
|
||||
convertRGBToARGB_V(slot->bitmap.buffer, (uint *)glyph_buffer, info.width, info.height, slot->bitmap.pitch, subpixelType != Subpixel_VRGB, false);
|
||||
} else
|
||||
#endif
|
||||
{
|
||||
|
|
@ -1091,10 +1091,10 @@ QFontEngineFT::Glyph *QFontEngineFT::loadGlyph(QGlyphSet *set, uint glyph,
|
|||
convoluteBitmap(bitmap.buffer, convoluted, bitmap.width, info.height, bitmap.pitch);
|
||||
buffer = convoluted;
|
||||
}
|
||||
convertRGBToARGB(buffer + 1, (uint *)glyph_buffer, info.width, info.height, bitmap.pitch, subpixelType != QFontEngineFT::Subpixel_RGB, useLegacyLcdFilter);
|
||||
convertRGBToARGB(buffer + 1, (uint *)glyph_buffer, info.width, info.height, bitmap.pitch, subpixelType != Subpixel_RGB, useLegacyLcdFilter);
|
||||
delete [] convoluted;
|
||||
} else if (vfactor != 1) {
|
||||
convertRGBToARGB_V(bitmap.buffer, (uint *)glyph_buffer, info.width, info.height, bitmap.pitch, subpixelType != QFontEngineFT::Subpixel_VRGB, true);
|
||||
convertRGBToARGB_V(bitmap.buffer, (uint *)glyph_buffer, info.width, info.height, bitmap.pitch, subpixelType != Subpixel_VRGB, true);
|
||||
} else if (format == Format_A32 && bitmap.pixel_mode == FT_PIXEL_MODE_GRAY) {
|
||||
convertGRAYToARGB(bitmap.buffer, (uint *)glyph_buffer, info.width, info.height, bitmap.pitch);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -150,14 +150,6 @@ public:
|
|||
uchar *data;
|
||||
};
|
||||
|
||||
enum SubpixelAntialiasingType {
|
||||
Subpixel_None,
|
||||
Subpixel_RGB,
|
||||
Subpixel_BGR,
|
||||
Subpixel_VRGB,
|
||||
Subpixel_VBGR
|
||||
};
|
||||
|
||||
struct GlyphInfo {
|
||||
unsigned short width;
|
||||
unsigned short height;
|
||||
|
|
|
|||
|
|
@ -261,6 +261,14 @@ public:
|
|||
};
|
||||
virtual void setDefaultHintStyle(HintStyle) { }
|
||||
|
||||
enum SubpixelAntialiasingType {
|
||||
Subpixel_None,
|
||||
Subpixel_RGB,
|
||||
Subpixel_BGR,
|
||||
Subpixel_VRGB,
|
||||
Subpixel_VBGR
|
||||
};
|
||||
|
||||
private:
|
||||
const Type m_type;
|
||||
|
||||
|
|
|
|||
|
|
@ -516,15 +516,15 @@ QFontEngineMulti *QFontconfigDatabase::fontEngineMulti(QFontEngine *fontEngine,
|
|||
}
|
||||
|
||||
namespace {
|
||||
QFontEngineFT::HintStyle defaultHintStyleFromMatch(QFont::HintingPreference hintingPreference, FcPattern *match)
|
||||
QFontEngine::HintStyle defaultHintStyleFromMatch(QFont::HintingPreference hintingPreference, FcPattern *match)
|
||||
{
|
||||
switch (hintingPreference) {
|
||||
case QFont::PreferNoHinting:
|
||||
return QFontEngineFT::HintNone;
|
||||
return QFontEngine::HintNone;
|
||||
case QFont::PreferVerticalHinting:
|
||||
return QFontEngineFT::HintLight;
|
||||
return QFontEngine::HintLight;
|
||||
case QFont::PreferFullHinting:
|
||||
return QFontEngineFT::HintFull;
|
||||
return QFontEngine::HintFull;
|
||||
case QFont::PreferDefaultHinting:
|
||||
break;
|
||||
}
|
||||
|
|
@ -544,21 +544,21 @@ QFontEngineFT::HintStyle defaultHintStyleFromMatch(QFont::HintingPreference hint
|
|||
hint_style = FC_HINT_FULL;
|
||||
switch (hint_style) {
|
||||
case FC_HINT_NONE:
|
||||
return QFontEngineFT::HintNone;
|
||||
return QFontEngine::HintNone;
|
||||
case FC_HINT_SLIGHT:
|
||||
return QFontEngineFT::HintLight;
|
||||
return QFontEngine::HintLight;
|
||||
case FC_HINT_MEDIUM:
|
||||
return QFontEngineFT::HintMedium;
|
||||
return QFontEngine::HintMedium;
|
||||
case FC_HINT_FULL:
|
||||
return QFontEngineFT::HintFull;
|
||||
return QFontEngine::HintFull;
|
||||
default:
|
||||
Q_UNREACHABLE();
|
||||
break;
|
||||
}
|
||||
return QFontEngineFT::HintFull;
|
||||
return QFontEngine::HintFull;
|
||||
}
|
||||
|
||||
QFontEngineFT::SubpixelAntialiasingType subpixelTypeFromMatch(FcPattern *match)
|
||||
QFontEngine::SubpixelAntialiasingType subpixelTypeFromMatch(FcPattern *match)
|
||||
{
|
||||
int subpixel = FC_RGBA_UNKNOWN;
|
||||
FcPatternGetInteger(match, FC_RGBA, 0, &subpixel);
|
||||
|
|
@ -566,20 +566,20 @@ QFontEngineFT::SubpixelAntialiasingType subpixelTypeFromMatch(FcPattern *match)
|
|||
switch (subpixel) {
|
||||
case FC_RGBA_UNKNOWN:
|
||||
case FC_RGBA_NONE:
|
||||
return QFontEngineFT::Subpixel_None;
|
||||
return QFontEngine::Subpixel_None;
|
||||
case FC_RGBA_RGB:
|
||||
return QFontEngineFT::Subpixel_RGB;
|
||||
return QFontEngine::Subpixel_RGB;
|
||||
case FC_RGBA_BGR:
|
||||
return QFontEngineFT::Subpixel_BGR;
|
||||
return QFontEngine::Subpixel_BGR;
|
||||
case FC_RGBA_VRGB:
|
||||
return QFontEngineFT::Subpixel_VRGB;
|
||||
return QFontEngine::Subpixel_VRGB;
|
||||
case FC_RGBA_VBGR:
|
||||
return QFontEngineFT::Subpixel_VBGR;
|
||||
return QFontEngine::Subpixel_VBGR;
|
||||
default:
|
||||
Q_UNREACHABLE();
|
||||
break;
|
||||
}
|
||||
return QFontEngineFT::Subpixel_None;
|
||||
return QFontEngine::Subpixel_None;
|
||||
}
|
||||
} // namespace
|
||||
|
||||
|
|
@ -598,7 +598,7 @@ QFontEngine *QFontconfigDatabase::fontEngine(const QFontDef &f, void *usrPtr)
|
|||
bool antialias = !(fontDef.styleStrategy & QFont::NoAntialias);
|
||||
engine = new QFontEngineFT(fontDef);
|
||||
|
||||
QFontEngineFT::GlyphFormat format;
|
||||
QFontEngine::GlyphFormat format;
|
||||
// try and get the pattern
|
||||
FcPattern *pattern = FcPatternCreate();
|
||||
|
||||
|
|
@ -633,20 +633,20 @@ QFontEngine *QFontconfigDatabase::fontEngine(const QFontDef &f, void *usrPtr)
|
|||
}
|
||||
|
||||
if (antialias) {
|
||||
QFontEngineFT::SubpixelAntialiasingType subpixelType = QFontEngineFT::Subpixel_None;
|
||||
QFontEngine::SubpixelAntialiasingType subpixelType = QFontEngine::Subpixel_None;
|
||||
if (!(f.styleStrategy & QFont::NoSubpixelAntialias))
|
||||
subpixelType = subpixelTypeFromMatch(match);
|
||||
engine->subpixelType = subpixelType;
|
||||
|
||||
format = (subpixelType == QFontEngineFT::Subpixel_None)
|
||||
? QFontEngineFT::Format_A8
|
||||
: QFontEngineFT::Format_A32;
|
||||
format = (subpixelType == QFontEngine::Subpixel_None)
|
||||
? QFontEngine::Format_A8
|
||||
: QFontEngine::Format_A32;
|
||||
} else
|
||||
format = QFontEngineFT::Format_Mono;
|
||||
format = QFontEngine::Format_Mono;
|
||||
|
||||
FcPatternDestroy(match);
|
||||
} else
|
||||
format = antialias ? QFontEngineFT::Format_A8 : QFontEngineFT::Format_Mono;
|
||||
format = antialias ? QFontEngine::Format_A8 : QFontEngine::Format_Mono;
|
||||
|
||||
FcPatternDestroy(pattern);
|
||||
|
||||
|
|
@ -666,7 +666,7 @@ QFontEngine *QFontconfigDatabase::fontEngine(const QByteArray &fontData, qreal p
|
|||
|
||||
QFontDef fontDef = engine->fontDef;
|
||||
|
||||
QFontEngineFT::GlyphFormat format;
|
||||
QFontEngine::GlyphFormat format;
|
||||
// try and get the pattern
|
||||
FcPattern *pattern = FcPatternCreate();
|
||||
|
||||
|
|
@ -691,17 +691,17 @@ QFontEngine *QFontconfigDatabase::fontEngine(const QByteArray &fontData, qreal p
|
|||
engine->antialias = fc_antialias;
|
||||
|
||||
if (engine->antialias) {
|
||||
QFontEngineFT::SubpixelAntialiasingType subpixelType = subpixelTypeFromMatch(match);
|
||||
QFontEngine::SubpixelAntialiasingType subpixelType = subpixelTypeFromMatch(match);
|
||||
engine->subpixelType = subpixelType;
|
||||
|
||||
format = subpixelType == QFontEngineFT::Subpixel_None
|
||||
? QFontEngineFT::Format_A8
|
||||
: QFontEngineFT::Format_A32;
|
||||
format = subpixelType == QFontEngine::Subpixel_None
|
||||
? QFontEngine::Format_A8
|
||||
: QFontEngine::Format_A32;
|
||||
} else
|
||||
format = QFontEngineFT::Format_Mono;
|
||||
format = QFontEngine::Format_Mono;
|
||||
FcPatternDestroy(match);
|
||||
} else
|
||||
format = QFontEngineFT::Format_A8;
|
||||
format = QFontEngine::Format_A8;
|
||||
|
||||
FcPatternDestroy(pattern);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue