[gnome-photos/wip/rishi/orientation: 4/8] gegl, thumbnailer: Don't use gegl:pixbuf



commit d85362a42caaa8ab108b85bc255462120825ad0f
Author: Debarshi Ray <debarshir gnome org>
Date:   Thu Nov 23 11:41:47 2017 +0100

    gegl, thumbnailer: Don't use gegl:pixbuf
    
    ... to convert the loaded GdkPixbuf to GeglBuffer. This is part of a
    general trend of moving away from using graphs to convert a GeglBuffer
    to and from GdkPixbuf.
    
    A subsequent commit will use this to optimize the application of a
    BaseItem's embedded orientation.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=781736

 src/photos-gegl.c        |    1 -
 src/photos-thumbnailer.c |   10 +++++++---
 2 files changed, 7 insertions(+), 4 deletions(-)
---
diff --git a/src/photos-gegl.c b/src/photos-gegl.c
index a5af71a..356a426 100644
--- a/src/photos-gegl.c
+++ b/src/photos-gegl.c
@@ -55,7 +55,6 @@ static const gchar *REQUIRED_GEGL_OPS[] =
   "gegl:load",
   "gegl:noise-reduction",
   "gegl:nop",
-  "gegl:pixbuf",
   "gegl:rotate-on-center",
   "gegl:save-pixbuf",
   "gegl:scale-ratio",
diff --git a/src/photos-thumbnailer.c b/src/photos-thumbnailer.c
index 2085d5d..e1536e7 100644
--- a/src/photos-thumbnailer.c
+++ b/src/photos-thumbnailer.c
@@ -344,9 +344,10 @@ photos_thumbnailer_generate_thumbnail_pixbuf (GObject *source_object, GAsyncResu
   GError *error;
   GTask *task = G_TASK (user_data);
   GdkPixbuf *pixbuf = NULL;
+  GeglBuffer *buffer = NULL;
+  GeglNode *buffer_source;
   GeglNode *orientation;
   GeglNode *pipeline_node;
-  GeglNode *pixbuf_source;
   GeglNode *save_pixbuf;
   GeglProcessor *processor = NULL;
   PhotosThumbnailerGenerateData *data;
@@ -364,7 +365,9 @@ photos_thumbnailer_generate_thumbnail_pixbuf (GObject *source_object, GAsyncResu
 
   g_assert_null (data->pixbuf_thumbnail);
 
-  pixbuf_source = gegl_node_new_child (data->graph, "operation", "gegl:pixbuf", "pixbuf", pixbuf, NULL);
+  buffer = photos_gegl_buffer_new_from_pixbuf (pixbuf);
+
+  buffer_source = gegl_node_new_child (data->graph, "operation", "gegl:buffer-source", "buffer", buffer, 
NULL);
   orientation = photos_gegl_create_orientation_node (data->graph, data->orientation);
   pipeline_node = photos_pipeline_get_graph (data->pipeline);
   save_pixbuf = gegl_node_new_child (data->graph,
@@ -372,7 +375,7 @@ photos_thumbnailer_generate_thumbnail_pixbuf (GObject *source_object, GAsyncResu
                                      "pixbuf", &data->pixbuf_thumbnail,
                                      NULL);
 
-  gegl_node_link_many (pixbuf_source, orientation, pipeline_node, save_pixbuf, NULL);
+  gegl_node_link_many (buffer_source, orientation, pipeline_node, save_pixbuf, NULL);
 
   processor = gegl_node_new_processor (save_pixbuf, NULL);
   photos_gegl_processor_process_async (processor,
@@ -381,6 +384,7 @@ photos_thumbnailer_generate_thumbnail_pixbuf (GObject *source_object, GAsyncResu
                                        g_object_ref (task));
 
  out:
+  g_clear_object (&buffer);
   g_clear_object (&pixbuf);
   g_clear_object (&processor);
   g_object_unref (task);


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