[cogl/wip/cogl-1.14: 31/50] blit: avoid using _COGL_GET_CONTEXT



commit 871a262ab1a1055c8243ec972fd93bf50e2034ba
Author: Robert Bragg <robert linux intel com>
Date:   Tue Sep 18 11:59:21 2012 +0100

    blit: avoid using _COGL_GET_CONTEXT
    
    As part of an on-going effort to avoid depending on a global Cogl
    context cogl-blit.c now finds the context by looking at
    data->src_text->context instead of using the _COGL_GET_CONTEXT macro.
    
    Reviewed-by: Neil Roberts <neil linux intel com>
    
    (cherry picked from commit 3f2c99150494efc04487d0dbd17980bac20e4485)

 cogl/cogl-blit.c |   11 ++++-------
 1 files changed, 4 insertions(+), 7 deletions(-)
---
diff --git a/cogl/cogl-blit.c b/cogl/cogl-blit.c
index 2f84973..6e6ca88 100644
--- a/cogl/cogl-blit.c
+++ b/cogl/cogl-blit.c
@@ -34,6 +34,7 @@
 #include "cogl-blit.h"
 #include "cogl-context-private.h"
 #include "cogl-framebuffer-private.h"
+#include "cogl-texture-private.h"
 #include "cogl-texture-2d-private.h"
 #include "cogl-private.h"
 #include "cogl1-context.h"
@@ -43,13 +44,12 @@ static const CoglBlitMode *_cogl_blit_default_mode = NULL;
 static CoglBool
 _cogl_blit_texture_render_begin (CoglBlitData *data)
 {
+  CoglContext *ctx = data->src_tex->context;
   CoglOffscreen *offscreen;
   CoglFramebuffer *fb;
   CoglPipeline *pipeline;
   unsigned int dst_width, dst_height;
 
-  _COGL_GET_CONTEXT (ctx, FALSE);
-
   offscreen = _cogl_offscreen_new_to_texture_full
     (data->dst_tex, COGL_OFFSCREEN_DISABLE_DEPTH_AND_STENCIL, 0 /* level */);
 
@@ -125,7 +125,7 @@ _cogl_blit_texture_render_blit (CoglBlitData *data,
 static void
 _cogl_blit_texture_render_end (CoglBlitData *data)
 {
-  _COGL_GET_CONTEXT (ctx, NO_RETVAL);
+  CoglContext *ctx = data->src_tex->context;
 
   cogl_pop_source ();
   cogl_pop_framebuffer ();
@@ -145,11 +145,10 @@ _cogl_blit_texture_render_end (CoglBlitData *data)
 static CoglBool
 _cogl_blit_framebuffer_begin (CoglBlitData *data)
 {
+  CoglContext *ctx = data->src_tex->context;
   CoglOffscreen *dst_offscreen = NULL, *src_offscreen = NULL;
   CoglFramebuffer *dst_fb, *src_fb;
 
-  _COGL_GET_CONTEXT (ctx, FALSE);
-
   /* We can only blit between FBOs if both textures are the same
      format and the blit framebuffer extension is supported */
   if ((cogl_texture_get_format (data->src_tex) & ~COGL_A_BIT) !=
@@ -218,8 +217,6 @@ _cogl_blit_copy_tex_sub_image_begin (CoglBlitData *data)
   CoglOffscreen *offscreen;
   CoglFramebuffer *fb;
 
-  _COGL_GET_CONTEXT (ctx, FALSE);
-
   /* This will only work if the target texture is a CoglTexture2D */
   if (!cogl_is_texture_2d (data->dst_tex))
     return FALSE;



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