handle gl init fialure correctly and dont mess up font init.

SVN revision: 48959
This commit is contained in:
Carsten Haitzler 2010-05-18 04:22:33 +00:00
parent 0cad792cb6
commit cedba3f7d9
3 changed files with 66 additions and 25 deletions

View File

@ -774,7 +774,14 @@ EAPI void
evas_common_font_flush(void) evas_common_font_flush(void)
{ {
if (font_cache_usage < font_cache) return; if (font_cache_usage < font_cache) return;
while (font_cache_usage > font_cache) evas_common_font_flush_last(); while (font_cache_usage > font_cache)
{
int pfont_cache_usage;
pfont_cache_usage = font_cache_usage;
evas_common_font_flush_last();
if (pfont_cache_usage == font_cache_usage) break;
}
} }
/* We run this when the cache gets larger than allowed size /* We run this when the cache gets larger than allowed size

View File

@ -15,11 +15,7 @@ evas_common_font_init(void)
initialised++; initialised++;
if (initialised != 1) return; if (initialised != 1) return;
error = FT_Init_FreeType(&evas_ft_lib); error = FT_Init_FreeType(&evas_ft_lib);
if (error) if (error) return;
{
initialised--;
return;
}
evas_common_font_load_init(); evas_common_font_load_init();
} }
@ -28,6 +24,7 @@ evas_common_font_shutdown(void)
{ {
int error; int error;
if (initialised < 1) return;
initialised--; initialised--;
if (initialised != 0) return; if (initialised != 0) return;

View File

@ -198,6 +198,9 @@ eng_info_free(Evas *e __UNUSED__, void *info)
free(in); free(in);
} }
static int initted = 0;
static int gl_wins = 0;
static int static int
eng_setup(Evas *e, void *in) eng_setup(Evas *e, void *in)
{ {
@ -235,6 +238,7 @@ eng_setup(Evas *e, void *in)
e->engine.data.output = NULL; e->engine.data.output = NULL;
return 0; return 0;
} }
gl_wins++;
{ {
int status; int status;
@ -290,6 +294,8 @@ eng_setup(Evas *e, void *in)
} }
} }
if (!initted)
{
evas_common_cpu_init(); evas_common_cpu_init();
evas_common_blend_init(); evas_common_blend_init();
@ -303,6 +309,8 @@ eng_setup(Evas *e, void *in)
evas_common_font_init(); evas_common_font_init();
evas_common_draw_init(); evas_common_draw_init();
evas_common_tilebuf_init(); evas_common_tilebuf_init();
initted = 1;
}
} }
else else
{ {
@ -315,8 +323,12 @@ eng_setup(Evas *e, void *in)
(info->info.depth != re->win->depth) || (info->info.depth != re->win->depth) ||
(info->info.destination_alpha != re->win->alpha) || (info->info.destination_alpha != re->win->alpha) ||
(info->info.rotation != re->win->rot)) (info->info.rotation != re->win->rot))
{
if (re->win)
{ {
eng_window_free(re->win); eng_window_free(re->win);
gl_wins--;
}
re->win = eng_window_new(info->info.display, re->win = eng_window_new(info->info.display,
info->info.drawable, info->info.drawable,
info->info.screen, info->info.screen,
@ -328,6 +340,7 @@ eng_setup(Evas *e, void *in)
info->indirect, info->indirect,
info->info.destination_alpha, info->info.destination_alpha,
info->info.rotation); info->info.rotation);
if (re->win) gl_wins++;
} }
else if ((re->win->w != e->output.w) || else if ((re->win->w != e->output.w) ||
(re->win->h != e->output.h)) (re->win->h != e->output.h))
@ -344,9 +357,14 @@ eng_setup(Evas *e, void *in)
free(re); free(re);
return 0; return 0;
} }
if (!e->engine.data.output) if (!e->engine.data.output)
{ {
if (re->win) eng_window_free(re->win); if (re->win)
{
eng_window_free(re->win);
gl_wins--;
}
free(re); free(re);
return 0; return 0;
} }
@ -378,11 +396,30 @@ eng_output_free(void *data)
// NOTE: XrmGetDatabase() result is shared per connection, do not free it. // NOTE: XrmGetDatabase() result is shared per connection, do not free it.
// if (re->xrdb) XrmDestroyDatabase(re->xrdb); // if (re->xrdb) XrmDestroyDatabase(re->xrdb);
if (re->win) eng_window_free(re->win); if (re->win)
{
eng_window_free(re->win);
gl_wins--;
}
free(re); free(re);
} }
evas_common_font_shutdown(); if ((initted == 1) && (gl_wins == 0))
{
evas_common_cpu_shutdown();
evas_common_blend_shutdown();
evas_common_image_shutdown(); evas_common_image_shutdown();
evas_common_convert_shutdown();
evas_common_scale_shutdown();
evas_common_rectangle_shutdown();
evas_common_gradient_shutdown();
evas_common_polygon_shutdown();
evas_common_line_shutdown();
evas_common_font_shutdown();
evas_common_draw_shutdown();
evas_common_tilebuf_shutdown();
initted = 0;
}
} }
static void static void