[retro-gtk/wip/aplazas/gl-display-2] core view pixbuf
- From: Adrien Plazas <aplazas src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [retro-gtk/wip/aplazas/gl-display-2] core view pixbuf
- Date: Sat, 18 Nov 2017 13:09:37 +0000 (UTC)
commit 17b9022d2bcd4ff6ca26d5659ea0394fbf07e538
Author: Adrien Plazas <kekun plazas laposte net>
Date: Sat Nov 18 14:09:15 2017 +0100
core view pixbuf
retro-gtk/retro-core-view.c | 35 +++--------------------------------
retro-gtk/retro-pixdata.c | 4 +---
2 files changed, 4 insertions(+), 35 deletions(-)
---
diff --git a/retro-gtk/retro-core-view.c b/retro-gtk/retro-core-view.c
index 6aa2cf3..d798007 100644
--- a/retro-gtk/retro-core-view.c
+++ b/retro-gtk/retro-core-view.c
@@ -33,9 +33,7 @@ struct _RetroCoreView
GtkEventBox parent_instance;
RetroCore *core;
RetroGLDisplay *display;
- GBinding *pixbuf_binding;
GBinding *sensitive_binding;
- GdkPixbuf *pixbuf;
RetroPaPlayer *audio_player;
gboolean can_grab_pointer;
gboolean snap_pointer_to_borders;
@@ -57,8 +55,7 @@ struct _RetroCoreView
G_DEFINE_TYPE (RetroCoreView, retro_core_view, GTK_TYPE_EVENT_BOX)
enum {
- PROP_PIXBUF = 1,
- PROP_CAN_GRAB_POINTER,
+ PROP_CAN_GRAB_POINTER = 1,
PROP_SNAP_POINTER_TO_BORDERS,
N_PROPS,
};
@@ -366,9 +363,7 @@ retro_core_view_finalize (GObject *object)
g_clear_object (&self->core);
g_object_unref (self->display);
- g_object_unref (self->pixbuf_binding);
g_object_unref (self->sensitive_binding);
- g_clear_object (&self->pixbuf);
g_object_unref (self->audio_player);
g_hash_table_unref (self->key_state);
g_hash_table_unref (self->mouse_button_state);
@@ -387,10 +382,6 @@ retro_core_view_get_property (GObject *object,
RetroCoreView *self = RETRO_CORE_VIEW (object);
switch (prop_id) {
- case PROP_PIXBUF:
- g_value_set_object (value, retro_core_view_get_pixbuf (self));
-
- break;
case PROP_CAN_GRAB_POINTER:
g_value_set_boolean (value, retro_core_view_get_can_grab_pointer (self));
@@ -415,10 +406,6 @@ retro_core_view_set_property (GObject *object,
RetroCoreView *self = RETRO_CORE_VIEW (object);
switch (prop_id) {
- case PROP_PIXBUF:
- retro_core_view_set_pixbuf (self, g_value_get_object (value));
-
- break;
case PROP_CAN_GRAB_POINTER:
retro_core_view_set_can_grab_pointer (self, g_value_get_boolean (value));
@@ -443,16 +430,6 @@ retro_core_view_class_init (RetroCoreViewClass *klass)
object_class->get_property = retro_core_view_get_property;
object_class->set_property = retro_core_view_set_property;
- properties[PROP_PIXBUF] =
- g_param_spec_object ("pixbuf",
- "Pixbuf",
- "The displayed pixbuf",
- gdk_pixbuf_get_type (),
- G_PARAM_READWRITE |
- G_PARAM_STATIC_NAME |
- G_PARAM_STATIC_NICK |
- G_PARAM_STATIC_BLURB);
-
properties[PROP_CAN_GRAB_POINTER] =
g_param_spec_boolean ("can-grab-pointer",
"Can grab pointer",
@@ -494,11 +471,6 @@ retro_core_view_init (RetroCoreView *self)
g_object_set (GTK_WIDGET (self->display), "can-focus", FALSE, NULL);
gtk_container_add (GTK_CONTAINER (self), GTK_WIDGET (self->display));
- self->pixbuf_binding =
- g_object_bind_property (G_OBJECT (self->display), "pixbuf",
- G_OBJECT (self), "pixbuf",
- G_BINDING_BIDIRECTIONAL |
- G_BINDING_SYNC_CREATE);
self->sensitive_binding =
g_object_bind_property (G_OBJECT (self), "sensitive",
G_OBJECT (self->display), "sensitive",
@@ -563,8 +535,7 @@ retro_core_view_set_pixbuf (RetroCoreView *self,
g_return_if_fail (RETRO_IS_CORE_VIEW (self));
g_return_if_fail (pixbuf == NULL || GDK_IS_PIXBUF (pixbuf));
- if (g_set_object (&self->pixbuf, pixbuf))
- g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_PIXBUF]);
+ retro_gl_display_set_pixbuf (self->display, pixbuf);
}
/**
@@ -580,7 +551,7 @@ retro_core_view_get_pixbuf (RetroCoreView *self)
{
g_return_val_if_fail (RETRO_IS_CORE_VIEW (self), NULL);
- return self->pixbuf;
+ return retro_gl_display_get_pixbuf (self->display);
}
/**
diff --git a/retro-gtk/retro-pixdata.c b/retro-gtk/retro-pixdata.c
index 8d60c85..b46c7fa 100644
--- a/retro-gtk/retro-pixdata.c
+++ b/retro-gtk/retro-pixdata.c
@@ -373,21 +373,18 @@ retro_pixdata_load_gl_texture (RetroPixdata *self)
switch (self->pixel_format) {
case RETRO_PIXEL_FORMAT_XRGB1555:
- g_message ("XRGB1555 stride %llux%llu stride %llu", self->width, self->height, self->rowstride);
format = GL_BGRA;
type = GL_UNSIGNED_SHORT_5_5_5_1;
pixel_size = 2;
break;
case RETRO_PIXEL_FORMAT_XRGB8888:
- g_message ("XRGB8888 %llux%llu stride %llu", self->width, self->height, self->rowstride);
format = GL_BGRA;
type = GL_UNSIGNED_BYTE;
pixel_size = 4;
break;
case RETRO_PIXEL_FORMAT_RGB565:
- g_message ("RGB565 stride %llux%llu stride %llu", self->width, self->height, self->rowstride);
format = GL_RGB;
type = GL_UNSIGNED_SHORT_5_6_5;
pixel_size = 2;
@@ -406,6 +403,7 @@ retro_pixdata_load_gl_texture (RetroPixdata *self)
0,
format, type,
self->data);
+ glPixelStorei (GL_UNPACK_ROW_LENGTH, 0);
return TRUE;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]