int alpha;
Evas_GL_Image *im2;
Evas_Engine_GL_Context *gl_context;
- RGBA_Draw_Context *dc;
int w, h;
+ void *pixels_in = NULL;
+ void *pixels_out = NULL;
re->window_use(re->software.ob);
gl_context = re->window_gl_context_get(re->software.ob);
+ if (!im1->im) return NULL;
+
w = im1->w;
h = im1->h;
alpha = eng_image_alpha_get(re, im1);
h = im1->w;
}
- im2 = evas_gl_common_image_surface_new(gl_context, w, h, alpha, EINA_FALSE);
- if (!im2) return NULL;
+ 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;
- evas_gl_common_context_target_surface_set(gl_context, im2);
-
- // Create a new and temporary context
- dc = evas_common_draw_context_new();
- evas_common_draw_context_set_render_op(dc, _EVAS_RENDER_COPY);
- evas_common_draw_context_set_clip(dc, 0, 0, im2->w, im2->h);
- gl_context->dc = dc;
-
- // Image draw handle the rotation magically for us
- evas_gl_common_image_draw(gl_context, im1,
- 0, 0, w, h,
- 0, 0, im2->w, im2->h,
- 0);
-
- gl_context->dc = NULL;
- evas_common_draw_context_free(dc);
+ pixels_in = im1->im->image.data;
+ pixels_out = im2->im->image.data;
- // Reverts to the previous target surface.
- evas_gl_common_context_target_surface_set(gl_context, im1);
-
- // flush everything
- eng_gl_surface_lock(re, im2);
-
- // Rely on Evas_GL_Image infrastructure to allocate pixels
- im2->im = (RGBA_Image *)evas_cache_image_empty(evas_common_image_cache_get());
- if (!im2->im)
- {
- eng_gl_surface_unlock(re, im2);
- evas_gl_common_image_free(im2);
- return NULL;
- }
- im2->im->cache_entry.flags.alpha = !!alpha;
- evas_gl_common_image_alloc_ensure(im2);
-
- eng_gl_surface_read_pixels(re, im2, 0, 0, im2->w, im2->h,
- EVAS_COLORSPACE_ARGB8888, im2->im->image.data);
+ if (!pixels_out || !pixels_in) {
+ return NULL;
+ }
- eng_gl_surface_unlock(re, im2);
+ 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;
}
memcpy(pixels_out, pixels_in, sizeof (unsigned int) * im->w * im->h);
break;
case EVAS_IMAGE_ORIENT_90:
- _image_rotate_270(pixels_out, pixels_in, im->w, im->h);
+ _evas_image_rotate_270(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_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_FLIP_HORIZONTAL:
- _image_flip_horizontal(pixels_out, pixels_in, im->w, im->h);
+ _evas_image_flip_horizontal(pixels_out, pixels_in, im->w, im->h);
break;
case EVAS_IMAGE_FLIP_VERTICAL:
- _image_flip_vertical(pixels_out, pixels_in, im->w, im->h);
+ _evas_image_flip_vertical(pixels_out, pixels_in, im->w, im->h);
break;
case EVAS_IMAGE_FLIP_TRANSPOSE:
- _image_flip_transpose(pixels_out, pixels_in, im->w, im->h);
+ _evas_image_flip_transpose(pixels_out, pixels_in, im->w, im->h);
break;
case EVAS_IMAGE_FLIP_TRANSVERSE:
- _image_flip_transverse(pixels_out, pixels_in, im->w, im->h);
+ _evas_image_flip_transverse(pixels_out, pixels_in, im->w, im->h);
break;
default:
ERR("Wrong orient value");
}
EAPI void
-_image_flip_horizontal(DATA32 *pixels_out, const DATA32 *pixels_in,
+_evas_image_flip_horizontal(DATA32 *pixels_out, const DATA32 *pixels_in,
int iw, int ih)
{
const unsigned int *pi1, *pi2;
}
EAPI void
-_image_flip_vertical(DATA32 *pixels_out, const DATA32 *pixels_in,
+_evas_image_flip_vertical(DATA32 *pixels_out, const DATA32 *pixels_in,
int iw, int ih)
{
const unsigned int *pi1, *pi2;
}
EAPI void
-_image_rotate_180(DATA32 *pixels_out, const DATA32 *pixels_in,
+_evas_image_rotate_180(DATA32 *pixels_out, const DATA32 *pixels_in,
int iw, int ih)
{
const unsigned int *pi1, *pi2;
}
EAPI void
-_image_rotate_90(DATA32 *pixels_out, const DATA32 *pixels_in, int iw, int ih)
+_evas_image_rotate_90(DATA32 *pixels_out, const DATA32 *pixels_in, int iw, int ih)
{
int x, y, xx, yy, xx2, yy2;
}
EAPI void
-_image_rotate_270(DATA32 *pixels_out, const DATA32 *pixels_in, int iw, int ih)
+_evas_image_rotate_270(DATA32 *pixels_out, const DATA32 *pixels_in, int iw, int ih)
{
int x, y, xx, yy, xx2, yy2;
}
EAPI void
-_image_flip_transpose(DATA32 *pixels_out, const DATA32 *pixels_in,
+_evas_image_flip_transpose(DATA32 *pixels_out, const DATA32 *pixels_in,
int iw, int ih)
{
int x, y;
}
EAPI void
-_image_flip_transverse(DATA32 *pixels_out, const DATA32 *pixels_in,
+_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;
}
#endif /* ! _WIN32 */
-EAPI void _image_flip_horizontal(DATA32 *pixels_out, const DATA32 *pixels_in, int iw, int ih);
-EAPI void _image_flip_vertical(DATA32 *pixels_out, const DATA32 *pixels_in, int iw, int ih);
-EAPI void _image_rotate_180(DATA32 *pixels_out, const DATA32 *pixels_in, int iw, int ih);
-EAPI void _image_rotate_90(DATA32 *pixels_out, const DATA32 *pixels_in, int iw, int ih);
-EAPI void _image_rotate_270(DATA32 *pixels_out, const DATA32 *pixels_in, int iw, int ih);
-EAPI void _image_flip_transpose(DATA32 *pixels_out, const DATA32 *pixels_in, int iw, int ih);
-EAPI void _image_flip_transverse(DATA32 *pixels_out, const DATA32 *pixels_in, int iw, int ih);
+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