[gtk/wip/baedert/stb-rect-pack: 5/6] glglyphcache: Fix dropping caches unnecessarily
- From: Timm Bäder <baedert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/wip/baedert/stb-rect-pack: 5/6] glglyphcache: Fix dropping caches unnecessarily
- Date: Sun, 10 Feb 2019 09:34:00 +0000 (UTC)
commit 7ee8500c71e496694a03c9a1f9d7211aeba0f0b7
Author: Timm Bäder <mail baedert org>
Date: Sun Feb 10 10:07:24 2019 +0100
glglyphcache: Fix dropping caches unnecessarily
gsk/gl/gskglglyphcache.c | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
---
diff --git a/gsk/gl/gskglglyphcache.c b/gsk/gl/gskglglyphcache.c
index 655da906ab..44618a257c 100644
--- a/gsk/gl/gskglglyphcache.c
+++ b/gsk/gl/gskglglyphcache.c
@@ -288,7 +288,9 @@ gsk_gl_glyph_cache_lookup (GskGLGlyphCache *cache,
if (value)
{
- if (cache->timestamp - value->timestamp >= MAX_AGE)
+ const guint age = cache->timestamp - value->timestamp;
+
+ if (MAX_AGE <= age && age < MAX_AGE + CHECK_INTERVAL)
{
GskGLGlyphAtlas *atlas = value->atlas;
@@ -363,16 +365,15 @@ gsk_gl_glyph_cache_begin_frame (GskGLGlyphCache *self)
self->timestamp++;
- if (self->timestamp % CHECK_INTERVAL != 0)
+ if ((self->timestamp - 1) % CHECK_INTERVAL != 0)
return;
/* look for glyphs that have grown old since last time */
g_hash_table_iter_init (&iter, self->hash_table);
while (g_hash_table_iter_next (&iter, (gpointer *)&key, (gpointer *)&value))
{
- guint age;
+ const guint age = self->timestamp - value->timestamp;
- age = self->timestamp - value->timestamp;
if (MAX_AGE <= age && age < MAX_AGE + CHECK_INTERVAL)
{
GskGLGlyphAtlas *atlas = value->atlas;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]