}
}
+static const Evas_Colorspace known_cspace[] = {
+ EVAS_COLORSPACE_GRY8,
+ EVAS_COLORSPACE_AGRY88,
+ EVAS_COLORSPACE_ARGB8888
+};
+
static Evas_GL_Image *
_evas_gl_common_image(Evas_Engine_GL_Context *gc, RGBA_Image *im_im, Evas_Image_Load_Opts *lo, int *error)
{
Evas_GL_Image *im;
Eina_List *l;
+ int cspace = EVAS_COLORSPACE_ARGB8888;
/* i'd LOVe to do this, but we can't because we load to load header
* to get image size to know if its too big or not! so this disallows
*error = EVAS_LOAD_ERROR_RESOURCE_ALLOCATION_FAILED;
return NULL;
}
+ if (im_im->cache_entry.cspaces)
+ {
+ unsigned int i;
+
+ for (i = 0; im_im->cache_entry.cspaces[i] != EVAS_COLORSPACE_ARGB8888; i++)
+ {
+ unsigned int j;
+
+ for (j = 0;
+ known_cspace[j] != EVAS_COLORSPACE_ARGB8888;
+ j++)
+ if (known_cspace[j] == im_im->cache_entry.cspaces[i])
+ break;
+
+ if (known_cspace[j] == im_im->cache_entry.cspaces[i])
+ break;
+ }
+
+ cspace = im_im->cache_entry.cspaces[i];
+ im_im->cache_entry.space = cspace;
+ }
+
im->references = 1;
im->im = im_im;
im->gc = gc;
im->cached = 1;
- im->cs.space = EVAS_COLORSPACE_ARGB8888;
+ im->cs.space = cspace;
im->alpha = im->im->cache_entry.flags.alpha;
im->w = im->im->cache_entry.w;
im->h = im->im->cache_entry.h;
if (lo) im->load_opts = *lo;
gc->shared->images = eina_list_prepend(gc->shared->images, im);
- return im;
+ return im;
}
Evas_GL_Image *
switch (cspace)
{
case EVAS_COLORSPACE_ARGB8888:
+ case EVAS_COLORSPACE_GRY8:
+ case EVAS_COLORSPACE_AGRY88:
break;
case EVAS_COLORSPACE_YCBCR422P601_PL:
case EVAS_COLORSPACE_YCBCR422P709_PL:
{
case EVAS_COLORSPACE_ARGB8888:
case EVAS_COLORSPACE_GRY8:
+ case EVAS_COLORSPACE_AGRY88:
break;
case EVAS_COLORSPACE_YCBCR422P601_PL:
case EVAS_COLORSPACE_YCBCR422P709_PL:
switch (cspace)
{
case EVAS_COLORSPACE_ARGB8888:
- break;
+ case EVAS_COLORSPACE_GRY8:
+ case EVAS_COLORSPACE_AGRY88:
+ break;
case EVAS_COLORSPACE_YCBCR422P601_PL:
case EVAS_COLORSPACE_YCBCR422P709_PL:
case EVAS_COLORSPACE_YCBCR422601_PL:
if (!im->gc->shared->info.sec_image_map) return;
if (!im->gc->shared->info.bgra) return;
// does not handle yuv yet.
- if (im->cs.space != EVAS_COLORSPACE_ARGB8888) return;
+ if (im->cs.space != EVAS_COLORSPACE_ARGB8888 ||
+ im->cs.space != EVAS_COLORSPACE_GRY8 ||
+ im->cs.space != EVAS_COLORSPACE_AGRY88) return;
if (im->content_hint == EVAS_IMAGE_CONTENT_HINT_DYNAMIC)
{
if (im->cs.data)
im->im = (RGBA_Image *)evas_cache_image_empty(evas_common_image_cache_get());
im->im->cache_entry.flags.alpha = im->alpha;
- im->cs.space = EVAS_COLORSPACE_ARGB8888;
+ im->im->cache_entry.space = im->cs.space;
evas_cache_image_colorspace(&im->im->cache_entry, im->cs.space);
im->im = (RGBA_Image *)evas_cache_image_size_set(&im->im->cache_entry, im->w, im->h);
if (!im->tex)
switch (im->cs.space)
{
case EVAS_COLORSPACE_ARGB8888:
+ case EVAS_COLORSPACE_GRY8:
+ case EVAS_COLORSPACE_AGRY88:
if ((im->tex) &&
((im->dirty) || (ie->animated.animated) || (ie->flags.updated_data)))
{
Eina_Bool alpha;
Eina_Bool bgra;
+ Evas_Colorspace cspace;
+
const GLenum *intformat;
const GLenum *format;
} matching_format[] = {
- { EINA_TRUE, EINA_TRUE, &bgra_ifmt, &bgra_fmt },
- { EINA_TRUE, EINA_FALSE, &rgba_ifmt, &rgba_fmt },
- { EINA_FALSE, EINA_TRUE, &bgr_ifmt, &bgr_fmt },
+ { EINA_TRUE, EINA_TRUE, EVAS_COLORSPACE_ARGB8888, &bgra_ifmt, &bgra_fmt },
+ { EINA_TRUE, EINA_FALSE, EVAS_COLORSPACE_ARGB8888, &rgba_ifmt, &rgba_fmt },
+ { EINA_FALSE, EINA_TRUE, EVAS_COLORSPACE_ARGB8888, &bgr_ifmt, &bgr_fmt },
#ifdef GL_GLES
- { EINA_FALSE, EINA_FALSE, &rgba_ifmt, &rgba_fmt }
+ { EINA_FALSE, EINA_FALSE, EVAS_COLORSPACE_ARGB8888, &rgba_ifmt, &rgba_fmt },
#else
- { EINA_FALSE, EINA_FALSE, &rgb_ifmt, &rgb_fmt }
+ { EINA_FALSE, EINA_FALSE, EVAS_COLORSPACE_ARGB8888, &rgb_ifmt, &rgb_fmt },
#endif
+ { EINA_FALSE, EINA_FALSE, EVAS_COLORSPACE_GRY8, &lum_fmt, &lum_ifmt },
+ { EINA_TRUE, EINA_FALSE, EVAS_COLORSPACE_AGRY88, &lum_alpha_fmt, &lum_alpha_ifmt }
};
static const GLenum matching_rgba[] = { GL_RGBA4, GL_RGBA8, GL_RGBA12, GL_RGBA16, 0x0 };
}
static int
-_evas_gl_texture_search_format(Eina_Bool alpha, Eina_Bool bgra)
+_evas_gl_texture_search_format(Eina_Bool alpha, Eina_Bool bgra, Evas_Colorspace cspace)
{
unsigned int i;
for (i = 0; i < sizeof (matching_format) / sizeof (matching_format[0]); ++i)
if (matching_format[i].alpha == alpha &&
- matching_format[i].bgra == bgra)
+ matching_format[i].bgra == bgra &&
+ matching_format[i].cspace == cspace)
return i;
abort();
case GL_LUMINANCE12:
case GL_LUMINANCE16:
return 3;
- // XXX: luminance_alpha not supported at all
+ case GL_LUMINANCE4_ALPHA4:
+ case GL_LUMINANCE8_ALPHA8:
+ case GL_LUMINANCE12_ALPHA12:
+ case GL_LUMINANCE16_ALPHA16:
+ return 4;
default:
return 0;
}
#define TEX_HREP 1
#define TEX_VREP 1
- lformat = _evas_gl_texture_search_format(im->cache_entry.flags.alpha, gc->shared->info.bgra);
+ lformat = _evas_gl_texture_search_format(im->cache_entry.flags.alpha, gc->shared->info.bgra, im->cache_entry.space);
tex->pt = _pool_tex_find(gc,
im->cache_entry.w + TEX_HREP + 2,
im->cache_entry.h + TEX_VREP,
tex = evas_gl_common_texture_alloc(gc, w, h, alpha);
if (!tex) return NULL;
- lformat = _evas_gl_texture_search_format(alpha, gc->shared->info.bgra);
+ lformat = _evas_gl_texture_search_format(alpha, gc->shared->info.bgra, EVAS_COLORSPACE_ARGB8888);
tex->pt = _pool_tex_native_new(gc, w, h,
*matching_format[lformat].intformat,
*matching_format[lformat].format,
tex = evas_gl_common_texture_alloc(gc, w, h, alpha);
if (!tex) return NULL;
- lformat = _evas_gl_texture_search_format(alpha, gc->shared->info.bgra);
+ lformat = _evas_gl_texture_search_format(alpha, gc->shared->info.bgra, EVAS_COLORSPACE_ARGB8888);
tex->pt = _pool_tex_render_new(gc, w, h,
*matching_format[lformat].intformat,
*matching_format[lformat].format);
tex = evas_gl_common_texture_alloc(gc, im->w, im->h, im->alpha);
if (!tex) return NULL;
- lformat = _evas_gl_texture_search_format(tex->alpha, gc->shared->info.bgra);
+ lformat = _evas_gl_texture_search_format(tex->alpha, gc->shared->info.bgra, EVAS_COLORSPACE_ARGB8888);
tex->pt = _pool_tex_dynamic_new(gc, tex->w, tex->h,
*matching_format[lformat].intformat,
*matching_format[lformat].format);
pt_unref(tex->pt);
tex->alpha = im->cache_entry.flags.alpha;
- lformat = _evas_gl_texture_search_format(tex->alpha, tex->gc->shared->info.bgra);
+ lformat = _evas_gl_texture_search_format(tex->alpha, tex->gc->shared->info.bgra, im->cache_entry.space);
// FIXME: why a 'render' new here ???
tex->pt = _pool_tex_render_new(tex->gc, tex->w, tex->h,
*matching_format[lformat].intformat,
// out is a miniature of the texture, upload that now and schedule the data for later.
// Creating the mini picture texture
- lformat = _evas_gl_texture_search_format(tex->alpha, tex->gc->shared->info.bgra);
+ lformat = _evas_gl_texture_search_format(tex->alpha, tex->gc->shared->info.bgra, im->cache_entry.space);
tex->ptt = _pool_tex_find(tex->gc, EVAS_GL_TILE_SIZE, EVAS_GL_TILE_SIZE,
*matching_format[lformat].intformat,
*matching_format[lformat].format,