Enlightenment CVS committal
Author : cedric
Project : e17
Module : libs/evas
Dir : e17/libs/evas/src/modules/engines/directfb
Modified Files:
evas_engine_dfb.c evas_engine_dfb_image_objects.c
Log Message:
Fix directfb engine with new Evas cache API.
NOTE: This engine should be rewritten and use the new engine cache api.
===================================================================
RCS file: /cvs/e/e17/libs/evas/src/modules/engines/directfb/evas_engine_dfb.c,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -3 -r1.12 -r1.13
--- evas_engine_dfb.c 25 Feb 2008 06:13:53 -0000 1.12
+++ evas_engine_dfb.c 24 Apr 2008 14:37:14 -0000 1.13
@@ -99,11 +99,8 @@
/* We create a "fake" RGBA_Image which points the to DFB surface. Each
access
* to that surface is wrapped in Lock / Unlock calls whenever the data is
* manipulated directly. */
- im = evas_cache_image_empty(evas_common_image_cache_get());
- im->image->w = w;
- im->image->h = h;
- im->image->no_free = 1;
- im->image->data = NULL;
+ im = (RGBA_Image*) evas_cache_image_empty(evas_common_image_cache_get());
+ evas_cache_image_size_set(&im->cache_entry, w, h);
re->rgba_image = im;
return re;
@@ -119,7 +116,7 @@
if (re->rects)
evas_common_tilebuf_free_render_rects(re->rects);
re->backbuf->Release(re->backbuf);
- evas_cache_image_drop(re->rgba_image);
+ evas_cache_image_drop(&re->rgba_image->cache_entry);
free(re);
evas_common_font_shutdown();
@@ -151,9 +148,7 @@
new_surf->StretchBlit(new_surf, re->backbuf, NULL, NULL);
re->backbuf->Release(re->backbuf);
re->backbuf = new_surf;
- re->rgba_image->image->w = w;
- re->rgba_image->image->h = h;
- re->rgba_image->image->data = NULL;
+ re->rgba_image = (RGBA_Image*)
evas_cache_image_size_set(&re->rgba_image->cache_entry, w, h);
}
}
@@ -240,7 +235,7 @@
re->backbuf->SetClip(re->backbuf, NULL);
re->backbuf->Lock(re->backbuf, DSLF_WRITE, &pixels, &pitch);
- re->rgba_image->image->data = pixels;
+ re->rgba_image->image.data = pixels;
return re->rgba_image;
}
@@ -258,7 +253,7 @@
re->surface->Flip(re->surface, ®ion, DSFLIP_NONE);
evas_common_cpu_end_opt();
- re->rgba_image->image->data = NULL;
+ re->rgba_image->image.data = NULL;
}
static void
===================================================================
RCS file:
/cvs/e/e17/libs/evas/src/modules/engines/directfb/evas_engine_dfb_image_objects.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -3 -r1.9 -r1.10
--- evas_engine_dfb_image_objects.c 10 Feb 2007 17:23:06 -0000 1.9
+++ evas_engine_dfb_image_objects.c 24 Apr 2008 14:37:14 -0000 1.10
@@ -69,26 +69,14 @@
provider->RenderTo(provider, image, NULL);
provider->Release(provider);
- im = evas_common_image_new();
- im->image = evas_common_image_surface_new(im);
- if (!im->image)
- {
- image->Release(image);
- _dfb_image_free(im);
- return NULL;
- }
- im->image->w = dsc.width;
- im->image->h = dsc.height;
- im->image->data = (void *)image;
- im->image->no_free = 0;
- if (img_desc.caps & DICAPS_ALPHACHANNEL)
- im->flags |= RGBA_IMAGE_HAS_ALPHA;
+ im = (RGBA_Image *) evas_cache_image_data(evas_common_image_cache_get(),
+ dsc.width, dsc.height,
+ (void*) image,
+ img_desc.caps &
DICAPS_ALPHACHANNEL,
+ EVAS_COLORSPACE_ARGB8888);
-// im->timestamp = mod_time;
- if (file)
- im->info.file = strdup(file);
- if (key)
- im->info.key = strdup(key);
+ im->cache_entry.file = strdup(file);
+ im->cache_entry.key = strdup(key);
_dfb_image_ref(im);
return im;
@@ -119,7 +107,7 @@
if (im)
{
- surf = (IDirectFBSurface *) im->image->data;
+ surf = (IDirectFBSurface *) im->image.data;
if (surf->Lock(surf, DSLF_WRITE, &p, &pitch) == DFB_OK)
{
memcpy(p, image_data, w * h * sizeof(DATA32));
@@ -149,9 +137,9 @@
re = (Render_Engine *) data;
im = image;
if (w)
- *w = im->image->w;
+ *w = im->cache_entry.w;
if (h)
- *h = im->image->h;
+ *h = im->cache_entry.h;
}
void *
@@ -165,15 +153,15 @@
re = (Render_Engine *) data;
im_old = image;
- im = _dfb_image_create(re, w,h);
- old_surf = (IDirectFBSurface *) im_old->image->data;
+ im = _dfb_image_create(re, w, h);
+ old_surf = (IDirectFBSurface *) im_old->image.data;
if (im)
{
outrect.x = 0;
outrect.y = 0;
outrect.w = w;
outrect.h = h;
- new_surf = (IDirectFBSurface *) im->image->data;
+ new_surf = (IDirectFBSurface *) im->image.data;
new_surf->StretchBlit(new_surf, old_surf, NULL, &outrect);
}
evas_common_cpu_end_opt;
@@ -208,8 +196,8 @@
re = (Render_Engine *) data;
im = image;
- surf = (IDirectFBSurface *) im->image->data;
- size = im->image->w * im->image->h * sizeof(DATA32);
+ surf = (IDirectFBSurface *) im->image.data;
+ size = im->cache_entry.w * im->cache_entry.h * sizeof(DATA32);
surf->Lock(surf, DSLF_READ, &p, &pitch);
if ((buf = malloc(size)))
@@ -229,12 +217,12 @@
re = (Render_Engine *)data;
im = image;
- if (image_data != im->image->data)
+ if (image_data != im->image.data)
{
int w, h;
- w = im->image->w;
- h = im->image->h;
+ w = im->cache_entry.w;
+ h = im->cache_entry.h;
_dfb_image_unref(im);
/* FIXME alpha and cspace (0, 0) is not used here yet */
return evas_engine_directfb_image_new_from_data(data, w, h, image_data,
0, 0);
@@ -302,10 +290,10 @@
DFBRectangle outrect;
RGBA_Image *im = (RGBA_Image *) image;
RGBA_Draw_Context *dc = (RGBA_Draw_Context *) context;
- IDirectFBSurface *img = (IDirectFBSurface *) im->image->data;
+ IDirectFBSurface *img = (IDirectFBSurface *) im->image.data;
- src_w = im->image->w;
- src_h = im->image->h;
+ src_w = im->cache_entry.w;
+ src_h = im->cache_entry.h;
dst_w = re->tb->outbuf_w;
dst_h = re->tb->outbuf_h;
@@ -573,16 +561,15 @@
*/
static void
-_dfb_image_surface_free(RGBA_Surface *is)
+_dfb_image_surface_free(RGBA_Image *im)
{
IDirectFBSurface *surf;
- if ( (is->data) && (!is->no_free) )
+ if ( (im->image.data) && (!im->image.no_free) )
{
- surf = (IDirectFBSurface *)is->data;
+ surf = (IDirectFBSurface *)im->image.data;
surf->Release(surf);
- is->data = NULL;
+ im->image.data = NULL;
}
- free(is);
}
@@ -593,49 +580,33 @@
DFBSurfaceDescription dsc;
IDirectFBSurface *surf;
- im = evas_common_image_new();
- if (!im) return NULL;
- im->image = evas_common_image_surface_new(im);
- if (!im->image)
- {
- _dfb_image_free(im);
- return NULL;
- }
- im->image->w = w;
- im->image->h = h;
-
dsc.flags = DSDESC_WIDTH | DSDESC_HEIGHT | DSDESC_PIXELFORMAT;
dsc.width = w;
dsc.height = h;
dsc.pixelformat = DSPF_ARGB;
if (re->dfb->CreateSurface(re->dfb, &dsc, &surf) != DFB_OK)
- {
- _dfb_image_free(im);
- return NULL;
- }
- im->image->data = (void*) surf;
- im->flags = RGBA_IMAGE_IS_DIRTY;
- im->references = 1;
- return im;
+ return NULL;
+
+ return (RGBA_Image*) evas_cache_image_data(evas_common_image_cache_get(),
+ w, h,
+ (void*) surf,
+ 1, EVAS_COLORSPACE_ARGB8888);
}
static void
_dfb_image_free(RGBA_Image *im)
{
- if (im->image) _dfb_image_surface_free(im->image);
- if (im->info.file) free(im->info.file);
- if (im->info.key) free(im->info.key);
- if (im->info.comment) free(im->info.comment);
+ if (im->image.data) _dfb_image_surface_free(im);
free(im);
}
static void
_dfb_image_ref(RGBA_Image *im)
{
- im->references++;
- if (im->references == 1) /* we were in cache - take us out */
+ im->cache_entry.references++;
+ if (im->cache_entry.references == 1) /* we were in cache - take us out */
{
_dfb_image_uncache(im);
_dfb_image_store(im);
@@ -645,8 +616,8 @@
static void
_dfb_image_unref(RGBA_Image *im)
{
- im->references--;
- if (im->references <= 0) /* we were are now in cache - put us in */
+ im->cache_entry.references--;
+ if (im->cache_entry.references <= 0) /* we were are now in cache - put us
in */
{
_dfb_image_unstore(im);
if ((cache_size > 0) &&
@@ -741,11 +712,11 @@
if (im->flags & RGBA_IMAGE_IS_DIRTY) return;
if (im->flags & RGBA_IMAGE_INDEXED) return;
- if ((!im->info.file) && (!im->info.key)) return;
+ if ((!im->cache_entry.file) && (!im->cache_entry.key)) return;
l1 = 0;
- if (im->info.file) l1 = strlen(im->info.file);
+ if (im->cache_entry.file) l1 = strlen(im->cache_entry.file);
l2 = 0;
- if (im->info.key) l2 = strlen(im->info.key);
+ if (im->cache_entry.key) l2 = strlen(im->cache_entry.key);
// snprintf(buf, sizeof(buf), "%llx", im->timestamp);
// l3 = strlen(buf);
buf[0] = 0;
@@ -753,9 +724,9 @@
key = malloc(l1 + 3 + l2 + 3 + l3 +1);
if (!key) return;
key[0] = 0;
- if (im->info.file) strcpy(key, im->info.file);
+ if (im->cache_entry.file) strcpy(key, im->cache_entry.file);
strcat(key, "/:/");
- if (im->info.key) strcat(key, im->info.key);
+ if (im->cache_entry.key) strcat(key, im->cache_entry.key);
strcat(key, "/:/");
strcat(key, buf);
images = evas_hash_add(images, key, im);
@@ -771,11 +742,11 @@
char buf[256];
if (!(im->flags & RGBA_IMAGE_INDEXED)) return;
- if ((!im->info.file) && (!im->info.key)) return;
+ if ((!im->cache_entry.file) && (!im->cache_entry.key)) return;
l1 = 0;
- if (im->info.file) l1 = strlen(im->info.file);
+ if (im->cache_entry.file) l1 = strlen(im->cache_entry.file);
l2 = 0;
- if (im->info.key) l2 = strlen(im->info.key);
+ if (im->cache_entry.key) l2 = strlen(im->cache_entry.key);
// snprintf(buf, sizeof(buf), "%llx", im->timestamp);
// l3 = strlen(buf);
buf[0] = 0;
@@ -783,9 +754,9 @@
key = malloc(l1 + 3 + l2 + 3 + l3 +1);
if (!key) return;
key[0] = 0;
- if (im->info.file) strcpy(key, im->info.file);
+ if (im->cache_entry.file) strcpy(key, im->cache_entry.file);
strcat(key, "/:/");
- if (im->info.key) strcat(key, im->info.key);
+ if (im->cache_entry.key) strcat(key, im->cache_entry.key);
strcat(key, "/:/");
strcat(key, buf);
images = evas_hash_del(images, key, im);
@@ -830,15 +801,15 @@
im = (RGBA_Image *)l;
ok = 0;
- if ((filename) && (im->info.file) &&
- (!strcmp(filename, im->info.file)))
+ if ((filename) && (im->cache_entry.file) &&
+ (!strcmp(filename, im->cache_entry.file)))
ok++;
- if ((!filename) && (!im->info.file))
+ if ((!filename) && (!im->cache_entry.file))
ok++;
- if ((key) && (im->info.key) &&
- (!strcmp(key, im->info.key)))
+ if ((key) && (im->cache_entry.key) &&
+ (!strcmp(key, im->cache_entry.key)))
ok++;
- if ((!key) && (!im->info.key))
+ if ((!key) && (!im->cache_entry.key))
ok++;
// if (im->timestamp == timestamp)
// ok++;
-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference
Don't miss this year's exciting event. There's still time to save $100.
Use priority code J8TL2D2.
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
enlightenment-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs