[Xfce4-commits] <ristretto:ristretto-0.0> Add workaround for the cache-size calculation

Stephan Arts noreply at xfce.org
Sun Oct 23 19:18:10 CEST 2011


Updating branch refs/heads/ristretto-0.0
         to abedf056b8badfb414c41efe142d7ba2bae81172 (commit)
       from 09f2c67e9f24784ba528af9631e60cc38166fba9 (commit)

commit abedf056b8badfb414c41efe142d7ba2bae81172
Author: Stephan Arts <stephan at xfce.org>
Date:   Tue Jun 16 22:29:55 2009 +0200

    Add workaround for the cache-size calculation

 src/image.c       |    6 +++++-
 src/image_cache.c |    3 ---
 2 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/src/image.c b/src/image.c
index b19cc35..a6a9bb5 100644
--- a/src/image.c
+++ b/src/image.c
@@ -713,7 +713,11 @@ rstto_image_get_size (RsttoImage *image)
     {
         gint rowstride = gdk_pixbuf_get_rowstride (pixbuf);
         gint height = gdk_pixbuf_get_height (pixbuf);
-        return rowstride * height;
+        /* HACK HACK HACK HACK */
+        /* multiplied by 2 since it is unclear why the nr of bytes
+         * in memory is twice what is calculated here, based on the dimensions
+         */
+        return rowstride * height * 2;
     }
     return 0;
 }
diff --git a/src/image_cache.c b/src/image_cache.c
index 00c4dc3..a37cda0 100644
--- a/src/image_cache.c
+++ b/src/image_cache.c
@@ -143,7 +143,6 @@ rstto_image_cache_push_image (RsttoImageCache *cache, RsttoImage *image, gboolea
             size += rstto_image_get_size (c_image);
             if (size > (cache_size*1000000))
             {
-                g_debug("Unload: %d", rstto_image_get_size (c_image));
                 rstto_image_unload (c_image);
                 cache->cache_list = g_list_remove (cache->cache_list, c_image);
                 g_object_unref (c_image);
@@ -154,7 +153,6 @@ rstto_image_cache_push_image (RsttoImageCache *cache, RsttoImage *image, gboolea
             {
                 if (rstto_image_get_size (c_image) == 0)
                 {
-                    g_debug("Unload: %d", rstto_image_get_size (c_image));
                     rstto_image_unload (c_image);
                     cache->cache_list = g_list_remove (cache->cache_list, c_image);
                     g_object_unref (c_image);
@@ -162,7 +160,6 @@ rstto_image_cache_push_image (RsttoImageCache *cache, RsttoImage *image, gboolea
                 }
             }
         }
-        g_debug ("CacheSize: %f%%\t %d:%d", ((gdouble)size/((gdouble)cache_size*1000000))*100, size, cache_size*1000000);
     }
     g_object_unref (settings);
     return retval;


More information about the Xfce4-commits mailing list