[retro-gtk] gl-display: Refactor pixdata and pixbuf setters



commit 093d8e2188077250bc801e50808d48bf4eda670b
Author: Adrien Plazas <kekun plazas laposte net>
Date:   Sat Nov 18 15:09:54 2017 +0100

    gl-display: Refactor pixdata and pixbuf setters

 retro-gtk/retro-gl-display.c |   22 ++++++++++++----------
 1 files changed, 12 insertions(+), 10 deletions(-)
---
diff --git a/retro-gtk/retro-gl-display.c b/retro-gtk/retro-gl-display.c
index 4327cef..7dfbd6c 100644
--- a/retro-gtk/retro-gl-display.c
+++ b/retro-gtk/retro-gl-display.c
@@ -53,17 +53,23 @@ static const gchar *filter_uris[] = {
 /* Private */
 
 static void
-retro_gl_display_set_pixdata (RetroGLDisplay *self,
-                              RetroPixdata   *pixdata)
+retro_gl_display_clear_video (RetroGLDisplay *self)
 {
-  if (self->pixdata == pixdata)
-    return;
-
   g_clear_object (&self->pixbuf);
   if (self->pixdata != NULL) {
     retro_pixdata_free (self->pixdata);
     self->pixdata = NULL;
   }
+}
+
+static void
+retro_gl_display_set_pixdata (RetroGLDisplay *self,
+                              RetroPixdata   *pixdata)
+{
+  if (self->pixdata == pixdata)
+    return;
+
+  retro_gl_display_clear_video (self);
 
   if (pixdata != NULL)
     self->pixdata = retro_pixdata_copy (pixdata);
@@ -485,11 +491,7 @@ retro_gl_display_set_pixbuf (RetroGLDisplay *self,
   if (self->pixbuf == pixbuf)
     return;
 
-  g_clear_object (&self->pixbuf);
-  if (self->pixdata != NULL) {
-    retro_pixdata_free (self->pixdata);
-    self->pixdata = NULL;
-  }
+  retro_gl_display_clear_video (self);
 
   if (pixbuf != NULL)
     self->pixbuf = g_object_ref (pixbuf);


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