mirror of
https://github.com/brl/mutter.git
synced 2024-12-24 03:52:05 +00:00
onscreen: move swap_buffer apis to onscreen namespace
This moves all the cogl_framebuffer_ apis relating to swap buffer requests into the cogl_onscreen_ namespace since on CoglOnscreen framebuffers have back buffers that can be swapped. Reviewed-by: Neil Roberts <neil@linux.intel.com>
This commit is contained in:
parent
785e6375eb
commit
479c5fd2c9
@ -127,8 +127,9 @@ _cogl_onscreen_free (CoglOnscreen *onscreen)
|
||||
}
|
||||
|
||||
void
|
||||
cogl_framebuffer_swap_buffers (CoglFramebuffer *framebuffer)
|
||||
cogl_onscreen_swap_buffers (CoglOnscreen *onscreen)
|
||||
{
|
||||
CoglFramebuffer *framebuffer = COGL_FRAMEBUFFER (onscreen);
|
||||
const CoglWinsysVtable *winsys;
|
||||
|
||||
_COGL_RETURN_IF_FAIL (framebuffer->type == COGL_FRAMEBUFFER_TYPE_ONSCREEN);
|
||||
@ -144,10 +145,11 @@ cogl_framebuffer_swap_buffers (CoglFramebuffer *framebuffer)
|
||||
}
|
||||
|
||||
void
|
||||
cogl_framebuffer_swap_region (CoglFramebuffer *framebuffer,
|
||||
const int *rectangles,
|
||||
int n_rectangles)
|
||||
cogl_onscreen_swap_region (CoglOnscreen *onscreen,
|
||||
const int *rectangles,
|
||||
int n_rectangles)
|
||||
{
|
||||
CoglFramebuffer *framebuffer = COGL_FRAMEBUFFER (onscreen);
|
||||
const CoglWinsysVtable *winsys;
|
||||
|
||||
_COGL_RETURN_IF_FAIL (framebuffer->type == COGL_FRAMEBUFFER_TYPE_ONSCREEN);
|
||||
@ -254,11 +256,10 @@ cogl_win32_onscreen_get_window (CoglOnscreen *onscreen)
|
||||
#endif /* COGL_HAS_WIN32_SUPPORT */
|
||||
|
||||
unsigned int
|
||||
cogl_framebuffer_add_swap_buffers_callback (CoglFramebuffer *framebuffer,
|
||||
CoglSwapBuffersNotify callback,
|
||||
void *user_data)
|
||||
cogl_onscreen_add_swap_buffers_callback (CoglOnscreen *onscreen,
|
||||
CoglSwapBuffersNotify callback,
|
||||
void *user_data)
|
||||
{
|
||||
CoglOnscreen *onscreen = COGL_ONSCREEN (framebuffer);
|
||||
CoglSwapBuffersNotifyEntry *entry = g_slice_new0 (CoglSwapBuffersNotifyEntry);
|
||||
static int next_swap_buffers_callback_id = 0;
|
||||
|
||||
@ -272,10 +273,9 @@ cogl_framebuffer_add_swap_buffers_callback (CoglFramebuffer *framebuffer,
|
||||
}
|
||||
|
||||
void
|
||||
cogl_framebuffer_remove_swap_buffers_callback (CoglFramebuffer *framebuffer,
|
||||
unsigned int id)
|
||||
cogl_onscreen_remove_swap_buffers_callback (CoglOnscreen *onscreen,
|
||||
unsigned int id)
|
||||
{
|
||||
CoglOnscreen *onscreen = COGL_ONSCREEN (framebuffer);
|
||||
CoglSwapBuffersNotifyEntry *entry;
|
||||
|
||||
COGL_TAILQ_FOREACH (entry, &onscreen->swap_callbacks, list_node)
|
||||
|
@ -3,7 +3,7 @@
|
||||
*
|
||||
* An object oriented GL/GLES Abstraction/Utility Layer
|
||||
*
|
||||
* Copyright (C) 2011 Intel Corporation.
|
||||
* Copyright (C) 2011,2012 Intel Corporation.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
@ -289,10 +289,9 @@ cogl_onscreen_show (CoglOnscreen *onscreen);
|
||||
void
|
||||
cogl_onscreen_hide (CoglOnscreen *onscreen);
|
||||
|
||||
/* XXX: Actually should this be renamed too cogl_onscreen_swap_buffers()? */
|
||||
/**
|
||||
* cogl_framebuffer_swap_buffers:
|
||||
* @framebuffer: A #CoglFramebuffer
|
||||
* cogl_onscreen_swap_buffers:
|
||||
* @onscreen: A #CoglOnscreen framebuffer
|
||||
*
|
||||
* Swaps the current back buffer being rendered too, to the front for display.
|
||||
*
|
||||
@ -302,15 +301,15 @@ cogl_onscreen_hide (CoglOnscreen *onscreen);
|
||||
* start a new frame that incrementally builds on the contents of the previous
|
||||
* frame.
|
||||
*
|
||||
* Since: 1.8
|
||||
* Since: 1.10
|
||||
* Stability: unstable
|
||||
*/
|
||||
void
|
||||
cogl_framebuffer_swap_buffers (CoglFramebuffer *framebuffer);
|
||||
cogl_onscreen_swap_buffers (CoglOnscreen *onscreen);
|
||||
|
||||
/**
|
||||
* cogl_framebuffer_swap_region:
|
||||
* @framebuffer: A #CoglFramebuffer
|
||||
* cogl_onscreen_swap_region:
|
||||
* @onscreen: A #CoglOnscreen framebuffer
|
||||
* @rectangles: An array of integer 4-tuples representing rectangles as
|
||||
* (x, y, width, height) tuples.
|
||||
* @n_rectangles: The number of 4-tuples to be read from @rectangles
|
||||
@ -320,32 +319,32 @@ cogl_framebuffer_swap_buffers (CoglFramebuffer *framebuffer);
|
||||
* defined by 4 sequential (x, y, width, height) integers.
|
||||
*
|
||||
* This function also implicitly discards the contents of the color, depth and
|
||||
* stencil buffers as if cogl_framebuffer_discard_buffers() were used. The
|
||||
* stencil buffers as if cogl_onscreen_discard_buffers() were used. The
|
||||
* significance of the discard is that you should not expect to be able to
|
||||
* start a new frame that incrementally builds on the contents of the previous
|
||||
* frame.
|
||||
*
|
||||
* Since: 1.8
|
||||
* Since: 1.10
|
||||
* Stability: unstable
|
||||
*/
|
||||
void
|
||||
cogl_framebuffer_swap_region (CoglFramebuffer *framebuffer,
|
||||
const int *rectangles,
|
||||
int n_rectangles);
|
||||
cogl_onscreen_swap_region (CoglOnscreen *onscreen,
|
||||
const int *rectangles,
|
||||
int n_rectangles);
|
||||
|
||||
|
||||
typedef void (*CoglSwapBuffersNotify) (CoglFramebuffer *framebuffer,
|
||||
void *user_data);
|
||||
|
||||
/**
|
||||
* cogl_framebuffer_add_swap_buffers_callback:
|
||||
* @framebuffer A #CoglFramebuffer
|
||||
* 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_framebuffer_swap_buffers()) for the given
|
||||
* @framebuffer completes.
|
||||
* 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
|
||||
@ -362,24 +361,24 @@ typedef void (*CoglSwapBuffersNotify) (CoglFramebuffer *framebuffer,
|
||||
* Stability: unstable
|
||||
*/
|
||||
unsigned int
|
||||
cogl_framebuffer_add_swap_buffers_callback (CoglFramebuffer *framebuffer,
|
||||
CoglSwapBuffersNotify callback,
|
||||
void *user_data);
|
||||
cogl_onscreen_add_swap_buffers_callback (CoglOnscreen *onscreen,
|
||||
CoglSwapBuffersNotify callback,
|
||||
void *user_data);
|
||||
|
||||
/**
|
||||
* cogl_framebuffer_remove_swap_buffers_callback:
|
||||
* @framebuffer:
|
||||
* @id: An identifier returned from cogl_framebuffer_add_swap_buffers_callback()
|
||||
* 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_framebuffer_add_swap_buffers_callback().
|
||||
* using cogl_onscreen_add_swap_buffers_callback().
|
||||
*
|
||||
* Since: 1.10
|
||||
* Stability: unstable
|
||||
*/
|
||||
void
|
||||
cogl_framebuffer_remove_swap_buffers_callback (CoglFramebuffer *framebuffer,
|
||||
unsigned int id);
|
||||
cogl_onscreen_remove_swap_buffers_callback (CoglOnscreen *onscreen,
|
||||
unsigned int id);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
|
@ -273,9 +273,9 @@ main (int argc, char **argv)
|
||||
cogl_has_feature (ctx, COGL_FEATURE_ID_SWAP_BUFFERS_EVENT);
|
||||
|
||||
if (has_swap_notify)
|
||||
cogl_framebuffer_add_swap_buffers_callback (fb,
|
||||
swap_notify_cb,
|
||||
&data);
|
||||
cogl_onscreen_add_swap_buffers_callback (COGL_ONSCREEN (fb),
|
||||
swap_notify_cb,
|
||||
&data);
|
||||
|
||||
while (1)
|
||||
{
|
||||
@ -286,7 +286,7 @@ main (int argc, char **argv)
|
||||
if (data.swap_ready)
|
||||
{
|
||||
paint (&data);
|
||||
cogl_framebuffer_swap_buffers (fb);
|
||||
cogl_onscreen_swap_buffers (COGL_ONSCREEN (fb));
|
||||
}
|
||||
|
||||
cogl_poll_get_info (ctx, &poll_fds, &n_poll_fds, &timeout);
|
||||
|
@ -41,7 +41,7 @@ main (int argc, char **argv)
|
||||
|
||||
cogl_framebuffer_clear4f (fb, COGL_BUFFER_BIT_COLOR, 0, 0, 0, 1);
|
||||
cogl_framebuffer_draw_primitive (fb, pipeline, triangle);
|
||||
cogl_framebuffer_swap_buffers (fb);
|
||||
cogl_onscreen_swap_buffers (onscreen);
|
||||
|
||||
cogl_poll_get_info (ctx, &poll_fds, &n_poll_fds, &timeout);
|
||||
g_poll ((GPollFD *) poll_fds, n_poll_fds, 0);
|
||||
|
@ -102,7 +102,7 @@ main (int argc, char **argv)
|
||||
cogl_set_source_texture (tex);
|
||||
cogl_rectangle (0, 1, 1, -1);
|
||||
|
||||
cogl_framebuffer_swap_buffers (fb);
|
||||
cogl_onscreen_swap_buffers (onscreen);
|
||||
|
||||
cogl_poll_get_info (ctx, &poll_fds, &n_poll_fds, &timeout);
|
||||
g_poll ((GPollFD *) poll_fds, n_poll_fds, 0);
|
||||
|
@ -28,7 +28,7 @@ redraw (Data *data)
|
||||
cogl_framebuffer_draw_primitive (fb, data->pipeline, data->triangle);
|
||||
cogl_framebuffer_pop_matrix (fb);
|
||||
|
||||
cogl_framebuffer_swap_buffers (fb);
|
||||
cogl_onscreen_swap_buffers (COGL_ONSCREEN (fb));
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -172,7 +172,7 @@ main (int argc, char **argv)
|
||||
}
|
||||
cogl_framebuffer_clear4f (fb, COGL_BUFFER_BIT_COLOR, 0, 0, 0, 1);
|
||||
cogl_framebuffer_draw_primitive (fb, pipeline, triangle);
|
||||
cogl_framebuffer_swap_buffers (fb);
|
||||
cogl_onscreen_swap_buffers (onscreen);
|
||||
|
||||
cogl_poll_get_info (ctx, &poll_fds, &n_poll_fds, &timeout);
|
||||
g_poll ((GPollFD *) poll_fds, n_poll_fds, 0);
|
||||
|
@ -217,7 +217,7 @@ main (int argc, char **argv)
|
||||
cogl_framebuffer_clear4f (fb, COGL_BUFFER_BIT_COLOR, 0, 0, 0, 1);
|
||||
cogl_set_source_texture (tfp);
|
||||
cogl_rectangle (-0.8, 0.8, 0.8, -0.8);
|
||||
cogl_framebuffer_swap_buffers (fb);
|
||||
cogl_onscreen_swap_buffers (onscreen);
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
@ -527,7 +527,7 @@ paint_cb (void *user_data)
|
||||
cogl_rectangle (-1, 1, 1, -1);
|
||||
}
|
||||
}
|
||||
cogl_framebuffer_swap_buffers (fb);
|
||||
cogl_onscreen_swap_buffers (COGL_ONSCREEN (fb));
|
||||
|
||||
cogl_pop_framebuffer ();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user