diff options
author | Alexander Gottwald <alexander.gottwald@s1999.tu-chemnitz.de> | 2004-09-15 16:34:16 +0000 |
---|---|---|
committer | Alexander Gottwald <alexander.gottwald@s1999.tu-chemnitz.de> | 2004-09-15 16:34:16 +0000 |
commit | 80ab2f34b4e4808cc2501e9d4505b12c9cd1bd5b (patch) | |
tree | 14096776c3344427af6cae30ec4e88dcb931da68 | |
parent | bafb10922ea0221400d832f95eaa0142baf8586d (diff) |
Pull XORG-6_8_0 to CYGWIN branchCYGWIN-6_8_2-MERGECYGWIN-6_8_1-MERGECYGWIN-6_8_0-MERGE
-rw-r--r-- | do_tests.c | 82 | ||||
-rw-r--r-- | do_traps.c | 164 | ||||
-rw-r--r-- | x11perf.h | 3 |
3 files changed, 234 insertions, 15 deletions
@@ -791,35 +791,101 @@ Test test[] = { V1_4FEATURE, ROP, 0, {2, 300, "escherknot", NULL, FillTiled}}, #ifdef XRENDER - {"-aatrap1", "Fill 1x1 aa trapezoid", NULL, + {"-aatrap1", "Fill 1x1 aa trap", NULL, + InitFixedTraps, DoFixedTraps, NullProc, EndFixedTraps, + V1_5FEATURE, NONROP, 0, + {POLY, 1 }}, + {"-aatrap10", "Fill 10x10 aa trap", NULL, + InitFixedTraps, DoFixedTraps, NullProc, EndFixedTraps, + V1_5FEATURE, NONROP, 0, + {POLY, 10 }}, + {"-aatrap100", "Fill 100x100 aa trap", NULL, + InitFixedTraps, DoFixedTraps, NullProc, EndFixedTraps, + V1_5FEATURE, NONROP, 0, + {POLY, 100 }}, + {"-aatrap300", "Fill 300x300 aa trap", NULL, + InitFixedTraps, DoFixedTraps, NullProc, EndFixedTraps, + V1_5FEATURE, NONROP, 0, + {POLY, 300 }}, + {"-aa4trap1", "Fill 1x1 aa trap with 4 bit alpha", NULL, + InitFixedTraps, DoFixedTraps, NullProc, EndFixedTraps, + V1_5FEATURE, NONROP, 0, + {POLY, 1, "4" }}, + {"-aa4trap10", "Fill 10x10 aa trap with 4 bit alpha", NULL, + InitFixedTraps, DoFixedTraps, NullProc, EndFixedTraps, + V1_5FEATURE, NONROP, 0, + {POLY, 10, "4" }}, + {"-aa4trap100", "Fill 100x100 aa trap with 4 bit alpha", NULL, + InitFixedTraps, DoFixedTraps, NullProc, EndFixedTraps, + V1_5FEATURE, NONROP, 0, + {POLY, 100, "4" }}, + {"-aa4trap300", "Fill 300x300 aa trap with 4 bit alpha", NULL, + InitFixedTraps, DoFixedTraps, NullProc, EndFixedTraps, + V1_5FEATURE, NONROP, 0, + {POLY, 300, "4" }}, + {"-aa1trap1", "Fill 1x1 aa trap with 1 bit alpha", NULL, + InitFixedTraps, DoFixedTraps, NullProc, EndFixedTraps, + V1_5FEATURE, NONROP, 0, + {POLY, 1, "1" }}, + {"-aa1trap10", "Fill 10x10 aa trap with 1 bit alpha", NULL, + InitFixedTraps, DoFixedTraps, NullProc, EndFixedTraps, + V1_5FEATURE, NONROP, 0, + {POLY, 10, "1" }}, + {"-aa1trap100", "Fill 100x100 aa trap with 1 bit alpha", NULL, + InitFixedTraps, DoFixedTraps, NullProc, EndFixedTraps, + V1_5FEATURE, NONROP, 0, + {POLY, 100, "1" }}, + {"-aa1trap300", "Fill 300x300 aa trap with 1 bit alpha", NULL, + InitFixedTraps, DoFixedTraps, NullProc, EndFixedTraps, + V1_5FEATURE, NONROP, 0, + {POLY, 300, "1" }}, + + {"-aatrap2x1", "Fill 2x1 aa trap", NULL, + InitFixedTraps, DoFixedTraps, NullProc, EndFixedTraps, + V1_5FEATURE, NONROP, 0, + {POLY, 1, "8,2" }}, + {"-aatrap2x10", "Fill 2x10 aa trap", NULL, + InitFixedTraps, DoFixedTraps, NullProc, EndFixedTraps, + V1_5FEATURE, NONROP, 0, + {POLY, 10, "8,2" }}, + {"-aatrap2x100", "Fill 2x100 aa trap", NULL, + InitFixedTraps, DoFixedTraps, NullProc, EndFixedTraps, + V1_5FEATURE, NONROP, 0, + {POLY, 100, "8,2" }}, + {"-aatrap2x300", "Fill 2x300 aa trap", NULL, + InitFixedTraps, DoFixedTraps, NullProc, EndFixedTraps, + V1_5FEATURE, NONROP, 0, + {POLY, 300, "8,2" }}, + + {"-aatrapezoid1", "Fill 1x1 aa trapezoid", NULL, InitFixedTrapezoids, DoFixedTrapezoids, NullProc, EndFixedTrapezoids, V1_5FEATURE, NONROP, 0, {POLY, 1 }}, - {"-aatrap10", "Fill 10x10 aa trapezoid", NULL, + {"-aatrapezoid10", "Fill 10x10 aa trapezoid", NULL, InitFixedTrapezoids, DoFixedTrapezoids, NullProc, EndFixedTrapezoids, V1_5FEATURE, NONROP, 0, {POLY, 10 }}, - {"-aatrap100", "Fill 100x100 aa trapezoid", NULL, + {"-aatrapezoid100", "Fill 100x100 aa trapezoid", NULL, InitFixedTrapezoids, DoFixedTrapezoids, NullProc, EndFixedTrapezoids, V1_5FEATURE, NONROP, 0, {POLY, 100 }}, - {"-aatrap300", "Fill 300x300 aa trapezoid", NULL, + {"-aatrapezoid300", "Fill 300x300 aa trapezoid", NULL, InitFixedTrapezoids, DoFixedTrapezoids, NullProc, EndFixedTrapezoids, V1_5FEATURE, NONROP, 0, {POLY, 300 }}, - {"-addaatrap1", "Fill 1x1 aa pre-added trapezoid", NULL, + {"-addaatrapezoid1", "Fill 1x1 aa pre-added trapezoid", NULL, InitFixedTrapezoids, DoFixedTrapezoids, NullProc, EndFixedTrapezoids, V1_5FEATURE, NONROP, 0, {POLY, 1, "add" }}, - {"-addaatrap10", "Fill 10x10 aa pre-added trapezoid", NULL, + {"-addaatrapezoid10", "Fill 10x10 aa pre-added trapezoid", NULL, InitFixedTrapezoids, DoFixedTrapezoids, NullProc, EndFixedTrapezoids, V1_5FEATURE, NONROP, 0, {POLY, 10, "add" }}, - {"-addaatrap100", "Fill 100x100 aa pre-added trapezoid", NULL, + {"-addaatrapezoid100", "Fill 100x100 aa pre-added trapezoid", NULL, InitFixedTrapezoids, DoFixedTrapezoids, NullProc, EndFixedTrapezoids, V1_5FEATURE, NONROP, 0, {POLY, 100, "add" }}, - {"-addaatrap300", "Fill 300x300 aa pre-added trapezoid", NULL, + {"-addaatrapezoid300", "Fill 300x300 aa pre-added trapezoid", NULL, InitFixedTrapezoids, DoFixedTrapezoids, NullProc, EndFixedTrapezoids, V1_5FEATURE, NONROP, 0, {POLY, 300, "add" }}, @@ -110,10 +110,160 @@ EndTrapezoids(XParms xp, Parms p) #include <X11/extensions/Xrender.h> #include <X11/Xft/Xft.h> -static XTrapezoid *traps; -static XftDraw *aadraw; -static XftColor aablack, aawhite; +static XTrap *traps; +static XTrapezoid *trapezoids; +static XftDraw *aadraw; +static XftColor aablack, aawhite; +static XRenderColor transparent = { 0, 0, 0, 0 }; static XRenderPictFormat *maskFormat; +static Pixmap maskPixmap; +static Picture mask; + +int +InitFixedTraps(XParms xp, Parms p, int reps) +{ + int i, numTraps; + int rows; + int x, y; + int size, skew; + XTrap *curTrap; + XRenderColor color; + int major, minor; + int depth; + int width; + int std_fmt; + + XRenderQueryVersion (xp->d, &major, &minor); + if (major == 0 && minor < 9) + return 0; + + pgc = xp->fggc; + + size = p->special; + numTraps = p->objects; + traps = (XTrap *)malloc(numTraps * sizeof(XTrap)); + curTrap = traps; + x = size; + y = 0; + rows = 0; + skew = size; + aadraw = XftDrawCreate (xp->d, xp->w, + xp->vinfo.visual, + xp->cmap); + + depth = 0; + width = 0; + if (p->font) + sscanf (p->font, "%d,%d", &depth, &width); + + switch (depth) { + case 8: + default: + depth = 8; + std_fmt = PictStandardA8; + break; + case 4: + std_fmt = PictStandardA4; + break; + case 1: + std_fmt = PictStandardA1; + break; + } + maskFormat = XRenderFindStandardFormat (xp->d, std_fmt); + + maskPixmap = XCreatePixmap (xp->d, xp->w, WIDTH, HEIGHT, depth); + + mask = XRenderCreatePicture (xp->d, maskPixmap, maskFormat, 0, 0); + + color.red = 0; + color.green = 0; + color.blue = 0; + color.alpha = 0xffff; + if (!XftColorAllocValue (xp->d, + xp->vinfo.visual, + xp->cmap, + &color, &aablack)) + { + XftDrawDestroy (aadraw); + aadraw = 0; + return 0; + } + color.red = 0xffff; + color.green = 0xffff; + color.blue = 0xffff; + color.alpha = 0xffff; + if (!XftColorAllocValue (xp->d, + xp->vinfo.visual, + xp->cmap, + &color, &aawhite)) + { + XftDrawDestroy (aadraw); + aadraw = 0; + return 0; + } + + if (width == 0) + width = size; + for (i = 0; i != p->objects; i++, curTrap ++) { + curTrap->top.y = XDoubleToFixed (y); + curTrap->top.left = XDoubleToFixed (x - skew); + curTrap->top.right = XDoubleToFixed (x - skew + width); + curTrap->bottom.y = XDoubleToFixed (y + size); + curTrap->bottom.left = XDoubleToFixed (x + skew - width); + curTrap->bottom.right = XDoubleToFixed (x + skew); + + skew--; + if (skew < 0) skew = size; + + y += size; + rows++; + if (y + size > HEIGHT || rows == MAXROWS) { + rows = 0; + y = 0; + x += 2 * size; + if (x + size > WIDTH) { + x = size; + } + } + } + + SetFillStyle(xp, p); + return reps; +} + +void +DoFixedTraps(XParms xp, Parms p, int reps) +{ + int i; + Picture white, black, src, dst; + + white = XftDrawSrcPicture (aadraw, &aawhite); + black = XftDrawSrcPicture (aadraw, &aablack); + dst = XftDrawPicture (aadraw); + + src = black; + for (i = 0; i != reps; i++) { + XRenderFillRectangle (xp->d, PictOpSrc, mask, &transparent, + 0, 0, WIDTH, HEIGHT); + XRenderAddTraps (xp->d, mask, 0, 0, traps, p->objects); + XRenderComposite (xp->d, PictOpOver, src, mask, dst, + 0, 0, 0, 0, 0, 0, WIDTH, HEIGHT); + if (src == black) + src = white; + else + src = black; + CheckAbort (); + } +} + +void +EndFixedTraps (XParms xp, Parms p) +{ + free (traps); + XftDrawDestroy (aadraw); + XRenderFreePicture (xp->d, mask); + XFreePixmap (xp->d, maskPixmap); +} int InitFixedTrapezoids(XParms xp, Parms p, int reps) @@ -129,8 +279,8 @@ InitFixedTrapezoids(XParms xp, Parms p, int reps) size = p->special; numTraps = p->objects; - traps = (XTrapezoid *)malloc(numTraps * sizeof(XTrapezoid)); - curTrap = traps; + trapezoids = (XTrapezoid *)malloc(numTraps * sizeof(XTrapezoid)); + curTrap = trapezoids; x = size; y = 0; rows = 0; @@ -228,7 +378,7 @@ DoFixedTrapezoids(XParms xp, Parms p, int reps) src = black; for (i = 0; i != reps; i++) { XRenderCompositeTrapezoids (xp->d, PictOpOver, src, dst, maskFormat, - 0, 0, traps, p->objects); + 0, 0, trapezoids, p->objects); if (src == black) src = white; else @@ -240,7 +390,7 @@ DoFixedTrapezoids(XParms xp, Parms p, int reps) void EndFixedTrapezoids (XParms xp, Parms p) { - free (traps); + free (trapezoids); XftDrawDestroy (aadraw); } @@ -263,6 +263,9 @@ extern int InitTrapezoids ( XParms xp, Parms p, int reps ); extern void DoTrapezoids ( XParms xp, Parms p, int reps ); extern void EndTrapezoids ( XParms xp, Parms p ); #ifdef XRENDER +extern int InitFixedTraps ( XParms xp, Parms p, int reps ); +extern void DoFixedTraps ( XParms xp, Parms p, int reps ); +extern void EndFixedTraps ( XParms xp, Parms p ); extern int InitFixedTrapezoids ( XParms xp, Parms p, int reps ); extern void DoFixedTrapezoids ( XParms xp, Parms p, int reps ); extern void EndFixedTrapezoids ( XParms xp, Parms p ); |