diff --git a/legacy/evas/test/evas_test.c b/legacy/evas/test/evas_test.c index c728f24cd7..fb03de0986 100644 --- a/legacy/evas/test/evas_test.c +++ b/legacy/evas/test/evas_test.c @@ -2,6 +2,15 @@ #include "../src/evas_gl_routines.h" #include +double +get_time(void) +{ + struct timeval timev; + + gettimeofday(&timev, NULL); + return (double)timev.tv_sec + (((double)timev.tv_usec) / 1000000); +} + int main(int argc, char **argv) { @@ -9,12 +18,14 @@ main(int argc, char **argv) Visual *vis; Colormap cmap; Window win; + int win_w, win_h; d = XOpenDisplay(NULL); __evas_gl_init(d); vis = __evas_gl_get_visual(d); cmap = __evas_gl_get_colormap(d); + win_w = 640; win_h = 480; { XSetWindowAttributes att; @@ -24,7 +35,7 @@ main(int argc, char **argv) win = XCreateWindow(d, RootWindow(d, DefaultScreen(d)), - 0, 0, 800, 600, 0, + 0, 0, win_w, win_h, 0, (__evas_gl_get_visual_info(d))->depth, InputOutput, vis, @@ -34,6 +45,7 @@ main(int argc, char **argv) } { int a = 0; + double t1, t2; Evas_GL_Image *i[4], *bg, *l; bg = __evas_gl_image_new_from_file(d, "img/sky001.png"); @@ -42,34 +54,52 @@ main(int argc, char **argv) i[2] = __evas_gl_image_new_from_file(d, "img/fog3001.png"); i[3] = __evas_gl_image_new_from_file(d, "img/fog4001.png"); l = __evas_gl_image_new_from_file(d, "img/logo001.png"); + if (!bg) + { + printf("cannot find images!\n"); + exit(1); + } for(;;) { int x, y, j, k; - __evas_gl_render_to_window(bg, d, win, 800, 600, + if (a == 0) + t1 = get_time(); + __evas_gl_render_to_window(bg, d, win, win_w, win_h, 0, 0, bg->w, bg->h, - 0, 0, 800, 600); - for (k = 0; k < 6; k++) + 0, 0, win_w, win_h); + for (k = 0; k < 4; k++) { int xx, yy; j = k % 4; - xx = (((k + 1) * a) / 2) % 800; + xx = (((k + 1) * a) / 2) % win_w; yy = 0; - if (k == 0) - __evas_gl_render_to_window(l, d, win, 800, 600, + if (k == 2) + __evas_gl_render_to_window(l, d, win, win_w, win_h, 0, 0, l->w, l->h, - (800 - l->w) / 2, (600 - l->h) /2, l->w, l->h); - __evas_gl_render_to_window(i[j], d, win, 800, 600, + (win_w - l->w) / 2, (win_h - l->h) /2, l->w, l->h); + __evas_gl_render_to_window(i[j], d, win, win_w, win_h, 0, 0, i[j]->w, i[j]->h, - xx, yy, 800, 600); - __evas_gl_render_to_window(i[j], d, win, 800, 600, + xx, yy, win_w, win_h); + __evas_gl_render_to_window(i[j], d, win, win_w, win_h, 0, 0, i[j]->w, i[j]->h, - xx - 800, yy, 800, 600); + xx - win_w, yy, win_w, win_h); } __evas_flush_draw(d, win); a++; - if (a == (800 * 4)) a = 0; + if (a == (win_w * 4)) + { + double pixels; + double tim; + + t2 = get_time(); + tim = t2 - t1; + pixels = (((((double)k + 1) * (double)win_w * (double)win_h) + ((double)l->w * (double)l->h)) * (double)a); + printf("%3.0f pixels in %3.3f seconds\n", pixels, tim); + printf("..... %4.1f Mpixels/second\n", pixels / (tim * 1000000)); + a = 0; + } } } }