+ static int tmp = 0;
+ if ( (++tmp == 100 )) { g_debug("DEBUG: cache count=%d size=%u list count=%d\n", g_hash_table_size(cache), cache_size, queue_count ); tmp=0; }
+}
+
+/**
+ * Function increases reference counter of pixels buffer in behalf of caller.
+ * Caller have to decrease references counter, when buffer is no longer needed.
+ */
+GdkPixbuf *a_mapcache_get ( gint x, gint y, gint z, guint16 type, gint zoom, guint8 alpha, gdouble xshrinkfactor, gdouble yshrinkfactor, const gchar* name )
+{
+ static char key[MC_KEY_SIZE];
+ guint nn = name ? g_str_hash ( name ) : 0;
+ g_snprintf ( key, sizeof(key), HASHKEY_FORMAT_STRING, type, x, y, z, zoom, nn, alpha, xshrinkfactor, yshrinkfactor );
+ g_mutex_lock(mc_mutex); /* prevent returning pixbuf when cache is being cleared */
+ cache_item_t *ci = g_hash_table_lookup ( cache, key );
+ if ( ci ) {
+ g_object_ref(ci->pixbuf);
+ g_mutex_unlock(mc_mutex);
+ return ci->pixbuf;
+ } else {
+ g_mutex_unlock(mc_mutex);
+ return NULL;
+ }