diff options
author | David Reveman <davidr@novell.com> | 2004-04-28 02:14:23 +0000 |
---|---|---|
committer | David Reveman <davidr@novell.com> | 2004-04-28 02:14:23 +0000 |
commit | 09698566e1b238830eca1085a65f6292195805a9 (patch) | |
tree | a7992918877bf3cb5073f5cf3fb470f8439ca2b9 | |
parent | 37f6590708061a79f1b3b34efe550935b3a03d8c (diff) |
Support compositing with mask surface when mask is solid or multi-texturing is available
-rw-r--r-- | ChangeLog | 8 | ||||
-rw-r--r-- | src/cairo_gl_surface.c | 17 |
2 files changed, 20 insertions, 5 deletions
@@ -1,3 +1,11 @@ +2004-04-28 David Reveman <c99drn@cs.umu.se> + + * src/cairo_gl_surface.c: Added CAIRO_GL_MULTITEXTURE_SUPPORT and + CAIRO_GL_SURFACE_IS_SOLID macros. + (_cairo_gl_surface_get_image): Simpler way for calculating rowstride. + (_cairo_gl_surface_composite): Support compositing with mask surface + when mask is solid or multi-texturing is available. + 2004-04-25 David Reveman <c99drn@cs.umu.se> * src/cairo_gl_surface.c (_cairo_gl_surface_set_clip_region): diff --git a/src/cairo_gl_surface.c b/src/cairo_gl_surface.c index c8e2230f..5abca93a 100644 --- a/src/cairo_gl_surface.c +++ b/src/cairo_gl_surface.c @@ -71,6 +71,9 @@ struct cairo_gl_surface { glitz_surface_t *surface; }; +#define CAIRO_GL_MULTITEXTURE_SUPPORT(surface) \ + (surface->features & GLITZ_FEATURE_ARB_MULTITEXTURE_MASK) + #define CAIRO_GL_OFFSCREEN_SUPPORT(surface) \ (surface->features & GLITZ_FEATURE_OFFSCREEN_DRAWING_MASK) @@ -94,6 +97,10 @@ struct cairo_gl_surface { #define CAIRO_GL_SURFACE_IS_OFFSCREEN(surface) \ (surface->hints & GLITZ_HINT_OFFSCREEN_MASK) +#define CAIRO_GL_SURFACE_IS_SOLID(surface) \ + ((surface->hints & GLITZ_HINT_PROGRAMMATIC_MASK) && \ + (surface->pattern.type == CAIRO_PATTERN_SOLID)) + static void _cairo_gl_surface_destroy (void *abstract_surface) { @@ -130,8 +137,7 @@ _cairo_gl_surface_get_image (void *abstract_surface) width = glitz_surface_get_width (surface->surface); height = glitz_surface_get_height (surface->surface); - rowstride = width * (surface->format->bpp / 8); - rowstride += (rowstride % 4) ? (4 - (rowstride % 4)) : 0; + rowstride = (width * (surface->format->bpp / 8) + 3) & -4; pixels = (char *) malloc (sizeof (char) * height * rowstride); @@ -392,10 +398,11 @@ _cairo_gl_surface_composite (cairo_operator_t operator, (!CAIRO_GL_OFFSCREEN_SUPPORT (dst))) return CAIRO_INT_STATUS_UNSUPPORTED; - /* Fragment program or offscreen drawing required for composite with - mask. */ + /* We need multi-texturing or offscreen drawing when compositing with + non-solid mask. */ if (mask && - (!CAIRO_GL_FRAGMENT_PROGRAM_SUPPORT (dst)) && + (!CAIRO_GL_SURFACE_IS_SOLID (mask)) && + (!CAIRO_GL_MULTITEXTURE_SUPPORT (dst)) && (!CAIRO_GL_OFFSCREEN_SUPPORT (dst))) return CAIRO_INT_STATUS_UNSUPPORTED; |