mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-10 23:44:24 +00:00
Made sure that glyph caches are flushed along with the typeface cache.
This commit is contained in:
parent
61d1e1b7ba
commit
a8984031ba
3 changed files with 37 additions and 5 deletions
|
|
@ -155,9 +155,19 @@ void Typeface::setTypefaceCacheSize (int numFontsToCache)
|
|||
TypefaceCache::getInstance()->setSize (numFontsToCache);
|
||||
}
|
||||
|
||||
#if JUCE_MODULE_AVAILABLE_juce_opengl
|
||||
extern void clearOpenGLGlyphCache();
|
||||
#endif
|
||||
|
||||
void Typeface::clearTypefaceCache()
|
||||
{
|
||||
TypefaceCache::getInstance()->clear();
|
||||
|
||||
RenderingHelpers::SoftwareRendererSavedState::clearGlyphCache();
|
||||
|
||||
#if JUCE_MODULE_AVAILABLE_juce_opengl
|
||||
clearOpenGLGlyphCache();
|
||||
#endif
|
||||
}
|
||||
|
||||
//==============================================================================
|
||||
|
|
|
|||
|
|
@ -142,7 +142,7 @@ class GlyphCache : private DeletedAtShutdown
|
|||
public:
|
||||
GlyphCache()
|
||||
{
|
||||
addNewGlyphSlots (120);
|
||||
reset();
|
||||
}
|
||||
|
||||
~GlyphCache()
|
||||
|
|
@ -207,6 +207,15 @@ public:
|
|||
glyph->draw (target, pos);
|
||||
}
|
||||
|
||||
void reset()
|
||||
{
|
||||
const ScopedWriteLock swl (lock);
|
||||
glyphs.clear();
|
||||
addNewGlyphSlots (120);
|
||||
hits.set (0);
|
||||
misses.set (0);
|
||||
}
|
||||
|
||||
private:
|
||||
friend struct ContainerDeletePolicy<CachedGlyphType>;
|
||||
OwnedArray<CachedGlyphType> glyphs;
|
||||
|
|
@ -215,6 +224,8 @@ private:
|
|||
|
||||
void addNewGlyphSlots (int num)
|
||||
{
|
||||
glyphs.ensureStorageAllocated (glyphs.size() + num);
|
||||
|
||||
while (--num >= 0)
|
||||
glyphs.add (new CachedGlyphType());
|
||||
}
|
||||
|
|
@ -2419,6 +2430,13 @@ public:
|
|||
}
|
||||
}
|
||||
|
||||
typedef GlyphCache<CachedGlyphEdgeTable <SoftwareRendererSavedState>, SoftwareRendererSavedState> GlyphCacheType;
|
||||
|
||||
static void clearGlyphCache()
|
||||
{
|
||||
GlyphCacheType::getInstance().reset();
|
||||
}
|
||||
|
||||
//==============================================================================
|
||||
void drawGlyph (int glyphNumber, const AffineTransform& trans)
|
||||
{
|
||||
|
|
@ -2426,8 +2444,6 @@ public:
|
|||
{
|
||||
if (trans.isOnlyTranslation() && ! transform.isRotated)
|
||||
{
|
||||
typedef GlyphCache <CachedGlyphEdgeTable <SoftwareRendererSavedState>, SoftwareRendererSavedState> GlyphCacheType;
|
||||
|
||||
GlyphCacheType& cache = GlyphCacheType::getInstance();
|
||||
|
||||
Point<float> pos (trans.getTranslationX(), trans.getTranslationY());
|
||||
|
|
|
|||
|
|
@ -1365,14 +1365,14 @@ public:
|
|||
}
|
||||
}
|
||||
|
||||
typedef RenderingHelpers::GlyphCache <RenderingHelpers::CachedGlyphEdgeTable <SavedState>, SavedState> GlyphCacheType;
|
||||
|
||||
void drawGlyph (int glyphNumber, const AffineTransform& trans)
|
||||
{
|
||||
if (clip != nullptr)
|
||||
{
|
||||
if (trans.isOnlyTranslation() && ! transform.isRotated)
|
||||
{
|
||||
typedef RenderingHelpers::GlyphCache <RenderingHelpers::CachedGlyphEdgeTable <SavedState>, SavedState> GlyphCacheType;
|
||||
|
||||
GlyphCacheType& cache = GlyphCacheType::getInstance();
|
||||
|
||||
Point<float> pos (trans.getTranslationX(), trans.getTranslationY());
|
||||
|
|
@ -1559,3 +1559,9 @@ LowLevelGraphicsContext* createOpenGLGraphicsContext (OpenGLContext& context, un
|
|||
using namespace OpenGLRendering;
|
||||
return OpenGLRendering::createOpenGLContext (OpenGLRendering::Target (context, frameBufferID, width, height));
|
||||
}
|
||||
|
||||
void clearOpenGLGlyphCache();
|
||||
void clearOpenGLGlyphCache()
|
||||
{
|
||||
OpenGLRendering::SavedState::GlyphCacheType::getInstance().reset();
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue