API break (well, kind of...)

* evas_engine_info_set() returns now an int, to inform if
   an error occured or not when setting the info of the engine.
 * in the Evas_Func structure, the setup() method returns an int
 * all the engines are updated

I'll fix ecore_evas and ewl later (the compilation is still fine).

Gustavo: should I add EINA_WARN_UNUSED_RESULT at the end of the
evas_engine_info_set() function ?



SVN revision: 39670
This commit is contained in:
Vincent Torri 2009-03-24 09:05:32 +00:00
parent 9a074ec131
commit b61328192f
20 changed files with 150 additions and 87 deletions

View File

@ -470,7 +470,7 @@ extern "C" {
EAPI int evas_output_method_get (const Evas *e) EINA_WARN_UNUSED_RESULT EINA_ARG_NONNULL(1) EINA_PURE;
EAPI Evas_Engine_Info *evas_engine_info_get (const Evas *e) EINA_WARN_UNUSED_RESULT EINA_ARG_NONNULL(1) EINA_PURE;
EAPI void evas_engine_info_set (Evas *e, Evas_Engine_Info *info) EINA_ARG_NONNULL(1);
EAPI int evas_engine_info_set (Evas *e, Evas_Engine_Info *info) EINA_ARG_NONNULL(1);
EAPI void evas_output_size_set (Evas *e, int w, int h) EINA_ARG_NONNULL(1);
EAPI void evas_output_size_get (const Evas *e, int *w, int *h) EINA_ARG_NONNULL(1);

View File

@ -329,18 +329,19 @@ evas_engine_info_get(const Evas *e)
*
* @param e The pointer to the Evas Canvas
* @param info The pointer to the Engine Info to use
* @return 1 if no error occured, 0 otherwise
* @ingroup Evas_Output_Method
*/
EAPI void
EAPI int
evas_engine_info_set(Evas *e, Evas_Engine_Info *info)
{
MAGIC_CHECK(e, Evas, MAGIC_EVAS);
return;
return 0;
MAGIC_CHECK_END();
if (!info) return;
if (info != e->engine.info) return;
if (info->magic != e->engine.info_magic) return;
e->engine.func->setup(e, info);
if (!info) return 0;
if (info != e->engine.info) return 0;
if (info->magic != e->engine.info_magic) return 0;
return e->engine.func->setup(e, info);
}
/**

View File

@ -541,7 +541,7 @@ struct _Evas_Func
{
void *(*info) (Evas *e);
void (*info_free) (Evas *e, void *info);
void (*setup) (Evas *e, void *info);
int (*setup) (Evas *e, void *info);
void (*output_free) (void *data);
void (*output_resize) (void *data, int w, int h);

View File

@ -23,7 +23,7 @@ static void *_output_setup(int w, int h, void *dest_buffer, int dest_buffer_row_
static void *eng_info(Evas *e);
static void eng_info_free(Evas *e, void *info);
static void eng_setup(Evas *e, void *info);
static int eng_setup(Evas *e, void *info);
static void eng_output_free(void *data);
static void eng_output_resize(void *data, int w, int h);
static void eng_output_tile_size_set(void *data, int w, int h);
@ -54,6 +54,8 @@ _output_setup(int w,
Render_Engine *re;
re = calloc(1, sizeof(Render_Engine));
if (!re)
return NULL;
/* if we haven't initialized - init (automatic abort if already done) */
evas_common_cpu_init();
@ -128,7 +130,7 @@ eng_info_free(Evas *e __UNUSED__, void *info)
free(in);
}
static void
static int
eng_setup(Evas *e, void *in)
{
Render_Engine *re;
@ -150,9 +152,10 @@ eng_setup(Evas *e, void *in)
if (e->engine.data.output)
eng_output_free(e->engine.data.output);
e->engine.data.output = re;
if (!e->engine.data.output) return;
if (!e->engine.data.output) return 0;
if (!e->engine.data.context)
e->engine.data.context = e->engine.func->context_new(e->engine.data.output);
return 1;
}
static void

View File

@ -10,7 +10,7 @@
static void *eng_info(Evas *e);
static void eng_info_free(Evas *e, void *info);
static void eng_setup(Evas *e, void *info);
static int eng_setup(Evas *e, void *info);
static void *eng_output_setup(int w, int h, Display *disp, Drawable draw, Visual *vis, Colormap cmap, int depth);
static void eng_output_free(void *data);
static void eng_output_resize(void *data, int w, int h);
@ -264,7 +264,7 @@ eng_info_free(Evas *e, void *info)
free(in);
}
static void
static int
eng_setup(Evas *e, void *in)
{
Render_Engine *re;
@ -281,12 +281,14 @@ eng_setup(Evas *e, void *in)
info->info.visual,
info->info.colormap,
info->info.depth);
if (!e->engine.data.output) return;
if (!e->engine.data.output) return 0;
if (!e->engine.data.context)
e->engine.data.context =
e->engine.func->context_new(e->engine.data.output);
re = e->engine.data.output;
return 1;
}
static void *
@ -295,6 +297,8 @@ eng_output_setup(int w, int h, Display *disp, Drawable draw, Visual *vis, Colorm
Render_Engine *re;
re = calloc(1, sizeof(Render_Engine));
if (!re)
return NULL;
re->win = eng_window_new(disp, draw,
0 /* FIXME: screen 0 assumption */,
vis, cmap, depth, w, h);

View File

@ -24,7 +24,7 @@ static Evas_Func func, pfunc;
static void *eng_info(Evas *e);
static void eng_info_free(Evas *e, void *info);
static void eng_setup(Evas *e, void *info);
static int eng_setup(Evas *e, void *info);
static void eng_output_free(void *data);
static void eng_output_resize(void *data, int width, int height);
@ -88,7 +88,7 @@ eng_info_free(Evas *e, void *info)
free(in);
}
static void
static int
eng_setup(Evas *e, void *info)
{
Render_Engine *re;
@ -98,8 +98,12 @@ eng_setup(Evas *e, void *info)
in = (Evas_Engine_Info_Direct3D *)info;
if (e->engine.data.output == NULL)
{
e->engine.data.output = _output_setup(e->output.w, e->output.h,
in->info.rotation, in->info.window, in->info.depth, in->info.fullscreen);
e->engine.data.output = _output_setup(e->output.w,
e->output.h,
in->info.rotation,
in->info.window,
in->info.depth,
in->info.fullscreen);
}
else if (in->info.fullscreen != 0)
{
@ -117,10 +121,11 @@ eng_setup(Evas *e, void *info)
}
if (e->engine.data.output == NULL)
return;
return 0;
if (e->engine.data.context == NULL)
e->engine.data.context = e->engine.func->context_new(e->engine.data.output);
return 1;
}
static void

View File

@ -840,7 +840,7 @@ _dfb_output_setup(int w, int h, const struct Evas_Engine_DirectFB_Spec *spec)
return NULL;
}
static void
static int
evas_engine_dfb_setup(Evas *e, void *in)
{
Evas_Engine_Info_DirectFB *info = in;
@ -851,11 +851,13 @@ evas_engine_dfb_setup(Evas *e, void *in)
// XXX TODO: else reconfigure existing...
if (!e->engine.data.output)
return;
return 0;
if (!e->engine.data.context)
e->engine.data.context =
e->engine.func->context_new(e->engine.data.output);
return 1;
}
static void

View File

@ -23,7 +23,7 @@ static void *_output_setup(int w, int h, int rot, int vt, int dev, int refresh);
static void *eng_info(Evas *e);
static void eng_info_free(Evas *e, void *info);
static void eng_setup(Evas *e, void *info);
static int eng_setup(Evas *e, void *info);
static void eng_output_free(void *data);
static void eng_output_resize(void *data, int w, int h);
static void eng_output_tile_size_set(void *data, int w, int h);
@ -42,6 +42,8 @@ _output_setup(int w, int h, int rot, int vt, int dev, int refresh)
Render_Engine *re;
re = calloc(1, sizeof(Render_Engine));
if (!re)
return NULL;
/* if we haven't initialized - init (automatic abort if already done) */
evas_common_cpu_init();
@ -91,7 +93,7 @@ eng_info_free(Evas *e __UNUSED__, void *info)
free(in);
}
static void
static int
eng_setup(Evas *e, void *in)
{
Render_Engine *re;
@ -105,8 +107,10 @@ eng_setup(Evas *e, void *in)
info->info.device_number,
info->info.refresh);
e->engine.data.output = re;
if (!e->engine.data.output) return;
if (!e->engine.data.output) return 0;
e->engine.data.context = e->engine.func->context_new(e->engine.data.output);
return 1;
}
static void

View File

@ -39,7 +39,7 @@ eng_info_free(Evas *e, void *info)
free(in);
}
static void
static int
eng_setup(Evas *e, void *in)
{
Render_Engine *re;
@ -49,13 +49,13 @@ eng_setup(Evas *e, void *in)
if (!e->engine.data.output)
{
re = calloc(1, sizeof(Render_Engine));
if (!re) return;
if (!re) return 0;
if (!evas_glew_init(info->info.window, &re->dc, &re->context))
{
free(re);
e->engine.data.output = NULL;
return;
return 0;
}
re->win = info->info.window;
@ -70,7 +70,7 @@ eng_setup(Evas *e, void *in)
{
free(re);
e->engine.data.output = NULL;
return;
return 0;
}
evas_common_cpu_init();
@ -94,7 +94,7 @@ eng_setup(Evas *e, void *in)
{
free(re);
e->engine.data.output = NULL;
return;
return 0;
}
re->win = info->info.window;
@ -107,11 +107,13 @@ eng_setup(Evas *e, void *in)
e->output.w,
e->output.h);
}
if (!e->engine.data.output) return;
if (!e->engine.data.output) return 0;
if (!e->engine.data.context)
e->engine.data.context =
e->engine.func->context_new(e->engine.data.output);
return 1;
}
static void

View File

@ -55,7 +55,7 @@ eng_info_free(Evas *e __UNUSED__, void *info)
free(in);
}
static void
static int
eng_setup(Evas *e, void *in)
{
Render_Engine *re;
@ -65,9 +65,9 @@ eng_setup(Evas *e, void *in)
info = (Evas_Engine_Info_GL_X11 *)in;
if (!e->engine.data.output)
{
if (!glXQueryExtension(info->info.display, &eb, &evb)) return;
if (!glXQueryExtension(info->info.display, &eb, &evb)) return 0;
re = calloc(1, sizeof(Render_Engine));
if (!re) return;
if (!re) return 0;
e->engine.data.output = re;
re->win = eng_window_new(info->info.display,
info->info.drawable,
@ -81,7 +81,7 @@ eng_setup(Evas *e, void *in)
{
free(re);
e->engine.data.output = NULL;
return;
return 0;
}
evas_common_cpu_init();
@ -111,10 +111,12 @@ eng_setup(Evas *e, void *in)
e->output.w,
e->output.h);
}
if (!e->engine.data.output) return;
if (!e->engine.data.output) return 0;
if (!e->engine.data.context)
e->engine.data.context =
e->engine.func->context_new(e->engine.data.output);
return 1;
}
static void

View File

@ -35,7 +35,7 @@ struct _Render_Engine
/* prototypes we will use here */
static void *eng_info(Evas *e);
static void eng_info_free(Evas *e, void *info);
static void eng_setup(Evas *e, void *info);
static int eng_setup(Evas *e, void *info);
static void eng_output_free(void *data);
static void eng_output_resize(void *data, int w, int h);
static void eng_output_tile_size_set(void *data, int w, int h);
@ -119,7 +119,7 @@ eng_info_free(Evas *e, void *info)
free(in);
}
static void
static int
eng_setup(Evas *e, void *in)
{
Render_Engine *re;
@ -130,6 +130,8 @@ eng_setup(Evas *e, void *in)
if (!e->engine.data.output)
{
re = calloc(1, sizeof(Render_Engine));
if (!re)
return 0;
evas_common_cpu_init();
evas_common_blend_init();
evas_common_image_init();
@ -149,7 +151,7 @@ eng_setup(Evas *e, void *in)
resize = 0;
}
re = e->engine.data.output;
if (!re) return;
if (!re) return 0;
if (!e->engine.data.context) e->engine.data.context = e->engine.func->context_new(e->engine.data.output);
@ -169,6 +171,8 @@ eng_setup(Evas *e, void *in)
if (re->tb)
evas_common_tilebuf_set_tile_size(re->tb, TILESIZE, TILESIZE);
}
return 1;
}
static void

View File

@ -55,7 +55,7 @@ eng_info_free(Evas *e, void *info)
free((Evas_Engine_Info_Quartz *)info);
}
static void
static int
eng_setup(Evas *e, void *in)
{
Render_Engine *re;
@ -63,13 +63,15 @@ eng_setup(Evas *e, void *in)
if (!e->engine.data.output)
e->engine.data.output = eng_output_setup(info->info.context, e->output.w, e->output.h);
if (!e->engine.data.output) return;
if (!e->engine.data.output) return 0;
if (!e->engine.data.context)
e->engine.data.context = e->engine.func->context_new(e->engine.data.output);
((Evas_Quartz_Context *)e->engine.data.context)->w = e->output.w;
((Evas_Quartz_Context *)e->engine.data.context)->h = e->output.h;
return 1;
}
#pragma mark Output Setup

View File

@ -33,7 +33,7 @@ struct _Render_Engine
static void *eng_info(Evas *e);
static void eng_info_free(Evas *e, void *info);
static void eng_setup(Evas *e, void *info);
static int eng_setup(Evas *e, void *info);
static void eng_output_free(void *data);
static void eng_output_resize(void *data, int w, int h);
static void eng_output_tile_size_set(void *data, int w, int h);
@ -101,7 +101,7 @@ _tmp_out_alloc(Render_Engine *re)
}
static void
static int
eng_setup(Evas *e, void *in)
{
Render_Engine *re;
@ -116,7 +116,7 @@ eng_setup(Evas *e, void *in)
* and no real other acceleration, and high resolution so we
* can pre-dither into 16bpp. */
if (info->info.depth != 16)
return;
return 0;
/* do common routine init - we wil at least use it for core
* image loading and font loading/glyph rendering & placement */
evas_common_cpu_init();
@ -137,7 +137,7 @@ eng_setup(Evas *e, void *in)
/* render engine specific data */
re = calloc(1, sizeof(Render_Engine));
if (!re)
return;
return 0;
e->engine.data.output = re;
re->window = info->info.window;
re->object = info->info.object;
@ -156,7 +156,7 @@ eng_setup(Evas *e, void *in)
/* we changed the info after first init - do a re-eval where
* appropriate */
if (info->info.depth != 16)
return;
return 0;
re = e->engine.data.output;
if (re->tb) evas_common_tilebuf_free(re->tb);
re->window = info->info.window;
@ -176,11 +176,13 @@ eng_setup(Evas *e, void *in)
re->tmp_out = NULL;
}
}
if (!e->engine.data.output) return;
if (!e->engine.data.output) return 0;
/* add a draw context if we dont have one */
if (!e->engine.data.context)
e->engine.data.context =
e->engine.func->context_new(e->engine.data.output);
return 1;
}
static void

View File

@ -116,9 +116,12 @@ _tmp_out_alloc(Render_Engine *re)
static void*
_sdl16_output_setup(int w, int h, int rotation, int fullscreen, int noframe, int hwsurface)
{
Render_Engine *re = calloc(1, sizeof(Render_Engine));
Render_Engine *re;
SDL_Surface *surface;
re = calloc(1, sizeof(Render_Engine));
if (!re)
return NULL;
/* if we haven't initialized - init (automatic abort if already done) */
evas_common_cpu_init();
evas_common_blend_init();
@ -141,7 +144,8 @@ _sdl16_output_setup(int w, int h, int rotation, int fullscreen, int noframe, int
if (!re->cache)
{
fprintf(stderr, "Evas_Cache_Engine_Image allocation failed!\n");
exit(-1);
free(re);
return NULL;
}
re->tb = evas_common_tilebuf_new(w, h);
@ -166,7 +170,9 @@ _sdl16_output_setup(int w, int h, int rotation, int fullscreen, int noframe, int
if (!surface)
{
fprintf(stderr, "SDL_SetVideoMode [ %i x %i x 16 ] failed\n", w, h);
exit(-1);
evas_cache_engine_image_shutdown(re->cache);
free(re);
return NULL;
}
SDL_SetAlpha(surface, SDL_RLEACCEL, 0);
@ -176,27 +182,30 @@ _sdl16_output_setup(int w, int h, int rotation, int fullscreen, int noframe, int
if (!re->soft16_engine_image)
{
fprintf(stderr, "Soft16_Image allocation from SDL failed\n");
exit(-1);
evas_cache_engine_image_shutdown(re->cache);
free(re);
return NULL;
}
return re;
}
static void
static int
evas_engine_sdl16_setup(Evas *e, void *in)
{
Evas_Engine_Info_SDL_16 *info = (Evas_Engine_Info_SDL_16 *) in;
if (evas_output_method_get(e) != evas_render_method_lookup("software_16_sdl"))
return ;
return 0;
SDL_Init(SDL_INIT_NOPARACHUTE);
if (SDL_InitSubSystem(SDL_INIT_VIDEO) < 0)
{
fprintf(stderr, "SDL_Init failed with %s\n", SDL_GetError());
exit(-1);
SDL_Quit();
return 0;
}
e->engine.data.output = _sdl16_output_setup(e->output.w, e->output.h,
@ -205,10 +214,12 @@ evas_engine_sdl16_setup(Evas *e, void *in)
info->info.noframe,
info->info.hwsurface);
if (!e->engine.data.output)
return;
return 0;
e->engine.func = &func;
e->engine.data.context = e->engine.func->context_new(e->engine.data.output);
return 1;
}
static void

View File

@ -48,7 +48,7 @@ struct _Render_Engine
static void *eng_info(Evas *e);
static void eng_info_free(Evas *e, void *info);
static void eng_setup(Evas *e, void *info);
static int eng_setup(Evas *e, void *info);
static void eng_output_free(void *data);
static void eng_output_resize(void *data, int w, int h);
static void eng_output_tile_size_set(void *data, int w, int h);
@ -142,7 +142,7 @@ _tmp_out_alloc(Render_Engine *re)
}
static void
static int
eng_setup(Evas *e, void *in)
{
Render_Engine *re;
@ -171,7 +171,7 @@ eng_setup(Evas *e, void *in)
/* render engine specific data */
re = calloc(1, sizeof(Render_Engine));
if (!re)
return;
return 0;
e->engine.data.output = re;
switch(info->info.backend)
@ -182,7 +182,7 @@ eng_setup(Evas *e, void *in)
if (!re->backend_priv)
{
free(re);
return;
return 0;
}
re->backend_shutdown = evas_software_wince_fb_shutdown;
re->backend_output_buffer_new = evas_software_wince_fb_output_buffer_new;
@ -196,7 +196,7 @@ eng_setup(Evas *e, void *in)
if (!re->backend_priv)
{
free(re);
return;
return 0;
}
re->backend_shutdown = evas_software_wince_gapi_shutdown;
re->backend_output_buffer_new = evas_software_wince_gapi_output_buffer_new;
@ -210,7 +210,7 @@ eng_setup(Evas *e, void *in)
if (!re->backend_priv)
{
free(re);
return;
return 0;
}
re->backend_shutdown = evas_software_wince_ddraw_shutdown;
re->backend_output_buffer_new = evas_software_wince_ddraw_output_buffer_new;
@ -224,7 +224,7 @@ eng_setup(Evas *e, void *in)
if (!re->backend_priv)
{
free(re);
return;
return 0;
}
re->backend_shutdown = evas_software_wince_gdi_shutdown;
re->backend_output_buffer_new = evas_software_wince_gdi_output_buffer_new;
@ -234,7 +234,7 @@ eng_setup(Evas *e, void *in)
break;
default:
free(re);
return;
return 0;
}
re->width = e->output.w;
@ -257,7 +257,7 @@ eng_setup(Evas *e, void *in)
if (!re->backend_priv)
{
free(re);
return;
return 0;
}
re->backend_shutdown = evas_software_wince_fb_shutdown;
re->backend_output_buffer_new = evas_software_wince_fb_output_buffer_new;
@ -271,7 +271,7 @@ eng_setup(Evas *e, void *in)
if (!re->backend_priv)
{
free(re);
return;
return 0;
}
re->backend_shutdown = evas_software_wince_gapi_shutdown;
re->backend_output_buffer_new = evas_software_wince_gapi_output_buffer_new;
@ -285,7 +285,7 @@ eng_setup(Evas *e, void *in)
if (!re->backend_priv)
{
free(re);
return;
return 0;
}
re->backend_shutdown = evas_software_wince_ddraw_shutdown;
re->backend_output_buffer_new = evas_software_wince_ddraw_output_buffer_new;
@ -299,7 +299,7 @@ eng_setup(Evas *e, void *in)
if (!re->backend_priv)
{
free(re);
return;
return 0;
}
re->backend_shutdown = evas_software_wince_gdi_shutdown;
re->backend_output_buffer_new = evas_software_wince_gdi_output_buffer_new;
@ -309,7 +309,7 @@ eng_setup(Evas *e, void *in)
break;
default:
free(re);
return;
return 0;
}
re->width = e->output.w;
@ -324,11 +324,13 @@ eng_setup(Evas *e, void *in)
re->tmp_out = NULL;
}
}
if (!e->engine.data.output) return;
if (!e->engine.data.output) return 0;
/* add a draw context if we dont have one */
if (!e->engine.data.context)
e->engine.data.context =
e->engine.func->context_new(e->engine.data.output);
return 1;
}
static void

View File

@ -30,7 +30,7 @@ struct _Render_Engine
static void *eng_info(Evas *e);
static void eng_info_free(Evas *e, void *info);
static void eng_setup(Evas *e, void *info);
static int eng_setup(Evas *e, void *info);
static void eng_output_free(void *data);
static void eng_output_resize(void *data, int w, int h);
static void eng_output_tile_size_set(void *data, int w, int h);
@ -98,7 +98,7 @@ _tmp_out_alloc(Render_Engine *re)
}
static void
static int
eng_setup(Evas *e, void *in)
{
Render_Engine *re;
@ -136,6 +136,8 @@ eng_setup(Evas *e, void *in)
/* render engine specific data */
re = calloc(1, sizeof(Render_Engine));
if (!re)
return 0;
e->engine.data.output = re;
re->disp = info->info.display;
re->draw = info->info.drawable;
@ -172,13 +174,15 @@ eng_setup(Evas *e, void *in)
re->tmp_out = NULL;
}
}
if (!e->engine.data.output) return;
if (!e->engine.data.output) return 0;
/* add a draw context if we dont have one */
if (!e->engine.data.context)
e->engine.data.context =
e->engine.func->context_new(e->engine.data.output);
/* check if the display can do shm */
re->shm = evas_software_x11_x_can_do_shm(re->disp);
return 1;
}
static void

View File

@ -105,7 +105,7 @@ eng_info_free(Evas *e, void *info)
free(in);
}
static void
static int
eng_setup(Evas *e, void *in)
{
Render_Engine *re;
@ -135,11 +135,13 @@ eng_setup(Evas *e, void *in)
info->info.fullscreen);
re->ob->onebuf = ponebuf;
}
if (!e->engine.data.output) return;
if (!e->engine.data.output) return 0;
if (!e->engine.data.context)
e->engine.data.context = e->engine.func->context_new(e->engine.data.output);
re = e->engine.data.output;
return 1;
}
static void

View File

@ -23,7 +23,7 @@ static void *_output_setup(int w, int h, int rot, QWidget *target);
static void *eng_info(Evas *e);
static void eng_info_free(Evas *e, void *info);
static void eng_setup(Evas *e, void *info);
static int eng_setup(Evas *e, void *info);
static void eng_output_free(void *data);
static void eng_output_resize(void *data, int w, int h);
static void eng_output_tile_size_set(void *data, int w, int h);
@ -42,6 +42,8 @@ _output_setup(int w, int h, int rot, QWidget *target)
Render_Engine *re;
re = calloc(1, sizeof(Render_Engine));
if (!re)
return NULL;
/* if we haven't initialized - init (automatic abort if already done) */
evas_common_cpu_init();
@ -101,7 +103,7 @@ eng_info_free(Evas *e, void *info)
free(in);
}
static void
static int
eng_setup(Evas *e, void *in)
{
Render_Engine *re;
@ -114,12 +116,14 @@ eng_setup(Evas *e, void *in)
e->output.h,
info->info.rotation,
info->info.target);
if (!e->engine.data.output) return;
if (!e->engine.data.output) return 0;
if (!e->engine.data.context)
e->engine.data.context =
e->engine.func->context_new(e->engine.data.output);
re = e->engine.data.output;
return 1;
}
static void

View File

@ -86,21 +86,22 @@ evas_engine_sdl_info_free (Evas* e __UNUSED__, void* info)
}
/* SDL engine output manipulation function */
static void
static int
evas_engine_sdl_setup (Evas* e, void* in)
{
Evas_Engine_Info_SDL* info = (Evas_Engine_Info_SDL*) in;
/* if we arent set to sdl, why the hell do we get called?! */
if (evas_output_method_get(e) != evas_render_method_lookup("software_sdl"))
return ;
return 0;
SDL_Init(SDL_INIT_NOPARACHUTE);
if (SDL_InitSubSystem(SDL_INIT_VIDEO) < 0)
{
fprintf(stderr, "SDL_Init failed with %s\n", SDL_GetError());
exit(-1);
SDL_Quit();
return 0;
}
/* lets just set up */
@ -111,10 +112,12 @@ evas_engine_sdl_setup (Evas* e, void* in)
info->info.hwsurface);
if (!e->engine.data.output)
return;
return 0;
e->engine.func = &func;
e->engine.data.context = e->engine.func->context_new(e->engine.data.output);
return 1;
}
static void

View File

@ -45,7 +45,7 @@ static int _best_depth_get (int backend, void *connection, int scree
static void *eng_info(Evas *e);
static void eng_info_free(Evas *e, void *info);
static void eng_setup(Evas *e, void *info);
static int eng_setup(Evas *e, void *info);
static void eng_output_free(void *data);
static void eng_output_resize(void *data, int w, int h);
static void eng_output_tile_size_set(void *data, int w, int h);
@ -79,6 +79,8 @@ _output_xlib_setup(int w,
Render_Engine *re;
re = calloc(1, sizeof(Render_Engine));
if (!re)
return NULL;
evas_software_xlib_x_init();
evas_software_xlib_x_color_init();
@ -147,6 +149,8 @@ _output_xcb_setup(int w,
Render_Engine *re;
re = calloc(1, sizeof(Render_Engine));
if (!re)
return NULL;
evas_software_xcb_x_init();
evas_software_xcb_x_color_init();
@ -328,7 +332,7 @@ eng_info_free(Evas *e __UNUSED__, void *info)
free(in);
}
static void
static int
eng_setup(Evas *e, void *in)
{
Render_Engine *re;
@ -378,9 +382,9 @@ eng_setup(Evas *e, void *in)
re->outbuf_idle_flush = evas_software_xlib_outbuf_idle_flush;
}
#ifdef BUILD_ENGINE_SOFTWARE_XCB
if (info->info.backend == 1)
{
#ifdef BUILD_ENGINE_SOFTWARE_XCB
re = _output_xcb_setup(e->output.w,
e->output.h,
info->info.rotation,
@ -405,8 +409,8 @@ eng_setup(Evas *e, void *in)
re->outbuf_free_region_for_update = evas_software_xcb_outbuf_free_region_for_update;
re->outbuf_flush = evas_software_xcb_outbuf_flush;
re->outbuf_idle_flush = evas_software_xcb_outbuf_idle_flush;
#endif
}
#endif
e->engine.data.output = re;
}
@ -437,9 +441,9 @@ eng_setup(Evas *e, void *in)
evas_software_xlib_outbuf_debug_set(re->ob, info->info.debug);
}
#ifdef BUILD_ENGINE_SOFTWARE_XCB
if (info->info.backend == 1)
{
#ifdef BUILD_ENGINE_SOFTWARE_XCB
evas_software_xcb_outbuf_free(re->ob);
re->ob = evas_software_xcb_outbuf_setup_x(e->output.w,
e->output.h,
@ -457,16 +461,18 @@ eng_setup(Evas *e, void *in)
info->info.shape_dither,
info->info.destination_alpha);
evas_software_xcb_outbuf_debug_set(re->ob, info->info.debug);
#endif
}
#endif
re->ob->onebuf = ponebuf;
}
if (!e->engine.data.output) return;
if (!e->engine.data.output) return 0;
if (!e->engine.data.context)
e->engine.data.context =
e->engine.func->context_new(e->engine.data.output);
re = e->engine.data.output;
return 1;
}
static void