simplification

This commit is contained in:
tth 2019-08-27 16:21:40 +02:00
parent e10f26df53
commit 1c47b50954

25
essai.c
View File

@ -13,29 +13,6 @@
int verbosity; int verbosity;
/* --------------------------------------------------------------------- */
int add(FloatImg *a, FloatImg *b)
{
int x, y;
int offset;
double tb;
fimg_timer_set(0);
for (x=0; x<a->width; x++) {
for (y=0; y<a->height; y++) {
offset = x + (y * a->width);
a->R[offset] += b->R[offset];
a->G[offset] += b->G[offset];
a->B[offset] += b->B[offset];
}
}
tb = fimg_timer_get(0);
fprintf(stderr, "%s = %f seconds\n", __func__, tb);
return 0;
}
/* --------------------------------------------------------------------- */ /* --------------------------------------------------------------------- */
void fait_un_dessin(char *fname) void fait_un_dessin(char *fname)
{ {
@ -107,7 +84,7 @@ fimg_create(&fimgB, W, H, 3);
fimg_timer_set(0); fimg_timer_set(0);
fimg_drand48(&fimgB, 100.0); fimg_drand48(&fimgB, 100.0);
fimg_drand48(&fimgA, 100.0); fimg_drand48(&fimgA, 100.0);
add(&fimgA, &fimgB); fimg_add(&fimgA, &fimgB, &fimgA);
tb = fimg_timer_get(0); tb = fimg_timer_get(0);
fprintf(stderr, "%s = %f seconds\n", __func__, tb); fprintf(stderr, "%s = %f seconds\n", __func__, tb);
foo = fimg_save_as_pnm(&fimgA, "drand48.pnm", 0); foo = fimg_save_as_pnm(&fimgA, "drand48.pnm", 0);