diff options
Diffstat (limited to 'libs/rs/rsFont.cpp')
| -rw-r--r-- | libs/rs/rsFont.cpp | 21 |
1 files changed, 9 insertions, 12 deletions
diff --git a/libs/rs/rsFont.cpp b/libs/rs/rsFont.cpp index 8571c32..7fdfbe0 100644 --- a/libs/rs/rsFont.cpp +++ b/libs/rs/rsFont.cpp @@ -74,6 +74,15 @@ bool Font::init(const char *name, float fontSize, uint32_t dpi, const void *data return true; } +void Font::preDestroy() const { + for (uint32_t ct = 0; ct < mRSC->mStateFont.mActiveFonts.size(); ct++) { + if (mRSC->mStateFont.mActiveFonts[ct] == this) { + mRSC->mStateFont.mActiveFonts.removeAt(ct); + break; + } + } +} + void Font::invalidateTextureCache() { for (uint32_t i = 0; i < mCachedGlyphs.size(); i ++) { mCachedGlyphs.valueAt(i)->mIsValid = false; @@ -309,13 +318,6 @@ Font::~Font() { FT_Done_Face(mFace); } - for (uint32_t ct = 0; ct < mRSC->mStateFont.mActiveFonts.size(); ct++) { - if (mRSC->mStateFont.mActiveFonts[ct] == this) { - mRSC->mStateFont.mActiveFonts.removeAt(ct); - break; - } - } - for (uint32_t i = 0; i < mCachedGlyphs.size(); i ++) { CachedGlyphInfo *glyph = mCachedGlyphs.valueAt(i); delete glyph; @@ -799,11 +801,6 @@ void FontState::deinit(Context *rsc) { mDefault.clear(); - Vector<Font*> fontsToDereference = mActiveFonts; - for (uint32_t i = 0; i < fontsToDereference.size(); i ++) { - fontsToDereference[i]->zeroUserRef(); - } - if (mLibrary) { FT_Done_FreeType( mLibrary ); mLibrary = NULL; |
