[retro-gtk/wip/aplazas/0.13: 12/14] Port VideoFilter to C
- From: Adrien Plazas <aplazas src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [retro-gtk/wip/aplazas/0.13: 12/14] Port VideoFilter to C
- Date: Wed, 6 Sep 2017 10:21:59 +0000 (UTC)
commit 032e06685f01c6ee5562a80fe2d835aa75c8dde8
Author: Adrien Plazas <kekun plazas laposte net>
Date: Tue Sep 5 18:39:49 2017 +0200
Port VideoFilter to C
retro-gtk/Makefile.am | 3 +-
retro-gtk/retro-gtk.h | 1 +
retro-gtk/retro-video-filter.c | 45 +++++++++++++++++++++++++++++++++++++
retro-gtk/retro-video-filter.h | 31 +++++++++++++++++++++++++
retro-gtk/vapi/retro-gtk-c.vapi | 8 ++++++
retro-gtk/video/video-filter.vala | 13 ----------
6 files changed, 87 insertions(+), 14 deletions(-)
---
diff --git a/retro-gtk/Makefile.am b/retro-gtk/Makefile.am
index e632ec7..308b3df 100644
--- a/retro-gtk/Makefile.am
+++ b/retro-gtk/Makefile.am
@@ -55,6 +55,7 @@ libretro_gtk_la_SOURCES = \
retro-module.c \
retro-module-query.vala \
retro-module-iterator.vala \
+ retro-video-filter.c \
rumble.vala \
video.vala \
retro-core.c \
@@ -63,7 +64,6 @@ libretro_gtk_la_SOURCES = \
\
video/cairo-display.vala \
video/retro-video-converter.c \
- video/video-filter.vala \
$(NULL)
video/retro-video-converter.c: retro-gtk-internal.h
@@ -117,6 +117,7 @@ retro_gtkinclude_HEADERS = \
retro-lightgun-id.h \
retro-mouse-id.h \
retro-pointer-id.h \
+ retro-video-filter.h \
$(NULL)
# Add unstable API guard
diff --git a/retro-gtk/retro-gtk.h b/retro-gtk/retro-gtk.h
index 008bf67..3029968 100644
--- a/retro-gtk/retro-gtk.h
+++ b/retro-gtk/retro-gtk.h
@@ -13,5 +13,6 @@
#include "retro-lightgun-id.h"
#include "retro-mouse-id.h"
#include "retro-pointer-id.h"
+#include "retro-video-filter.h"
#endif
diff --git a/retro-gtk/retro-video-filter.c b/retro-gtk/retro-video-filter.c
new file mode 100644
index 0000000..eafa6ad
--- /dev/null
+++ b/retro-gtk/retro-video-filter.c
@@ -0,0 +1,45 @@
+// This file is part of retro-gtk. License: GPL-3.0+.
+
+#include "retro-video-filter.h"
+
+RetroVideoFilter
+retro_video_filter_from_string (const gchar *filter)
+{
+ GEnumClass* enum_class;
+ RetroVideoFilter result;
+ GEnumValue* eval = NULL;
+
+ g_return_val_if_fail (filter != NULL, RETRO_VIDEO_FILTER_SMOOTH);
+
+ enum_class = (GEnumClass *) g_type_class_ref (RETRO_TYPE_VIDEO_FILTER);
+ eval = g_enum_get_value_by_nick (enum_class, filter);
+
+ result = (eval == NULL) ?
+ RETRO_VIDEO_FILTER_SMOOTH :
+ (RetroVideoFilter) eval->value;
+
+ g_type_class_unref (enum_class);
+
+ return result;
+}
+
+GType
+retro_video_filter_get_type (void)
+{
+ static volatile gsize retro_video_filter_type = 0;
+
+ if (g_once_init_enter (&retro_video_filter_type)) {
+ static const GEnumValue values[] = {
+ { RETRO_VIDEO_FILTER_SMOOTH, "RETRO_VIDEO_FILTER_SMOOTH", "smooth" },
+ { RETRO_VIDEO_FILTER_SHARP, "RETRO_VIDEO_FILTER_SHARP", "sharp" },
+ { 0, NULL, NULL },
+ };
+ GType type;
+
+ type = g_enum_register_static ("RetroVideoFilter", values);
+
+ g_once_init_leave (&retro_video_filter_type, type);
+ }
+
+ return retro_video_filter_type;
+}
diff --git a/retro-gtk/retro-video-filter.h b/retro-gtk/retro-video-filter.h
new file mode 100644
index 0000000..d6aaa1b
--- /dev/null
+++ b/retro-gtk/retro-video-filter.h
@@ -0,0 +1,31 @@
+// This file is part of retro-gtk. License: GPL-3.0+.
+
+#ifndef RETRO_VIDEO_FILTER_H
+#define RETRO_VIDEO_FILTER_H
+
+#include <glib-object.h>
+
+G_BEGIN_DECLS
+
+#define RETRO_TYPE_VIDEO_FILTER (retro_video_filter_get_type ())
+
+GType retro_video_filter_get_type (void) G_GNUC_CONST;
+
+/**
+ * RetroJoypadId:
+ * @RETRO_VIDEO_FILTER_SMOOTH: A smooth but blurry video filer.
+ * @RETRO_VIDEO_FILTER_SHARP: A sharp video filter showing every pixel.
+ *
+ * Represents the filters that can be applied to the video output.
+ */
+typedef enum
+{
+ RETRO_VIDEO_FILTER_SMOOTH,
+ RETRO_VIDEO_FILTER_SHARP,
+} RetroVideoFilter;
+
+RetroVideoFilter retro_video_filter_from_string (const gchar *filter);
+
+G_END_DECLS
+
+#endif /* RETRO_VIDEO_FILTER_H */
diff --git a/retro-gtk/vapi/retro-gtk-c.vapi b/retro-gtk/vapi/retro-gtk-c.vapi
index c22ec5c..dca05f9 100644
--- a/retro-gtk/vapi/retro-gtk-c.vapi
+++ b/retro-gtk/vapi/retro-gtk-c.vapi
@@ -12,6 +12,14 @@ public enum Retro.DeviceType {
POINTER = 6,
}
+[CCode (cheader_filename = "retro-video-filter.h")]
+public enum Retro.VideoFilter {
+ SMOOTH,
+ SHARP;
+
+ public static VideoFilter from_string (string filter);
+}
+
[CCode (cheader_filename = "retro-input-device.h")]
public interface Retro.InputDevice : GLib.Object {
public abstract void poll ();
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]