st_texture_cache_load_from_raw: Don't pointlessly include size in cache key

The texture is independent of the size that the user passed in; so there
is no obvious reason to include the texture in the cache key.

https://bugzilla.gnome.org/show_bug.cgi?id=633595
This commit is contained in:
Owen W. Taylor 2010-10-30 19:46:50 -04:00
parent e381f0f492
commit 86f3a637f1

View File

@ -1505,11 +1505,13 @@ st_texture_cache_load_from_raw (StTextureCache *cache,
texture = create_default_texture (cache); texture = create_default_texture (cache);
clutter_actor_set_size (CLUTTER_ACTOR (texture), size, size); clutter_actor_set_size (CLUTTER_ACTOR (texture), size, size);
/* In theory, two images of different size could have the same /* In theory, two images of with different width and height could have the same
* pixel data. We ignore that theory. * pixel data and thus hash the same. (Say, a 16x16 and a 8x32 blank image.)
* We ignore this for now. If anybody hits this problem they should use
* GChecksum directly to compute a checksum including the width and height.
*/ */
checksum = g_compute_checksum_for_data (G_CHECKSUM_SHA1, data, len); checksum = g_compute_checksum_for_data (G_CHECKSUM_SHA1, data, len);
key = g_strdup_printf (CACHE_PREFIX_RAW_CHECKSUM "checksum=%s,size=%d", checksum, size); key = g_strdup_printf (CACHE_PREFIX_RAW_CHECKSUM "checksum=%s", checksum);
g_free (checksum); g_free (checksum);
texdata = g_hash_table_lookup (cache->priv->keyed_cache, key); texdata = g_hash_table_lookup (cache->priv->keyed_cache, key);