[cogl/wip/wl-list: 3/7] Use CoglList instead of COGL_STAILQ_* for onscreen events and dirty
- From: Neil Roberts <nroberts src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [cogl/wip/wl-list: 3/7] Use CoglList instead of COGL_STAILQ_* for onscreen events and dirty
- Date: Sun, 9 Jun 2013 01:20:13 +0000 (UTC)
commit affabb66751b78ca07e6e0253ab7098c7437fb32
Author: Neil Roberts <neil linux intel com>
Date: Sun Jun 9 00:09:59 2013 +0100
Use CoglList instead of COGL_STAILQ_* for onscreen events and dirty
This is part of ongoing work to remove cogl-queue.h in favour of the
Wayland list implementation.
cogl/cogl-context-private.h | 4 ++--
cogl/cogl-context.c | 4 ++--
cogl/cogl-onscreen-private.h | 22 +++++++---------------
cogl/cogl-onscreen.c | 23 ++++++++++-------------
4 files changed, 21 insertions(+), 32 deletions(-)
---
diff --git a/cogl/cogl-context-private.h b/cogl/cogl-context-private.h
index 7978232..5243aaa 100644
--- a/cogl/cogl-context-private.h
+++ b/cogl/cogl-context-private.h
@@ -176,8 +176,8 @@ struct _CoglContext
gboolean have_last_offscreen_allocate_flags;
CoglOffscreenAllocateFlags last_offscreen_allocate_flags;
- CoglOnscreenEventList onscreen_events_queue;
- CoglOnscreenQueuedDirtyList onscreen_dirty_queue;
+ CoglList onscreen_events_queue;
+ CoglList onscreen_dirty_queue;
CoglClosure *onscreen_dispatch_idle;
CoglGLES2Context *current_gles2_context;
diff --git a/cogl/cogl-context.c b/cogl/cogl-context.c
index 39901b1..bdfdf1e 100644
--- a/cogl/cogl-context.c
+++ b/cogl/cogl-context.c
@@ -292,8 +292,8 @@ cogl_context_new (CoglDisplay *display,
context->current_draw_buffer_state_flushed = 0;
context->current_draw_buffer_changes = COGL_FRAMEBUFFER_STATE_ALL;
- COGL_TAILQ_INIT (&context->onscreen_events_queue);
- COGL_TAILQ_INIT (&context->onscreen_dirty_queue);
+ _cogl_list_init (&context->onscreen_events_queue);
+ _cogl_list_init (&context->onscreen_dirty_queue);
g_queue_init (&context->gles2_context_stack);
diff --git a/cogl/cogl-onscreen-private.h b/cogl/cogl-onscreen-private.h
index e960dc3..1383f3d 100644
--- a/cogl/cogl-onscreen-private.h
+++ b/cogl/cogl-onscreen-private.h
@@ -26,8 +26,8 @@
#include "cogl-onscreen.h"
#include "cogl-framebuffer-private.h"
-#include "cogl-queue.h"
#include "cogl-closure-list-private.h"
+#include "cogl-list.h"
#include <glib.h>
@@ -35,30 +35,22 @@
#include <windows.h>
#endif
-typedef struct _CoglOnscreenEvent CoglOnscreenEvent;
-
-COGL_TAILQ_HEAD (CoglOnscreenEventList, CoglOnscreenEvent);
-
-struct _CoglOnscreenEvent
+typedef struct _CoglOnscreenEvent
{
- COGL_TAILQ_ENTRY (CoglOnscreenEvent) list_node;
+ CoglList link;
CoglOnscreen *onscreen;
CoglFrameInfo *info;
CoglFrameEvent type;
-};
+} CoglOnscreenEvent;
-typedef struct _CoglOnscreenQueuedDirty CoglOnscreenQueuedDirty;
-
-COGL_TAILQ_HEAD (CoglOnscreenQueuedDirtyList, CoglOnscreenQueuedDirty);
-
-struct _CoglOnscreenQueuedDirty
+typedef struct _CoglOnscreenQueuedDirty
{
- COGL_TAILQ_ENTRY (CoglOnscreenQueuedDirty) list_node;
+ CoglList link;
CoglOnscreen *onscreen;
CoglOnscreenDirtyInfo info;
-};
+} CoglOnscreenQueuedDirty;
struct _CoglOnscreen
{
diff --git a/cogl/cogl-onscreen.c b/cogl/cogl-onscreen.c
index f686b14..8fdc1aa 100644
--- a/cogl/cogl-onscreen.c
+++ b/cogl/cogl-onscreen.c
@@ -122,23 +122,20 @@ static void
_cogl_dispatch_onscreen_cb (CoglContext *context)
{
CoglOnscreenEvent *event, *tmp;
- CoglOnscreenEventList queue;
+ CoglList queue;
/* Dispatching the event callback may cause another frame to be
* drawn which in may cause another event to be queued immediately.
* To make sure this loop will only dispatch one set of events we'll
* steal the queue and iterate that separately */
- COGL_TAILQ_INIT (&queue);
- COGL_TAILQ_CONCAT (&queue, &context->onscreen_events_queue, list_node);
- COGL_TAILQ_INIT (&context->onscreen_events_queue);
+ _cogl_list_init (&queue);
+ _cogl_list_insert_list (&queue, &context->onscreen_events_queue);
+ _cogl_list_init (&context->onscreen_events_queue);
_cogl_closure_disconnect (context->onscreen_dispatch_idle);
context->onscreen_dispatch_idle = NULL;
- COGL_TAILQ_FOREACH_SAFE (event,
- &queue,
- list_node,
- tmp)
+ _cogl_list_for_each_safe (event, tmp, &queue, link)
{
CoglOnscreen *onscreen = event->onscreen;
CoglFrameInfo *info = event->info;
@@ -151,12 +148,12 @@ _cogl_dispatch_onscreen_cb (CoglContext *context)
g_slice_free (CoglOnscreenEvent, event);
}
- while (!COGL_TAILQ_EMPTY (&context->onscreen_dirty_queue))
+ while (!_cogl_list_empty (&context->onscreen_dirty_queue))
{
CoglOnscreenQueuedDirty *qe =
- COGL_TAILQ_FIRST (&context->onscreen_dirty_queue);
+ _cogl_container_of (context->onscreen_dirty_queue.next, qe, link);
- COGL_TAILQ_REMOVE (&context->onscreen_dirty_queue, qe, list_node);
+ _cogl_list_remove (&qe->link);
_cogl_closure_list_invoke (&qe->onscreen->dirty_closures,
CoglOnscreenDirtyCallback,
@@ -194,7 +191,7 @@ _cogl_onscreen_queue_dirty (CoglOnscreen *onscreen,
qe->onscreen = cogl_object_ref (onscreen);
qe->info = *info;
- COGL_TAILQ_INSERT_TAIL (&ctx->onscreen_dirty_queue, qe, list_node);
+ _cogl_list_insert (ctx->onscreen_dirty_queue.prev, &qe->link);
_cogl_onscreen_queue_dispatch_idle (onscreen);
}
@@ -226,7 +223,7 @@ _cogl_onscreen_queue_event (CoglOnscreen *onscreen,
event->info = cogl_object_ref (info);
event->type = type;
- COGL_TAILQ_INSERT_TAIL (&ctx->onscreen_events_queue, event, list_node);
+ _cogl_list_insert (ctx->onscreen_events_queue.prev, &event->link);
_cogl_onscreen_queue_dispatch_idle (onscreen);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]