[cairo] [patch] gl: use a shared mask surface for text rendering via mask

Eric Anholt eric at anholt.net
Mon Apr 9 14:02:49 PDT 2012


On Wed, 4 Apr 2012 19:54:21 +0000, "Henry (Yu) Song - SISA" <hsong at sisa.samsung.com> wrote:
> commit b9a2f1f4e2fdd3351cea02e8334c2c1cea4f1253
> Author: Henry (Yu) Song <hsong at sisa.samsung.com>
> Date:   Wed Apr 4 11:20:44 2012 -0700
> 
>     gl:  use a shared mask surface for text rendering via mask case.  This
>     reduces time to create mask surface on the fly
>      /* XXX: For non-CA, this should be CAIRO_CONTENT_ALPHA to save memory */

> -    mask = cairo_gl_surface_create (dst->base.device,
> -                                    CAIRO_CONTENT_COLOR_ALPHA,
> -                                    info->extents.width,
> -                                    info->extents.height);
> -    if (unlikely (mask->status))
> -        return mask->status;
> -
> -    status = render_glyphs ((cairo_gl_surface_t *) mask,
> +    width = info->extents.width;
> +    height = info->extents.height;
> +
> +    if (ctx->mask && 
> +        (((cairo_gl_surface_t *)ctx->mask)->width < info->extents.width ||
> +	((cairo_gl_surface_t *)ctx->mask)->height < info->extents.height)){
> +
> +	if (((cairo_gl_surface_t *)ctx->mask)->width > width)
> +	    width = ((cairo_gl_surface_t *)ctx->mask)->width;
> +	else if (((cairo_gl_surface_t *)ctx->mask)->height > height)
> +	    height = ((cairo_gl_surface_t *)ctx->mask)->height;
> +
> +	cairo_surface_destroy (ctx->mask);
> +	ctx->mask = NULL;
> +    }

This would look a lot nicer I think if ctx->mask was just stored as a
cairo_gl_surface_t.  If not, just make a temporary variable.

You've also got a lot of trailing whitespace.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: not available
URL: <http://lists.cairographics.org/archives/cairo/attachments/20120409/2cdd38fe/attachment.pgp>


More information about the cairo mailing list