if EVAS_STATIC_BUILD_SOFTWARE_GENERIC
lib_evas_libevas_la_SOURCES += \
modules/evas/engines/software_generic/evas_engine.c \
+modules/evas/engines/software_generic/evas_engine.h \
modules/evas/engines/software_generic/Evas_Engine_Software_Generic.h \
modules/evas/engines/software_generic/Evas_Engine_Software_Shared.h \
modules/evas/engines/software_generic/evas_native_tbm.c \
modules_evas_engines_software_generic_module_la_SOURCES = \
modules/evas/engines/software_generic/evas_engine.c \
+modules/evas/engines/software_generic/evas_engine.h \
modules/evas/engines/software_generic/Evas_Engine_Software_Generic.h \
modules/evas/engines/software_generic/Evas_Engine_Software_Shared.h \
modules/evas/engines/software_generic/evas_native_tbm.c \
/* if we fail to get engine_data, we have to return NULL */
if (!pixels || !data) goto error;
+ // TIZEN_ONLY(20171114) : image orient
+/*
if (!tofree)
{
o->engine_data = pixels;
if (!eina_hash_add(hash, data, px_entry))
goto error;
}
+*/
+
+ // TIZEN_ONLY(20171114) : image orient
+ if (tofree)
+ {
+ ENFN->image_free(ENC, o->engine_data);
+ o->engine_data = pixels;
+
+ if (ENFN->image_scale_hint_set)
+ ENFN->image_scale_hint_set(ENC, o->engine_data, o->scale_hint);
+ if (ENFN->image_content_hint_set)
+ ENFN->image_content_hint_set(ENC, o->engine_data, o->content_hint);
+
+ }
+ else
+ {
+ o->engine_data = pixels;
+ }
+
+ if (ENFN->image_stride_get)
+ ENFN->image_stride_get(ENC, o->engine_data, &stride);
+ else
+ stride = o->cur->image.w * 4;
+
+ if (o->cur->image.stride != stride)
+ {
+ EINA_COW_IMAGE_STATE_WRITE_BEGIN(o, state_write)
+ state_write->image.stride = stride;
+ EINA_COW_IMAGE_STATE_WRITE_END(o, state_write);
+ }
+ o->pixels_checked_out++;
if (for_writing)
{
o->written = EINA_TRUE;
Eina_Inlist *maps; /* Evas_GL_Image_Data_Map */
Evas_Image_Orient orient;
+ Evas_Image_Orient rotated_orient; // TIZEN_ONLY(20171114) : image orient
int scale_hint, content_hint;
int csize;
#include "../gl_common/evas_gl_common.h"
#include "Evas_Engine_GL_Generic.h"
+#include "../software_generic/evas_engine.h"
#ifdef EVAS_CSERVE2
#include "evas_cs2_private.h"
Evas_Engine_GL_Context *gl_context;
RGBA_Draw_Context *dc;
int w, h;
+ void *pixels_in = NULL;
+ void *pixels_out = NULL;
+ if (!im1->im) return NULL;
w = im1->w;
h = im1->h;
h = im1->w;
}
+ // TIZEN_ONLY(20171114) : image orient
+ /*
if ((w * h) <= 0) return NULL;
alpha = eng_image_alpha_get(re, im1);
EVAS_COLORSPACE_ARGB8888, im2->im->image.data);
eng_gl_surface_unlock(re, im2);
+ */
+
+ // TIZEN_ONLY(20171114) : image orient
+ im2 = evas_gl_common_image_new_from_copied_data(gl_context, w, h, im1->im->image.data, alpha, im1->cs.space);
+ if (!im2 || !im2->im) return NULL;
+ im2->rotated_orient = im1->orient;
+
+ pixels_in = im1->im->image.data;
+ pixels_out = im2->im->image.data;
+
+ if (!pixels_out || !pixels_in) {
+ return NULL;
+ }
+
+
+ switch(im1->orient)
+ {
+ case EVAS_IMAGE_ORIENT_0:
+ memcpy(pixels_out, pixels_in, sizeof (unsigned int) * im1->w * im1->h);
+ break;
+ case EVAS_IMAGE_ORIENT_90:
+ _evas_image_rotate_90(pixels_out, pixels_in, im1->w, im1->h);
+ break;
+ case EVAS_IMAGE_ORIENT_180:
+ _evas_image_rotate_180(pixels_out, pixels_in, im1->w, im1->h);
+ break;
+ case EVAS_IMAGE_ORIENT_270:
+ _evas_image_rotate_270(pixels_out, pixels_in, im1->w, im1->h);
+ break;
+ case EVAS_IMAGE_FLIP_HORIZONTAL:
+ _evas_image_flip_horizontal(pixels_out, pixels_in, im1->w, im1->h);
+ break;
+ case EVAS_IMAGE_FLIP_VERTICAL:
+ _evas_image_flip_vertical(pixels_out, pixels_in, im1->w, im1->h);
+ break;
+ case EVAS_IMAGE_FLIP_TRANSPOSE:
+ _evas_image_flip_transpose(pixels_out, pixels_in, im1->w, im1->h);
+ break;
+ case EVAS_IMAGE_FLIP_TRANSVERSE:
+ _evas_image_flip_transverse(pixels_out, pixels_in, im1->w, im1->h);
+ break;
+ default:
+ ERR("Wrong orient value");
+ return NULL;
+ }
+
return im2;
}
static void *
eng_image_orient_set(void *engine, void *image, Evas_Image_Orient orient)
{
+ Render_Engine_GL_Generic *re = engine;
Evas_GL_Image *im;
- Evas_GL_Image *im_new;
+ Evas_GL_Image *im_new = NULL;
+ void *pixels_in = NULL;
+ void *pixels_out = NULL;
if (!image) return NULL;
im = image;
- if (im->orient == orient) return image;
+ if (im->orient == orient && !im->rotated_orient) return image;
gl_generic_window_find(engine);
evas_gl_common_image_update(im->gc, im);
- im_new = evas_gl_common_image_new(im->gc, im->w, im->h, im->alpha, im->cs.space);
+ // TIZEN_ONLY(20171114) : image orient
+ if (im->im)
+ {
+ if (!im->im->image.data)
+ {
+#ifdef EVAS_CSERVE2
+ if (evas_cserve2_use_get() && evas_cache2_image_cached(&im->im->cache_entry))
+ evas_cache2_image_load_data(&im->im->cache_entry);
+ else
+#endif
+ evas_cache_image_load_data(&im->im->cache_entry);
+ }
+ evas_gl_common_image_alloc_ensure(im);
+
+ // If the image has already been rotated because of evas_object_image_data_get()
+ // undo the previous orientation
+ if (im->rotated_orient)
+ {
+ int w, h;
+ w = im->w;
+ h = im->h;
+
+ if (im->rotated_orient == EVAS_IMAGE_ORIENT_90 ||
+ im->rotated_orient == EVAS_IMAGE_ORIENT_270 ||
+ im->rotated_orient == EVAS_IMAGE_FLIP_TRANSPOSE ||
+ im->rotated_orient == EVAS_IMAGE_FLIP_TRANSVERSE)
+ {
+ w = im->h;
+ h = im->w;
+ }
+
+ im_new = evas_gl_common_image_new_from_copied_data(im->gc, w, h, im->im->image.data, im->alpha, im->cs.space);
+ if (!im_new) return im;
+
+ pixels_in = im->im->image.data;
+ pixels_out = im_new->im->image.data;
+
+ if (!pixels_out || !pixels_in) {
+ ERR("evas_test !pixels_out || !pixels_in goto error");
+ goto on_error;
+ }
+
+ switch(im->rotated_orient)
+ {
+ case EVAS_IMAGE_ORIENT_0:
+ memcpy(pixels_out, pixels_in, sizeof (unsigned int) * im->w * im->h);
+ break;
+ case EVAS_IMAGE_ORIENT_90:
+ _evas_image_rotate_270(pixels_out, pixels_in, im->w, im->h);
+ break;
+ case EVAS_IMAGE_ORIENT_180:
+ _evas_image_rotate_180(pixels_out, pixels_in, im->w, im->h);
+ break;
+ case EVAS_IMAGE_ORIENT_270:
+ _evas_image_rotate_90(pixels_out, pixels_in, im->w, im->h);
+ break;
+ case EVAS_IMAGE_FLIP_HORIZONTAL:
+ _evas_image_flip_horizontal(pixels_out, pixels_in, im->w, im->h);
+ break;
+ case EVAS_IMAGE_FLIP_VERTICAL:
+ _evas_image_flip_vertical(pixels_out, pixels_in, im->w, im->h);
+ break;
+ case EVAS_IMAGE_FLIP_TRANSPOSE:
+ _evas_image_flip_transpose(pixels_out, pixels_in, im->w, im->h);
+ break;
+ case EVAS_IMAGE_FLIP_TRANSVERSE:
+ _evas_image_flip_transverse(pixels_out, pixels_in, im->w, im->h);
+ break;
+ default:
+ ERR("Wrong orient value");
+ goto on_error;
+ }
+ }
+ else
+ {
+ im_new = evas_gl_common_image_new_from_copied_data(im->gc, im->w, im->h, im->im->image.data, im->alpha, im->cs.space);
+ }
+ } // TIZEN_ONLY(20171114) : image orient
+
if (!im_new) return im;
im_new->load_opts = im->load_opts;
im_new->cached = EINA_FALSE;
im_new->orient = orient;
- im_new->tex = im->tex;
- im_new->tex->references++;
- im_new->tex->pt->references++;
+ im_new->rotated_orient = EVAS_IMAGE_ORIENT_NONE;
evas_gl_common_image_free(im);
return im_new;
+
+on_error:
+ evas_gl_common_image_free(im_new);
+ return im;
}
static Evas_Image_Orient
#include "evas_common_private.h" /* Also includes international specific stuff */
#include "evas_private.h"
#include "evas_blend_private.h"
+#include "evas_engine.h"
#ifdef EVAS_CSERVE2
#include "evas_cs2_private.h"
#endif
return eng_image_map_surface_new(engdata, w, h, alpha);
}
-static void
-_image_flip_horizontal(DATA32 *pixels_out, const DATA32 *pixels_in,
+EAPI void
+_evas_image_flip_horizontal(DATA32 *pixels_out, const DATA32 *pixels_in,
int iw, int ih)
{
const unsigned int *pi1, *pi2;
}
}
-static void
-_image_flip_vertical(DATA32 *pixels_out, const DATA32 *pixels_in,
+EAPI void
+_evas_image_flip_vertical(DATA32 *pixels_out, const DATA32 *pixels_in,
int iw, int ih)
{
const unsigned int *pi1, *pi2;
}
}
-static void
-_image_rotate_180(DATA32 *pixels_out, const DATA32 *pixels_in,
+EAPI void
+_evas_image_rotate_180(DATA32 *pixels_out, const DATA32 *pixels_in,
int iw, int ih)
{
const unsigned int *pi1, *pi2;
}
}
-static void
-_image_rotate_90(DATA32 *pixels_out, const DATA32 *pixels_in, int iw, int ih)
+EAPI void
+_evas_image_rotate_90(DATA32 *pixels_out, const DATA32 *pixels_in, int iw, int ih)
{
int x, y, xx, yy, xx2, yy2;
}
}
-static void
-_image_rotate_270(DATA32 *pixels_out, const DATA32 *pixels_in, int iw, int ih)
+EAPI void
+_evas_image_rotate_270(DATA32 *pixels_out, const DATA32 *pixels_in, int iw, int ih)
{
int x, y, xx, yy, xx2, yy2;
}
}
-static void
-_image_flip_transpose(DATA32 *pixels_out, const DATA32 *pixels_in,
+EAPI void
+_evas_image_flip_transpose(DATA32 *pixels_out, const DATA32 *pixels_in,
int iw, int ih)
{
int x, y;
}
}
-static void
-_image_flip_transverse(DATA32 *pixels_out, const DATA32 *pixels_in,
+EAPI void
+_evas_image_flip_transverse(DATA32 *pixels_out, const DATA32 *pixels_in,
int iw, int ih)
{
int x, y;
ERR("You shouldn't get this message, wrong orient value");
goto on_error;
case EVAS_IMAGE_ORIENT_90:
- _image_rotate_90(pixels_out, pixels_in, im->w, im->h);
+ _evas_image_rotate_90(pixels_out, pixels_in, im->w, im->h);
break;
case EVAS_IMAGE_ORIENT_180:
- _image_rotate_180(pixels_out, pixels_in, im->w, im->h);
+ _evas_image_rotate_180(pixels_out, pixels_in, im->w, im->h);
break;
case EVAS_IMAGE_ORIENT_270:
- _image_rotate_270(pixels_out, pixels_in, im->w, im->h);
+ _evas_image_rotate_270(pixels_out, pixels_in, im->w, im->h);
break;
default:
ERR("Wrong orient value");
(orient == EVAS_IMAGE_ORIENT_NONE)))
{
// flip horizontally to get the new orientation
- _image_flip_horizontal(pixels_out, pixels_in, im->w, im->h);
+ _evas_image_flip_horizontal(pixels_out, pixels_in, im->w, im->h);
}
else if (((im->orient == EVAS_IMAGE_ORIENT_NONE) &&
(orient == EVAS_IMAGE_FLIP_VERTICAL)) ||
(orient == EVAS_IMAGE_ORIENT_NONE)))
{
// flip vertically to get the new orientation
- _image_flip_vertical(pixels_out, pixels_in, im->w, im->h);
+ _evas_image_flip_vertical(pixels_out, pixels_in, im->w, im->h);
}
else
{
memcpy(pixels_tmp, pixels_in, sizeof (unsigned int) * w * h);
break;
case EVAS_IMAGE_ORIENT_90:
- _image_rotate_270(pixels_tmp, pixels_in, im->w, im->h);
+ _evas_image_rotate_270(pixels_tmp, pixels_in, im->w, im->h);
break;
case EVAS_IMAGE_ORIENT_180:
- _image_rotate_180(pixels_tmp, pixels_in, im->w, im->h);
+ _evas_image_rotate_180(pixels_tmp, pixels_in, im->w, im->h);
break;
case EVAS_IMAGE_ORIENT_270:
- _image_rotate_90(pixels_tmp, pixels_in, im->w, im->h);
+ _evas_image_rotate_90(pixels_tmp, pixels_in, im->w, im->h);
break;
case EVAS_IMAGE_FLIP_HORIZONTAL:
- _image_flip_horizontal(pixels_tmp, pixels_in, im->w, im->h);
+ _evas_image_flip_horizontal(pixels_tmp, pixels_in, im->w, im->h);
break;
case EVAS_IMAGE_FLIP_VERTICAL:
- _image_flip_vertical(pixels_tmp, pixels_in, im->w, im->h);
+ _evas_image_flip_vertical(pixels_tmp, pixels_in, im->w, im->h);
break;
case EVAS_IMAGE_FLIP_TRANSPOSE:
- _image_flip_transpose(pixels_tmp, pixels_in, im->w, im->h);
+ _evas_image_flip_transpose(pixels_tmp, pixels_in, im->w, im->h);
break;
case EVAS_IMAGE_FLIP_TRANSVERSE:
- _image_flip_transverse(pixels_tmp, pixels_in, im->w, im->h);
+ _evas_image_flip_transverse(pixels_tmp, pixels_in, im->w, im->h);
break;
default:
ERR("Wrong orient value");
memcpy(pixels_out, pixels_tmp, sizeof (unsigned int) * w * h);
break;
case EVAS_IMAGE_ORIENT_90:
- _image_rotate_90(pixels_out, pixels_tmp, tw, th);
+ _evas_image_rotate_90(pixels_out, pixels_tmp, tw, th);
break;
case EVAS_IMAGE_ORIENT_180:
- _image_rotate_180(pixels_out, pixels_tmp, tw, th);
+ _evas_image_rotate_180(pixels_out, pixels_tmp, tw, th);
break;
case EVAS_IMAGE_ORIENT_270:
- _image_rotate_270(pixels_out, pixels_tmp, tw, th);
+ _evas_image_rotate_270(pixels_out, pixels_tmp, tw, th);
break;
case EVAS_IMAGE_FLIP_HORIZONTAL:
- _image_flip_horizontal(pixels_out, pixels_tmp, tw, th);
+ _evas_image_flip_horizontal(pixels_out, pixels_tmp, tw, th);
break;
case EVAS_IMAGE_FLIP_VERTICAL:
- _image_flip_vertical(pixels_out, pixels_tmp, tw, th);
+ _evas_image_flip_vertical(pixels_out, pixels_tmp, tw, th);
break;
case EVAS_IMAGE_FLIP_TRANSPOSE:
- _image_flip_transpose(pixels_out, pixels_tmp, tw, th);
+ _evas_image_flip_transpose(pixels_out, pixels_tmp, tw, th);
break;
case EVAS_IMAGE_FLIP_TRANSVERSE:
- _image_flip_transverse(pixels_out, pixels_tmp, tw, th);
+ _evas_image_flip_transverse(pixels_out, pixels_tmp, tw, th);
break;
}
--- /dev/null
+#ifndef _EVAS_ENGINE_H
+# define _EVAS_ENGINE_H
+
+#ifdef EAPI
+# undef EAPI
+#endif
+
+#ifdef _WIN32
+# ifdef EFL_EVAS_BUILD
+# ifdef DLL_EXPORT
+# define EAPI __declspec(dllexport)
+# else
+# define EAPI
+# endif /* ! DLL_EXPORT */
+# else
+# define EAPI __declspec(dllimport)
+# endif /* ! EFL_EVAS_BUILD */
+#else
+# ifdef __GNUC__
+# if __GNUC__ >= 4
+# define EAPI __attribute__ ((visibility("default")))
+# else
+# define EAPI
+# endif
+# else
+# define EAPI
+# endif
+#endif /* ! _WIN32 */
+
+// TIZEN_ONLY(20171114) : image orient
+EAPI void _evas_image_flip_horizontal(DATA32 *pixels_out, const DATA32 *pixels_in, int iw, int ih);
+EAPI void _evas_image_flip_vertical(DATA32 *pixels_out, const DATA32 *pixels_in, int iw, int ih);
+EAPI void _evas_image_rotate_180(DATA32 *pixels_out, const DATA32 *pixels_in, int iw, int ih);
+EAPI void _evas_image_rotate_90(DATA32 *pixels_out, const DATA32 *pixels_in, int iw, int ih);
+EAPI void _evas_image_rotate_270(DATA32 *pixels_out, const DATA32 *pixels_in, int iw, int ih);
+EAPI void _evas_image_flip_transpose(DATA32 *pixels_out, const DATA32 *pixels_in, int iw, int ih);
+EAPI void _evas_image_flip_transverse(DATA32 *pixels_out, const DATA32 *pixels_in, int iw, int ih);
+
+#endif //_EVAS_ENGINE_H