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

Eric Anholt <[email protected]>
Newsgroups gmane.comp.lib.cairo
Message-ID <[email protected]>
On Wed, 4 Apr 2012 19:54:21 +0000, "Henry (Yu) Song - SISA" <[email protected]> wrote:
> commit b9a2f1f4e2fdd3351cea02e8334c2c1cea4f1253
> Author: Henry (Yu) Song <[email protected]>
> 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.

--
cairo mailing list
[email protected]
http://lists.cairographics.org/mailman/listinfo/cairo
signature.asc (application/pgp-signature, 197 B)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.12 (GNU/Linux)

iEYEARECAAYFAk+DTnkACgkQHUdvYGzw6vd5AQCdEmZhzNwaVgKszecbSpU9KUXH
NyIAnj+9YIX48yidnBn2Dyk9r1IDCXdx
=2dmF
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.