Beispiel #1
0
cairo_int_status_t
_cairo_gl_composite_glyphs (void			*_dst,
			    cairo_operator_t		 op,
			    cairo_surface_t		*_src,
			    int				 src_x,
			    int				 src_y,
			    int				 dst_x,
			    int				 dst_y,
			    cairo_composite_glyphs_info_t *info)
{
    cairo_gl_surface_t *dst = _dst;
    cairo_bool_t has_component_alpha;
    int i;

    TRACE ((stderr, "%s\n", __FUNCTION__));

    /* If any of the glyphs are component alpha, we have to go through a mask,
     * since only _cairo_gl_surface_composite() currently supports component
     * alpha.
     */
    if (!dst->base.is_clear && ! info->use_mask && op != CAIRO_OPERATOR_OVER) {
	for (i = 0; i < info->num_glyphs; i++) {
	    cairo_scaled_glyph_t *scaled_glyph;

	    if (_cairo_scaled_glyph_lookup (info->font, info->glyphs[i].index,
					    CAIRO_SCALED_GLYPH_INFO_SURFACE,
					    &scaled_glyph) == CAIRO_INT_STATUS_SUCCESS &&
		scaled_glyph->surface->format == CAIRO_FORMAT_ARGB32)
	    {
		info->use_mask = TRUE;
		break;
	    }
	}
    }

    if (info->use_mask) {
	return render_glyphs_via_mask (dst, dst_x, dst_y,
				       op, _src, info);
    } else {
	return render_glyphs (dst, dst_x, dst_y,
			      op, _src, info,
			      &has_component_alpha);
    }
}
Beispiel #2
0
cairo_int_status_t
_cairo_gl_composite_glyphs_with_clip (void			    *_dst,
				      cairo_operator_t		     op,
				      cairo_surface_t		    *_src,
				      int			     src_x,
				      int			     src_y,
				      int			     dst_x,
				      int			     dst_y,
				      cairo_composite_glyphs_info_t *info,
				      cairo_clip_t		     *clip,
				      cairo_bool_t		     via_msaa_compositor)
{
    cairo_gl_surface_t *dst = _dst;
    cairo_bool_t has_component_alpha;

    TRACE ((stderr, "%s\n", __FUNCTION__));

    /* If any of the glyphs require component alpha, we have to go through
     * a mask, since only _cairo_gl_surface_composite() currently supports
     * component alpha.
     */
    if (!dst->base.is_clear && ! info->use_mask && op != CAIRO_OPERATOR_OVER &&
	(info->font->options.antialias == CAIRO_ANTIALIAS_SUBPIXEL ||
	 info->font->options.antialias == CAIRO_ANTIALIAS_BEST))
    {
	info->use_mask = TRUE;
    }

    if (info->use_mask) {
	return render_glyphs_via_mask (dst, dst_x, dst_y,
					   op, _src, info, clip,
					   via_msaa_compositor);
    } else {
	return render_glyphs (dst, dst_x, dst_y,
			      op, _src, info,
			      &has_component_alpha,
			      clip,
			      via_msaa_compositor);
     }

}