colorspace work mostly. not complete.
SVN revision: 27630
This commit is contained in:
parent
e1f4f1c1cf
commit
b51bdcbc1e
|
@ -97,7 +97,7 @@ evas_gl_common_context_use(Evas_GL_Context *gc)
|
||||||
void
|
void
|
||||||
evas_gl_common_context_resize(Evas_GL_Context *gc, int w, int h)
|
evas_gl_common_context_resize(Evas_GL_Context *gc, int w, int h)
|
||||||
{
|
{
|
||||||
if ((gc->w == w) && (gc->h == h)) return;
|
//if ((gc->w == w) && (gc->h == h)) return;
|
||||||
gc->change.size = 1;
|
gc->change.size = 1;
|
||||||
gc->w = w;
|
gc->w = w;
|
||||||
gc->h = h;
|
gc->h = h;
|
||||||
|
|
|
@ -140,6 +140,7 @@ evas_gl_common_image_new_from_copied_data(Evas_GL_Context *gc, int w, int h, int
|
||||||
im->im->image->data = NULL;
|
im->im->image->data = NULL;
|
||||||
if (im->tex) evas_gl_common_texture_free(im->tex);
|
if (im->tex) evas_gl_common_texture_free(im->tex);
|
||||||
im->tex = NULL;
|
im->tex = NULL;
|
||||||
|
im->cs.no_free = 0;
|
||||||
im->cs.data = calloc(1, im->im->image->h * sizeof(unsigned char *) * 2);
|
im->cs.data = calloc(1, im->im->image->h * sizeof(unsigned char *) * 2);
|
||||||
if ((data) && (im->cs.data))
|
if ((data) && (im->cs.data))
|
||||||
memcpy(im->cs.data, data, im->im->image->h * sizeof(unsigned char *) * 2);
|
memcpy(im->cs.data, data, im->im->image->h * sizeof(unsigned char *) * 2);
|
||||||
|
@ -254,10 +255,20 @@ evas_gl_common_image_draw(Evas_GL_Context *gc, Evas_GL_Image *im, int sx, int sy
|
||||||
if (!im->tex) return;
|
if (!im->tex) return;
|
||||||
ow = (dw * im->tex->tw) / sw;
|
ow = (dw * im->tex->tw) / sw;
|
||||||
oh = (dh * im->tex->th) / sh;
|
oh = (dh * im->tex->th) / sh;
|
||||||
tx1 = (double)(sx ) / (double)(im->tex->w);
|
if (im->tex->rectangle)
|
||||||
ty1 = (double)(sy ) / (double)(im->tex->h);
|
{
|
||||||
tx2 = (double)(sx + sw) / (double)(im->tex->w);
|
tx1 = sx;
|
||||||
ty2 = (double)(sy + sh) / (double)(im->tex->h);
|
ty1 = sy;
|
||||||
|
tx2 = sx + sw;
|
||||||
|
ty2 = sy + sh;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
tx1 = (double)(sx ) / (double)(im->tex->w);
|
||||||
|
ty1 = (double)(sy ) / (double)(im->tex->h);
|
||||||
|
tx2 = (double)(sx + sw) / (double)(im->tex->w);
|
||||||
|
ty2 = (double)(sy + sh) / (double)(im->tex->h);
|
||||||
|
}
|
||||||
evas_gl_common_context_texture_set(gc, im->tex, smooth, ow, oh);
|
evas_gl_common_context_texture_set(gc, im->tex, smooth, ow, oh);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
|
|
@ -419,8 +419,9 @@ evas_gl_common_ycbcr601pl_texture_new(Evas_GL_Context *gc, unsigned char **rows,
|
||||||
int im_w, im_h, tw, th, y;
|
int im_w, im_h, tw, th, y;
|
||||||
GLenum texfmt;
|
GLenum texfmt;
|
||||||
GLhandleARB fshad;
|
GLhandleARB fshad;
|
||||||
|
|
||||||
if (!gc->ext.arb_texture_non_power_of_two) return NULL;
|
// on an nv 6600gt this is fast - but on a 5500fx its DEAD SLOW!!!!!
|
||||||
|
// if (!gc->ext.arb_texture_non_power_of_two) return NULL;
|
||||||
|
|
||||||
tex = calloc(1, sizeof(Evas_GL_Texture));
|
tex = calloc(1, sizeof(Evas_GL_Texture));
|
||||||
if (!tex) return NULL;
|
if (!tex) return NULL;
|
||||||
|
|
|
@ -150,6 +150,7 @@ eng_output_redraws_rect_add(void *data, int x, int y, int w, int h)
|
||||||
Render_Engine *re;
|
Render_Engine *re;
|
||||||
|
|
||||||
re = (Render_Engine *)data;
|
re = (Render_Engine *)data;
|
||||||
|
evas_gl_common_context_resize(re->win->gl_context, re->win->w, re->win->h);
|
||||||
/* smple bounding box */
|
/* smple bounding box */
|
||||||
if (!re->win->draw.redraw)
|
if (!re->win->draw.redraw)
|
||||||
{
|
{
|
||||||
|
@ -747,9 +748,10 @@ eng_image_data_get(void *data, void *image, int to_write, DATA32 **image_data)
|
||||||
eng_image_colorspace_get(data, image));
|
eng_image_colorspace_get(data, image));
|
||||||
if (!im_new)
|
if (!im_new)
|
||||||
{
|
{
|
||||||
return im;
|
|
||||||
*image_data = NULL;
|
*image_data = NULL;
|
||||||
|
return im;
|
||||||
}
|
}
|
||||||
|
evas_gl_common_image_free(im);
|
||||||
im = im_new;
|
im = im_new;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -790,6 +792,7 @@ eng_image_data_put(void *data, void *image, DATA32 *image_data)
|
||||||
im2 = eng_image_new_from_data(data, w, h, image_data,
|
im2 = eng_image_new_from_data(data, w, h, image_data,
|
||||||
eng_image_alpha_get(data, image),
|
eng_image_alpha_get(data, image),
|
||||||
eng_image_colorspace_get(data, image));
|
eng_image_colorspace_get(data, image));
|
||||||
|
if (!im2) return im;
|
||||||
evas_gl_common_image_free(im);
|
evas_gl_common_image_free(im);
|
||||||
im = im2;
|
im = im2;
|
||||||
}
|
}
|
||||||
|
|
|
@ -462,6 +462,130 @@ eng_gradient_draw(void *data, void *context, void *surface, void *gradient, int
|
||||||
_xre_gradient_draw(surface, context, gradient, x, y, w, h);
|
_xre_gradient_draw(surface, context, gradient, x, y, w, h);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
eng_image_alpha_get(void *data, void *image)
|
||||||
|
{
|
||||||
|
if (!image) return 0;
|
||||||
|
return _xre_image_alpha_get((XR_Image *)image);
|
||||||
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
eng_image_colorspace_get(void *data, void *image)
|
||||||
|
{
|
||||||
|
if (!image) return EVAS_COLORSPACE_ARGB8888;
|
||||||
|
return ((XR_Image *)image)->cs.space;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void *
|
||||||
|
eng_image_alpha_set(void *data, void *image, int has_alpha)
|
||||||
|
{
|
||||||
|
XR_Image *im;
|
||||||
|
|
||||||
|
im = (XR_Image *)image;
|
||||||
|
if (!im) return im;
|
||||||
|
if (im->cs.space != EVAS_COLORSPACE_ARGB8888) return im;
|
||||||
|
if (((im->alpha) && (has_alpha)) || ((!im->alpha) && (!has_alpha)))
|
||||||
|
return im;
|
||||||
|
if (im->references > 1)
|
||||||
|
{
|
||||||
|
XR_Image *old_im;
|
||||||
|
|
||||||
|
old_im = im;
|
||||||
|
im = _xre_image_copy(old_im);
|
||||||
|
if (im)
|
||||||
|
{
|
||||||
|
im->alpha = old_im->alpha;
|
||||||
|
_xre_image_free(old_im);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
im = old_im;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
_xre_image_dirty(im);
|
||||||
|
_xre_image_alpha_set(im, has_alpha);
|
||||||
|
return im;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void *
|
||||||
|
eng_image_border_set(void *data, void *image, int l, int r, int t, int b)
|
||||||
|
{
|
||||||
|
if (!image) return image;
|
||||||
|
_xre_image_border_set((XR_Image *)image, l, r, t, b);
|
||||||
|
return image;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
eng_image_border_get(void *data, void *image, int *l, int *r, int *t, int *b)
|
||||||
|
{
|
||||||
|
if (!image) return;
|
||||||
|
_xre_image_border_get((XR_Image *)image, l, r, t, b);
|
||||||
|
}
|
||||||
|
|
||||||
|
static const char *
|
||||||
|
eng_image_comment_get(void *data, void *image, char *key)
|
||||||
|
{
|
||||||
|
if (!image) return NULL;
|
||||||
|
return ((XR_Image *)image)->comment;
|
||||||
|
}
|
||||||
|
|
||||||
|
static char *
|
||||||
|
eng_image_format_get(void *data, void *image)
|
||||||
|
{
|
||||||
|
if (!image) return NULL;
|
||||||
|
return ((XR_Image *)image)->format;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
eng_image_colorspace_set(void *data, void *image, int cspace)
|
||||||
|
{
|
||||||
|
XR_Image *im;
|
||||||
|
|
||||||
|
if (!image) return;
|
||||||
|
im = (XR_Image *)image;
|
||||||
|
if (im->cs.space == cspace) return;
|
||||||
|
switch (cspace)
|
||||||
|
{
|
||||||
|
case EVAS_COLORSPACE_ARGB8888:
|
||||||
|
if (im->cs.data)
|
||||||
|
{
|
||||||
|
if (!im->cs.no_free) free(im->cs.data);
|
||||||
|
im->cs.data = NULL;
|
||||||
|
im->cs.no_free = 0;
|
||||||
|
}
|
||||||
|
if (im->im) evas_common_image_unref(im->im);
|
||||||
|
im->im = NULL;
|
||||||
|
break;
|
||||||
|
case EVAS_COLORSPACE_YCBCR422P601_PL:
|
||||||
|
case EVAS_COLORSPACE_YCBCR422P709_PL:
|
||||||
|
if (im->im) evas_common_image_unref(im->im);
|
||||||
|
im->im = NULL;
|
||||||
|
if (im->cs.data)
|
||||||
|
{
|
||||||
|
if (!im->cs.no_free) free(im->cs.data);
|
||||||
|
}
|
||||||
|
im->cs.data = calloc(1, im->h * sizeof(unsigned char *) * 2);
|
||||||
|
im->cs.no_free = 0;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
abort();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
im->cs.space = cspace;
|
||||||
|
_xre_image_dirty(im);
|
||||||
|
_xre_image_region_dirty(im, 0, 0, im->w, im->h);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
eng_image_native_set(void *data, void *image, void *native)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
static void *
|
||||||
|
eng_image_native_get(void *data, void *image)
|
||||||
|
{
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
static void *
|
static void *
|
||||||
eng_image_load(void *data, const char *file, const char *key, int *error, Evas_Image_Load_Opts *lo)
|
eng_image_load(void *data, const char *file, const char *key, int *error, Evas_Image_Load_Opts *lo)
|
||||||
{
|
{
|
||||||
|
@ -514,29 +638,35 @@ eng_image_size_get(void *data, void *image, int *w, int *h)
|
||||||
static void *
|
static void *
|
||||||
eng_image_size_set(void *data, void *image, int w, int h)
|
eng_image_size_set(void *data, void *image, int w, int h)
|
||||||
{
|
{
|
||||||
if (!image) return image;
|
XR_Image *im, *im_old;
|
||||||
|
|
||||||
|
if (!image) return NULL;
|
||||||
|
im_old = image;
|
||||||
|
if ((im_old) && (im_old->w == w) && (im_old->h == h))
|
||||||
|
return image;
|
||||||
if ((w <= 0) || (h <= 0))
|
if ((w <= 0) || (h <= 0))
|
||||||
{
|
{
|
||||||
_xre_image_free((XR_Image *)image);
|
_xre_image_free((XR_Image *)image);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
if (((XR_Image *)image)->references > 1)
|
if (im_old)
|
||||||
{
|
{
|
||||||
XR_Image *old_image;
|
if (im_old->references > 1)
|
||||||
|
|
||||||
old_image = (XR_Image *)image;
|
|
||||||
image = _xre_image_copy((XR_Image *)old_image);
|
|
||||||
if (image)
|
|
||||||
{
|
{
|
||||||
((XR_Image *)image)->alpha = old_image->alpha;
|
im = _xre_image_copy(im_old);
|
||||||
_xre_image_free(old_image);
|
if (im)
|
||||||
|
{
|
||||||
|
_xre_image_free(im_old);
|
||||||
|
return im;
|
||||||
|
}
|
||||||
|
return image;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
image = old_image;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
_xre_image_dirty((XR_Image *)image);
|
{
|
||||||
_xre_image_resize((XR_Image *)image, w, h);
|
_xre_image_dirty((XR_Image *)image);
|
||||||
|
_xre_image_resize((XR_Image *)image, w, h);
|
||||||
|
}
|
||||||
return image;
|
return image;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -552,115 +682,113 @@ eng_image_dirty_region(void *data, void *image, int x, int y, int w, int h)
|
||||||
static void *
|
static void *
|
||||||
eng_image_data_get(void *data, void *image, int to_write, DATA32 **image_data)
|
eng_image_data_get(void *data, void *image, int to_write, DATA32 **image_data)
|
||||||
{
|
{
|
||||||
if (!image) return image;
|
XR_Image *im;
|
||||||
if (to_write)
|
|
||||||
|
if (!image)
|
||||||
{
|
{
|
||||||
if (((XR_Image *)image)->references > 1)
|
*image_data = NULL;
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
im = (XR_Image *)image;
|
||||||
|
if (im->im)
|
||||||
|
evas_common_load_image_data_from_file(im->im);
|
||||||
|
switch (im->cs.space)
|
||||||
|
{
|
||||||
|
case EVAS_COLORSPACE_ARGB8888:
|
||||||
|
if (to_write)
|
||||||
{
|
{
|
||||||
XR_Image *old_image;
|
if (im->references > 1)
|
||||||
|
|
||||||
old_image = (XR_Image *)image;
|
|
||||||
image = _xre_image_copy((XR_Image *)old_image);
|
|
||||||
if (image)
|
|
||||||
{
|
{
|
||||||
((XR_Image *)image)->alpha = old_image->alpha;
|
XR_Image *im_old;
|
||||||
_xre_image_free(old_image);
|
|
||||||
|
im_old = im;
|
||||||
|
im = _xre_image_copy(im_old);
|
||||||
|
if (im)
|
||||||
|
_xre_image_free(im_old);
|
||||||
|
else
|
||||||
|
im = im_old;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
image = old_image;
|
_xre_image_dirty(im);
|
||||||
}
|
}
|
||||||
else
|
break;
|
||||||
_xre_image_dirty((XR_Image *)image);
|
case EVAS_COLORSPACE_YCBCR422P601_PL:
|
||||||
|
case EVAS_COLORSPACE_YCBCR422P709_PL:
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
abort();
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
if (image_data) *image_data = _xre_image_data_get((XR_Image *)image);
|
if (image_data) *image_data = _xre_image_data_get(im);
|
||||||
return image;
|
return im;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void *
|
static void *
|
||||||
eng_image_data_put(void *data, void *image, DATA32 *image_data)
|
eng_image_data_put(void *data, void *image, DATA32 *image_data)
|
||||||
{
|
{
|
||||||
|
XR_Image *im;
|
||||||
|
|
||||||
if (!image) return image;
|
if (!image) return image;
|
||||||
if (_xre_image_data_get((XR_Image *)image) != image_data)
|
im = (XR_Image *)image;
|
||||||
|
|
||||||
|
switch (im->cs.space)
|
||||||
{
|
{
|
||||||
XR_Image *old_image;
|
case EVAS_COLORSPACE_ARGB8888:
|
||||||
|
if (_xre_image_data_get(im) != image_data)
|
||||||
old_image = (XR_Image *)image;
|
|
||||||
image = _xre_image_data_find(image_data);
|
|
||||||
if (image != old_image)
|
|
||||||
{
|
{
|
||||||
if (!image)
|
XR_Image *im_old;
|
||||||
|
|
||||||
|
im_old = im;
|
||||||
|
image = _xre_image_data_find(image_data);
|
||||||
|
if (image != im_old)
|
||||||
{
|
{
|
||||||
image = _xre_image_new_from_data(old_image->xinf, old_image->w, old_image->h, image_data, old_image->alpha, EVAS_COLORSPACE_ARGB8888);
|
if (!image)
|
||||||
if (image)
|
|
||||||
{
|
{
|
||||||
((XR_Image *)image)->alpha = old_image->alpha;
|
image = _xre_image_new_from_data(im_old->xinf, im_old->w, im_old->h, image_data, im_old->alpha, EVAS_COLORSPACE_ARGB8888);
|
||||||
_xre_image_free(old_image);
|
if (image)
|
||||||
|
{
|
||||||
|
((XR_Image *)image)->alpha = im_old->alpha;
|
||||||
|
_xre_image_free(im_old);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
image = im_old;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
image = old_image;
|
{
|
||||||
|
_xre_image_free(im_old);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
_xre_image_free(old_image);
|
_xre_image_free(image);
|
||||||
|
image = im_old;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
break;
|
||||||
{
|
case EVAS_COLORSPACE_YCBCR422P601_PL:
|
||||||
_xre_image_free(image);
|
case EVAS_COLORSPACE_YCBCR422P709_PL:
|
||||||
|
if (_xre_image_data_get(im) != image_data)
|
||||||
|
{
|
||||||
|
if (im->data)
|
||||||
|
{
|
||||||
|
if (im->free_data) free(im->data);
|
||||||
|
im->data = NULL;
|
||||||
|
}
|
||||||
|
if (im->cs.data)
|
||||||
|
{
|
||||||
|
if (!im->cs.no_free) free(im->cs.data);
|
||||||
|
}
|
||||||
|
im->cs.data = image_data;
|
||||||
|
_xre_image_dirty(im);
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
abort();
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
return image;
|
return image;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void *
|
|
||||||
eng_image_alpha_set(void *data, void *image, int has_alpha)
|
|
||||||
{
|
|
||||||
if (!image) return image;
|
|
||||||
if (((((XR_Image *)image)->alpha) && (has_alpha)) ||
|
|
||||||
((!((XR_Image *)image)->alpha) && (!has_alpha)))
|
|
||||||
return image;
|
|
||||||
if (((XR_Image *)image)->references > 1)
|
|
||||||
{
|
|
||||||
XR_Image *old_image;
|
|
||||||
|
|
||||||
old_image = (XR_Image *)image;
|
|
||||||
image = _xre_image_copy((XR_Image *)old_image);
|
|
||||||
if (image)
|
|
||||||
{
|
|
||||||
((XR_Image *)image)->alpha = old_image->alpha;
|
|
||||||
_xre_image_free(old_image);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
image = old_image;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
_xre_image_dirty((XR_Image *)image);
|
|
||||||
_xre_image_alpha_set((XR_Image *)image, has_alpha);
|
|
||||||
return image;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int
|
|
||||||
eng_image_alpha_get(void *data, void *image)
|
|
||||||
{
|
|
||||||
if (!image) return 0;
|
|
||||||
return _xre_image_alpha_get((XR_Image *)image);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void *
|
|
||||||
eng_image_border_set(void *data, void *image, int l, int r, int t, int b)
|
|
||||||
{
|
|
||||||
if (!image) return image;
|
|
||||||
_xre_image_border_set((XR_Image *)image, l, r, t, b);
|
|
||||||
return image;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
eng_image_border_get(void *data, void *image, int *l, int *r, int *t, int *b)
|
|
||||||
{
|
|
||||||
if (!image) return;
|
|
||||||
_xre_image_border_get((XR_Image *)image, l, r, t, b);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
eng_image_draw(void *data, void *context, void *surface, void *image, int src_x, int src_y, int src_w, int src_h, int dst_x, int dst_y, int dst_w, int dst_h, int smooth)
|
eng_image_draw(void *data, void *context, void *surface, void *image, int src_x, int src_y, int src_w, int src_h, int dst_x, int dst_y, int dst_w, int dst_h, int smooth)
|
||||||
{
|
{
|
||||||
|
@ -675,42 +803,6 @@ eng_image_draw(void *data, void *context, void *surface, void *image, int src_x,
|
||||||
smooth);
|
smooth);
|
||||||
}
|
}
|
||||||
|
|
||||||
static const char *
|
|
||||||
eng_image_comment_get(void *data, void *image, char *key)
|
|
||||||
{
|
|
||||||
if (!image) return NULL;
|
|
||||||
return ((XR_Image *)image)->comment;
|
|
||||||
}
|
|
||||||
|
|
||||||
static char *
|
|
||||||
eng_image_format_get(void *data, void *image)
|
|
||||||
{
|
|
||||||
if (!image) return NULL;
|
|
||||||
return ((XR_Image *)image)->format;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
eng_image_colorspace_set(void *data, void *image, int cspace)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
static int
|
|
||||||
eng_image_colorspace_get(void *data, void *image)
|
|
||||||
{
|
|
||||||
return EVAS_COLORSPACE_ARGB8888;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
eng_image_native_set(void *data, void *image, void *native)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
static void *
|
|
||||||
eng_image_native_get(void *data, void *image)
|
|
||||||
{
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
eng_image_cache_flush(void *data)
|
eng_image_cache_flush(void *data)
|
||||||
{
|
{
|
||||||
|
|
|
@ -100,6 +100,11 @@ struct _XR_Image
|
||||||
const char *comment;
|
const char *comment;
|
||||||
Tilebuf *updates;
|
Tilebuf *updates;
|
||||||
RGBA_Image_Loadopts load_opts;
|
RGBA_Image_Loadopts load_opts;
|
||||||
|
struct {
|
||||||
|
int space;
|
||||||
|
void *data;
|
||||||
|
unsigned char no_free : 1;
|
||||||
|
} cs;
|
||||||
unsigned char alpha : 1;
|
unsigned char alpha : 1;
|
||||||
unsigned char dirty : 1;
|
unsigned char dirty : 1;
|
||||||
unsigned char free_data : 1;
|
unsigned char free_data : 1;
|
||||||
|
|
|
@ -102,6 +102,7 @@ _xre_image_load(Ximage_Info *xinf, const char *file, const char *key, Evas_Image
|
||||||
}
|
}
|
||||||
im->xinf = xinf;
|
im->xinf = xinf;
|
||||||
im->xinf->references++;
|
im->xinf->references++;
|
||||||
|
im->cs.space = EVAS_COLORSPACE_ARGB8888;
|
||||||
im->fkey = strdup(buf);
|
im->fkey = strdup(buf);
|
||||||
im->file = evas_stringshare_add(file);
|
im->file = evas_stringshare_add(file);
|
||||||
if (key) im->key = evas_stringshare_add(key);
|
if (key) im->key = evas_stringshare_add(key);
|
||||||
|
@ -125,11 +126,25 @@ _xre_image_new_from_data(Ximage_Info *xinf, int w, int h, void *data, int alpha,
|
||||||
if (!im) return NULL;
|
if (!im) return NULL;
|
||||||
im->xinf = xinf;
|
im->xinf = xinf;
|
||||||
im->xinf->references++;
|
im->xinf->references++;
|
||||||
|
im->cs.space = cspace;
|
||||||
im->w = w;
|
im->w = w;
|
||||||
im->h = h;
|
im->h = h;
|
||||||
im->references = 1;
|
im->references = 1;
|
||||||
im->data = data;
|
switch (im->cs.space)
|
||||||
im->alpha = alpha;
|
{
|
||||||
|
case EVAS_COLORSPACE_ARGB8888:
|
||||||
|
im->data = data;
|
||||||
|
im->alpha = alpha;
|
||||||
|
break;
|
||||||
|
case EVAS_COLORSPACE_YCBCR422P601_PL:
|
||||||
|
case EVAS_COLORSPACE_YCBCR422P709_PL:
|
||||||
|
im->cs.data = data;
|
||||||
|
im->cs.no_free = 1;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
abort();
|
||||||
|
break;
|
||||||
|
}
|
||||||
im->dirty = 1;
|
im->dirty = 1;
|
||||||
__xre_image_dirty_hash_add(im);
|
__xre_image_dirty_hash_add(im);
|
||||||
return im;
|
return im;
|
||||||
|
@ -142,27 +157,43 @@ _xre_image_new_from_copied_data(Ximage_Info *xinf, int w, int h, void *data, int
|
||||||
|
|
||||||
im = calloc(1, sizeof(XR_Image));
|
im = calloc(1, sizeof(XR_Image));
|
||||||
if (!im) return NULL;
|
if (!im) return NULL;
|
||||||
im->data = malloc(w * h * 4);
|
im->cs.space = cspace;
|
||||||
if (!im->data)
|
switch (im->cs.space)
|
||||||
{
|
{
|
||||||
free(im);
|
case EVAS_COLORSPACE_ARGB8888:
|
||||||
return NULL;
|
im->data = malloc(w * h * 4);
|
||||||
}
|
if (!im->data)
|
||||||
if (data)
|
{
|
||||||
{
|
free(im);
|
||||||
Gfx_Func_Copy func;
|
return NULL;
|
||||||
|
}
|
||||||
func = evas_common_draw_func_copy_get(w * h, 0);
|
if (data)
|
||||||
if (func) func(data, im->data, w * h);
|
{
|
||||||
evas_common_cpu_end_opt();
|
Gfx_Func_Copy func;
|
||||||
|
|
||||||
|
func = evas_common_draw_func_copy_get(w * h, 0);
|
||||||
|
if (func) func(data, im->data, w * h);
|
||||||
|
evas_common_cpu_end_opt();
|
||||||
|
}
|
||||||
|
im->alpha = alpha;
|
||||||
|
im->free_data = 1;
|
||||||
|
break;
|
||||||
|
case EVAS_COLORSPACE_YCBCR422P601_PL:
|
||||||
|
case EVAS_COLORSPACE_YCBCR422P709_PL:
|
||||||
|
im->cs.no_free = 0;
|
||||||
|
im->cs.data = calloc(1, h * sizeof(unsigned char *) * 2);
|
||||||
|
if ((data) && (im->cs.data))
|
||||||
|
memcpy(im->cs.data, data, h * sizeof(unsigned char *) * 2);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
abort();
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
im->w = w;
|
im->w = w;
|
||||||
im->h = h;
|
im->h = h;
|
||||||
im->references = 1;
|
im->references = 1;
|
||||||
im->xinf = xinf;
|
im->xinf = xinf;
|
||||||
im->xinf->references++;
|
im->xinf->references++;
|
||||||
im->free_data = 1;
|
|
||||||
im->alpha = alpha;
|
|
||||||
im->dirty = 1;
|
im->dirty = 1;
|
||||||
__xre_image_dirty_hash_add(im);
|
__xre_image_dirty_hash_add(im);
|
||||||
return im;
|
return im;
|
||||||
|
@ -184,6 +215,7 @@ _xre_image_new(Ximage_Info *xinf, int w, int h)
|
||||||
im->w = w;
|
im->w = w;
|
||||||
im->h = h;
|
im->h = h;
|
||||||
im->references = 1;
|
im->references = 1;
|
||||||
|
im->cs.space = EVAS_COLORSPACE_ARGB8888;
|
||||||
im->xinf = xinf;
|
im->xinf = xinf;
|
||||||
im->xinf->references++;
|
im->xinf->references++;
|
||||||
im->free_data = 1;
|
im->free_data = 1;
|
||||||
|
@ -196,6 +228,10 @@ _xre_image_new(Ximage_Info *xinf, int w, int h)
|
||||||
static void
|
static void
|
||||||
__xre_image_real_free(XR_Image *im)
|
__xre_image_real_free(XR_Image *im)
|
||||||
{
|
{
|
||||||
|
if (im->cs.data)
|
||||||
|
{
|
||||||
|
if (!im->cs.no_free) free(im->cs.data);
|
||||||
|
}
|
||||||
if (im->file) evas_stringshare_del(im->file);
|
if (im->file) evas_stringshare_del(im->file);
|
||||||
if (im->key) evas_stringshare_del(im->key);
|
if (im->key) evas_stringshare_del(im->key);
|
||||||
if (im->fkey) free(im->fkey);
|
if (im->fkey) free(im->fkey);
|
||||||
|
@ -257,6 +293,7 @@ _xre_image_copy(XR_Image *im)
|
||||||
XR_Image *im2;
|
XR_Image *im2;
|
||||||
void *data = NULL;
|
void *data = NULL;
|
||||||
|
|
||||||
|
/* FIXME: colorspace support */
|
||||||
if (im->data) data = im->data;
|
if (im->data) data = im->data;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -281,6 +318,7 @@ _xre_image_copy(XR_Image *im)
|
||||||
void
|
void
|
||||||
_xre_image_resize(XR_Image *im, int w, int h)
|
_xre_image_resize(XR_Image *im, int w, int h)
|
||||||
{
|
{
|
||||||
|
/* FIXME: colorspace support */
|
||||||
/* FIXME: ... */
|
/* FIXME: ... */
|
||||||
if ((w == im->w) && (h == im->h)) return;
|
if ((w == im->w) && (h == im->h)) return;
|
||||||
if (im->surface)
|
if (im->surface)
|
||||||
|
@ -389,6 +427,7 @@ _xre_image_data_get(XR_Image *im)
|
||||||
{
|
{
|
||||||
void *data = NULL;
|
void *data = NULL;
|
||||||
|
|
||||||
|
/* FIXME: colorspace support */
|
||||||
if (im->data) data = im->data;
|
if (im->data) data = im->data;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -420,6 +459,7 @@ _xre_image_data_put(XR_Image *im, void *data)
|
||||||
{
|
{
|
||||||
void *imdata = NULL;
|
void *imdata = NULL;
|
||||||
|
|
||||||
|
/* FIXME: colorspace support */
|
||||||
if (!data) return;
|
if (!data) return;
|
||||||
if (im->data)
|
if (im->data)
|
||||||
{
|
{
|
||||||
|
@ -462,6 +502,7 @@ _xre_image_data_put(XR_Image *im, void *data)
|
||||||
void
|
void
|
||||||
_xre_image_alpha_set(XR_Image *im, int alpha)
|
_xre_image_alpha_set(XR_Image *im, int alpha)
|
||||||
{
|
{
|
||||||
|
/* FIXME: colorspace support */
|
||||||
if (im->alpha == alpha) return;
|
if (im->alpha == alpha) return;
|
||||||
im->alpha = alpha;
|
im->alpha = alpha;
|
||||||
if (im->surface)
|
if (im->surface)
|
||||||
|
@ -488,6 +529,10 @@ _xre_image_alpha_set(XR_Image *im, int alpha)
|
||||||
int
|
int
|
||||||
_xre_image_alpha_get(XR_Image *im)
|
_xre_image_alpha_get(XR_Image *im)
|
||||||
{
|
{
|
||||||
|
if (im->im)
|
||||||
|
{
|
||||||
|
if (im->im->cs.space != EVAS_COLORSPACE_ARGB8888) return 0;
|
||||||
|
}
|
||||||
return im->alpha;
|
return im->alpha;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -519,6 +564,7 @@ _xre_image_surface_gen(XR_Image *im)
|
||||||
{
|
{
|
||||||
void *data = NULL;
|
void *data = NULL;
|
||||||
|
|
||||||
|
/* FIXME: colorspace support */
|
||||||
if ((im->surface) && (!im->updates)) return;
|
if ((im->surface) && (!im->updates)) return;
|
||||||
if (im->data) data = im->data;
|
if (im->data) data = im->data;
|
||||||
else
|
else
|
||||||
|
|
Loading…
Reference in New Issue