add call to get maximum image size (eg max texture size)

SVN revision: 64244
This commit is contained in:
Carsten Haitzler 2011-10-21 08:17:14 +00:00
parent f63b1d9ecd
commit 1541b0e97e
4 changed files with 49 additions and 3 deletions

View File

@ -2653,21 +2653,37 @@ EAPI void evas_image_cache_reload (Evas *e) EINA_ARG_NONN
* @param e The given evas pointer.
* @param size The cache size.
*
* This function sets the image cache of canvas.
* This function sets the image cache of canvas in bytes.
*
*/
EAPI void evas_image_cache_set (Evas *e, int size) EINA_ARG_NONNULL(1);
/**
* Set the image cache
* Get the image cache
*
* @param e The given evas pointer.
*
* This function returns the image cache of canvas.
* This function returns the image cache size of canvas in bytes.
*
*/
EAPI int evas_image_cache_get (const Evas *e) EINA_WARN_UNUSED_RESULT EINA_ARG_NONNULL(1) EINA_PURE;
/**
* Get the maximum image size evas can possibly handle
*
* @param e The given evas pointer.
* @param maxw Pointer to hold the return value in pixels of the maxumum width
* @param maxh Pointer to hold the return value in pixels of the maximum height
*
* This function returns the larges image or surface size that evas can handle
* in pixels, and if there is one, returns EINA_TRUE. It returns EINA_FALSE
* if no extra constraint on maximum image size exists. You still should
* check the return values of @p maxw and @p maxh as there may still be a
* limit, just a much higher one.
*
*/
EAPI Eina_Bool evas_image_max_size_get (const Evas *e, int *maxw, int *maxh) EINA_ARG_NONNULL(1) EINA_PURE;
/**
* @}
*/

View File

@ -2139,6 +2139,23 @@ evas_image_cache_get(const Evas *e)
return e->engine.func->image_cache_get(e->engine.data.output);
}
EAPI Eina_Bool
evas_image_max_size_get(const Evas *e, int *maxw, int *maxh)
{
int w = 0, h = 0;
MAGIC_CHECK(e, Evas, MAGIC_EVAS);
return EINA_FALSE;
MAGIC_CHECK_END();
if (maxw) *maxw = 0xffff;
if (maxh) *maxh = 0xffff;
if (!e->engine.func->image_max_size_get) return EINA_FALSE;
e->engine.func->image_max_size_get(e->engine.data.output, &w, &h);
if (maxw) *maxw = w;
if (maxh) *maxh = h;
return EINA_TRUE;
}
/* all nice and private */
static void
_proxy_unset(Evas_Object *proxy)

View File

@ -834,6 +834,9 @@ struct _Evas_Func
int (*image_animated_loop_count_get) (void *data, void *image);
double (*image_animated_frame_duration_get) (void *data, void *image, int start_frame, int frame_num);
Eina_Bool (*image_animated_frame_set) (void *data, void *image, int frame_index);
/* max size query */
void (*image_max_size_get) (void *data, int *maxw, int *maxh);
};
struct _Evas_Image_Load_Func

View File

@ -3764,6 +3764,14 @@ eng_image_animated_frame_set(void *data __UNUSED__, void *image, int frame_index
return EINA_TRUE;
}
static void
eng_image_max_size_get(void *data, int *maxw, int *maxh)
{
Render_Engine *re = (Render_Engine *)data;
if (maxw) *maxw = re->win->gl_context->shared->info.max_texture_size;
if (maxh) *maxh = re->win->gl_context->shared->info.max_texture_size;
}
static int
module_open(Evas_Module *em)
{
@ -3880,6 +3888,8 @@ module_open(Evas_Module *em)
ORD(image_animated_frame_duration_get);
ORD(image_animated_frame_set);
ORD(image_max_size_get);
/* now advertise out own api */
em->functions = (void *)(&func);
return 1;