[cogl] context: Simplify _cogl_context_get_default



commit 157631a194663cb3d1e1a580a6604e0643a2a049
Author: Robert Bragg <robert linux intel com>
Date:   Mon Sep 10 11:03:11 2012 +0100

    context: Simplify _cogl_context_get_default
    
    Since the 2.0 api requires developers to explicitly create a CoglContext
    we no longer need to be able to create a context lazily in
    _cogl_context_get_default() so the function can simply be reduced to an
    assertion that a context has been created and return the file scope
    _cogl_context pointer.
    
    Reviewed-by: Neil Roberts <neil linux intel com>

 cogl/cogl-context.c |   14 +-------------
 1 files changed, 1 insertions(+), 13 deletions(-)
---
diff --git a/cogl/cogl-context.c b/cogl/cogl-context.c
index b032ef4..19e23c6 100644
--- a/cogl/cogl-context.c
+++ b/cogl/cogl-context.c
@@ -527,19 +527,7 @@ _cogl_context_free (CoglContext *context)
 CoglContext *
 _cogl_context_get_default (void)
 {
-  CoglError *error = NULL;
-  /* Create if doesn't exist yet */
-  if (_cogl_context == NULL)
-    {
-      _cogl_context = cogl_context_new (NULL, &error);
-      if (!_cogl_context)
-        {
-          g_warning ("Failed to create default context: %s",
-                     error->message);
-          cogl_error_free (error);
-        }
-    }
-
+  _COGL_RETURN_VAL_IF_FAIL (_cogl_context != NULL, NULL);
   return _cogl_context;
 }
 



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