ngl: clear Glyph front cache at the beginning of a frame

We don't want to be responsible for duplicating the effort of the hash
table, we just want to speed up subsequent lookups. Otherwise, we risk
not marking glyph usage when tracking usage for compaction.
This commit is contained in:
Christian Hergert 2021-03-18 17:54:48 -07:00
parent af80f3a976
commit 0f0ee97e1e

View File

@ -83,6 +83,16 @@ gsk_ngl_glyph_value_free (gpointer data)
g_slice_free (GskNglGlyphValue, data); g_slice_free (GskNglGlyphValue, data);
} }
static void
gsk_ngl_glyph_library_begin_frame (GskNglTextureLibrary *library,
gint64 frame_id,
GPtrArray *removed_atlases)
{
GskNglGlyphLibrary *self = GSK_NGL_GLYPH_LIBRARY (library);
memset (self->front, 0, sizeof self->front);
}
static void static void
gsk_ngl_glyph_library_finalize (GObject *object) gsk_ngl_glyph_library_finalize (GObject *object)
{ {
@ -98,8 +108,11 @@ static void
gsk_ngl_glyph_library_class_init (GskNglGlyphLibraryClass *klass) gsk_ngl_glyph_library_class_init (GskNglGlyphLibraryClass *klass)
{ {
GObjectClass *object_class = G_OBJECT_CLASS (klass); GObjectClass *object_class = G_OBJECT_CLASS (klass);
GskNglTextureLibraryClass *library_class = GSK_NGL_TEXTURE_LIBRARY_CLASS (klass);
object_class->finalize = gsk_ngl_glyph_library_finalize; object_class->finalize = gsk_ngl_glyph_library_finalize;
library_class->begin_frame = gsk_ngl_glyph_library_begin_frame;
} }
static void static void