[gnome-photos/wip/rishi/buffer-decoder: 4/4] base-item: Use the new GeglBuffer codec API
- From: Debarshi Ray <debarshir src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-photos/wip/rishi/buffer-decoder: 4/4] base-item: Use the new GeglBuffer codec API
- Date: Sun, 2 Jun 2019 00:02:35 +0000 (UTC)
commit 53f1a2a8c49c92b4418a30c339f028871ae4f015
Author: Debarshi Ray <debarshir gnome org>
Date: Thu Sep 6 11:06:01 2018 +0200
base-item: Use the new GeglBuffer codec API
Unlike the older GeglOperation based API, the newer API is cancellable,
supports error handling, and doesn't make any assumptions about the
paths being UTF-8 encoded.
https://gitlab.gnome.org/GNOME/gnome-photos/issues/63
src/photos-base-item.c | 23 +++++------------------
1 file changed, 5 insertions(+), 18 deletions(-)
---
diff --git a/src/photos-base-item.c b/src/photos-base-item.c
index f192308e..980b547c 100644
--- a/src/photos-base-item.c
+++ b/src/photos-base-item.c
@@ -46,6 +46,7 @@
#include "photos-error.h"
#include "photos-filterable.h"
#include "photos-gegl.h"
+#include "photos-gegl-buffer-io.h"
#include "photos-glib.h"
#include "photos-local-item.h"
#include "photos-pipeline.h"
@@ -1464,10 +1465,6 @@ photos_base_item_load_buffer (PhotosBaseItem *self, GCancellable *cancellable, G
g_autoptr (GFile) file = NULL;
g_autoptr (GeglBuffer) buffer = NULL;
GeglBuffer *ret_val = NULL;
- GeglNode *buffer_sink;
- g_autoptr (GeglNode) graph = NULL;
- GeglNode *load;
- g_autofree gchar *path = NULL;
gint64 end;
gint64 start;
@@ -1477,22 +1474,12 @@ photos_base_item_load_buffer (PhotosBaseItem *self, GCancellable *cancellable, G
if (file == NULL)
goto out;
- path = g_file_get_path (file);
- if (!g_utf8_validate (path, -1, NULL))
- {
- g_set_error (error, PHOTOS_ERROR, 0, "Path is not UTF-8 encoded");
- goto out;
- }
-
- graph = gegl_node_new ();
- load = gegl_node_new_child (graph, "operation", "gegl:load", "path", path, NULL);
- buffer_sink = gegl_node_new_child (graph, "operation", "gegl:buffer-sink", "buffer", &buffer, NULL);
-
- gegl_node_link (load, buffer_sink);
-
start = g_get_monotonic_time ();
- gegl_node_process (buffer_sink);
+ buffer = photos_gegl_buffer_new_from_file (file, cancellable, error);
+ if (buffer == NULL)
+ goto out;
+
ret_val = photos_gegl_buffer_apply_orientation (buffer, priv->orientation);
end = g_get_monotonic_time ();
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]