enlarge yout glitcher

This commit is contained in:
le vieux
2020-11-10 14:00:22 +01:00
parent 3706ad4d98
commit 954de623ab
3 changed files with 19 additions and 11 deletions

View File

@@ -10,12 +10,12 @@
extern int verbosity;
/* -------------------------------------------------------------- */
int kill_a_random_line(FloatImg *pvictime, float fval, int notused)
int kill_a_random_line(FloatImg *pvictime, float fval, int bits)
{
int line, xpos, offset;
#if DEBUG_LEVEL
fprintf(stderr, ">>> %s ( %p %d )\n", __func__, pvictime, notused);
fprintf(stderr, ">>> %s ( %p %d )\n", __func__, pvictime, bits);
#endif
line = rand() % pvictime->height;
@@ -27,9 +27,12 @@ if (verbosity > 1) {
offset = pvictime->width * line;
for (xpos=0; xpos<pvictime->width; xpos++) {
pvictime->R[offset+xpos] = fval;
pvictime->G[offset+xpos] = 0.0;
pvictime->B[offset+xpos] = fval;
if (bits & 1) pvictime->R[offset+xpos] = fval;
else pvictime->R[offset+xpos] = 0.0;
if (bits & 2) pvictime->G[offset+xpos] = fval;
else pvictime->G[offset+xpos] = 0.0;
if (bits & 4) pvictime->B[offset+xpos] = fval;
else pvictime->B[offset+xpos] = 0.0;
}
return 0;
@@ -41,7 +44,7 @@ int idx, foo;
/* Frag the pixels */
for (idx=0; idx<number; idx++) {
foo = kill_a_random_line(who, fval, 0);
foo = kill_a_random_line(who, fval, rand() & 0x0f);
if (foo) abort();
}