1
0
Fork 0

mir: only allow to set foreign surfaces with hardware buffer

And return a CoglBool accordingly.
This commit is contained in:
Marco Trevisan (Treviño) 2014-11-20 07:18:26 +01:00
parent 8e6997db44
commit 77e28d4a77
2 changed files with 12 additions and 4 deletions

View file

@ -282,10 +282,12 @@ cogl_mir_onscreen_get_surface (CoglOnscreen *onscreen);
*
* This function must be called before @onscreen is allocated.
*
* Returns: whether @surface has been marked as been set as surface or not.
*
* Since: 1.18
* Stability: unstable
*/
void
CoglBool
cogl_mir_onscreen_set_foreign_surface (CoglOnscreen *onscreen,
struct MirSurface *surface);
#endif /* COGL_HAS_EGL_PLATFORM_MIR_SUPPORT */

View file

@ -658,17 +658,23 @@ cogl_mir_renderer_get_connection (CoglRenderer *renderer)
return NULL;
}
void
CoglBool
cogl_mir_onscreen_set_foreign_surface (CoglOnscreen *onscreen,
MirSurface *surface)
{
CoglFramebuffer *fb;
_COGL_RETURN_IF_FAIL (mir_surface_is_valid (surface));
MirSurfaceParameters parameters;
_COGL_RETURN_VAL_IF_FAIL (mir_surface_is_valid (surface), FALSE);
fb = COGL_FRAMEBUFFER (onscreen);
_COGL_RETURN_IF_FAIL (!fb->allocated);
_COGL_RETURN_VAL_IF_FAIL (!fb->allocated, FALSE);
mir_surface_get_parameters (surface, &parameters);
_COGL_RETURN_VAL_IF_FAIL (parameters.buffer_usage == mir_buffer_usage_hardware, FALSE);
onscreen->foreign_surface = surface;
return TRUE;
}
MirSurface *