if (re->tb) evas_common_tilebuf_free(re->tb);
if (re->rects) evas_common_tilebuf_free_render_rects(re->rects);
if (re->tmp_out) evas_cache_image_drop(&re->tmp_out->cache_entry);
- if (re->soft16_engine_image) evas_cache_engine_image_drop(&re->soft16_engine_image->cache_entry);
+ if (re->soft16_engine_image)
+ evas_cache_engine_image_drop(&re->soft16_engine_image->cache_entry);
+ if (re->cache) evas_cache_engine_image_shutdown(re->cache);
+
+ if (re->update_rects)
+ free(re->update_rects);
free(re);
evas_common_font_shutdown();
evas_common_image_shutdown();
evas_common_soft16_image_shutdown();
+
+ SDL_QuitSubSystem(SDL_INIT_VIDEO);
}
static void
Render_Engine *re = data;
SDL_Surface *surface;
- if ((re->w == w) && (re->h == h)) return;
+ if ((re->tb->outbuf_w == w) && (re->tb->outbuf_h == h)) return;
evas_cache_engine_image_drop(&re->soft16_engine_image->cache_entry);
re->cur_rect = re->rects;
if (re->rot != 0) _tmp_out_alloc(re); /* grows if required */
}
+
if (!re->cur_rect)
{
if (re->rects) evas_common_tilebuf_free_render_rects(re->rects);
_tmp_out_process(re, rect.x, rect.y, w, h);
++re->update_rects_count;
+
+ evas_common_cpu_end_opt();
}
static void
if (!eim) return 1;
im = (Soft16_Image *) eim->cache_entry.src;
- if (im->cache_entry.flags.alpha) return 1;
+ switch (eim->cache_entry.src->space)
+ {
+ case EVAS_COLORSPACE_ARGB8888:
+ if (im->cache_entry.flags.alpha) return 1;
+ default:
+ break;
+ }
return 0;
}
SDL_Engine_Image_Entry *eim;
eim = image;
- if (w) *w = eim->cache_entry.w;
- if (h) *h = eim->cache_entry.h;
+ if (w) *w = eim->cache_entry.src->w;
+ if (h) *h = eim->cache_entry.src->h;
}
static int
evas_engine_sdl16_image_colorspace_get(void *data __UNUSED__, void *image __UNUSED__)
{
- return EVAS_COLORSPACE_RGB565_A5P;
+ SDL_Engine_Image_Entry *eim = image;
+
+ if (!eim) return EVAS_COLORSPACE_RGB565_A5P;
+ return eim->cache_entry.src->space;
}
static void
evas_engine_sdl16_image_colorspace_set(void *data __UNUSED__, void *image __UNUSED__, int cspace __UNUSED__)
{
- /* FIXME: Not implemented. */
+ SDL_Engine_Image_Entry *eim = image;
+
+ if (!eim) return;
+ if (eim->cache_entry.src->space == cspace) return;
+
+ evas_cache_engine_image_colorspace(&eim->cache_entry, cspace, NULL);
}
static void*
SDL_Engine_Image_Entry *eim = image;
Soft16_Image *im;
int error;
-
+
if (!eim)
{
*image_data = NULL;
+ if (err) *err = EVAS_LOAD_ERROR_GENERIC;
return NULL;
}
im = (Soft16_Image *) eim->cache_entry.src;
- error = evas_cache_image_load_data(&im->cache_entry);
if (to_write)
- eim = (SDL_Engine_Image_Entry *) evas_cache_engine_image_alone(&eim->cache_entry,
- NULL);
+ eim = (SDL_Engine_Image_Entry *) evas_cache_engine_image_dirty(&eim->cache_entry,
+ 0, 0, eim->cache_entry.src->w, eim->cache_entry.src->h);
+ error = evas_cache_image_load_data(&im->cache_entry);
/* FIXME: Handle colorspace conversion correctly. */
if (image_data) *image_data = (DATA32 *) im->pixels;
if (im->cache_entry.flags.alpha == has_alpha) return eim;
- eim = (SDL_Engine_Image_Entry *) evas_cache_engine_image_alone(&eim->cache_entry,
- NULL);
-
- im = (Soft16_Image *) eim->cache_entry.src;
+ //eim = (SDL_Engine_Image_Entry *) evas_cache_engine_image_alone(&eim->cache_entry, NULL);
+ //im = (Soft16_Image *) eim->cache_entry.src;
im->cache_entry.flags.alpha = has_alpha;
eim = (SDL_Engine_Image_Entry *) evas_cache_engine_image_dirty(&eim->cache_entry, 0, 0, eim->cache_entry.w, eim->cache_entry.h);
dst_region_x, dst_region_y, dst_region_w, dst_region_h,
smooth);
+ evas_common_cpu_end_opt ();
if (mustlock_im)
SDL_UnlockSurface(eim->surface);
Soft16_Image *dst = (Soft16_Image *) eim->cache_entry.src;
int mustlock_im = 0;
- if (!im)
- im = (RGBA_Image *) evas_cache_image_empty(evas_common_image_cache_get());
- evas_cache_image_surface_alloc(&im->cache_entry, dst->cache_entry.w, dst->cache_entry.h);
-
if (eim->surface && SDL_MUSTLOCK(eim->surface))
{
mustlock_im = 1;
evas_common_soft16_font_glyph_new,
evas_common_soft16_font_glyph_free,
evas_common_soft16_font_glyph_draw);
- evas_common_font_draw(im, context, font, x, y, intl_props);
+ evas_common_font_draw((RGBA_Image *) eim->cache_entry.src, context, font, x, y, intl_props);
evas_common_draw_context_font_ext_set(context,
NULL,
NULL,
evas_common_soft16_line_draw((Soft16_Image *) eim->cache_entry.src,
context,
x1, y1, x2, y2);
+ evas_common_cpu_end_opt();
if (mustlock_im)
SDL_UnlockSurface(eim->surface);
im = (Soft16_Image *) eim->cache_entry.src;
evas_common_soft16_rectangle_draw(im, context, x, y, w, h);
+ evas_common_cpu_end_opt();
if (mustlock_im)
SDL_UnlockSurface(eim->surface);
}
evas_common_soft16_polygon_draw((Soft16_Image *) eim->cache_entry.src, context, polygon, x, y);
+ evas_common_cpu_end_opt();
if (mustlock_im)
SDL_UnlockSurface(eim->surface);
im = (Soft16_Image *) ie->src;
- if (im->pixels)
+ if (im)
{
- /* FIXME: Take care of CSPACE */
- sdl = SDL_CreateRGBSurfaceFrom(im->pixels,
- ie->w, ie->h,
- 16, ie->w * 2,
- RMASK565, GMASK565, BMASK565, AMASK565);
- eim->surface = sdl;
- eim->flags.engine_surface = 0;
+ evas_cache_image_load_data(&im->cache_entry);
+
+ if (im->pixels)
+ {
+ /* FIXME: Take care of CSPACE */
+ sdl = SDL_CreateRGBSurfaceFrom(im->pixels,
+ ie->w, ie->h,
+ 16, ie->w * 2,
+ RMASK565, GMASK565, BMASK565, AMASK565);
+ eim->surface = sdl;
+ eim->flags.engine_surface = 0;
+ }
}
return EVAS_LOAD_ERROR_NONE;
Evas_Engine_Info_SDL* in;
in = (Evas_Engine_Info_SDL*) info;
free(in);
- in = NULL;
}
/* SDL engine output manipulation function */
{
Render_Engine* re = data;
- if (re->cache)
- evas_cache_engine_image_shutdown(re->cache);
-
- evas_common_tilebuf_free(re->tb);
+ if (re->tb)
+ evas_common_tilebuf_free(re->tb);
if (re->rects)
evas_common_tilebuf_free_render_rects(re->rects);
+ if (re->rgba_engine_image)
+ evas_cache_engine_image_drop(&re->rgba_engine_image->cache_entry);
+ if (re->cache)
+ evas_cache_engine_image_shutdown(re->cache);
if (re->update_rects)
free(re->update_rects);
re->cur_rect = EINA_INLIST_GET(re->rects);
}
if (!re->cur_rect)
- return NULL;
+ {
+ if (re->rects) evas_common_tilebuf_free_render_rects(re->rects);
+ re->rects = NULL;
+ return NULL;
+ }
tb_rect = (Tilebuf_Rect*) re->cur_rect;
*cx = *x = tb_rect->x;
Render_Engine *re = calloc(1, sizeof(Render_Engine));
SDL_Surface *surface;
+ if (!re)
+ return NULL;
+
/* if we haven't initialized - init (automatic abort if already done) */
evas_common_cpu_init();
evas_common_blend_init();
re->cache = evas_cache_engine_image_init(&_sdl_cache_engine_image_cb, evas_common_image_cache_get());
if (!re->cache)
{
- CRIT("Evas_Cache_Engine_Image allocation failed!");
- exit(-1);
+ ERR("Evas_Cache_Engine_Image allocation failed!");
+ free (re);
+ return NULL;
}
re->tb = evas_common_tilebuf_new(w, h);
if (!surface)
{
- CRIT("SDL_SetVideoMode [ %i x %i x 32 ] failed.", w, h);
- exit(-1);
+ ERR("SDL_SetVideoMode [ %i x %i x 32 ] failed.", w, h);
+ evas_cache_engine_image_shutdown(re->cache);
+ free (re);
+ return NULL;
}
SDL_SetAlpha(surface, SDL_SRCALPHA | SDL_RLEACCEL, 0);
if (!re->rgba_engine_image)
{
CRIT("RGBA_Image allocation from SDL failed");
- exit(-1);
+ evas_cache_engine_image_shutdown(re->cache);
+ free (re);
+ return NULL;
}
SDL_FillRect(surface, NULL, 0);