more glue/infra. glue evas api to engine together. gl engine gets stubs.

SVN revision: 51028
This commit is contained in:
Carsten Haitzler 2010-08-12 06:11:13 +00:00
parent 83f2ef6142
commit 01b7216880
6 changed files with 60 additions and 5 deletions

View File

@ -1884,6 +1884,7 @@ evas_object_image_native_surface_set(Evas_Object *obj, Evas_Native_Surface *surf
MAGIC_CHECK(o, Evas_Object_Image, MAGIC_OBJ_IMAGE);
return;
MAGIC_CHECK_END();
if (!obj->layer->evas->engine.func->image_native_set) return;
o->engine_data =
obj->layer->evas->engine.func->image_native_set(obj->layer->evas->engine.data.output,
o->engine_data,
@ -1911,6 +1912,7 @@ evas_object_image_native_surface_get(const Evas_Object *obj)
MAGIC_CHECK(o, Evas_Object_Image, MAGIC_OBJ_IMAGE);
return NULL;
MAGIC_CHECK_END();
if (!obj->layer->evas->engine.func->image_native_get) return NULL;
return obj->layer->evas->engine.func->image_native_get(obj->layer->evas->engine.data.output,
o->engine_data);
}
@ -1945,6 +1947,10 @@ evas_object_image_scale_hint_set(Evas_Object *obj, Evas_Image_Scale_Hint hint)
}
#endif
o->scale_hint = hint;
if (obj->layer->evas->engine.func->image_content_hint_set)
obj->layer->evas->engine.func->image_scale_hint_set
(obj->layer->evas->engine.data.output,
o->engine_data, o->content_hint);
}
/**
@ -1998,8 +2004,12 @@ evas_object_image_content_hint_set(Evas_Object *obj, Evas_Image_Content_Hint hin
if (o->engine_data)
evas_common_pipe_op_image_flush(o->engine_data);
}
#endif
#endif
o->content_hint = hint;
if (obj->layer->evas->engine.func->image_content_hint_set)
obj->layer->evas->engine.func->image_content_hint_set
(obj->layer->evas->engine.data.output,
o->engine_data, o->content_hint);
}
/**

View File

@ -730,6 +730,9 @@ struct _Evas_Func
void (*image_map4_draw) (void *data, void *context, void *surface, void *image, RGBA_Map_Point *p, int smooth, int level);
void *(*image_map_surface_new) (void *data, int w, int h, int alpha);
void (*image_map_surface_free) (void *data, void *surface);
void (*image_content_hint_set) (void *data, void *surface, int hint);
int (*image_content_hint_get) (void *data, void *surface);
};
struct _Evas_Image_Load_Func

View File

@ -281,6 +281,8 @@ struct _Evas_GL_Image
int mipmap;
unsigned char loose : 1;
} native;
int scale_hint, content_hint;
unsigned char dirty : 1;
unsigned char cached : 1;
@ -407,6 +409,8 @@ Evas_GL_Image *evas_gl_common_image_new(Evas_GL_Context *gc, int w, int h, in
Evas_GL_Image *evas_gl_common_image_alpha_set(Evas_GL_Image *im, int alpha);
void evas_gl_common_image_native_enable(Evas_GL_Image *im);
void evas_gl_common_image_native_disable(Evas_GL_Image *im);
void evas_gl_common_image_scale_hint_set(Evas_GL_Image *im, int hint);
void evas_gl_common_image_content_hint_set(Evas_GL_Image *im, int hint);
void evas_gl_common_image_free(Evas_GL_Image *im);
Evas_GL_Image *evas_gl_common_image_surface_new(Evas_GL_Context *gc, int w, int h, int alpha);
void evas_gl_common_image_dirty(Evas_GL_Image *im, int x, int y, int w, int h);

View File

@ -264,6 +264,22 @@ evas_gl_common_image_native_disable(Evas_GL_Image *im)
im->tex = evas_gl_common_texture_new(im->gc, im->im);
}
void
evas_gl_common_image_scale_hint_set(Evas_GL_Image *im, int hint)
{
im->scale_hint = hint;
// FIXME: take advantage of this even in gl (eg if image is
// 1600x1200 but we always use it at 800x600 or even less - drop
// the texture res down for "non dynamic" stuff to save memory)
}
void
evas_gl_common_image_content_hint_set(Evas_GL_Image *im, int hint)
{
im->content_hint = hint;
// FIXME: make use of content hint
}
void
evas_gl_common_image_free(Evas_GL_Image *im)
{

View File

@ -1907,6 +1907,15 @@ eng_image_draw(void *data, void *context, void *surface, void *image, int src_x,
static void
eng_image_scale_hint_set(void *data __UNUSED__, void *image, int hint)
{
if (image) evas_gl_common_image_scale_hint_set(image, hint);
}
static int
eng_image_scale_hint_get(void *data __UNUSED__, void *image)
{
Evas_GL_Image *gim = image;
if (!gim) return EVAS_IMAGE_SCALE_HINT_NONE;
return gim->scale_hint;
}
static void
@ -1936,10 +1945,18 @@ eng_image_map_surface_free(void *data __UNUSED__, void *surface)
evas_gl_common_image_free(surface);
}
static int
eng_image_scale_hint_get(void *data __UNUSED__, void *image)
static void
eng_image_content_hint_set(void *data __UNUSED__, void *image, int hint)
{
return EVAS_IMAGE_SCALE_HINT_NONE;
if (image) evas_gl_common_image_content_hint_set(image, hint);
}
static int
eng_image_content_hint_get(void *data __UNUSED__, void *image)
{
Evas_GL_Image *gim = image;
if (!gim) return EVAS_IMAGE_CONTENT_HINT_NONE;
return gim->content_hint;
}
static void
@ -2098,6 +2115,9 @@ module_open(Evas_Module *em)
ORD(image_map_surface_new);
ORD(image_map_surface_free);
ORD(image_content_hint_set);
ORD(image_content_hint_get);
/* now advertise out own api */
em->functions = (void *)(&func);
return 1;

View File

@ -1240,7 +1240,9 @@ static Evas_Func func =
/* FUTURE software generic calls go here (done) */
eng_image_map4_draw,
eng_image_map_surface_new,
eng_image_map_surface_free
eng_image_map_surface_free,
NULL, // eng_image_content_hint_set - software doesnt use it
NULL // eng_image_content_hint_get - software doesnt use it
/* FUTURE software generic calls go here */
};