[Cogl] [PATCH] move outputs member up to CoglRenderer

Robert Bragg robert at sixbynine.org
Tue Dec 4 02:56:09 PST 2012


From: Robert Bragg <robert at linux.intel.com>

TODO: squash back into owen's patch
---
 cogl/cogl-renderer-private.h      |    2 ++
 cogl/cogl-xlib-renderer-private.h |    1 -
 cogl/cogl-xlib-renderer.c         |   27 +++++++++++----------------
 3 files changed, 13 insertions(+), 17 deletions(-)

diff --git a/cogl/cogl-renderer-private.h b/cogl/cogl-renderer-private.h
index 72ea9d0..0b907b9 100644
--- a/cogl/cogl-renderer-private.h
+++ b/cogl/cogl-renderer-private.h
@@ -47,6 +47,8 @@ struct _CoglRenderer
   CoglWinsysID winsys_id_override;
   GList *constraints;
 
+  GList *outputs;
+
 #ifdef COGL_HAS_XLIB_SUPPORT
   Display *foreign_xdpy;
   CoglBool xlib_enable_event_retrieval;
diff --git a/cogl/cogl-xlib-renderer-private.h b/cogl/cogl-xlib-renderer-private.h
index cb3b60e..5632164 100644
--- a/cogl/cogl-xlib-renderer-private.h
+++ b/cogl/cogl-xlib-renderer-private.h
@@ -44,7 +44,6 @@ typedef struct _CoglXlibRenderer
   CoglPollFD poll_fd;
 
   unsigned long outputs_update_serial;
-  GList *outputs;
 } CoglXlibRenderer;
 
 CoglBool
diff --git a/cogl/cogl-xlib-renderer.c b/cogl/cogl-xlib-renderer.c
index 1060949..9cf4abd 100644
--- a/cogl/cogl-xlib-renderer.c
+++ b/cogl/cogl-xlib-renderer.c
@@ -341,7 +341,7 @@ update_outputs (CoglRenderer *renderer,
       new_outputs = g_list_sort (new_outputs, (GCompareFunc)compare_outputs);
 
       l = new_outputs;
-      m = xlib_renderer->outputs;
+      m = renderer->outputs;
 
       while (l || m)
         {
@@ -362,11 +362,9 @@ update_outputs (CoglRenderer *renderer,
 
               if (!_cogl_output_values_equal (output_l, output_m))
                 {
-                  xlib_renderer->outputs =
-                    g_list_remove_link (xlib_renderer->outputs, m);
-                  xlib_renderer->outputs =
-                    g_list_insert_before (xlib_renderer->outputs,
-                                          m_next, output_l);
+                  renderer->outputs = g_list_remove_link (renderer->outputs, m);
+                  renderer->outputs = g_list_insert_before (renderer->outputs,
+                                                            m_next, output_l);
                   cogl_object_ref (output_l);
 
                   changed = TRUE;
@@ -377,8 +375,8 @@ update_outputs (CoglRenderer *renderer,
             }
           else if (cmp < 0)
             {
-              xlib_renderer->outputs =
-                g_list_insert_before (xlib_renderer->outputs, m, output_l);
+              renderer->outputs =
+                g_list_insert_before (renderer->outputs, m, output_l);
               cogl_object_ref (output_l);
               changed = TRUE;
               l = l->next;
@@ -386,8 +384,7 @@ update_outputs (CoglRenderer *renderer,
           else
             {
               GList *m_next = m->next;
-              xlib_renderer->outputs =
-                g_list_remove_link (xlib_renderer->outputs, m);
+              renderer->outputs = g_list_remove_link (renderer->outputs, m);
               changed = TRUE;
               m = m_next;
             }
@@ -406,7 +403,7 @@ update_outputs (CoglRenderer *renderer,
       else
         COGL_NOTE (WINSYS, "Outputs:");
 
-      for (l = xlib_renderer->outputs; l; l = l->next)
+      for (l = renderer->outputs; l; l = l->next)
         {
           CoglOutput *output = l->data;
           const char *subpixel_string;
@@ -525,9 +522,8 @@ _cogl_xlib_renderer_disconnect (CoglRenderer *renderer)
   CoglXlibRenderer *xlib_renderer =
     _cogl_xlib_renderer_get_data (renderer);
 
-  g_list_free_full (xlib_renderer->outputs,
-                    (GDestroyNotify)cogl_object_unref);
-  xlib_renderer->outputs = NULL;
+  g_list_free_full (renderer->outputs, (GDestroyNotify)cogl_object_unref);
+  renderer->outputs = NULL;
 
   if (!renderer->foreign_xdpy && xlib_renderer->xdpy)
     XCloseDisplay (xlib_renderer->xdpy);
@@ -622,14 +618,13 @@ _cogl_xlib_renderer_output_for_rectangle (CoglRenderer *renderer,
                                           int           width,
                                           int           height)
 {
-  CoglXlibRenderer *xlib_renderer = _cogl_xlib_renderer_get_data (renderer);
   int max_overlap = 0;
   CoglOutput *max_overlapped = NULL;
   GList *l;
   int xa1 = x, xa2 = x + width;
   int ya1 = y, ya2 = y + height;
 
-  for (l = xlib_renderer->outputs; l; l = l->next)
+  for (l = renderer->outputs; l; l = l->next)
     {
       CoglOutput *output = l->data;
       int xb1 = output->x, xb2 = output->x + output->width;
-- 
1.7.7.6



More information about the Cogl mailing list