evas: fix initialisation of cairo context in software backend.

This commit is contained in:
Cedric BAIL 2015-04-03 16:31:11 +02:00
parent 986704dfb4
commit 61c1e7d103
1 changed files with 16 additions and 12 deletions

View File

@ -4953,8 +4953,8 @@ void evas_engine_software_generic_shutdown(void)
EVAS_EINA_MODULE_DEFINE(engine, software_generic);
#endif
#define USE(Obj, Sym, Error) \
if (!Sym) _ector_cairo_symbol_get(Obj, #Sym); \
#define USE(Obj, Sym, Error) \
if (!Sym) Sym = _ector_cairo_symbol_get(Obj, #Sym); \
if (!Sym) return Error;
static inline void *
@ -5007,24 +5007,28 @@ _ector_cairo_software_surface_surface_set(Eo *obj, Ector_Cairo_Software_Surface_
USE(obj, cairo_create, );
USE(obj, cairo_destroy, );
cairo_surface_destroy(pd->surface); pd->surface = NULL;
cairo_destroy(pd->ctx); pd->ctx = NULL;
if (pd->surface) cairo_surface_destroy(pd->surface); pd->surface = NULL;
if (pd->ctx) cairo_destroy(pd->ctx); pd->ctx = NULL;
pd->pixels = NULL;
pd->width = 0;
pd->height = 0;
pd->surface = cairo_image_surface_create_for_data(pixels, CAIRO_FORMAT_ARGB32, width, height, width);
if (pd->surface) goto end;
pd->ctx = cairo_create(pd->surface);
if (pd->ctx)
if (pixels)
{
pd->pixels = pixels;
pd->width = width;
pd->height = height;
pd->surface = cairo_image_surface_create_for_data(pixels,
CAIRO_FORMAT_ARGB32,
width, height, width);
if (!pd->surface) goto end;
pd->ctx = cairo_create(pd->surface);
if (!pd->ctx) goto end;
}
pd->pixels = pixels;
pd->width = width;
pd->height = height;
end:
eo_do(obj, ector_cairo_surface_context_set(pd->ctx));
}