diff options
author | kraxel <kraxel> | 2006-08-13 17:53:48 +0000 |
---|---|---|
committer | kraxel <kraxel> | 2006-08-13 17:53:48 +0000 |
commit | 3e07a22545ccf71b2bdd755b9f308ae52eac334c (patch) | |
tree | a87f481dacfcf3561f0f5b14cbdff09e2c3f8204 | |
parent | ea123857b645bacb2c3832e2a39326b3afe3c70d (diff) | |
download | fbida-3e07a22545ccf71b2bdd755b9f308ae52eac334c.tar.gz |
performance tweaks
-rw-r--r-- | fb-gui.c | 8 | ||||
-rw-r--r-- | fbi.c | 37 |
2 files changed, 29 insertions, 16 deletions
@@ -350,8 +350,10 @@ void shadow_merge_rgbdata(int x, int y, int pixels, int weight, unsigned char *dest = shadow[y] + 3*x; int i = 3*pixels; + weight = weight * 256 / 100; + while (i-- > 0) - *(dest++) += *(rgb++) * weight / 100; + *(dest++) += *(rgb++) * weight >> 8; sdirty[y]++; } @@ -376,13 +378,15 @@ void shadow_darkify(int x1, int x2, int y1,int y2, int percent) if (y2 >= sheight) y2 = sheight; + percent = percent * 256 / 100; + for (y = y1; y <= y2; y++) { sdirty[y]++; ptr = shadow[y]; ptr += 3*x1; x = 3*(x2-x1+1); while (x-- > 0) { - *ptr = *ptr * percent / 100; + *ptr = (*ptr * percent) >> 8; ptr++; } } @@ -142,6 +142,8 @@ int preserve; int read_ahead; int editable; int once; +int blending_msecs = 1000; +int perfmon = 1; /* font handling */ static char *fontname = NULL; @@ -744,21 +746,18 @@ static float auto_scale(struct ida_image *img) static void effect_blend(struct flist *f, struct flist *t) { - static int duration = 300; /* msecs */ struct timeval start, now; int msecs, weight = 0; - -#if 0 char linebuffer[80]; int pos = 0; -#endif + int count = 0; gettimeofday(&start, NULL); do { gettimeofday(&now, NULL); msecs = (now.tv_sec - start.tv_sec) * 1000; msecs += (now.tv_usec - start.tv_usec) / 1000; - weight = msecs * 100 / duration; + weight = msecs * 100 / blending_msecs; if (weight > 100) weight = 100; shadow_draw_image(flist_img_get(f), f->left, f->top, @@ -766,18 +765,27 @@ static void effect_blend(struct flist *f, struct flist *t) shadow_draw_image(flist_img_get(t), t->left, t->top, 0, fb_var.yres-1, weight); -#if 0 - pos += snprintf(linebuffer+pos, sizeof(linebuffer)-pos, - " %d%%", weight); - status_update(linebuffer, NULL); -#endif + if (perfmon) { + pos += snprintf(linebuffer+pos, sizeof(linebuffer)-pos, + " %d%%", weight); + status_update(linebuffer, NULL); + count++; + } shadow_render(); } while (weight < 100); -#if 0 - sleep(1); -#endif + if (perfmon) { + gettimeofday(&now, NULL); + msecs = (now.tv_sec - start.tv_sec) * 1000; + msecs += (now.tv_usec - start.tv_usec) / 1000; + pos += snprintf(linebuffer+pos, sizeof(linebuffer)-pos, + " | %d/%d -> %d msec", + msecs, count, msecs/count); + status_update(linebuffer, NULL); + shadow_render(); + sleep(2); + } } static int @@ -819,7 +827,8 @@ svga_show(struct flist *f, struct flist *prev, if (f->left + fb_var.xres > img->i.width) f->left = img->i.width - fb_var.xres; } - if (prev && prev != f) { + if (blending_msecs && prev && prev != f && + flist_img_get(prev) && flist_img_get(f)) { effect_blend(prev, f); prev = NULL; } else { |