summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKim Woelders <kim@woelders.dk>2018-02-17 09:32:21 +0100
committerKim Woelders <kim@woelders.dk>2018-02-17 11:56:42 +0100
commit5cf3e34ff169b50b87f5f6e39c0d50db94c136b6 (patch)
tree31388a22bdfa92a1c735f4b7a6ecbafa5425d56f
parent327f8c0ce4b9f95ff0af05d28504119ae85387dc (diff)
downloadimlib2-5cf3e34ff169b50b87f5f6e39c0d50db94c136b6.tar.gz
Add imlib_get_cache_used()
And some cosmetics.
-rw-r--r--src/lib/Imlib2.h1
-rw-r--r--src/lib/api.c21
2 files changed, 18 insertions, 4 deletions
diff --git a/src/lib/Imlib2.h b/src/lib/Imlib2.h
index f2d86cf..e2124b6 100644
--- a/src/lib/Imlib2.h
+++ b/src/lib/Imlib2.h
@@ -196,6 +196,7 @@ EAPI Imlib_Image imlib_context_get_image(void);
EAPI void imlib_context_get_cliprect(int *x, int *y, int *w, int *h);
EAPI Imlib_TTF_Encoding imlib_context_get_TTF_encoding(void);
+EAPI int imlib_get_cache_used(void);
EAPI int imlib_get_cache_size(void);
EAPI void imlib_set_cache_size(int bytes);
EAPI int imlib_get_color_usage(void);
diff --git a/src/lib/api.c b/src/lib/api.c
index 5f3c301..a226206 100644
--- a/src/lib/api.c
+++ b/src/lib/api.c
@@ -1042,10 +1042,23 @@ imlib_context_get_TTF_encoding(void)
/* imlib api */
/**
- * @return The current image cache size.
+ * @return The current image cache memory usage.
*
- * Returns the current size of the image cache in bytes. The cache is
- * a unified cache used for image data AND pixmaps.
+ * Returns the current size of the image cache in bytes.
+ * The cache is a unified cache used for image data AND pixmaps.
+ */
+EAPI int
+imlib_get_cache_used(void)
+{
+ CHECK_CONTEXT(ctx);
+ return __imlib_CurrentCacheSize();
+}
+
+/**
+ * @return The current image cache max size.
+ *
+ * Returns the current maximum size of the image cache in bytes.
+ * The cache is a unified cache used for image data AND pixmaps.
*/
EAPI int
imlib_get_cache_size(void)
@@ -1055,7 +1068,7 @@ imlib_get_cache_size(void)
}
/**
- * @param bytes Cache size.
+ * @param bytes Image cache max size.
*
* Sets the cache size. The size is in bytes. Setting the cache size to
* 0 effectively flushes the cache and keeps the cache size at 0 until