From 3d9f83019d22dcc27b51535ba58aa15c0e1c1041 Mon Sep 17 00:00:00 2001 From: Ivan Leben Date: Mon, 19 May 2008 15:21:56 +0000 Subject: [PATCH] * clutter/cogl/gles/cogl-texture.c: (cogl_texture_download_from_gl:) Store old blending factors and restore them when done. The lack of ability to retrieve the alpha channel now more noticable in test-cogl-tex-getset since the edges of the hand are not antialiased. * clutter/cogl/gl(es)/cogl-internal.h: Declare cogl_blend_func to avoid "implicit implementation" compile warning. --- ChangeLog | 12 ++++++++++++ clutter/cogl/gl/cogl-internal.h | 4 ++++ clutter/cogl/gles/cogl-internal.h | 4 ++++ clutter/cogl/gles/cogl-texture.c | 11 +++++++++-- 4 files changed, 29 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 847c8ccbf..4e986d6ef 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,15 @@ +2008-05-19 Ivan Leben + + * clutter/cogl/gles/cogl-texture.c: + (cogl_texture_download_from_gl:) Store old blending factors + and restore them when done. The lack of ability to retrieve + the alpha channel now more noticable in test-cogl-tex-getset + since the edges of the hand are not antialiased. + + * clutter/cogl/gl(es)/cogl-internal.h: Declare + cogl_blend_func to avoid "implicit implementation" compile + warning. + 2008-05-19 Ivan Leben * clutter/cogl/gl(es)/cogl.c: New internal function diff --git a/clutter/cogl/gl/cogl-internal.h b/clutter/cogl/gl/cogl-internal.h index 1f6b8639e..20f4996af 100644 --- a/clutter/cogl/gl/cogl-internal.h +++ b/clutter/cogl/gl/cogl-internal.h @@ -58,4 +58,8 @@ cogl_enable (gulong flags); gulong cogl_get_enable (); +void +cogl_blend_func (COGLenum src_factor, + COGLenum dst_factor); + #endif /* __COGL_INTERNAL_H */ diff --git a/clutter/cogl/gles/cogl-internal.h b/clutter/cogl/gles/cogl-internal.h index 69baa4a9a..819ec0d60 100644 --- a/clutter/cogl/gles/cogl-internal.h +++ b/clutter/cogl/gles/cogl-internal.h @@ -60,4 +60,8 @@ cogl_enable (gulong flags); gulong cogl_get_enable (); +void +cogl_blend_func (COGLenum src_factor, + COGLenum dst_factor); + #endif /* __COGL_INTERNAL_H */ diff --git a/clutter/cogl/gles/cogl-texture.c b/clutter/cogl/gles/cogl-texture.c index 992f1b6d6..07a736c2c 100644 --- a/clutter/cogl/gles/cogl-texture.c +++ b/clutter/cogl/gles/cogl-texture.c @@ -255,6 +255,10 @@ _cogl_texture_download_from_gl (CoglTexture *tex, ClutterFixed tx1, ty1; ClutterFixed tx2, ty2; int bw, bh; + COGLenum old_src_factor; + COGLenum old_dst_factor; + + _COGL_GET_CONTEXT (ctx, FALSE); handle = _cogl_texture_handle_from_pointer (tex); bpp = _cogl_get_format_bpp (COGL_PIXEL_FORMAT_RGBA_8888); @@ -286,6 +290,10 @@ _cogl_texture_download_from_gl (CoglTexture *tex, /* Draw to all channels */ cogl_draw_buffer (COGL_WINDOW_BUFFER | COGL_MASK_BUFFER, 0); + /* Store old blending factors and setup direct copy operation */ + old_src_factor = ctx->blend_src_factor; + old_dst_factor = ctx->blend_dst_factor; + cogl_blend_func (CGL_ONE, CGL_ZERO); /* If whole image fits into the viewport and target buffer has got no special rowstride, we can do it in one pass */ @@ -297,7 +305,6 @@ _cogl_texture_download_from_gl (CoglTexture *tex, for direct copy to framebuffer */ cogl_paint_init (&cback); cogl_color (&cwhite); - cogl_blend_func (CGL_ONE, CGL_ZERO); /* Draw the texture image */ cogl_texture_rectangle (handle, @@ -350,7 +357,6 @@ _cogl_texture_download_from_gl (CoglTexture *tex, for direct copy to framebuffer */ cogl_paint_init (&cback); cogl_color (&cwhite); - cogl_blend_func (CGL_ONE, CGL_ZERO); /* Draw a portion of texture */ cogl_texture_rectangle (handle, @@ -397,6 +403,7 @@ _cogl_texture_download_from_gl (CoglTexture *tex, glPopMatrix (); cogl_draw_buffer (COGL_WINDOW_BUFFER, 0); + cogl_blend_func (old_src_factor, old_dst_factor); return TRUE; }