[retro-gtk/c-port: 19/42] Port PixelFormat to C
- From: Adrien Plazas <aplazas src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [retro-gtk/c-port: 19/42] Port PixelFormat to C
- Date: Wed, 4 Oct 2017 05:24:00 +0000 (UTC)
commit 576b8d3b268e48364fc2f85dba362b0a03bba881
Author: Adrien Plazas <kekun plazas laposte net>
Date: Wed Sep 6 07:24:03 2017 +0200
Port PixelFormat to C
retro-gtk/Makefile.am | 3 +-
retro-gtk/retro-core-private.h | 1 +
retro-gtk/retro-gtk.h | 1 +
retro-gtk/retro-pixel-format.c | 26 +++++++++++++++++++++
retro-gtk/retro-pixel-format.h | 37 ++++++++++++++++++++++++++++++
retro-gtk/vapi/retro-gtk-c.vapi | 8 ++++++
retro-gtk/video.vala | 38 -------------------------------
retro-gtk/video/retro-video-converter.c | 2 +-
8 files changed, 76 insertions(+), 40 deletions(-)
---
diff --git a/retro-gtk/Makefile.am b/retro-gtk/Makefile.am
index 8ea1fa1..fadf0df 100644
--- a/retro-gtk/Makefile.am
+++ b/retro-gtk/Makefile.am
@@ -40,6 +40,7 @@ retro_gtk_public_h_sources = \
retro-joypad-id.h \
retro-lightgun-id.h \
retro-mouse-id.h \
+ retro-pixel-format.h \
retro-pointer-id.h \
retro-video-filter.h \
$(NULL)
@@ -87,9 +88,9 @@ libretro_gtk_la_SOURCES = \
retro-module-iterator.vala \
retro-option.c \
retro-options.c \
+ retro-pixel-format.c \
retro-video-filter.c \
rumble.vala \
- video.vala \
retro-core.c \
retro-environment.c \
libretro-environment.h \
diff --git a/retro-gtk/retro-core-private.h b/retro-gtk/retro-core-private.h
index a4a8fbb..aedb5e0 100644
--- a/retro-gtk/retro-core-private.h
+++ b/retro-gtk/retro-core-private.h
@@ -11,6 +11,7 @@
#include "retro-gtk-internal.h"
#include "retro-module.h"
#include "retro-options.h"
+#include "retro-pixel-format.h"
#include "retro-rotation.h"
G_BEGIN_DECLS
diff --git a/retro-gtk/retro-gtk.h b/retro-gtk/retro-gtk.h
index 1bedfd6..612a6bb 100644
--- a/retro-gtk/retro-gtk.h
+++ b/retro-gtk/retro-gtk.h
@@ -18,6 +18,7 @@
#include "retro-joypad-id.h"
#include "retro-lightgun-id.h"
#include "retro-mouse-id.h"
+#include "retro-pixel-format.h"
#include "retro-pointer-id.h"
#include "retro-video-filter.h"
diff --git a/retro-gtk/retro-pixel-format.c b/retro-gtk/retro-pixel-format.c
new file mode 100644
index 0000000..5184211
--- /dev/null
+++ b/retro-gtk/retro-pixel-format.c
@@ -0,0 +1,26 @@
+// This file is part of retro-gtk. License: GPL-3.0+.
+
+#include "retro-pixel-format.h"
+
+GType
+retro_pixel_format_get_type (void)
+{
+ static volatile gsize retro_pixel_format_type = 0;
+
+ if (g_once_init_enter (&retro_pixel_format_type)) {
+ static const GEnumValue values[] = {
+ { RETRO_PIXEL_FORMAT_XRGB1555, "RETRO_PIXEL_FORMAT_XRGB1555", "xrgb1555" },
+ { RETRO_PIXEL_FORMAT_XRGB8888, "RETRO_PIXEL_FORMAT_XRGB8888", "xrgb8888" },
+ { RETRO_PIXEL_FORMAT_RGB565, "RETRO_PIXEL_FORMAT_RGB565", "rgb565" },
+ { RETRO_PIXEL_FORMAT_UNKNOWN, "RETRO_PIXEL_FORMAT_UNKNOWN", "unknown" },
+ { 0, NULL, NULL },
+ };
+ GType type;
+
+ type = g_enum_register_static ("RetroPixelFormat", values);
+
+ g_once_init_leave (&retro_pixel_format_type, type);
+ }
+
+ return retro_pixel_format_type;
+}
diff --git a/retro-gtk/retro-pixel-format.h b/retro-gtk/retro-pixel-format.h
new file mode 100644
index 0000000..cd642da
--- /dev/null
+++ b/retro-gtk/retro-pixel-format.h
@@ -0,0 +1,37 @@
+// This file is part of retro-gtk. License: GPL-3.0+.
+
+#ifndef RETRO_PIXEL_FORMAT_H
+#define RETRO_PIXEL_FORMAT_H
+
+#if !defined(__RETRO_GTK_INSIDE__) && !defined(RETRO_GTK_COMPILATION)
+# error "Only <retro-gtk.h> can be included directly."
+#endif
+
+#include <glib-object.h>
+
+G_BEGIN_DECLS
+
+#define RETRO_TYPE_PIXEL_FORMAT (retro_pixel_format_get_type ())
+
+GType retro_pixel_format_get_type (void) G_GNUC_CONST;
+
+/**
+ * RetroPixelFormat:
+ * @RETRO_PIXEL_FORMAT_XRGB1555: Native endian, the first bit is ignored.
+ * @RETRO_PIXEL_FORMAT_XRGB8888: Native endian, the first 8 bits are ignored.
+ * @RETRO_PIXEL_FORMAT_RGB565: Native endian.
+ * @RETRO_PIXEL_FORMAT_UNKNOWN: An unknown format.
+ *
+ * Represents the pixel formats used by Libretro.
+ */
+typedef enum
+{
+ RETRO_PIXEL_FORMAT_XRGB1555,
+ RETRO_PIXEL_FORMAT_XRGB8888,
+ RETRO_PIXEL_FORMAT_RGB565,
+ RETRO_PIXEL_FORMAT_UNKNOWN = -1,
+} RetroPixelFormat;
+
+G_END_DECLS
+
+#endif /* RETRO_PIXEL_FORMAT_H */
diff --git a/retro-gtk/vapi/retro-gtk-c.vapi b/retro-gtk/vapi/retro-gtk-c.vapi
index dca05f9..1d548e2 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-pixel-format.h")]
+public enum Retro.PixelFormat {
+ XRGB1555,
+ XRGB8888,
+ RGB565,
+ UNKNOWN = -1,
+}
+
[CCode (cheader_filename = "retro-video-filter.h")]
public enum Retro.VideoFilter {
SMOOTH,
diff --git a/retro-gtk/video/retro-video-converter.c b/retro-gtk/video/retro-video-converter.c
index 2af308b..f9de9cc 100644
--- a/retro-gtk/video/retro-video-converter.c
+++ b/retro-gtk/video/retro-video-converter.c
@@ -2,7 +2,7 @@
#include <gdk-pixbuf/gdk-pixbuf.h>
-#include "retro-gtk-internal.h"
+#include "retro-pixel-format.h"
typedef struct _xrgb1555 {
guint16 b: 5;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]