[cogl/wip/wl-list: 6/7] Use CoglList for the list of foreign GLES2 offscreens



commit 4964ed10d9fa6bf33c3a83eaa9d87c0fc039b777
Author: Neil Roberts <neil linux intel com>
Date:   Sun Jun 9 01:59:04 2013 +0100

    Use CoglList for the list of foreign GLES2 offscreens
    
    This is part of ongoing work to remove the BSD list implementation in
    favour of the one from Wayland.

 cogl/cogl-gles2-context-private.h |   14 +++++---------
 cogl/cogl-gles2-context.c         |   21 +++++++++++----------
 2 files changed, 16 insertions(+), 19 deletions(-)
---
diff --git a/cogl/cogl-gles2-context-private.h b/cogl/cogl-gles2-context-private.h
index 5afb296..c9d4bcc 100644
--- a/cogl/cogl-gles2-context-private.h
+++ b/cogl/cogl-gles2-context-private.h
@@ -33,18 +33,14 @@
 
 #include "cogl-object-private.h"
 #include "cogl-framebuffer-private.h"
-#include "cogl-queue.h"
+#include "cogl-list.h"
 
-typedef struct _CoglGLES2Offscreen CoglGLES2Offscreen;
-
-COGL_LIST_HEAD (CoglGLES2OffscreenList, CoglGLES2Offscreen);
-
-struct _CoglGLES2Offscreen
+typedef struct _CoglGLES2Offscreen
 {
-  COGL_LIST_ENTRY (CoglGLES2Offscreen) list_node;
+  CoglList link;
   CoglOffscreen *original_offscreen;
   CoglGLFramebuffer gl_framebuffer;
-};
+} CoglGLES2Offscreen;
 
 typedef struct
 {
@@ -143,7 +139,7 @@ struct _CoglGLES2Context
 
   GLuint current_fbo_handle;
 
-  CoglGLES2OffscreenList foreign_offscreens;
+  CoglList foreign_offscreens;
 
   CoglGLES2Vtable *vtable;
 
diff --git a/cogl/cogl-gles2-context.c b/cogl/cogl-gles2-context.c
index 2d0ab52..4063fdc 100644
--- a/cogl/cogl-gles2-context.c
+++ b/cogl/cogl-gles2-context.c
@@ -1435,7 +1435,7 @@ gl_tex_image_2d_wrapper (GLenum target,
 static void
 _cogl_gles2_offscreen_free (CoglGLES2Offscreen *gles2_offscreen)
 {
-  COGL_LIST_REMOVE (gles2_offscreen, list_node);
+  _cogl_list_remove (&gles2_offscreen->link);
   g_slice_free (CoglGLES2Offscreen, gles2_offscreen);
 }
 
@@ -1513,10 +1513,12 @@ _cogl_gles2_context_free (CoglGLES2Context *gles2_context)
   winsys = ctx->display->renderer->winsys_vtable;
   winsys->destroy_gles2_context (gles2_context);
 
-  while (gles2_context->foreign_offscreens.lh_first)
+  while (!_cogl_list_empty (&gles2_context->foreign_offscreens))
     {
       CoglGLES2Offscreen *gles2_offscreen =
-        gles2_context->foreign_offscreens.lh_first;
+        _cogl_container_of (gles2_context->foreign_offscreens.next,
+                            gles2_offscreen,
+                            link);
 
       /* Note: this will also indirectly free the gles2_offscreen by
        * calling the destroy notify for the _user_data */
@@ -1572,7 +1574,7 @@ cogl_gles2_context_new (CoglContext *ctx, CoglError **error)
 
   gles2_ctx->context = ctx;
 
-  COGL_LIST_INIT (&gles2_ctx->foreign_offscreens);
+  _cogl_list_init (&gles2_ctx->foreign_offscreens);
 
   winsys = ctx->display->renderer->winsys_vtable;
   gles2_ctx->winsys = winsys->context_create_gles2_context (ctx, error);
@@ -1694,9 +1696,9 @@ _cogl_gles2_offscreen_allocate (CoglOffscreen *offscreen,
       return NULL;
     }
 
-  for (gles2_offscreen = gles2_context->foreign_offscreens.lh_first;
-       gles2_offscreen;
-       gles2_offscreen = gles2_offscreen->list_node.le_next)
+  _cogl_list_for_each (gles2_offscreen,
+                       &gles2_context->foreign_offscreens,
+                       link)
     {
       if (gles2_offscreen->original_offscreen == offscreen)
         return gles2_offscreen;
@@ -1740,9 +1742,8 @@ _cogl_gles2_offscreen_allocate (CoglOffscreen *offscreen,
 
   gles2_offscreen->original_offscreen = offscreen;
 
-  COGL_LIST_INSERT_HEAD (&gles2_context->foreign_offscreens,
-                         gles2_offscreen,
-                         list_node);
+  _cogl_list_insert (&gles2_context->foreign_offscreens,
+                     &gles2_offscreen->link);
 
   /* So we avoid building up an ever growing collection of ancillary
    * buffers for wrapped framebuffers, we make sure that the wrappers


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