[retro-gtk/c-port: 18/39] Port PixelFormat to C
- From: Adrien Plazas <aplazas src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [retro-gtk/c-port: 18/39] Port PixelFormat to C
- Date: Tue, 26 Sep 2017 09:24:53 +0000 (UTC)
commit 1530766ac15bff70605787ff8a79577aa500077e
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.h | 1 +
retro-gtk/retro-gtk.h | 1 +
retro-gtk/retro-pixel-format.c | 26 +++++++++++++++++++++
retro-gtk/retro-pixel-format.h | 33 ++++++++++++++++++++++++++
retro-gtk/vapi/retro-gtk-c.vapi | 8 ++++++
retro-gtk/video.vala | 38 -------------------------------
retro-gtk/video/retro-video-converter.c | 2 +-
8 files changed, 72 insertions(+), 40 deletions(-)
---
diff --git a/retro-gtk/Makefile.am b/retro-gtk/Makefile.am
index d8662f4..649a3fc 100644
--- a/retro-gtk/Makefile.am
+++ b/retro-gtk/Makefile.am
@@ -55,9 +55,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 \
@@ -118,6 +118,7 @@ retro_gtkinclude_HEADERS = \
retro-mouse-id.h \
retro-option.h \
retro-options.h \
+ retro-pixel-format.h \
retro-pointer-id.h \
retro-variable.h \
retro-video-filter.h \
diff --git a/retro-gtk/retro-core.h b/retro-gtk/retro-core.h
index b5c9369..682b9e9 100644
--- a/retro-gtk/retro-core.h
+++ b/retro-gtk/retro-core.h
@@ -7,6 +7,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 33827a5..012a42b 100644
--- a/retro-gtk/retro-gtk.h
+++ b/retro-gtk/retro-gtk.h
@@ -16,6 +16,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..e00853f
--- /dev/null
+++ b/retro-gtk/retro-pixel-format.h
@@ -0,0 +1,33 @@
+// This file is part of retro-gtk. License: GPL-3.0+.
+
+#ifndef RETRO_PIXEL_FORMAT_H
+#define RETRO_PIXEL_FORMAT_H
+
+#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 6057a6a..4e675f7 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]