mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-11-08 17:50:10 +00:00
gpu: Don't replace cache items
Instead, keep them. This is not useful yet, but will become so in the next commits.
This commit is contained in:
parent
ad757cccb6
commit
cf12503fec
@ -1061,6 +1061,14 @@ gdk_texture_set_render_data (GdkTexture *self,
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void
|
||||
gdk_texture_steal_render_data (GdkTexture *self)
|
||||
{
|
||||
self->render_key = NULL;
|
||||
self->render_data = NULL;
|
||||
self->render_notify = NULL;
|
||||
}
|
||||
|
||||
void
|
||||
gdk_texture_clear_render_data (GdkTexture *self)
|
||||
{
|
||||
|
@ -76,6 +76,7 @@ gboolean gdk_texture_set_render_data (GdkTexture
|
||||
gpointer key,
|
||||
gpointer data,
|
||||
GDestroyNotify notify);
|
||||
void gdk_texture_steal_render_data (GdkTexture *self);
|
||||
void gdk_texture_clear_render_data (GdkTexture *self);
|
||||
gpointer gdk_texture_get_render_data (GdkTexture *self,
|
||||
gpointer key);
|
||||
|
@ -336,10 +336,14 @@ gsk_gpu_cached_texture_new (GskGpuCache *cache,
|
||||
{
|
||||
GskGpuCachedTexture *self;
|
||||
|
||||
if (gdk_texture_get_render_data (texture, cache))
|
||||
gdk_texture_clear_render_data (texture);
|
||||
else if ((self = g_hash_table_lookup (cache->texture_cache, texture)))
|
||||
g_hash_table_remove (cache->texture_cache, texture);
|
||||
/* First, move any existing renderdata */
|
||||
self = gdk_texture_get_render_data (texture, cache);
|
||||
if (self)
|
||||
{
|
||||
gdk_texture_steal_render_data (texture);
|
||||
g_object_weak_ref (G_OBJECT (texture), (GWeakNotify) gsk_gpu_cached_texture_destroy_cb, self);
|
||||
g_hash_table_insert (cache->texture_cache, texture, self);
|
||||
}
|
||||
|
||||
self = gsk_gpu_cached_new (cache, &GSK_GPU_CACHED_TEXTURE_CLASS, NULL);
|
||||
self->texture = texture;
|
||||
|
Loading…
Reference in New Issue
Block a user