unsigned char direct : 1; // evas gl direct renderable
/*Disable generate atlas for texture unit, EINA_FALSE by default*/
Eina_Bool disable_atlas : 1;
- Eina_Bool rotated : 1; // check eng_image_orient_set() called
};
struct _Evas_GL_Font_Texture
if (im->native.data)
return im;
- if (im->im && im->rotated)
- {
- im_new = _rotate_image_data(data, image);
- if (!im_new)
- {
- if (err) *err = EVAS_LOAD_ERROR_RESOURCE_ALLOCATION_FAILED;
- return im;
- }
-
- *image_data = im_new->im->image.data;
- if (tofree) *tofree = EINA_TRUE;
- return im_new;
- }
+ if ((tofree != NULL) && im->im && (im->orient != EVAS_IMAGE_ORIENT_NONE))
+ goto rotate_image;
#ifdef GL_GLES
re->window_use(re->software.ob);
if (!im->im)
{
- // FIXME: Should we create an FBO and draw the texture there, to then read it back?
+ if (tofree)
+ goto rotate_image;
+ else
+ {
ERR("GL image has no source data, failed to get pixel data");
if (err) *err = EVAS_LOAD_ERROR_RESOURCE_ALLOCATION_FAILED;
return NULL;
}
+ }
#ifdef EVAS_CSERVE2
if (evas_cserve2_use_get() && evas_cache2_image_cached(&im->im->cache_entry))
else
#endif
error = evas_cache_image_load_data(&im->im->cache_entry);
+
+ if (error != EVAS_LOAD_ERROR_NONE)
+ {
+ if (tofree)
+ goto rotate_image;
+ }
+
evas_gl_common_image_alloc_ensure(im);
switch (im->cs.space)
{
}
if (err) *err = error;
return im;
+
+rotate_image:
+ // rotate data for image save
+ im_new = _rotate_image_data(data, image);
+ if (!im_new)
+ {
+ if (err) *err = EVAS_LOAD_ERROR_RESOURCE_ALLOCATION_FAILED;
+ ERR("Image rotation failed.");
+ return im;
+ }
+ *tofree = EINA_TRUE;
+ *image_data = im_new->im->image.data;
+ return im_new;
}
static void *
im_new->cached = EINA_FALSE;
im_new->orient = orient;
- im_new->rotated = EINA_TRUE;
evas_gl_common_image_free(im);
return im_new;