diff options
author | Marco Trevisan (Treviño) <mail@3v1n0.net> | 2014-12-09 22:01:32 +0100 |
---|---|---|
committer | Marco Trevisan (Treviño) <mail@3v1n0.net> | 2014-12-09 22:01:32 +0100 |
commit | 2872695fa7d8f29386f6461277cc2d9e9f700b53 (patch) | |
tree | aa594366ad8d5ea7b2fdf413d83edc4117c07d0f | |
parent | 7c71a06936f846c0edc8d982ea765b775a292080 (diff) |
mir: don't always allocate when getting the mir surface
Add proper documentation on header file
-rw-r--r-- | cogl/cogl-onscreen.h | 13 | ||||
-rw-r--r-- | cogl/winsys/cogl-winsys-egl-mir.c | 4 |
2 files changed, 16 insertions, 1 deletions
diff --git a/cogl/cogl-onscreen.h b/cogl/cogl-onscreen.h index 98b89d22..481664e0 100644 --- a/cogl/cogl-onscreen.h +++ b/cogl/cogl-onscreen.h @@ -268,6 +268,19 @@ cogl_wayland_onscreen_resize (CoglOnscreen *onscreen, #endif /* COGL_HAS_EGL_PLATFORM_WAYLAND_SUPPORT */ #if defined (COGL_HAS_EGL_PLATFORM_MIR_SUPPORT) +/** + * cogl_mir_onscreen_get_surface: + * @onscreen: A #CoglOnscreen framebuffer + * + * Allows you to get the internal #MirSurface linked to the given @onscreen. + * This function might return %NULL if the @onscreen has not been allocated + * (see cogl_framebuffer_allocate() for more details) + * + * Returns: (transfer none): a #MirSurface or %NULL. + * + * Since: 1.18 + * Stability: unstable + */ struct MirSurface * cogl_mir_onscreen_get_surface (CoglOnscreen *onscreen); diff --git a/cogl/winsys/cogl-winsys-egl-mir.c b/cogl/winsys/cogl-winsys-egl-mir.c index e7bbfde5..6c0dbe3c 100644 --- a/cogl/winsys/cogl-winsys-egl-mir.c +++ b/cogl/winsys/cogl-winsys-egl-mir.c @@ -744,7 +744,9 @@ cogl_mir_onscreen_get_surface (CoglOnscreen *onscreen) CoglOnscreenMir *mir_onscreen; _COGL_RETURN_VAL_IF_FAIL (cogl_is_onscreen (onscreen), NULL); - cogl_framebuffer_allocate (COGL_FRAMEBUFFER (onscreen), NULL); + + if (!COGL_FRAMEBUFFER (onscreen)->allocated) + return NULL; egl_onscreen = onscreen->winsys; mir_onscreen = egl_onscreen->platform; |