[gtk/big-glyphs: 7/7] gl: Fix glyph cache aging
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/big-glyphs: 7/7] gl: Fix glyph cache aging
- Date: Sun, 2 Jun 2019 22:26:22 +0000 (UTC)
commit a53d9818e59db984545b5c9ab06cc463fa583ff8
Author: Matthias Clasen <mclasen redhat com>
Date: Sun Jun 2 20:55:34 2019 +0000
gl: Fix glyph cache aging
The logic here seems faulty. We want to keep
a timestamp that tells us when the glyph was
last used, so always update the timestamp.
And whenever we use a glyph, it turns 'young'
again, so remove it from the old pixels
accounting.
The (MAX_AGE, MAX_AGE+CHECK_INTERVAL) interval
is only relevant to prevent us from turning
a cached glyph old more than once, and that
is already taken care of.
gsk/gl/gskglglyphcache.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
---
diff --git a/gsk/gl/gskglglyphcache.c b/gsk/gl/gskglglyphcache.c
index 8f80ac6552..eb2628fb86 100644
--- a/gsk/gl/gskglglyphcache.c
+++ b/gsk/gl/gskglglyphcache.c
@@ -308,15 +308,15 @@ gsk_gl_glyph_cache_lookup (GskGLGlyphCache *cache,
{
const guint age = cache->timestamp - value->timestamp;
- if (MAX_AGE <= age && age < MAX_AGE + CHECK_INTERVAL)
+ if (MAX_AGE <= age)
{
GskGLGlyphAtlas *atlas = value->atlas;
if (atlas)
atlas->old_pixels -= value->draw_width * value->draw_height;
-
- value->timestamp = cache->timestamp;
}
+
+ value->timestamp = cache->timestamp;
}
if (create && value == NULL)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]