[gnome-photos/wip/rishi/double-buffering: 2/12] base-item, utils: Rename a function
- From: Debarshi Ray <debarshir src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-photos/wip/rishi/double-buffering: 2/12] base-item, utils: Rename a function
- Date: Tue, 17 Jan 2017 22:23:01 +0000 (UTC)
commit 2543bd14af2deca4d74c4298a002b9ce75dcf0c0
Author: Debarshi Ray <debarshir gnome org>
Date: Tue Jan 17 12:18:51 2017 +0100
base-item, utils: Rename a function
Currently photos_utils_get_buffer_from_node hits a fast path inside
gegl:buffer-sink and doesn't actually create a new GeglBuffer. It
returns a new reference on the GeglNode's output buffer.
To implement double buffering inside PhotosImageView, we will add a
similar function that will actually copy the GeglBuffer. This rename is
meant to clarify the difference between the two.
src/photos-base-item.c | 6 ++--
src/photos-utils.c | 58 ++++++++++++++++++++++++------------------------
src/photos-utils.h | 4 +-
3 files changed, 34 insertions(+), 34 deletions(-)
---
diff --git a/src/photos-base-item.c b/src/photos-base-item.c
index 70cc5ec..43c03e2 100644
--- a/src/photos-base-item.c
+++ b/src/photos-base-item.c
@@ -1110,7 +1110,7 @@ photos_base_item_guess_save_sizes_load (GObject *source_object, GAsyncResult *re
goto out;
}
- buffer = photos_utils_create_buffer_from_node (graph);
+ buffer = photos_utils_get_buffer_from_node (graph);
data = photos_base_item_save_data_new (NULL, buffer, priv->mime_type, 0.0);
g_task_set_task_data (task, data, (GDestroyNotify) photos_base_item_save_data_free);
@@ -2052,7 +2052,7 @@ photos_base_item_save_to_stream_load (GObject *source_object, GAsyncResult *res,
goto out;
}
- buffer = photos_utils_create_buffer_from_node (graph);
+ buffer = photos_utils_get_buffer_from_node (graph);
photos_utils_buffer_zoom_async (buffer,
data->zoom,
cancellable,
@@ -3665,7 +3665,7 @@ photos_base_item_save_load (GObject *source_object, GAsyncResult *res, gpointer
goto out;
}
- buffer = photos_utils_create_buffer_from_node (graph);
+ buffer = photos_utils_get_buffer_from_node (graph);
photos_utils_buffer_zoom_async (buffer,
data->zoom,
cancellable,
diff --git a/src/photos-utils.c b/src/photos-utils.c
index fe02bb2..86db6c4 100644
--- a/src/photos-utils.c
+++ b/src/photos-utils.c
@@ -286,35 +286,6 @@ photos_utils_convert_path_to_uri (const gchar *path)
}
-GeglBuffer *
-photos_utils_create_buffer_from_node (GeglNode *node)
-{
- GeglBuffer *buffer = NULL;
- GeglNode *buffer_sink;
- GeglNode *graph;
- gint64 end;
- gint64 start;
-
- graph = gegl_node_get_parent (node);
- buffer_sink = gegl_node_new_child (graph,
- "operation", "gegl:buffer-sink",
- "buffer", &buffer,
- NULL);
- gegl_node_link (node, buffer_sink);
-
- start = g_get_monotonic_time ();
-
- gegl_node_process (buffer_sink);
-
- end = g_get_monotonic_time ();
- photos_debug (PHOTOS_DEBUG_GEGL, "Utils: Create Buffer from Node: %" G_GINT64_FORMAT, end - start);
-
- g_object_unref (buffer_sink);
-
- return buffer;
-}
-
-
GIcon *
photos_utils_create_collection_icon (gint base_size, GList *pixbufs)
{
@@ -631,6 +602,35 @@ photos_utils_create_thumbnail (GFile *file,
}
+GeglBuffer *
+photos_utils_get_buffer_from_node (GeglNode *node)
+{
+ GeglBuffer *buffer = NULL;
+ GeglNode *buffer_sink;
+ GeglNode *graph;
+ gint64 end;
+ gint64 start;
+
+ graph = gegl_node_get_parent (node);
+ buffer_sink = gegl_node_new_child (graph,
+ "operation", "gegl:buffer-sink",
+ "buffer", &buffer,
+ NULL);
+ gegl_node_link (node, buffer_sink);
+
+ start = g_get_monotonic_time ();
+
+ gegl_node_process (buffer_sink);
+
+ end = g_get_monotonic_time ();
+ photos_debug (PHOTOS_DEBUG_GEGL, "Utils: Create Buffer from Node: %" G_GINT64_FORMAT, end - start);
+
+ g_object_unref (buffer_sink);
+
+ return buffer;
+}
+
+
static GIcon *
photos_utils_get_thumbnail_icon (const gchar *uri)
{
diff --git a/src/photos-utils.h b/src/photos-utils.h
index 8a85055..26a5db1 100644
--- a/src/photos-utils.h
+++ b/src/photos-utils.h
@@ -81,8 +81,6 @@ GdkPixbuf *photos_utils_center_pixbuf (GdkPixbuf *pixbuf, gi
gchar *photos_utils_convert_path_to_uri (const gchar *path);
-GeglBuffer *photos_utils_create_buffer_from_node (GeglNode *node);
-
GIcon *photos_utils_create_collection_icon (gint base_size, GList *pixbufs);
GeglNode *photos_utils_create_orientation_node (GeglNode *parent, GQuark orientation);
@@ -99,6 +97,8 @@ gboolean photos_utils_create_thumbnail (GFile *file,
GCancellable *cancellable,
GError **error);
+GeglBuffer *photos_utils_get_buffer_from_node (GeglNode *node);
+
GIcon *photos_utils_get_icon_from_cursor (TrackerSparqlCursor *cursor);
GdkPixbuf *photos_utils_downscale_pixbuf_for_scale (GdkPixbuf *pixbuf, gint size, gint scale);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]