MCDE dtphoto: the clipboard carries the selection's shape, and Cut

stays inside it

Three faults in Edit, all measured against pixels:

- Copy took the bounding rectangle of the selection, so Paste brought
  back what a lasso had excluded.  The clipboard is now RGB plus one
  coverage byte per pixel (PasteBlend/SelectFromCover), not a pixmap,
  which also blends a feathered edge and keeps both depths identical.
- Cut was MaskClear plus a full XFillRectangle: cutting a lasso wiped
  the whole picture.  It is now Copy followed by PaintMask, which is
  mask-aware.
- Paste Into called PasteFromClip() with no limit and was a second
  Paste; it now clips to the selection's coverage.

And one fault at the root: MaskFromRect() called MaskClear(), which
drops hasSel, after every caller had set hasSel = 1 -- so the marquee
produced a mask nothing believed in.  Copy fell back to the whole
picture, Clear/Fill/Crop ignored the rectangle.  MaskFromRect claims
the selection itself now, and no caller has to remember.

Evidence:
  -cliptest  PASS on depth 24 and depth 8: lasso hole kept through
             Copy/Paste, cut-left/cut-right outside the band intact,
             paste-into limited to the selection, soft paste blends,
             a whole-picture clip stays opaque.
  full run   24 green, 0 red (12 modes x 2 depths)
  mouse      dragged 60x60 box -> "dtphoto: copied 60x60";
             Select > None, same Copy -> "dtphoto: copied 1024x768";
             Edit > Cut -> "copied 60x60" then "cut";
             Edit > Paste Into -> "pasted 60x60 into the selection"
This commit is contained in:
lotherk committed 2026-11-22 16:22:34 +00:00
1 parent 02aa4ce6d4
commit eb35bf6aac
3 files changed
+470 -34

No files matched your search

+17
View File
@@ -535,6 +535,23 @@ Pixel, bei 100 sechs). Per Maus belegt: Optionsbox offen (240x207),
Toleranz 32 -> 100, Bleistiftradius 3 -> 12 zeichnet 7 bzw. 25 Pixel breit.
Alle 18 Tests gruen auf Tiefe 24 und Tiefe 8.
Stand 2026-11-22 (Zwischenablage): Copy, Cut und Paste haben die Form der
Auswahl getragen, nicht ihr Rechteck -- `clipRGB` plus ein Deckungsbyte je
Pixel statt einer Pixmap, damit ein Lasso seine Kontur pastet und eine
weiche Kante mischt. Drei Fehler fielen dabei auf. Copy nahm das Rechteck
um das Lasso, also brachte Paste die Pixel zurueck, die das Lasso
ausgeschlossen hatte. Cut leerte das *ganze* Bild: es war MaskClear plus
ein volles XFillRectangle, ein Lassoschnitt loeschte alles ausserhalb mit.
Paste Into rief `PasteFromClip()` ohne Grenze und war ein zweites Paste.
`-cliptest` prueft alle drei plus das weiche Pasten an exakten Pixeln.
Dazu ein Fehler an der Wurzel: `MaskFromRect` setzt die Auswahl jetzt
selbst. `MaskClear` loescht `hasSel`, und jeder Aufrufer setzte es
*vorher*, also hinterliess das Rechteck eine Maske, an die niemand
glaubte -- Copy fiel auf das ganze Bild zurueck, Clear/Fill/Crop
ignorierten das Marquee. Per Maus belegt: ein gezogener 60x60-Kasten
ergibt `dtphoto: copied 60x60`, nach Select > None dasselbe Copy
`copied 1024x768`.
Stand 2026-11-22 (Formate): Gelesen wurde bisher nur BMP und ICO, geschrieben
nur BMP -- PNG, JPEG und GIF standen seit dem 12.11. als offen in dieser
Datei. Der Leser war schon da: `McdeThumbRead` in libDtSvc kann alle fuenf
+20 -1
View File
@@ -94,7 +94,8 @@ narratives and test notes, is `docs/reference/mcde-agents-history-2026-11-13.txt
Crop drags a rectangle and crops to it on release. Type opens a prompt
and draws one line with the GC font over an undo snapshot.
`dtphoto -movetest|-croptest|-typetest|-selecttest|-retouchtest|-layertest`
are the headless proofs (no display needed beyond Xvfb): exact pixel sets for
`|-cliptest` are the headless proofs (no display needed beyond Xvfb): exact
pixel sets for
wand/inverse/lasso/clear, a 10x10 block moved (10,5) with its mask and a
background hole left behind, a crop to 20x30 that keeps only blue, a
text line with dark pixels and an untouched corner, and all six
@@ -243,6 +244,24 @@ narratives and test notes, is `docs/reference/mcde-agents-history-2026-11-13.txt
its radius entirely (one XDrawPoint). `-optest` proves both: a tip laid
across the edge of a 2 px selection changes only those two columns, and
the wand at tolerance 0 takes one pixel where tolerance 100 takes six.
The clipboard carries the *shape* of the selection, not its bounding
box (2026-11-22): `clipRGB` plus one coverage byte per pixel instead of
a pixmap, so a lasso pastes its outline and a feathered edge blends.
Three faults fell out of that the same day. Copy took the rectangle,
so Paste brought back the pixels the lasso had excluded. Cut cleared
the *whole* picture -- it was MaskClear plus a full XFillRectangle, so
cutting a lasso wiped everything outside it. Paste Into called
PasteFromClip() with no limit and was a second Paste. `-cliptest`
checks all three plus the soft paste against exact pixels, and the
menu path through a mouse: a dragged 60x60 box gives
`dtphoto: copied 60x60`, and after Select > None the same Copy gives
`copied 1024x768`.
`MaskFromRect` claims the selection itself. `MaskClear` drops `hasSel`
and every caller set it *before* the call, so the rectangle produced a
mask nothing believed in: Copy fell back to the whole picture and
Clear/Fill/Crop ignored the marquee. A rectangle put into the mask is
a selection; the function that puts it there says so, and no caller has
to remember.
dtpaint builds its menus in code and its labels are catalogued
(`dtpaint.msg`, 51 messages from 1-53, 52 unused: menus, the
tool/file/error/discard/attributes/colour/print dialogs, Help and About);
+433 -33
View File
@@ -2593,7 +2593,13 @@ MaskAlloc(void)
return 0;
}
/* the rectangle of the marquee, into the mask */
/*
* The rectangle of the marquee, into the mask. Setting the mask means
* there is a selection: MaskClear() below drops hasSel, so putting the
* rectangle back must claim it again -- otherwise Select > All left a
* mask nobody believed in (measured 2026-11-22: Copy took the whole
* picture instead of the dragged box).
*/
static void
MaskFromRect(void)
{
@@ -2605,6 +2611,8 @@ MaskFromRect(void)
for (y = selY0; y < selY1; y++)
for (x = selX0; x < selX1; x++)
MaskSet(x, y, 1);
selMaskAny = (selX1 > selX0 && selY1 > selY0);
hasSel = selMaskAny;
}
/*
* Selection morphology: the distance to the nearest selected and to the
@@ -5161,49 +5169,188 @@ TrapOk(const int *v)
/* --------------------------------------------------- Edit */
/*
* The clipboard is one pixmap plus its size. Cut, Copy and Paste work on
* the selection's rectangle, which is what a desktop's CLIPBOARD has room
* for without a server round trip per pixel.
* The clipboard is RGB plus one coverage byte per pixel, not a pixmap.
* Copy has to keep the *shape* of the selection -- a lasso pastes its
* outline, not the rectangle around it -- and Paste has to blend a
* feathered edge. A pixmap carries neither, and on a PseudoColor screen
* reading it back would be one colour-map lookup per pixel. A clip without
* coverage is opaque.
*/
static Pixmap clipPix = None;
static unsigned char *clipRGB;
static unsigned char *clipCover; /* clipW*clipH, NULL = opaque */
static int clipW, clipH;
static void
ClipFree(void)
{
free(clipRGB);
free(clipCover);
clipRGB = NULL;
clipCover = NULL;
clipW = clipH = 0;
}
/*
* Copy keeps the coverage of every pixel of the selection, so what was
* outside the lasso is not pasted later. Without a selection the whole
* picture is the clip and it is opaque.
*/
static void
CopyToClip(void)
{
int x0 = 0, y0 = 0, w = docW, h = docH;
Patch p;
int shaped = selMaskAny && hasSel;
int x, y;
if (selMaskAny && hasSel) {
x0 = selX0; y0 = selY0;
w = selX1 - selX0;
h = selY1 - selY0;
}
if (w < 1 || h < 1)
if (!shaped) {
if (GetImageRGB(&p.rgb, &p.w, &p.h) != 0)
return;
p.x = p.y = 0;
} else if (ReadPatch(&p, selX0, selY0, selX1 - selX0,
selY1 - selY0) != 0) {
return;
if (clipPix != None)
XFreePixmap(dpy, clipPix);
clipPix = XCreatePixmap(dpy, drawable, (unsigned int) w,
(unsigned int) h, (unsigned int) visdepth);
XCopyArea(dpy, image, clipPix, gc, x0, y0, (unsigned int) w,
(unsigned int) h, 0, 0);
clipW = w;
clipH = h;
fprintf(stderr, "dtphoto: copied %dx%d\n", w, h);
}
if (p.w < 1 || p.h < 1) {
free(p.rgb);
return;
}
ClipFree();
clipRGB = p.rgb;
clipW = p.w;
clipH = p.h;
if (shaped && (clipCover = malloc((size_t) p.w * p.h)) != NULL) {
for (y = 0; y < p.h; y++)
for (x = 0; x < p.w; x++)
clipCover[(size_t) y * p.w + x] =
(unsigned char) MaskCover(p.x + x,
p.y + y);
}
fprintf(stderr, "dtphoto: copied %dx%d\n", p.w, p.h);
}
/*
* Lay the clipboard over the picture at the top-left corner, which is where
* the original drops a paste that has no floating selection to follow the
* pointer. `limit`, when not NULL, is a second coverage in document
* coordinates: that is what makes Paste Into paste *into* the selection
* instead of beside it. The coverage the paste left behind comes back, so
* the caller can make it the new selection.
*/
static unsigned char *
PasteBlend(const unsigned char *limit, int *wP, int *hP)
{
unsigned char *dst, *cov;
int w, h, x, y, c;
if (clipRGB == NULL || clipW < 1 || clipH < 1)
return NULL;
if (GetImageRGB(&dst, &w, &h) != 0)
return NULL;
if ((cov = malloc((size_t) w * h)) == NULL) {
free(dst);
return NULL;
}
for (y = 0; y < h; y++)
for (x = 0; x < w; x++) {
size_t di = (size_t) y * w + x;
unsigned char *s = NULL;
int cv = 0;
if (x < clipW && y < clipH) {
s = clipRGB + ((size_t) y * clipW + x) * 3;
cv = clipCover != NULL ?
clipCover[(size_t) y * clipW + x] : 255;
if (limit != NULL && cv > (int) limit[di])
cv = (int) limit[di];
}
cov[di] = (unsigned char) cv;
if (cv <= 0 || s == NULL)
continue;
for (c = 0; c < 3; c++)
dst[di * 3 + c] = (unsigned char)
((dst[di * 3 + c] * (255 - cv) +
s[c] * cv) / 255);
}
SetImageRGB(dst, w, h);
free(dst);
*wP = w;
*hP = h;
return cov;
}
/*
* What was pasted is what is selected afterwards, as in the original: the
* next correction applies to the pasted shape, and Paste Into narrows the
* old selection to the pixels that actually received a picture.
*/
static void
SelectFromCover(const unsigned char *cov, int w, int h)
{
int x, y, x0 = w, y0 = h, x1 = -1, y1 = -1, soft = 0;
MaskClear();
if (MaskAlloc() != 0)
return;
for (y = 0; y < h; y++)
for (x = 0; x < w; x++) {
int cv = cov[(size_t) y * w + x];
if (cv >= 128) {
MaskSet(x, y, 1);
if (x < x0) x0 = x;
if (y < y0) y0 = y;
if (x > x1) x1 = x;
if (y > y1) y1 = y;
}
if (cv > 0 && cv < 255)
soft = 1;
}
if (x1 < 0)
return;
selX0 = x0;
selY0 = y0;
selX1 = x1 + 1;
selY1 = y1 + 1;
hasSel = 1;
if (!soft)
return;
/* a soft paste keeps its band, so the next step blends the same way */
if ((selCover = malloc((size_t) w * h)) != NULL) {
selCoverSize = (size_t) w * h;
memcpy(selCover, cov, selCoverSize);
}
}
static void
PasteFromClip(void)
PasteFromClip(int into)
{
if (clipPix == None || clipW < 1 || clipH < 1) {
unsigned char *cov, *limit = NULL;
int w = 0, h = 0, x, y;
if (clipRGB == NULL || clipW < 1 || clipH < 1) {
fprintf(stderr, "dtphoto: nothing to paste\n");
return;
}
XCopyArea(dpy, image, snap, gc, 0, 0, docW, docH, 0, 0);
XCopyArea(dpy, clipPix, image, gc, 0, 0,
(unsigned int) (clipW > docW ? docW : clipW),
(unsigned int) (clipH > docH ? docH : clipH), 0, 0);
if (into) {
if ((limit = malloc((size_t) docW * docH)) == NULL)
return;
for (y = 0; y < docH; y++)
for (x = 0; x < docW; x++)
limit[(size_t) y * docW + x] =
(unsigned char) MaskCover(x, y);
}
cov = PasteBlend(limit, &w, &h);
free(limit);
if (cov == NULL) {
RenderDoc(canvas);
return;
}
SelectFromCover(cov, w, h);
free(cov);
RenderDoc(canvas);
fprintf(stderr, "dtphoto: pasted %dx%d\n", clipW, clipH);
fprintf(stderr, "dtphoto: pasted %dx%d%s\n", clipW, clipH,
into ? " into the selection" : "");
}
/* Define Pattern: the selection becomes the fill pattern, kept in a pixmap */
@@ -9656,6 +9803,7 @@ CanvasInput(Widget w, XtPointer cd, XEvent *ev, Boolean *keep)
if (selX0 > selX1) { t = selX0; selX0 = selX1; selX1 = t; }
if (selY0 > selY1) { t = selY0; selY0 = selY1; selY1 = t; }
hasSel = (selX1 > selX0 && selY1 > selY0);
/* MaskFromRect puts hasSel back itself */
if (hasSel)
MaskFromRect();
}
@@ -10922,10 +11070,14 @@ MenuCallback(Widget w, XtPointer data, XtPointer call)
break;
/* Edit: the clipboard and the pattern */
case CMD_CUT:
/*
* Cut is Copy followed by Clear, and Clear already honours the
* selection: cutting a lasso used to wipe the whole picture
* (measured 2026-11-22).
*/
CopyToClip();
MaskClear();
XSetForeground(dpy, gc, bgPixel);
XFillRectangle(dpy, image, gc, 0, 0, docW, docH);
XCopyArea(dpy, image, snap, gc, 0, 0, docW, docH, 0, 0);
PaintMask(bgPixel);
RenderDoc(canvas);
fprintf(stderr, "dtphoto: cut\n");
break;
@@ -10933,7 +11085,7 @@ MenuCallback(Widget w, XtPointer data, XtPointer call)
CopyToClip();
break;
case CMD_PASTE:
PasteFromClip();
PasteFromClip(0);
break;
case CMD_DEFPATTERN:
DefinePattern();
@@ -11061,12 +11213,12 @@ MenuCallback(Widget w, XtPointer data, XtPointer call)
break;
/* Edit */
case CMD_PASTEINTO:
PasteFromClip();
PasteFromClip(1);
OpDone("paste into");
break;
case CMD_PASTELAYER:
LayerNew();
PasteFromClip();
PasteFromClip(0);
OpDone("paste layer");
break;
case CMD_CREATEPUB:
@@ -13265,6 +13417,254 @@ main(int argc, char **argv)
return bad == 0 ? 0 : 1;
}
if (argc >= 2 && strcmp(argv[1], "-cliptest") == 0) {
/*
* The clipboard against exact pixels. Three things the old
* pixmap clipboard got wrong:
*
* - Copy took the rectangle around a lasso, so Paste brought
* back the pixels the lasso had excluded.
* - Cut cleared the whole picture instead of the selection.
* - Paste Into was Paste, it ignored the selection.
*
* The document is 16x8 of three vertical bands (0..4 red,
* 5..10 green, 11..15 blue) so a wrong band is visible at a
* known coordinate.
*/
int w = 16, h = 8, bad = 0, x, y, i;
unsigned char *rgb, *now = NULL;
int nw = 0, nh = 0;
rgb = malloc((size_t) w * h * 3);
if (rgb == NULL) {
printf("dtphoto cliptest: FAIL malloc\n");
return 1;
}
for (y = 0; y < h; y++)
for (x = 0; x < w; x++) {
unsigned char *p = rgb + ((size_t) y * w + x) * 3;
if (x < 5) { p[0] = 200; p[1] = 0; p[2] = 0; }
else if (x < 11) { p[0] = 0; p[1] = 200; p[2] = 0; }
else { p[0] = 0; p[1] = 0; p[2] = 200; }
}
/* load the base picture and forget any selection, but keep the clip */
#define CLIP_RESET() do { \
if (SetImageRGB(rgb, w, h) != 0) { \
printf("dtphoto cliptest: FAIL image\n"); \
free(rgb); return 1; \
} \
MaskClear(); \
} while (0)
/* the same, and throw the clipboard away too */
#define CLIP_LOAD() do { \
CLIP_RESET(); \
ClipFree(); \
} while (0)
/* select the vertical band (x0..x1-1), the whole height */
#define CLIP_BAND(x0, x1) do { \
int bx_, by_; \
if (MaskAlloc() != 0) { \
printf("dtphoto cliptest: FAIL alloc\n"); \
free(rgb); return 1; \
} \
MaskClear(); \
for (by_ = 0; by_ < h; by_++) \
for (bx_ = (x0); bx_ < (x1); bx_++) \
MaskSet(bx_, by_, 1); \
selMaskAny = 1; \
hasSel = 1; \
selX0 = (x0); selY0 = 0; selX1 = (x1); selY1 = h; \
} while (0)
/* one pixel of the picture as it is now, against (r,g,b) */
#define CLIP_PIX(tag, px, py, er, eg, eb) do { \
free(now); now = NULL; \
if (GetImageRGB(&now, &nw, &nh) != 0) { \
printf("dtphoto cliptest: FAIL readback\n"); \
free(rgb); return 1; \
} \
if ((px) < nw && (py) < nh) { \
unsigned char *q = now + ((size_t) (py) * nw + (px)) * 3; \
int ok_ = q[0] == (er) && q[1] == (eg) && q[2] == (eb); \
printf("dtphoto cliptest: %s (%d,%d)=%d,%d,%d want " \
"%d,%d,%d %s\n", tag, px, py, q[0], q[1], q[2], er, eg, \
eb, ok_ ? "ok" : "FAIL"); \
if (!ok_) bad++; \
} else { \
printf("dtphoto cliptest: %s (%d,%d) outside %d " \
"FAIL\n", tag, px, py, nw); \
bad++; \
} \
} while (0)
/* --- 1. Copy of a lasso keeps the shape, not the box ---
* The selection is the green band *except* (7,3): a hole the
* rectangle copy could not have represented. */
CLIP_LOAD();
CLIP_BAND(5, 11);
MaskSet(7, 3, 0);
CopyToClip();
if (clipW != 6 || clipH != 8) {
printf("dtphoto cliptest: clip %dx%d want 6x8 FAIL\n",
clipW, clipH);
bad++;
}
if (clipCover == NULL) {
printf("dtphoto cliptest: clip has no coverage FAIL\n");
bad++;
} else if (clipCover[(size_t) 3 * clipW + 2] != 0) {
printf("dtphoto cliptest: clip hole not kept FAIL\n");
bad++;
}
if (clipCover != NULL && clipCover[0] != 255) {
printf("dtphoto cliptest: clip inside not opaque FAIL\n");
bad++;
}
/* --- 2. Paste puts the shape down, the hole stays ---
* The clip is the green band (6 wide, taken from x=5), so
* after a paste at (0,0) its pixel x is the document's x.
* The mask hole was at the band's x=2, which lands on
* document (2,3): the red base must show through there. */
CLIP_RESET();
CLIP_BAND(5, 11);
MaskSet(7, 3, 0);
CopyToClip();
CLIP_RESET();
PasteFromClip(0);
CLIP_PIX("paste-inside", 0, 3, 0, 200, 0);
CLIP_PIX("paste-hole", 2, 3, 200, 0, 0); /* red stays */
CLIP_PIX("paste-right", 15, 3, 0, 0, 200); /* untouched */
/* --- 3. Cut clears the selection, not the picture ---
* Cut the green band; red and blue must survive. */
CLIP_LOAD();
CLIP_BAND(5, 11);
CopyToClip();
PaintMask(bgPixel);
CLIP_PIX("cut-left", 2, 4, 200, 0, 0);
CLIP_PIX("cut-right", 13, 4, 0, 0, 200);
{
/* inside the cut band the colour must have gone: the
* background is white, so nothing is 0,200,0 there */
free(now); now = NULL;
if (GetImageRGB(&now, &nw, &nh) == 0) {
unsigned char *q =
now + ((size_t) 4 * nw + 8) * 3;
int ok_ = !(q[0] == 0 && q[1] == 200 &&
q[2] == 0);
printf("dtphoto cliptest: cut-inside (8,4)="
"%d,%d,%d cleared %s\n", q[0], q[1], q[2],
ok_ ? "ok" : "FAIL");
if (!ok_) bad++;
}
}
/* --- 4. Paste Into is limited to the selection ---
* Copy the blue band (5 wide, from x=11), then select
* x 0..2 and paste into it. Blue may appear inside that
* narrow selection and nowhere else, so (1,4) turns blue
* while (8,4) stays green. */
CLIP_RESET();
CLIP_BAND(11, 16);
CopyToClip();
CLIP_RESET();
CLIP_BAND(0, 3);
PasteFromClip(1);
{
free(now); now = NULL;
if (GetImageRGB(&now, &nw, &nh) == 0) {
unsigned char *in = now +
((size_t) 4 * nw + 1) * 3;
unsigned char *out = now +
((size_t) 4 * nw + 8) * 3;
/* inside: the clipboard's first pixel, which
* is the blue band */
int okin = in[0] == 0 && in[1] == 0 &&
in[2] == 200;
/* outside the old selection: still green */
int okout = out[0] == 0 && out[1] == 200 &&
out[2] == 0;
printf("dtphoto cliptest: pasteinto-in (1,4)="
"%d,%d,%d %s\n", in[0], in[1], in[2],
okin ? "ok" : "FAIL");
printf("dtphoto cliptest: pasteinto-out (8,4)="
"%d,%d,%d %s\n", out[0], out[1], out[2],
okout ? "ok" : "FAIL");
if (!okin) bad++;
if (!okout) bad++;
}
}
/* --- 5. A feathered clip blends instead of cutting ---
* Copy the red band, lay a uniform green picture underneath,
* paste with a coverage of 128: the result must be half of
* each. A pixel that ignored the coverage would be pure red
* (200,0,0), one that ignored the clipboard pure green
* (0,200,0); an 8-bit screen lands near the middle, not on
* it, so the check is a band around 100. */
CLIP_LOAD();
CLIP_BAND(0, 4);
CopyToClip();
if (clipCover != NULL) {
unsigned char *g = malloc((size_t) w * h * 3);
int ok_ = 0;
if (g != NULL) {
memset(g, 0, (size_t) w * h * 3);
for (i = 0; i < w * h; i++)
g[i * 3 + 1] = 200;
SetImageRGB(g, w, h);
free(g);
}
memset(clipCover, 128, (size_t) clipW * clipH);
PasteFromClip(0);
free(now); now = NULL;
if (GetImageRGB(&now, &nw, &nh) == 0) {
unsigned char *q = now +
((size_t) 4 * nw + 1) * 3;
ok_ = q[0] > 50 && q[0] < 150 &&
q[1] > 50 && q[1] < 150 && q[2] == 0;
printf("dtphoto cliptest: paste-soft (1,4)="
"%d,%d,%d want about 100,100,0 %s\n",
q[0], q[1], q[2], ok_ ? "ok" : "FAIL");
}
if (!ok_)
bad++;
}
/* --- 6. Paste with no selection on either side is opaque --- */
CLIP_RESET();
CopyToClip();
if (clipCover != NULL) {
printf("dtphoto cliptest: whole-picture clip is " \
"shaped FAIL\n");
bad++;
}
if (clipW != w || clipH != h) {
printf("dtphoto cliptest: whole clip %dx%d want %dx%d " \
"FAIL\n", clipW, clipH, w, h);
bad++;
}
#undef CLIP_LOAD
#undef CLIP_BAND
#undef CLIP_PIX
ClipFree();
MaskClear();
free(now);
free(rgb);
printf("dtphoto cliptest: %s\n", bad == 0 ? "PASS" : "FAIL");
return bad == 0 ? 0 : 1;
}
if (argc >= 2 && strcmp(argv[1], "-filtertest") == 0) {
/*
* Every filter family in one pass: a structured picture is