Cache rendered fonts to speed up mobile load

This commit is contained in:
elasota
2020-10-24 11:41:39 -04:00
parent daebba7d47
commit 26c423bb58
10 changed files with 216 additions and 12 deletions

View File

@@ -60,13 +60,18 @@ namespace PortabilityLayer
return m_hacks[variation];
}
FontFamily *FontFamily::Create()
int FontFamily::GetCacheID() const
{
return m_cacheID;
}
FontFamily *FontFamily::Create(int cacheID)
{
void *storage = malloc(sizeof(FontFamily));
if (!storage)
return nullptr;
return new (storage) FontFamily();
return new (storage) FontFamily(cacheID);
}
void FontFamily::Destroy()
@@ -75,8 +80,9 @@ namespace PortabilityLayer
free(this);
}
FontFamily::FontFamily()
FontFamily::FontFamily(int cacheID)
: m_defaultVariation(0)
, m_cacheID(cacheID)
{
for (unsigned int i = 0; i < kNumVariations; i++)
{