[gimp] app: add gimp_gegl_pyramid_get_memsize(), used by gimp_projection_get_memsize()
- From: Michael Natterer <mitch src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] app: add gimp_gegl_pyramid_get_memsize(), used by gimp_projection_get_memsize()
- Date: Sun, 15 Jun 2014 16:24:27 +0000 (UTC)
commit 9f0fde139738fa136b50579c51ad08584a1df7d7
Author: Michael Natterer <mitch gimp org>
Date: Sun Jun 15 18:21:05 2014 +0200
app: add gimp_gegl_pyramid_get_memsize(), used by gimp_projection_get_memsize()
app/core/gimp-utils.c | 17 +++++++++++++++++
app/core/gimp-utils.h | 1 +
app/core/gimpprojection.c | 2 +-
3 files changed, 19 insertions(+), 1 deletions(-)
---
diff --git a/app/core/gimp-utils.c b/app/core/gimp-utils.c
index 7980bb4..cb0ead9 100644
--- a/app/core/gimp-utils.c
+++ b/app/core/gimp-utils.c
@@ -305,6 +305,23 @@ gimp_gegl_buffer_get_memsize (GeglBuffer *buffer)
}
gint64
+gimp_gegl_pyramid_get_memsize (GeglBuffer *buffer)
+{
+ if (buffer)
+ {
+ const Babl *format = gegl_buffer_get_format (buffer);
+
+ /* The pyramid levels constitute a geometric sum with a ratio of 1/4. */
+ return ((gint64) babl_format_get_bytes_per_pixel (format) *
+ (gint64) gegl_buffer_get_width (buffer) *
+ (gint64) gegl_buffer_get_height (buffer) * 1.33 +
+ gimp_g_object_get_memsize (G_OBJECT (buffer)));
+ }
+
+ return 0;
+}
+
+gint64
gimp_string_get_memsize (const gchar *string)
{
if (string)
diff --git a/app/core/gimp-utils.h b/app/core/gimp-utils.h
index f1126e0..90404b5 100644
--- a/app/core/gimp-utils.h
+++ b/app/core/gimp-utils.h
@@ -53,6 +53,7 @@ gint64 gimp_g_value_get_memsize (GValue *value);
gint64 gimp_g_param_spec_get_memsize (GParamSpec *pspec);
gint64 gimp_gegl_buffer_get_memsize (GeglBuffer *buffer);
+gint64 gimp_gegl_pyramid_get_memsize (GeglBuffer *buffer);
gint64 gimp_string_get_memsize (const gchar *string);
gint64 gimp_parasite_get_memsize (GimpParasite *parasite,
diff --git a/app/core/gimpprojection.c b/app/core/gimpprojection.c
index 72a7e26..092b68f 100644
--- a/app/core/gimpprojection.c
+++ b/app/core/gimpprojection.c
@@ -296,7 +296,7 @@ gimp_projection_get_memsize (GimpObject *object,
GimpProjection *projection = GIMP_PROJECTION (object);
gint64 memsize = 0;
- memsize += gimp_gegl_buffer_get_memsize (projection->priv->buffer);
+ memsize += gimp_gegl_pyramid_get_memsize (projection->priv->buffer);
return memsize + GIMP_OBJECT_CLASS (parent_class)->get_memsize (object,
gui_size);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]