diff src/image.c @ 847:77fc0ea3457d

measure pixbuf cache size in bytes
author nadvornik
date Sat, 21 Jun 2008 19:26:01 +0000
parents 8911a4f0e56c
children e1d158ac6d36
line wrap: on
line diff
--- a/src/image.c	Sat Jun 21 16:00:13 2008 +0000
+++ b/src/image.c	Sat Jun 21 19:26:01 2008 +0000
@@ -492,16 +492,15 @@
 static FileCacheData *image_get_cache()
 {
 	static FileCacheData *cache = NULL;
-	if (!cache) cache = file_cache_new(image_cache_release_cb, 5);
+	if (!cache) cache = file_cache_new(image_cache_release_cb, 120000000);
 	return cache;
 }
 
 static void image_cache_set(ImageWindow *imd, FileData *fd)
 {
+	g_assert(fd->pixbuf);
 
-	file_cache_put(image_get_cache(), fd, 1);
-	
-	g_assert(fd->pixbuf);
+	file_cache_put(image_get_cache(), fd, (gulong)gdk_pixbuf_get_rowstride(fd->pixbuf) * (gulong)gdk_pixbuf_get_height(fd->pixbuf));
 }
 
 static gint image_cache_get(ImageWindow *imd)
@@ -672,7 +671,7 @@
 
 	if (image_cache_get(imd))
 		{
-		DEBUG_1("from post buffer: %s", imd->image_fd->path);
+		DEBUG_1("from cache: %s", imd->image_fd->path);
 		return TRUE;
 		}