static void glyph_iter_fini(struct glyph_iter *gi)
{
	if (gi->out.glyphset)
		XRenderFreeGlyphSet (gi->out.dpy->dpy, gi->out.glyphset);
	if (gi->ref.glyphset)
		XRenderFreeGlyphSet (gi->ref.dpy->dpy, gi->ref.glyphset);

	test_target_destroy_render(gi->out.dpy, &gi->out.tt);
	test_target_destroy_render(gi->ref.dpy, &gi->ref.tt);
}
Exemple #2
0
/** Free \a glyphSet on back-end screen number \a idx. */
Bool dmxBEFreeGlyphSet(ScreenPtr pScreen, GlyphSetPtr glyphSet)
{
    dmxGlyphPrivPtr  glyphPriv = DMX_GET_GLYPH_PRIV(glyphSet);
    int              idx       = pScreen->myNum;
    DMXScreenInfo   *dmxScreen = &dmxScreens[idx];

    if (glyphPriv->glyphSets[idx]) {
	XRenderFreeGlyphSet(dmxScreen->beDisplay, glyphPriv->glyphSets[idx]);
	glyphPriv->glyphSets[idx] = (GlyphSet)0;
	return TRUE;
    }

    return FALSE;
}
static bool glyph_iter_next(struct glyph_iter *gi)
{
restart:
	if (gi->stage == GLYPHS) {
		if (++gi->glyph_format == PictStandardNUM)
			return false;

		if (gi->out.glyphset)
			XRenderFreeGlyphSet(gi->out.dpy->dpy,
					    gi->out.glyphset);
		gi->out.glyphset = create_glyphs(gi->out.dpy->dpy,
					       gi->glyph_format);

		if (gi->ref.glyphset)
			XRenderFreeGlyphSet(gi->ref.dpy->dpy,
					    gi->ref.glyphset);
		gi->ref.glyphset = create_glyphs(gi->ref.dpy->dpy,
					       gi->glyph_format);

		gi->stage++;
	}

	if (gi->stage == OP) {
		do {
			if (++gi->op == 255)
				goto reset_op;
		} while (!check_op(gi->out.dpy, gi->op, &gi->out.tt) ||
			 !check_op(gi->ref.dpy, gi->op, &gi->ref.tt));

		gi->stage++;
	}

	if (gi->stage == DST) {
		if (++gi->dst_color == ARRAY_SIZE(colors))
			goto reset_dst;

		gi->stage++;
	}

	if (gi->stage == SRC) {
		if (++gi->src_color == ARRAY_SIZE(colors))
			goto reset_src;

		if (gi->ref.src)
			XRenderFreePicture(gi->ref.dpy->dpy, gi->ref.src);
		gi->ref.src = XRenderCreateSolidFill(gi->ref.dpy->dpy,
						     &colors[gi->src_color]);

		if (gi->out.src)
			XRenderFreePicture(gi->out.dpy->dpy, gi->out.src);
		gi->out.src = XRenderCreateSolidFill(gi->out.dpy->dpy,
						     &colors[gi->src_color]);

		gi->stage++;
	}

	if (gi->stage == MASK) {
		if (++gi->mask_format > PictStandardNUM)
			goto reset_mask;

		if (gi->mask_format == PictStandardRGB24)
			gi->mask_format++;

		if (gi->mask_format < PictStandardNUM) {
			gi->out.mask_format = XRenderFindStandardFormat(gi->out.dpy->dpy,
									gi->mask_format);
			gi->ref.mask_format = XRenderFindStandardFormat(gi->ref.dpy->dpy,
									gi->mask_format);
		} else {
			gi->out.mask_format = NULL;
			gi->ref.mask_format = NULL;
		}

		gi->stage++;
	}

	if (gi->stage == CLIP) {
		if (++gi->clip == ARRAY_SIZE(clips))
			goto reset_clip;

		gi->stage++;
	}

	gi->stage--;
	return true;

reset_op:
	gi->op = -1;
reset_dst:
	gi->dst_color = -1;
reset_src:
	gi->src_color = -1;
reset_mask:
	gi->mask_format = -1;
reset_clip:
	gi->clip = -1;
	gi->stage--;
	goto restart;
}