added save file flag for old evas test and fixe dimage buffer rendering to work

again


SVN revision: 3630
This commit is contained in:
Carsten Haitzler 2000-10-15 19:54:36 +00:00
parent 5e5d03af9c
commit 3a11bc158a
4 changed files with 41 additions and 23 deletions

View File

@ -817,7 +817,6 @@ __evas_image_flush_draw(Display *disp, Imlib_Image dstim, Window win)
{ {
Evas_List l; Evas_List l;
imlib_context_set_dither(1);
imlib_context_set_blend(1); imlib_context_set_blend(1);
for(l = drawable_list; l; l = l->next) for(l = drawable_list; l; l = l->next)
@ -826,7 +825,7 @@ __evas_image_flush_draw(Display *disp, Imlib_Image dstim, Window win)
dr = l->data; dr = l->data;
if ((dr->im == dstim) && (dr->disp == disp)) if ((dr->im == dstim))
{ {
Evas_List ll; Evas_List ll;
@ -840,6 +839,7 @@ __evas_image_flush_draw(Display *disp, Imlib_Image dstim, Window win)
{ {
int w, h; int w, h;
w = up->w; h = up->h;
imlib_context_set_image(dr->im); imlib_context_set_image(dr->im);
imlib_blend_image_onto_image(up->image, 1, imlib_blend_image_onto_image(up->image, 1,
0, 0, w, h, 0, 0, w, h,
@ -909,12 +909,10 @@ __evas_image_init(Display *disp, int screen, int colors)
if (!initted) if (!initted)
{ {
imlib_set_color_usage(216);
imlib_set_font_cache_size(1024 * 1024); imlib_set_font_cache_size(1024 * 1024);
imlib_set_cache_size(8 * 1024 * 1024); imlib_set_cache_size(8 * 1024 * 1024);
initted = 1; initted = 1;
} }
imlib_set_color_usage(colors);
} }
void void

View File

@ -822,7 +822,7 @@ __evas_imlib_init(Display *disp, int screen, int colors)
if (!initted) if (!initted)
{ {
imlib_set_color_usage(216); imlib_set_color_usage(colors);
imlib_set_font_cache_size(1024 * 1024); imlib_set_font_cache_size(1024 * 1024);
imlib_set_cache_size(8 * 1024 * 1024); imlib_set_cache_size(8 * 1024 * 1024);
initted = 1; initted = 1;

View File

@ -95,15 +95,19 @@ fn_rect(double v, double val, int no)
200, 60, 220, 80 200, 60, 220, 80
}; };
static double coords[8 * 4]; static double coords[8 * 4];
static double last_val = 0;
int i; int i;
if (no) if (no)
{ {
for (i = 0; i < 8; i++) if (last_val != val)
{ {
if (o_fn_rects[i]) for (i = 0; i < 8; i++)
evas_del_object(evas_view, o_fn_rects[i]); {
o_fn_rects[i] = NULL; if (o_fn_rects[i])
evas_del_object(evas_view, o_fn_rects[i]);
o_fn_rects[i] = NULL;
}
} }
return; return;
} }
@ -144,6 +148,7 @@ fn_rect(double v, double val, int no)
coords[(i * 4) + 2], coords[(i * 4) + 3]); coords[(i * 4) + 2], coords[(i * 4) + 3]);
evas_show(evas_view, o_fn_rects[i]); evas_show(evas_view, o_fn_rects[i]);
} }
last_val = val;
} }
static void static void
@ -154,15 +159,19 @@ fn_line(double v, double val, int no)
static int init = 0; static int init = 0;
static int colors[64 * 4]; static int colors[64 * 4];
static double coords[64 * 4]; static double coords[64 * 4];
static double last_val = 0;
int i; int i;
if (no) if (no)
{ {
for (i = 0; i < 64; i++) if (last_val != val)
{ {
if (o_fn_lines[i]) for (i = 0; i < 64; i++)
evas_del_object(evas_view, o_fn_lines[i]); {
o_fn_lines[i] = NULL; if (o_fn_lines[i])
evas_del_object(evas_view, o_fn_lines[i]);
o_fn_lines[i] = NULL;
}
} }
return; return;
} }
@ -207,6 +216,7 @@ fn_line(double v, double val, int no)
coords[(i * 4) + 3] + (20 * sin((val * 1.3) + 2.1 + i))); coords[(i * 4) + 3] + (20 * sin((val * 1.3) + 2.1 + i)));
evas_show(evas_view, o_fn_lines[i]); evas_show(evas_view, o_fn_lines[i]);
} }
last_val = val;
} }
static void static void
@ -230,7 +240,7 @@ fn_image(double v, double val, int no)
} }
static double codes_loop = 170; static double codes_loop = 180;
static CodeBlock codes[] = static CodeBlock codes[] =
{ {
{ 128.0, 2.0, 4.0, 6.0, fn_rect}, { 128.0, 2.0, 4.0, 6.0, fn_rect},
@ -238,9 +248,15 @@ static CodeBlock codes[] =
{ 136.0, 2.0, 4.0, 6.0, fn_poly}, { 136.0, 2.0, 4.0, 6.0, fn_poly},
{ 140.0, 2.0, 4.0, 6.0, fn_text}, { 140.0, 2.0, 4.0, 6.0, fn_text},
{ 144.0, 2.0, 4.0, 6.0, fn_grad}, { 144.0, 2.0, 4.0, 6.0, fn_grad},
{ 148.0, 2.0, 4.0, 6.0, fn_image} { 148.0, 2.0, 4.0, 6.0, fn_image},
{ 164.0, 4.0, 12.0, 16.0, fn_rect},
{ 164.0, 4.0, 12.0, 16.0, fn_line},
{ 164.0, 4.0, 12.0, 16.0, fn_poly},
{ 164.0, 4.0, 12.0, 16.0, fn_text},
{ 164.0, 4.0, 12.0, 16.0, fn_grad},
{ 164.0, 4.0, 12.0, 16.0, fn_image}
}; };
static double texts_loop = 170; static double texts_loop = 180;
static TextBlock texts[] = static TextBlock texts[] =
{ {
{ 10.0, 2.0, 4.0, 6.0, "What are the 7 Wonders of the world?", NULL, NULL}, { 10.0, 2.0, 4.0, 6.0, "What are the 7 Wonders of the world?", NULL, NULL},
@ -282,7 +298,7 @@ static TextBlock texts[] =
{ 160.0, 2.0, 4.0, 6.0, "Faded in and out ...", NULL, NULL}, { 160.0, 2.0, 4.0, 6.0, "Faded in and out ...", NULL, NULL},
{ 164.0, 2.0, 4.0, 6.0, "And much much more ...", NULL, NULL}, { 164.0, 2.0, 4.0, 6.0, "And much much more ...", NULL, NULL},
}; };
static double images_loop = 170; static double images_loop = 180;
static ImageBlock images[] = static ImageBlock images[] =
{ {
{ 14.0, 2.0, 4.0, 6.0, 300, 100, IMGDIR"evas_test_wonder_1.png", NULL}, { 14.0, 2.0, 4.0, 6.0, 300, 100, IMGDIR"evas_test_wonder_1.png", NULL},

View File

@ -80,6 +80,7 @@ main(int argc, char **argv)
Evas_Gradient grad; Evas_Gradient grad;
int down; int down;
double t1, t2; double t1, t2;
char *save_file = NULL;
char *imgs[8] = char *imgs[8] =
{ {
"img/mush.png", "img/mush.png",
@ -135,6 +136,11 @@ main(int argc, char **argv)
i++; i++;
evas_set_scale_smoothness(e, atoi(argv[i])); evas_set_scale_smoothness(e, atoi(argv[i]));
} }
else if ((!strcmp(argv[i], "-v")) && (i < (argc - 1)))
{
i++;
save_file = argv[i];
}
else else
{ {
printf("Usage:\n"); printf("Usage:\n");
@ -145,6 +151,7 @@ main(int argc, char **argv)
printf(" -m [x11 | soft | hard | buf] - rendering mode\n"); printf(" -m [x11 | soft | hard | buf] - rendering mode\n");
printf(" -c colors - maximum colors allocated\n"); printf(" -c colors - maximum colors allocated\n");
printf(" -s [1 | 0] - smooth scaling / rendering\n"); printf(" -s [1 | 0] - smooth scaling / rendering\n");
printf(" -v file.png - save buffer to file.png\n");
printf("\n"); printf("\n");
printf("Examples:\n"); printf("Examples:\n");
printf(" %s -x 640 -y 480 -m soft - run test in 640x480 in software mode\n", argv[0]); printf(" %s -x 640 -y 480 -m soft - run test in 640x480 in software mode\n", argv[0]);
@ -388,14 +395,11 @@ main(int argc, char **argv)
} }
evas_set_angle(e, o_grad, (double)a * 360 / 1000); evas_set_angle(e, o_grad, (double)a * 360 / 1000);
evas_render(e); evas_render(e);
if ((argc == 5) && (!strcmp(argv[4], "save")) && (buffer)) if ((save_file) && (buffer))
{ {
imlib_context_set_image(buffer); imlib_context_set_image(buffer);
imlib_image_set_format("png"); imlib_image_set_format("png");
imlib_save_image("output.png"); imlib_save_image(save_file);
printf("save done\n");
sleep(1);
printf("run\n");
} }
a++; a++;
m++; m++;