[Cogl] [PATCH] onscreen: remove _swap_buffers_callback apis
Robert Bragg
robert at sixbynine.org
Thu Jan 31 06:47:33 PST 2013
From: Robert Bragg <robert at linux.intel.com>
This removes the cogl_onscreen_add/remove_swap_buffers_callback which
have been deprecated by the new cogl_onscreen_add/remove_frame_callback
api.
---
cogl/cogl-context-private.h | 3 --
cogl/cogl-context.c | 6 ---
cogl/cogl-onscreen.c | 72 ----------------------------------
cogl/cogl-onscreen.h | 49 -----------------------
doc/reference/cogl2/cogl2-sections.txt | 3 --
5 files changed, 133 deletions(-)
diff --git a/cogl/cogl-context-private.h b/cogl/cogl-context-private.h
index fc528e7..188fa4b 100644
--- a/cogl/cogl-context-private.h
+++ b/cogl/cogl-context-private.h
@@ -173,9 +173,6 @@ struct _CoglContext
gboolean have_last_offscreen_allocate_flags;
CoglOffscreenAllocateFlags last_offscreen_allocate_flags;
- GHashTable *swap_callback_closures;
- int next_swap_callback_id;
-
CoglOnscreenEventList onscreen_events_queue;
CoglGLES2Context *current_gles2_context;
diff --git a/cogl/cogl-context.c b/cogl/cogl-context.c
index 11779f9..fac8e1b 100644
--- a/cogl/cogl-context.c
+++ b/cogl/cogl-context.c
@@ -289,9 +289,6 @@ cogl_context_new (CoglDisplay *display,
context->current_draw_buffer_state_flushed = 0;
context->current_draw_buffer_changes = COGL_FRAMEBUFFER_STATE_ALL;
- context->swap_callback_closures =
- g_hash_table_new (g_direct_hash, g_direct_equal);
-
COGL_TAILQ_INIT (&context->onscreen_events_queue);
g_queue_init (&context->gles2_context_stack);
@@ -453,9 +450,6 @@ _cogl_context_free (CoglContext *context)
if (context->blit_texture_pipeline)
cogl_object_unref (context->blit_texture_pipeline);
- if (context->swap_callback_closures)
- g_hash_table_destroy (context->swap_callback_closures);
-
g_warn_if_fail (context->gles2_context_stack.length == 0);
if (context->journal_flush_attributes_array)
diff --git a/cogl/cogl-onscreen.c b/cogl/cogl-onscreen.c
index 2f05001..afa4f63 100644
--- a/cogl/cogl-onscreen.c
+++ b/cogl/cogl-onscreen.c
@@ -352,78 +352,6 @@ cogl_onscreen_remove_frame_callback (CoglOnscreen *onscreen,
g_slice_free (CoglFrameClosure, closure);
}
-typedef struct _SwapBufferCallbackState
-{
- CoglSwapBuffersNotify callback;
- void *user_data;
-} SwapBufferCallbackState;
-
-static void
-destroy_swap_buffers_callback_state (void *user_data)
-{
- g_slice_free (SwapBufferCallbackState, user_data);
-}
-
-static void
-shim_swap_buffers_callback (CoglOnscreen *onscreen,
- CoglFrameEvent event,
- CoglFrameInfo *info,
- void *user_data)
-{
- SwapBufferCallbackState *state = user_data;
-
- /* XXX: Note that technically it is a change in semantics for this
- * interface to forward _SYNC events here and also makes the api
- * name somewhat missleading.
- *
- * In practice though this interface is currently used by
- * applications for throttling, not because they are strictly
- * interested in knowing when a frame has been presented and so
- * forwarding _SYNC events should serve them better.
- */
- if (event == COGL_FRAME_EVENT_SYNC)
- state->callback (COGL_FRAMEBUFFER (onscreen), state->user_data);
-}
-
-unsigned int
-cogl_onscreen_add_swap_buffers_callback (CoglOnscreen *onscreen,
- CoglSwapBuffersNotify callback,
- void *user_data)
-{
- CoglContext *ctx = COGL_FRAMEBUFFER (onscreen)->context;
- SwapBufferCallbackState *state = g_slice_new (SwapBufferCallbackState);
- CoglFrameClosure *closure;
- unsigned int id = ctx->next_swap_callback_id++;
-
- state->callback = callback;
- state->user_data = user_data;
-
- closure =
- cogl_onscreen_add_frame_callback (onscreen,
- shim_swap_buffers_callback,
- state,
- destroy_swap_buffers_callback_state);
-
- g_hash_table_insert (ctx->swap_callback_closures,
- GINT_TO_POINTER (id),
- closure);
-
- return id;
-}
-
-void
-cogl_onscreen_remove_swap_buffers_callback (CoglOnscreen *onscreen,
- unsigned int id)
-{
- CoglContext *ctx = COGL_FRAMEBUFFER (onscreen)->context;
- CoglFrameClosure *closure = g_hash_table_lookup (ctx->swap_callback_closures,
- GINT_TO_POINTER (id));
-
- _COGL_RETURN_IF_FAIL (closure);
-
- cogl_onscreen_remove_frame_callback (onscreen, closure);
-}
-
void
cogl_onscreen_set_swap_throttled (CoglOnscreen *onscreen,
CoglBool throttled)
diff --git a/cogl/cogl-onscreen.h b/cogl/cogl-onscreen.h
index 0a59eb8..13b51a1 100644
--- a/cogl/cogl-onscreen.h
+++ b/cogl/cogl-onscreen.h
@@ -543,55 +543,6 @@ void
cogl_onscreen_remove_frame_callback (CoglOnscreen *onscreen,
CoglFrameClosure *closure);
-typedef void (*CoglSwapBuffersNotify) (CoglFramebuffer *framebuffer,
- void *user_data);
-
-/**
- * cogl_onscreen_add_swap_buffers_callback:
- * @onscreen: A #CoglOnscreen framebuffer
- * @callback: A callback function to call when a swap has completed
- * @user_data: A private pointer to be passed to @callback
- *
- * Installs a @callback function that should be called whenever a swap buffers
- * request (made using cogl_onscreen_swap_buffers()) for the given
- * @onscreen completes.
- *
- * <note>Applications should check for the %COGL_FEATURE_ID_SWAP_BUFFERS_EVENT
- * feature before using this API. It's currently undefined when and if
- * registered callbacks will be called if this feature is not supported.</note>
- *
- * We recommend using this mechanism when available to manually throttle your
- * applications (in conjunction with cogl_onscreen_set_swap_throttled()) so
- * your application will be able to avoid long blocks in the driver caused by
- * throttling when you request to swap buffers too quickly.
- *
- * Return value: a unique identifier that can be used to remove to remove
- * the callback later.
- * Since: 1.10
- * Stability: unstable
- * Deprecated: 1.14: Use cogl_onscreen_add_swap_complete_callback
- */
-unsigned int
-cogl_onscreen_add_swap_buffers_callback (CoglOnscreen *onscreen,
- CoglSwapBuffersNotify callback,
- void *user_data);
-
-/**
- * cogl_onscreen_remove_swap_buffers_callback:
- * @onscreen: A #CoglOnscreen framebuffer
- * @id: An identifier returned from cogl_onscreen_add_swap_buffers_callback()
- *
- * Removes a callback that was previously registered
- * using cogl_onscreen_add_swap_buffers_callback().
- *
- * Since: 1.10
- * Stability: unstable
- * Deprecated: 1.14: Use cogl_onscreen_remove_swap_complete_callback
- */
-void
-cogl_onscreen_remove_swap_buffers_callback (CoglOnscreen *onscreen,
- unsigned int id);
-
/**
* cogl_onscreen_set_resizable:
* @onscreen: A #CoglOnscreen framebuffer
diff --git a/doc/reference/cogl2/cogl2-sections.txt b/doc/reference/cogl2/cogl2-sections.txt
index 235add3..722677a 100644
--- a/doc/reference/cogl2/cogl2-sections.txt
+++ b/doc/reference/cogl2/cogl2-sections.txt
@@ -551,9 +551,6 @@ cogl_onscreen_hide
cogl_onscreen_swap_buffers
cogl_onscreen_swap_region
cogl_onscreen_set_swap_throttled
-CoglSwapBuffersNotify
-cogl_onscreen_add_swap_buffers_callback
-cogl_onscreen_remove_swap_buffers_callback
</SECTION>
<SECTION>
--
1.8.1.1
More information about the Cogl
mailing list