Пример #1
0
static void
fbBresFillDash(DrawablePtr pDrawable,
               GCPtr pGC,
               int dashOffset,
               int signdx,
               int signdy,
               int axis, int x1, int y1, int e, int e1, int e3, int len)
{
    FbGCPrivPtr pPriv = fbGetGCPrivate(pGC);

    FbDashDeclare;
    int dashlen;
    Bool even;
    Bool doOdd;
    Bool doBg;
    Pixel fg, bg;

    fg = pGC->fgPixel;
    bg = pGC->bgPixel;

    /* whether to fill the odd dashes */
    doOdd = pGC->lineStyle == LineDoubleDash;
    /* whether to switch fg to bg when filling odd dashes */
    doBg = doOdd && (pGC->fillStyle == FillSolid ||
                     pGC->fillStyle == FillStippled);

    /* compute current dash position */
    FbDashInit(pGC, pPriv, dashOffset, dashlen, even);

    while (len--) {
        if (even || doOdd) {
            if (doBg) {
                if (even)
                    fbSetFg(pDrawable, pGC, fg);
                else
                    fbSetFg(pDrawable, pGC, bg);
            }
            fbFill(pDrawable, pGC, x1, y1, 1, 1);
        }
        if (axis == X_AXIS) {
            x1 += signdx;
            e += e1;
            if (e >= 0) {
                e += e3;
                y1 += signdy;
            }
        }
        else {
            y1 += signdy;
            e += e1;
            if (e >= 0) {
                e += e3;
                x1 += signdx;
            }
        }
        FbDashStep(dashlen, even);
    }
    if (doBg)
        fbSetFg(pDrawable, pGC, fg);
}
Пример #2
0
static void
fbBresFillDash(DrawablePtr drawable,
               GCPtr gc,
               int dashOffset,
               int sdx,
               int sdy,
               int axis, int x1, int y1, int e, int e1, int e3, int len)
{
	FbGCPrivPtr pgc = fb_gc(gc);

	FbDashDeclare;
	int dashlen;
	bool even;
	bool doOdd;
	bool doBg;
	Pixel fg, bg;

	fg = gc->fgPixel;
	bg = gc->bgPixel;

	/* whether to fill the odd dashes */
	doOdd = gc->lineStyle == LineDoubleDash;
	/* whether to switch fg to bg when filling odd dashes */
	doBg = doOdd && (gc->fillStyle == FillSolid ||
			 gc->fillStyle == FillStippled);

	/* compute current dash position */
	FbDashInit(gc, pgc, dashOffset, dashlen, even);

	while (len--) {
		if (even || doOdd) {
			if (doBg) {
				if (even)
					fbSetFg(drawable, gc, fg);
				else
					fbSetFg(drawable, gc, bg);
			}
			fbFill(drawable, gc, x1, y1, 1, 1);
		}
		if (axis == X_AXIS) {
			x1 += sdx;
			e += e1;
			if (e >= 0) {
				e += e3;
				y1 += sdy;
			}
		} else {
			y1 += sdy;
			e += e1;
			if (e >= 0) {
				e += e3;
				x1 += sdx;
			}
		}
		FbDashStep(dashlen, even);
	}
	if (doBg)
		fbSetFg(drawable, gc, fg);
}