[lasem] lsm_cairo: define filter_surface as a boxed type.



commit 8479ed266796ee8fc1a8b8247368e79f5c10ec3f
Author: Emmanuel Pacaud <emmanuel gnome org>
Date:   Tue Jun 12 23:57:59 2012 +0200

    lsm_cairo: define filter_surface as a boxed type.

 src/lsmcairo.c |   33 +++++++++++++++++++++++++++++++++
 src/lsmcairo.h |    4 ++++
 2 files changed, 37 insertions(+), 0 deletions(-)
---
diff --git a/src/lsmcairo.c b/src/lsmcairo.c
index 8ce0456..35d9efc 100644
--- a/src/lsmcairo.c
+++ b/src/lsmcairo.c
@@ -36,6 +36,26 @@ struct _LsmFilterSurface {
 };
 
 LsmFilterSurface *
+lsm_filter_surface_duplicate (const LsmFilterSurface *from)
+{
+	LsmFilterSurface *filter_surface;
+
+	g_return_val_if_fail (from != NULL, NULL);
+
+	cairo_surface_reference (from->surface);
+	
+	filter_surface = g_new (LsmFilterSurface, 1);
+	filter_surface->name = g_strdup (from->name);
+	filter_surface->surface = from->surface;
+	filter_surface->x0 = from->x0;
+	filter_surface->x1 = from->x1;
+	filter_surface->y0 = from->y0;
+	filter_surface->y1 = from->y1;
+
+	return filter_surface;
+}
+
+LsmFilterSurface *
 lsm_filter_surface_new (const char *name, unsigned int x0, unsigned int y0, unsigned int x1, unsigned int y1)
 {
 	cairo_surface_t *surface;
@@ -77,6 +97,19 @@ lsm_filter_surface_free (LsmFilterSurface *filter_surface)
 	g_free (filter_surface);
 }
 
+GType
+lsm_filter_surface_get_type (void)
+{
+	static GType our_type = 0;
+
+	if (our_type == 0)
+		our_type = g_boxed_type_register_static ("LsmFilterSurface",
+							 (GBoxedCopyFunc) lsm_filter_surface_duplicate,
+							 (GBoxedFreeFunc) lsm_filter_surface_free);
+
+	return our_type;
+}
+
 static void
 box_blur (LsmFilterSurface *input,
 	  LsmFilterSurface *output,
diff --git a/src/lsmcairo.h b/src/lsmcairo.h
index bee50c6..181e8f8 100644
--- a/src/lsmcairo.h
+++ b/src/lsmcairo.h
@@ -32,6 +32,10 @@ G_BEGIN_DECLS
 
 typedef struct _LsmFilterSurface LsmFilterSurface;
 
+GType lsm_filter_surface_get_type (void);
+
+#define LSM_TYPE_FILTER_SURFACE (lsm_filter_surface_get_type())
+
 LsmFilterSurface * 	lsm_filter_surface_new 			(const char *name,
 								 unsigned int x0, unsigned int y0,
 								 unsigned int x1, unsigned int y1);



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