[gnome-photos/wip/rishi/unit-tests-gegl: 3/4] Add photos_gegl_compute_checksum_for_buffer



commit 7686f5f2a537ce0de3b92aa0f416e9873d162653
Author: Debarshi Ray <debarshir gnome org>
Date:   Sun Nov 18 15:27:57 2018 +0100

    Add photos_gegl_compute_checksum_for_buffer

 src/photos-gegl.c | 25 ++++++++++++++++++++++++-
 src/photos-gegl.h |  4 +++-
 2 files changed, 27 insertions(+), 2 deletions(-)
---
diff --git a/src/photos-gegl.c b/src/photos-gegl.c
index b3b02cff..e4d0ecd9 100644
--- a/src/photos-gegl.c
+++ b/src/photos-gegl.c
@@ -1,6 +1,6 @@
 /*
  * Photos - access, organize and share your photos on GNOME
- * Copyright © 2013 – 2017 Red Hat, Inc.
+ * Copyright © 2013 – 2018 Red Hat, Inc.
  *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -505,6 +505,29 @@ photos_gegl_buffer_zoom_finish (GeglBuffer *buffer, GAsyncResult *res, GError **
 }
 
 
+gchar *
+photos_gegl_compute_checksum_for_buffer  (GChecksumType checksum_type, GeglBuffer *buffer)
+{
+  const Babl *format;
+  g_autoptr (GChecksum) checksum = NULL;
+  GeglRectangle bbox;
+  const gchar *str;
+  gchar *ret_val = NULL;
+  gint bpp;
+  g_autofree guchar *buf = NULL;
+
+  bbox = *gegl_buffer_get_extent (buffer);
+
+  format = gegl_buffer_get_format (buffer);
+  bpp = babl_format_get_bytes_per_pixel (format);
+
+  checksum = g_checksum_new (checksum_type);
+  str = g_checksum_get_string (checksum);
+  ret_val = g_strdup (str);
+  return ret_val;
+}
+
+
 GdkPixbuf *
 photos_gegl_create_pixbuf_from_node (GeglNode *node)
 {
diff --git a/src/photos-gegl.h b/src/photos-gegl.h
index d902300b..716458b3 100644
--- a/src/photos-gegl.h
+++ b/src/photos-gegl.h
@@ -1,6 +1,6 @@
 /*
  * Photos - access, organize and share your photos on GNOME
- * Copyright © 2013 – 2017 Red Hat, Inc.
+ * Copyright © 2013 – 2018 Red Hat, Inc.
  *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -39,6 +39,8 @@ void             photos_gegl_buffer_zoom_async            (GeglBuffer *buffer,
 
 GeglBuffer      *photos_gegl_buffer_zoom_finish           (GeglBuffer *buffer, GAsyncResult *res, GError 
**error);
 
+gchar           *photos_gegl_compute_checksum_for_buffer  (GChecksumType checksum_type, GeglBuffer *buffer);
+
 GdkPixbuf       *photos_gegl_create_pixbuf_from_node      (GeglNode *node);
 
 GeglBuffer      *photos_gegl_dup_buffer_from_node         (GeglNode *node, const Babl *format);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]