[cogl/cogl-1.18] mir: don't always allocate when getting the mir surface



commit 2872695fa7d8f29386f6461277cc2d9e9f700b53
Author: Marco Trevisan (TreviƱo) <mail 3v1n0 net>
Date:   Tue Dec 9 22:01:32 2014 +0100

    mir: don't always allocate when getting the mir surface
    
    Add proper documentation on header file

 cogl/cogl-onscreen.h              |   13 +++++++++++++
 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 98b89d2..481664e 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 e7bbfde..6c0dbe3 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;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]