diff options
author | Robert Bragg <robert@linux.intel.com> | 2012-09-07 15:26:34 +0100 |
---|---|---|
committer | Robert Bragg <robert@linux.intel.com> | 2012-09-10 13:24:54 +0100 |
commit | 83131072eea395f18ab0525ea2446f443a6033b1 (patch) | |
tree | e111b917557832534ad7cdacb1bdee85741ed87e /cogl/cogl-texture.c | |
parent | 23ce51beba1bb739a224e47614a59327dfbb65af (diff) | |
download | cogl-83131072eea395f18ab0525ea2446f443a6033b1.tar.gz |
texture: Add a context pointer to each texture
As part of our on-going goal to remove our dependence on a global Cogl
context this patch adds a pointer to the context to each CoglTexture
so that the various texture apis no longer need to use
_COGL_GET_CONTEXT.
Reviewed-by: Neil Roberts <neil@linux.intel.com>
Diffstat (limited to 'cogl/cogl-texture.c')
-rw-r--r-- | cogl/cogl-texture.c | 31 |
1 files changed, 15 insertions, 16 deletions
diff --git a/cogl/cogl-texture.c b/cogl/cogl-texture.c index bf579d99..25c52829 100644 --- a/cogl/cogl-texture.c +++ b/cogl/cogl-texture.c @@ -99,8 +99,10 @@ cogl_is_texture (void *object) void _cogl_texture_init (CoglTexture *texture, + CoglContext *context, const CoglTextureVtable *vtable) { + texture->context = context; texture->vtable = vtable; texture->framebuffers = NULL; } @@ -669,10 +671,9 @@ cogl_texture_set_region (CoglTexture *texture, unsigned int rowstride, const uint8_t *data) { + CoglContext *ctx = texture->context; CoglBitmap *source_bmp; - CoglBool ret; - - _COGL_GET_CONTEXT (ctx, FALSE); + CoglBool ret; _COGL_RETURN_VAL_IF_FAIL ((width - src_x) >= dst_width, FALSE); _COGL_RETURN_VAL_IF_FAIL ((height - src_y) >= dst_height, FALSE); @@ -958,13 +959,12 @@ get_texture_bits_via_offscreen (CoglTexture *texture, unsigned int dst_rowstride, CoglPixelFormat dst_format) { + CoglContext *ctx = texture->context; CoglOffscreen *offscreen; CoglFramebuffer *framebuffer; CoglBitmap *bitmap; CoglBool ret; - _COGL_GET_CONTEXT (ctx, FALSE); - if (!cogl_has_feature (ctx, COGL_FEATURE_ID_OFFSCREEN)) return FALSE; @@ -1123,20 +1123,19 @@ cogl_texture_get_data (CoglTexture *texture, unsigned int rowstride, uint8_t *data) { - int bpp; - int byte_size; - CoglPixelFormat closest_format; - GLenum closest_gl_format; - GLenum closest_gl_type; - CoglBitmap *target_bmp; - int tex_width; - int tex_height; - CoglPixelFormat texture_format; + CoglContext *ctx = texture->context; + int bpp; + int byte_size; + CoglPixelFormat closest_format; + GLenum closest_gl_format; + GLenum closest_gl_type; + CoglBitmap *target_bmp; + int tex_width; + int tex_height; + CoglPixelFormat texture_format; CoglTextureGetData tg_data; - _COGL_GET_CONTEXT (ctx, 0); - texture_format = cogl_texture_get_format (texture); /* Default to internal format if none specified */ |