[cogl/wip/cogl-1.14-fixes: 1/2] offscreen: Allocate the framebuffer in cogl_offscreen_new_to_texture_full



commit ac413ad1ee5a1c1fb04386339d06e05bc01a9636
Author: Adel Gadllah <adel gadllah gmail com>
Date:   Wed Jul 3 18:51:53 2013 +0200

    offscreen: Allocate the framebuffer in cogl_offscreen_new_to_texture_full
    
    The API says that it should return NULL on failure but it does not do that
    due to the lazy allocation.
    
    Reviewed-by: Robert Bragg <robert linux intel com>
    
    https://bugzilla.gnome.org/show_bug.cgi?id=703174

 cogl/cogl-framebuffer.c |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)
---
diff --git a/cogl/cogl-framebuffer.c b/cogl/cogl-framebuffer.c
index 136ae86..c3e1fb7 100644
--- a/cogl/cogl-framebuffer.c
+++ b/cogl/cogl-framebuffer.c
@@ -615,6 +615,7 @@ _cogl_offscreen_new_to_texture_full (CoglTexture *texture,
   int level_width;
   int level_height;
   CoglOffscreen *ret;
+  CoglError *error = NULL;
 
   _COGL_RETURN_VAL_IF_FAIL (cogl_is_texture (texture), NULL);
   _COGL_RETURN_VAL_IF_FAIL (level < _cogl_texture_get_n_levels (texture),
@@ -646,6 +647,13 @@ _cogl_offscreen_new_to_texture_full (CoglTexture *texture,
 
   _cogl_texture_associate_framebuffer (texture, fb);
 
+  if (!cogl_framebuffer_allocate (ret, &error))
+    {
+      cogl_object_unref (offscreen);
+      cogl_error_free (error);
+      ret = NULL;
+    }
+
   return ret;
 }
 


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