From 06e7cf9967135d2938d5a73aafcdb9acca104362 Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Tue, 25 Mar 2014 16:54:40 -0700 Subject: [PATCH 1/9] Set position of the status window based on perf window pos --- x11perf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/x11perf.c b/x11perf.c index e98cca5..708d607 100644 --- a/x11perf.c +++ b/x11perf.c @@ -1303,7 +1303,7 @@ main(int argc, char *argv[]) HSy = HEIGHT-1; if (window_y + 1 + HEIGHT > DisplayHeight(xparms.d, screen)) HSy = DisplayHeight(xparms.d, screen) - (1 + window_y + 1); - status = CreatePerfWindow(&xparms, window_x, HEIGHT+5, WIDTH, 20); + status = CreatePerfWindow(&xparms, window_x, window_y + HEIGHT+3, WIDTH, 20); tgcv.foreground = AllocateColor(xparms.d, "black", BlackPixel(xparms.d, screen)); tgcv.background = -- GitLab From 837d8630895dd22749a915a00a75c80b59ca3e07 Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Mon, 3 Oct 2016 15:12:34 -0700 Subject: [PATCH 2/9] Don't try to make XOR 'look good'. Best to make it visible. Attempts to pick 'good' pixel values to make XOR rendering look decent instead make it invisible on modern TrueColor visuals. Just use the defined fg/bg pixel values, which at least make it appear. Adapt to this change by drawing the lines for the blt tests in copy mode so they appear on the screen. Signed-off-by: Keith Packard --- do_blt.c | 2 ++ x11perf.c | 25 ++++++++----------------- 2 files changed, 10 insertions(+), 17 deletions(-) diff --git a/do_blt.c b/do_blt.c index 3374ca6..fe9d153 100644 --- a/do_blt.c +++ b/do_blt.c @@ -66,7 +66,9 @@ int InitScroll(XParms xp, Parms p, int64_t reps) { InitBltLines(); + XSetFunction(xp->d, xp->fggc, GXcopy); XDrawLines(xp->d, xp->w, xp->fggc, points, NUMPOINTS, CoordModeOrigin); + XSetFunction(xp->d, xp->fggc, xp->func); return reps; } diff --git a/x11perf.c b/x11perf.c index 708d607..21ca6fc 100644 --- a/x11perf.c +++ b/x11perf.c @@ -748,23 +748,14 @@ CreatePerfGCs(XParms xp, int func, unsigned long pm) gcvddfg.function = func; gcvddbg.function = func; - if (func == GXxor) { - /* Make test look good visually if possible */ - gcvbg.foreground = gcvfg.foreground = bg ^ fg; - gcvbg.background = gcvfg.background = bg; - /* Double Dash GCs (This doesn't make a huge amount of sense) */ - gcvddbg.foreground = gcvddfg.foreground = bg ^ fg; - gcvddbg.background = gcvddfg.foreground = bg ^ ddbg; - } else { - gcvfg.foreground = fg; - gcvfg.background = bg; - gcvbg.foreground = bg; - gcvbg.background = fg; - gcvddfg.foreground = fg; - gcvddfg.background = ddbg; - gcvddbg.foreground = ddbg; - gcvddbg.background = fg; - } + gcvfg.foreground = fg; + gcvfg.background = bg; + gcvbg.foreground = bg; + gcvbg.background = fg; + gcvddfg.foreground = fg; + gcvddfg.background = ddbg; + gcvddbg.foreground = ddbg; + gcvddbg.background = fg; xp->fggc = XCreateGC(xp->d, xp->w, GCForeground | GCBackground | GCGraphicsExposures | GCFunction | GCPlaneMask, &gcvfg); -- GitLab From 5eae08fc55f052e6349a28d10f8ffe3e2798504c Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Tue, 25 Mar 2014 16:52:02 -0700 Subject: [PATCH 3/9] Ensure that vertical/horizontal segments do not overlap Some drivers manage to optimize the solid block of segments into a single square fill operation, which is a nifty optimization, but doesn't really measure what we're interested here. Signed-off-by: Keith Packard --- do_segs.c | 129 ++++++++++++++++++++++++----------------------------- do_tests.c | 16 +++---- 2 files changed, 67 insertions(+), 78 deletions(-) diff --git a/do_segs.c b/do_segs.c index 369f784..a67dcee 100644 --- a/do_segs.c +++ b/do_segs.c @@ -3,13 +3,13 @@ Copyright 1988, 1989 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved -Permission to use, copy, modify, and distribute this software and its -documentation for any purpose and without fee is hereby granted, +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that -both that copyright notice and this permission notice appear in +both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the -software without specific, written prior permission. +software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL @@ -26,7 +26,7 @@ SOFTWARE. static XSegment *segments; static GC pgc; -static void +static void GenerateSegments(XParms xp, Parms p, Bool ddashed) { int size; @@ -71,7 +71,7 @@ GenerateSegments(XParms xp, Parms p, Bool ddashed) if (phaseinc == 0) phaseinc = 1; rows = 0; - for (i = 0; i != p->objects; i++) { + for (i = 0; i != p->objects; i++) { switch (phase / size) { case 0: x1 = 0; @@ -81,7 +81,7 @@ GenerateSegments(XParms xp, Parms p, Bool ddashed) break; case 1: - x1 = phase % size; + x1 = phase % size; y1 = 0; x2 = size; y2 = size; @@ -164,15 +164,15 @@ GenerateSegments(XParms xp, Parms p, Bool ddashed) XChangeGC(xp->d, xp->bggc, GCCapStyle, &gcv); } } - -int + +int InitSegments(XParms xp, Parms p, int64_t reps) { GenerateSegments(xp, p, False); return reps; } -int +int InitDashedSegments(XParms xp, Parms p, int64_t reps) { char dashes[2]; @@ -190,7 +190,7 @@ InitDashedSegments(XParms xp, Parms p, int64_t reps) return reps; } -int +int InitDoubleDashedSegments(XParms xp, Parms p, int64_t reps) { char dashes[2]; @@ -208,13 +208,11 @@ InitDoubleDashedSegments(XParms xp, Parms p, int64_t reps) return reps; } -int -InitHorizSegments(XParms xp, Parms p, int64_t reps) +static int +InitHorizSegmentsWidth(XParms xp, Parms p, int64_t reps, int width) { int size; - int half; int i; - int rows; /* Number of rows filled in current column */ int x, y; /* base of square to draw in */ int y1; /* y position inside square */ int inc; @@ -223,39 +221,33 @@ InitHorizSegments(XParms xp, Parms p, int64_t reps) pgc = xp->fggc; size = p->special; - half = (size + 19) / 20; segments = (XSegment *)malloc((p->objects) * sizeof(XSegment)); - x = half; - y = half; + x = width / 2 + 1; + y = width / 2 + 1; y1 = 0; - rows = 0; - inc = size / p->objects; - if (inc == 0) inc = 1; + inc = width + 1; for (i = 0; i != p->objects; i++) { if (i % 2) { segments[i].x1 = x + size; segments[i].x2 = x; - segments[i].y1 = y + size - y1; - segments[i].y2 = y + size - y1; - y1 += inc; - if (y1 >= size) y1 -= size; + segments[i].y1 = y + (HEIGHT - width - 2) - y1; + segments[i].y2 = y + (HEIGHT - width - 2) - y1; + y1 += inc; } else { segments[i].x1 = x; segments[i].x2 = x + size; segments[i].y1 = y + y1; segments[i].y2 = y + y1; } - rows++; - y += size; - if (y >= HEIGHT - size - half || rows == MAXROWS) { - rows = 0; - y = half; - x += size; - if (x >= WIDTH - size - half) - x = half; + /* Go to next row */ + if (y1 >= HEIGHT / 2 - (width + 2)) { + y1 =0; + x += size + inc; + if (x >= WIDTH - size - width) + x = width/2 + 1; } } gcv.cap_style = CapNotLast; @@ -264,14 +256,19 @@ InitHorizSegments(XParms xp, Parms p, int64_t reps) return reps; } -int +int +InitHorizSegments(XParms xp, Parms p, int64_t reps) +{ + return InitHorizSegmentsWidth(xp, p, reps, 1); +} + +int InitWideHorizSegments(XParms xp, Parms p, int64_t reps) { - int size; + int size = p->special; - (void)InitHorizSegments(xp, p, reps); + (void)InitHorizSegmentsWidth(xp, p, reps, (int) ((size + 9) / 10)); - size = p->special; XSetLineAttributes(xp->d, xp->bggc, (int) ((size + 9) / 10), LineSolid, CapRound, JoinRound); XSetLineAttributes(xp->d, xp->fggc, (int) ((size + 9) / 10), @@ -279,15 +276,12 @@ InitWideHorizSegments(XParms xp, Parms p, int64_t reps) return reps; } - -int -InitVertSegments(XParms xp, Parms p, int64_t reps) +static int +InitVertSegmentsWidth(XParms xp, Parms p, int64_t reps, int width) { int size; - int half; int i; - int rows; /* Number of rows filled in current column */ int x, y; /* base of square to draw in */ int x1; /* x position inside square */ int inc; @@ -296,41 +290,33 @@ InitVertSegments(XParms xp, Parms p, int64_t reps) pgc = xp->fggc; size = p->special; - half = (size + 19) / 20; segments = (XSegment *)malloc((p->objects) * sizeof(XSegment)); - x = half; - y = half; + x = width / 2 + 1; + y = width / 2 + 1; x1 = 0; - rows = 0; - inc = size / p->objects; - if (inc == 0) inc = 1; + inc = width + 1; for (i = 0; i != p->objects; i++) { if (i % 2) { - segments[i].x1 = x + size - x1; - segments[i].x2 = x + size - x1; + segments[i].x1 = x + (WIDTH - width - 2) - x1; + segments[i].x2 = x + (WIDTH - width - 2) - x1; segments[i].y1 = y + size; segments[i].y2 = y; - x1 += inc; - if (x1 >= size) x1 -= size; + x1 += inc; } else { segments[i].x1 = x + x1; segments[i].x2 = x + x1; segments[i].y1 = y; segments[i].y2 = y + size; } - rows++; - y += size; - if (y >= HEIGHT - size - half || rows == MAXROWS) { - /* Go to next column */ - rows = 0; - y = half; - x += size; - if (x >= WIDTH - size - half) { - x = half; - } + /* Go to next column */ + if (x1 >= WIDTH / 2 - (width + 2)) { + x1 = 0; + y += size + inc; + if (y >= HEIGHT - size - width) + y = width/2 + 1; } } gcv.cap_style = CapNotLast; @@ -339,14 +325,19 @@ InitVertSegments(XParms xp, Parms p, int64_t reps) return reps; } -int +int +InitVertSegments(XParms xp, Parms p, int64_t reps) +{ + return InitVertSegmentsWidth(xp, p, reps, 1); +} + +int InitWideVertSegments(XParms xp, Parms p, int64_t reps) { - int size; + int size = p->special; - (void)InitVertSegments(xp, p, reps); + (void)InitVertSegmentsWidth(xp, p, reps, (size + 9) / 10); - size = p->special; XSetLineAttributes(xp->d, xp->bggc, (int) ((size + 9) / 10), LineSolid, CapRound, JoinRound); XSetLineAttributes(xp->d, xp->fggc, (int) ((size + 9) / 10), @@ -354,9 +345,8 @@ InitWideVertSegments(XParms xp, Parms p, int64_t reps) return reps; } - -void +void DoSegments(XParms xp, Parms p, int64_t reps) { int i; @@ -375,9 +365,8 @@ DoSegments(XParms xp, Parms p, int64_t reps) } } -void +void EndSegments(XParms xp, Parms p) { free(segments); } - diff --git a/do_tests.c b/do_tests.c index e6ff767..26e2a47 100644 --- a/do_tests.c +++ b/do_tests.c @@ -289,7 +289,7 @@ Test test[] = { {"-hseg500", "500-pixel horizontal line segment", NULL, InitHorizSegments, DoSegments, NullProc, EndSegments, V1_3FEATURE, ROP, 0, - {POLY, 500}}, + {300, 500}}, {"-vseg10", "10-pixel vertical line segment", NULL, InitVertSegments, DoSegments, NullProc, EndSegments, V1_3FEATURE, ROP, 0, @@ -301,31 +301,31 @@ Test test[] = { {"-vseg500", "500-pixel vertical line segment", NULL, InitVertSegments, DoSegments, NullProc, EndSegments, V1_3FEATURE, ROP, 0, - {POLY, 500}}, + {300, 500}}, {"-whseg10", "10x1 wide horizontal line segment", NULL, InitWideHorizSegments, DoSegments, NullProc, EndSegments, V1_3FEATURE, ROP, 0, - {200, 10}}, + {POLY, 10}}, {"-whseg100", "100x10 wide horizontal line segment", NULL, InitWideHorizSegments, DoSegments, NullProc, EndSegments, V1_3FEATURE, ROP, 0, - {100, 100}}, + {270, 100}}, {"-whseg500", "500x50 wide horizontal line segment", NULL, InitWideHorizSegments, DoSegments, NullProc, EndSegments, V1_3FEATURE, ROP, 0, - {50, 500}}, + {10, 500}}, {"-wvseg10", "10x1 wide vertical line segment", NULL, InitWideVertSegments, DoSegments, NullProc, EndSegments, V1_3FEATURE, ROP, 0, - {200, 10}}, + {POLY, 10}}, {"-wvseg100", "100x10 wide vertical line segment", NULL, InitWideVertSegments, DoSegments, NullProc, EndSegments, V1_3FEATURE, ROP, 0, - {100, 100}}, + {270, 100}}, {"-wvseg500", "500x50 wide vertical line segment", NULL, InitWideVertSegments, DoSegments, NullProc, EndSegments, V1_3FEATURE, ROP, 0, - {50, 500}}, + {10, 500}}, {"-line1", "1-pixel line", NULL, InitLines, DoLines, NullProc, EndLines, V1_2FEATURE, ROP, 0, -- GitLab From fbbbda652cc415db2aa3d3a3b07681bcfa2990ff Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Tue, 25 Mar 2014 16:56:29 -0700 Subject: [PATCH 4/9] Ensure that 100x100 rectangles do not overlap This avoids the obvious optimization which catch overlapping rectangles to avoid re-rendering the same pixels. --- do_tests.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/do_tests.c b/do_tests.c index 26e2a47..5dd5e00 100644 --- a/do_tests.c +++ b/do_tests.c @@ -45,7 +45,7 @@ Test test[] = { {"-rect100", "100x100 rectangle", NULL, InitRectangles, DoRectangles, NullProc, EndRectangles, V1_2FEATURE, ROP, 0, - {36, 100, NULL, NULL, FillSolid}}, + {25, 100, NULL, NULL, FillSolid}}, {"-rect500", "500x500 rectangle", NULL, InitRectangles, DoRectangles, NullProc, EndRectangles, V1_2FEATURE, ROP, 0, @@ -64,7 +64,7 @@ Test test[] = { "100x100 stippled rectangle (8x8 stipple)", InitRectangles, DoRectangles, NullProc, EndRectangles, V1_2FEATURE, ROP, 0, - {36, 100, NULL, NULL, FillStippled}}, + {25, 100, NULL, NULL, FillStippled}}, {"-srect500", "500x500 stippled rectangle", "500x500 stippled rectangle (8x8 stipple)", InitRectangles, DoRectangles, NullProc, EndRectangles, @@ -84,7 +84,7 @@ Test test[] = { "100x100 opaque stippled rectangle (8x8 stipple)", InitRectangles, DoRectangles, NullProc, EndRectangles, V1_2FEATURE, ROP, 0, - {36, 100, NULL, NULL, FillOpaqueStippled}}, + {25, 100, NULL, NULL, FillOpaqueStippled}}, {"-osrect500", "500x500 opaque stippled rectangle", "500x500 opaque stippled rectangle (8x8 stipple)", InitRectangles, DoRectangles, NullProc, EndRectangles, @@ -104,7 +104,7 @@ Test test[] = { "100x100 tiled rectangle (4x4 tile)", InitRectangles, DoRectangles, NullProc, EndRectangles, V1_2FEATURE, ROP, 0, - {36, 100, NULL, NULL, FillTiled}}, + {25, 100, NULL, NULL, FillTiled}}, {"-tilerect500", "500x500 4x4 tiled rectangle", "500x500 tiled rectangle (4x4 tile)", InitRectangles, DoRectangles, NullProc, EndRectangles, @@ -121,7 +121,7 @@ Test test[] = { {"-oddsrect100", "100x100 stippled rectangle (17x15 stipple)", NULL, InitRectangles, DoRectangles, NullProc, EndRectangles, V1_4FEATURE, ROP, 0, - {36, 100, "OddTile", NULL, FillStippled}}, + {25, 100, "OddTile", NULL, FillStippled}}, {"-oddsrect500", "500x500 stippled rectangle (17x15 stipple)", NULL, InitRectangles, DoRectangles, NullProc, EndRectangles, V1_4FEATURE, ROP, 0, @@ -137,7 +137,7 @@ Test test[] = { {"-oddosrect100", "100x100 opaque stippled rectangle (17x15 stipple)", NULL, InitRectangles, DoRectangles, NullProc, EndRectangles, V1_4FEATURE, ROP, 0, - {36, 100, "OddTile", NULL, FillOpaqueStippled}}, + {25, 100, "OddTile", NULL, FillOpaqueStippled}}, {"-oddosrect500", "500x500 opaque stippled rectangle (17x15 stipple)", NULL, InitRectangles, DoRectangles, NullProc, EndRectangles, V1_4FEATURE, ROP, 0, @@ -153,7 +153,7 @@ Test test[] = { {"-oddtilerect100", "100x100 tiled rectangle (17x15 tile)", NULL, InitRectangles, DoRectangles, NullProc, EndRectangles, V1_4FEATURE, ROP, 0, - {36, 100, "OddTile", NULL, FillTiled}}, + {25, 100, "OddTile", NULL, FillTiled}}, {"-oddtilerect500", "500x500 tiled rectangle (17x15 tile)", NULL, InitRectangles, DoRectangles, NullProc, EndRectangles, V1_4FEATURE, ROP, 0, @@ -172,7 +172,7 @@ Test test[] = { "100x100 stippled rectangle (161x145 stipple)", InitRectangles, DoRectangles, NullProc, EndRectangles, V1_3FEATURE, ROP, 0, - {36, 100, "mensetmanus", NULL, FillStippled}}, + {25, 100, "mensetmanus", NULL, FillStippled}}, {"-bigsrect500", "500x500 161x145 stippled rectangle", "500x500 stippled rectangle (161x145 stipple)", InitRectangles, DoRectangles, NullProc, EndRectangles, @@ -192,7 +192,7 @@ Test test[] = { "100x100 opaque stippled rectangle (161x145 stipple)", InitRectangles, DoRectangles, NullProc, EndRectangles, V1_3FEATURE, ROP, 0, - {36, 100, "mensetmanus", NULL, FillOpaqueStippled}}, + {25, 100, "mensetmanus", NULL, FillOpaqueStippled}}, {"-bigosrect500", "500x500 161x145 opaque stippled rectangle", "500x500 opaque stippled rectangle (161x145 stipple)", InitRectangles, DoRectangles, NullProc, EndRectangles, @@ -212,7 +212,7 @@ Test test[] = { "100x100 tiled rectangle (161x145 tile)", InitRectangles, DoRectangles, NullProc, EndRectangles, V1_2FEATURE, ROP, 0, - {36, 100, "mensetmanus", NULL, FillTiled}}, + {25, 100, "mensetmanus", NULL, FillTiled}}, {"-bigtilerect500", "500x500 161x145 tiled rectangle", "500x500 tiled rectangle (161x145 tile)", InitRectangles, DoRectangles, NullProc, EndRectangles, @@ -232,7 +232,7 @@ Test test[] = { "100x100 tiled rectangle (216x208 tile)", InitRectangles, DoRectangles, NullProc, EndRectangles, V1_3FEATURE, ROP, 0, - {36, 100, "escherknot", NULL, FillTiled}}, + {25, 100, "escherknot", NULL, FillTiled}}, {"-eschertilerect500", "500x500 216x208 tiled rectangle", "500x500 tiled rectangle (216x208 tile)", InitRectangles, DoRectangles, NullProc, EndRectangles, -- GitLab From 6f3f66f579127e63dd3cd6db1fe9bee2b141a95f Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Tue, 25 Mar 2014 16:59:02 -0700 Subject: [PATCH 5/9] Ensure that 100x100 rectangle outlines do not overlap Signed-off-by: Keith Packard --- do_tests.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/do_tests.c b/do_tests.c index 5dd5e00..d3b5e48 100644 --- a/do_tests.c +++ b/do_tests.c @@ -381,7 +381,7 @@ Test test[] = { {"-orect100", "100x100 rectangle outline", NULL, InitRectangles, DoOutlineRectangles, NullProc, EndRectangles, V1_3FEATURE, ROP, 0, - {36, 100, NULL, "0", FillSolid}}, + {25, 100, NULL, "0", FillSolid}}, {"-orect500", "500x500 rectangle outline", NULL, InitRectangles, DoOutlineRectangles, NullProc, EndRectangles, V1_3FEATURE, ROP, 0, @@ -393,7 +393,7 @@ Test test[] = { {"-worect100", "100x100 wide rectangle outline", NULL, InitRectangles, DoOutlineRectangles, NullProc, EndRectangles, V1_3FEATURE, ROP, 0, - {36, 100, NULL, "10", FillSolid}}, + {25, 100, NULL, "10", FillSolid}}, {"-worect500", "500x500 wide rectangle outline", NULL, InitRectangles, DoOutlineRectangles, NullProc, EndRectangles, V1_3FEATURE, ROP, 0, -- GitLab From 3c1b77b44bc95651824bf60e31cdb04242015b8a Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Tue, 1 Apr 2014 15:37:51 -0700 Subject: [PATCH 6/9] Eliminate overlaps in rects and traps --- do_tests.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/do_tests.c b/do_tests.c index d3b5e48..9952c0a 100644 --- a/do_tests.c +++ b/do_tests.c @@ -783,7 +783,7 @@ Test test[] = { "Fill 100x100 tiled trapezoid (216x208 tile)", InitTrapezoids, DoTrapezoids, NullProc, EndTrapezoids, V1_3FEATURE, ROP, 0, - {36, 100, "escherknot", NULL, FillTiled}}, + {25, 100, "escherknot", NULL, FillTiled}}, {"-eschertiletrap300", "Fill 300x300 tiled trapezoid (216x208 tile)", NULL, InitTrapezoids, DoTrapezoids, NullProc, EndTrapezoids, V1_4FEATURE, ROP, 0, @@ -816,7 +816,7 @@ Test test[] = { {"-aa4trap100", "Fill 100x100 aa trap with 4 bit alpha", NULL, InitFixedTraps, DoFixedTraps, NullProc, EndFixedTraps, V1_5FEATURE, NONROP, 0, - {POLY, 100, "4" }}, + {25, 100, "4" }}, {"-aa4trap300", "Fill 300x300 aa trap with 4 bit alpha", NULL, InitFixedTraps, DoFixedTraps, NullProc, EndFixedTraps, V1_5FEATURE, NONROP, 0, @@ -832,11 +832,11 @@ Test test[] = { {"-aa1trap100", "Fill 100x100 aa trap with 1 bit alpha", NULL, InitFixedTraps, DoFixedTraps, NullProc, EndFixedTraps, V1_5FEATURE, NONROP, 0, - {POLY, 100, "1" }}, + {25, 100, "1" }}, {"-aa1trap300", "Fill 300x300 aa trap with 1 bit alpha", NULL, InitFixedTraps, DoFixedTraps, NullProc, EndFixedTraps, V1_5FEATURE, NONROP, 0, - {POLY, 300, "1" }}, + {2, 300, "1" }}, {"-aatrap2x1", "Fill 2x1 aa trap", NULL, InitFixedTraps, DoFixedTraps, NullProc, EndFixedTraps, @@ -849,11 +849,11 @@ Test test[] = { {"-aatrap2x100", "Fill 2x100 aa trap", NULL, InitFixedTraps, DoFixedTraps, NullProc, EndFixedTraps, V1_5FEATURE, NONROP, 0, - {POLY, 100, "8,2" }}, + {25, 100, "8,2" }}, {"-aatrap2x300", "Fill 2x300 aa trap", NULL, InitFixedTraps, DoFixedTraps, NullProc, EndFixedTraps, V1_5FEATURE, NONROP, 0, - {POLY, 300, "8,2" }}, + {2, 300, "8,2" }}, {"-aatrapezoid1", "Fill 1x1 aa trapezoid", NULL, InitFixedTrapezoids, DoFixedTrapezoids, NullProc, EndFixedTrapezoids, @@ -866,11 +866,11 @@ Test test[] = { {"-aatrapezoid100", "Fill 100x100 aa trapezoid", NULL, InitFixedTrapezoids, DoFixedTrapezoids, NullProc, EndFixedTrapezoids, V1_5FEATURE, NONROP, 0, - {POLY, 100 }}, + {25, 100 }}, {"-aatrapezoid300", "Fill 300x300 aa trapezoid", NULL, InitFixedTrapezoids, DoFixedTrapezoids, NullProc, EndFixedTrapezoids, V1_5FEATURE, NONROP, 0, - {POLY, 300 }}, + {2, 300 }}, {"-addaatrapezoid1", "Fill 1x1 aa pre-added trapezoid", NULL, InitFixedTrapezoids, DoFixedTrapezoids, NullProc, EndFixedTrapezoids, V1_5FEATURE, NONROP, 0, @@ -882,11 +882,11 @@ Test test[] = { {"-addaatrapezoid100", "Fill 100x100 aa pre-added trapezoid", NULL, InitFixedTrapezoids, DoFixedTrapezoids, NullProc, EndFixedTrapezoids, V1_5FEATURE, NONROP, 0, - {POLY, 100, "add" }}, + {25, 100, "add" }}, {"-addaatrapezoid300", "Fill 300x300 aa pre-added trapezoid", NULL, InitFixedTrapezoids, DoFixedTrapezoids, NullProc, EndFixedTrapezoids, V1_5FEATURE, NONROP, 0, - {POLY, 300, "add" }}, + {2, 300, "add" }}, #endif {"-complex10", "Fill 10-pixel/side complex polygon", NULL, InitComplexPoly, DoComplexPoly, NullProc, EndComplexPoly, -- GitLab From 73ec97bffaafe7ef0f864da77cdc7ec1e274eb91 Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Tue, 1 Apr 2014 14:48:42 -0700 Subject: [PATCH 7/9] Make put image tests work with planemasks --- do_blt.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/do_blt.c b/do_blt.c index fe9d153..a67c97c 100644 --- a/do_blt.c +++ b/do_blt.c @@ -210,13 +210,13 @@ InitCopyPix(XParms xp, Parms p, int64_t reps) return reps; } -int -InitGetImage(XParms xp, Parms p, int64_t reps) +static int +InitImage(XParms xp, Parms p, int64_t reps, long pm) { (void) InitCopyWin(xp, p, reps); /* Create image to stuff bits into */ - image = XGetImage(xp->d, xp->w, 0, 0, WIDTH, HEIGHT, xp->planemask, + image = XGetImage(xp->d, xp->w, 0, 0, WIDTH, HEIGHT, pm, p->font==NULL?ZPixmap:XYPixmap); if(image==NULL){ printf("XGetImage failed\n"); @@ -225,10 +225,16 @@ InitGetImage(XParms xp, Parms p, int64_t reps) return reps; } +int +InitGetImage(XParms xp, Parms p, int64_t reps) +{ + return InitImage(xp, p, reps, xp->planemask); +} + int InitPutImage(XParms xp, Parms p, int64_t reps) { - if(!InitGetImage(xp, p, reps))return False; + if(!InitImage(xp, p, reps, 0xffffffff))return False; XClearWindow(xp->d, xp->w); return reps; } @@ -374,7 +380,7 @@ InitShmImage(XParms xp, Parms p, int64_t reps, Bool read_only) { int image_size; - if(!InitGetImage(xp, p, reps))return False; + if(!InitImage(xp, p, reps, 0xffffffff))return False; if (!XShmQueryExtension(xp->d)) { /* * Clean up here because cleanup function is not called if this -- GitLab From 3022ef3047851dd9e55bc339c639d2ad9295aa4b Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Mon, 3 Oct 2016 15:09:20 -0700 Subject: [PATCH 8/9] Add xybitmap putimage tests Signed-off-by: Keith Packard --- do_blt.c | 32 +++++++++++++++++++++++++++++--- do_tests.c | 24 ++++++++++++++++++++++++ 2 files changed, 53 insertions(+), 3 deletions(-) diff --git a/do_blt.c b/do_blt.c index a67c97c..591d09e 100644 --- a/do_blt.c +++ b/do_blt.c @@ -217,11 +217,37 @@ InitImage(XParms xp, Parms p, int64_t reps, long pm) /* Create image to stuff bits into */ image = XGetImage(xp->d, xp->w, 0, 0, WIDTH, HEIGHT, pm, - p->font==NULL?ZPixmap:XYPixmap); + p->font==NULL ? ZPixmap : (strcmp(p->font, "XY") == 0? XYPixmap : ZPixmap)); if(image==NULL){ printf("XGetImage failed\n"); return False; - } + } + if (p->font && !strcmp(p->font, "XYBitmap")) { + int bytes_per_line = (WIDTH + 31) / 8; + char *data = malloc (bytes_per_line * HEIGHT); + XImage *new = XCreateImage(xp->d, xp->vinfo.visual, 1, XYBitmap, 0, + data, WIDTH, HEIGHT, 32, bytes_per_line); + int x, y; + unsigned long zero_pixel; + int has_zero = 0; + + for (y = 0; y < HEIGHT; y++) + for (x = 0; x < WIDTH; x++) { + unsigned long src_pixel = XGetPixel(image, x, y); + unsigned long dst_pixel = 0; + if (!has_zero) { + zero_pixel = src_pixel; + has_zero = 1; + } + if (src_pixel == zero_pixel) + dst_pixel = 0; + else + dst_pixel = 1; + XPutPixel(new, x, y, dst_pixel); + } + XDestroyImage(image); + image = new; + } return reps; } @@ -396,7 +422,7 @@ InitShmImage(XParms xp, Parms p, int64_t reps, Bool read_only) shm_image = *image; image_size = image->bytes_per_line * image->height; /* allow XYPixmap choice: */ - if(p->font)image_size *= xp->vinfo.depth; + if(p->font && strcmp(p->font, "XYBitmap") != 0) image_size *= xp->vinfo.depth; shm_info.shmid = shmget(IPC_PRIVATE, image_size, IPC_CREAT|0777); if (shm_info.shmid < 0) { diff --git a/do_tests.c b/do_tests.c index 9952c0a..481fd3f 100644 --- a/do_tests.c +++ b/do_tests.c @@ -1185,6 +1185,18 @@ Test test[] = { InitPutImage, DoPutImage, MidCopyPix, EndGetImage, V1_4FEATURE, ROP, 0, {4, 500, "XY"}}, + {"-putimagexybitmap10", "PutImage XYBitmap 10x10 square", NULL, + InitPutImage, DoPutImage, MidCopyPix, EndGetImage, + V1_4FEATURE, ROP, 0, + {4, 10, "XYBitmap"}}, + {"-putimagexybitmap100", "PutImage XYBitmap 100x100 square", NULL, + InitPutImage, DoPutImage, MidCopyPix, EndGetImage, + V1_4FEATURE, ROP, 0, + {4, 100, "XYBitmap"}}, + {"-putimagexybitmap500", "PutImage XYBitmap 500x500 square", NULL, + InitPutImage, DoPutImage, MidCopyPix, EndGetImage, + V1_4FEATURE, ROP, 0, + {4, 500, "XYBitmap"}}, #ifdef MITSHM {"-shmput10", "ShmPutImage 10x10 square", NULL, InitShmPutImage, DoShmPutImage, MidCopyPix, EndShmPutImage, @@ -1210,6 +1222,18 @@ Test test[] = { InitShmPutImage, DoShmPutImage, MidCopyPix, EndShmPutImage, V1_4FEATURE, ROP, 0, {4, 500, "XY"}}, + {"-shmputxybitmap10", "ShmPutImage XYBitmap 10x10 square", NULL, + InitShmPutImage, DoShmPutImage, MidCopyPix, EndShmPutImage, + V1_4FEATURE, ROP, 0, + {4, 10, "XYBitmap"}}, + {"-shmputxybitmap100", "ShmPutImage XYBitmap 100x100 square", NULL, + InitShmPutImage, DoShmPutImage, MidCopyPix, EndShmPutImage, + V1_4FEATURE, ROP, 0, + {4, 100, "XYBitmap"}}, + {"-shmputxybitmap500", "ShmPutImage XYBitmap 500x500 square", NULL, + InitShmPutImage, DoShmPutImage, MidCopyPix, EndShmPutImage, + V1_4FEATURE, ROP, 0, + {4, 500, "XYBitmap"}}, {"-shmget10", "ShmGetImage 10x10 square", NULL, InitShmGetImage, DoShmGetImage, NullProc, EndShmGetImage, V1_2FEATURE, ROP, 0, -- GitLab From bf4fcd83eeddcc805ed705d931d431b42eed5567 Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Tue, 1 Apr 2014 15:38:22 -0700 Subject: [PATCH 9/9] Add tiled text test --- do_tests.c | 4 ++++ do_text.c | 3 +++ 2 files changed, 7 insertions(+) diff --git a/do_tests.c b/do_tests.c index 481fd3f..715728e 100644 --- a/do_tests.c +++ b/do_tests.c @@ -924,6 +924,10 @@ Test test[] = { InitText, DoText, ClearTextWin, EndText, V1_2FEATURE, ROP, 0, {80, False, "6x13", NULL}}, + {"-tileftext","Char in 80-char line (6x13)", NULL, + InitText, DoText, ClearTextWin, EndText, + V1_2FEATURE, ROP, 0, + {80, False, "6x13", NULL, FillTiled}}, {"-f8text", "Char in 70-char line (8x13)", NULL, InitText, DoText, ClearTextWin, EndText, V1_3FEATURE, ROP, 0, diff --git a/do_text.c b/do_text.c index 01845e1..7b6600e 100644 --- a/do_text.c +++ b/do_text.c @@ -23,6 +23,7 @@ SOFTWARE. #include "x11perf.h" #include +#include "bitmaps.h" static char **charBuf; static XFontStruct *font, *bfont; @@ -67,6 +68,8 @@ InitText(XParms xp, Parms p, int64_t reps) XChangeGC(xp->d, xp->fggc, GCFont, &gcv); XChangeGC(xp->d, xp->bggc, GCFont, &gcv); + SetFillStyle(xp, p); + charsPerLine = p->objects; charsPerLine = (charsPerLine + 3) & ~3; p->objects = charsPerLine; -- GitLab