forked from enlightenment/efl
step 1. some map support! images only right now. next. render-to-texture.
invasive change right now. SVN revision: 43611
This commit is contained in:
parent
43fb7ca168
commit
6e22b36451
|
@ -241,6 +241,12 @@ void evas_gl_common_context_yuv_push(Evas_GL_Context *gc,
|
||||||
int x, int y, int w, int h,
|
int x, int y, int w, int h,
|
||||||
int r, int g, int b, int a,
|
int r, int g, int b, int a,
|
||||||
Eina_Bool smooth);
|
Eina_Bool smooth);
|
||||||
|
void evas_gl_common_context_image_map4_push(Evas_GL_Context *gc,
|
||||||
|
Evas_GL_Texture *tex,
|
||||||
|
RGBA_Map_Point *p,
|
||||||
|
int clip, int cx, int cy, int cw, int ch,
|
||||||
|
int r, int g, int b, int a,
|
||||||
|
Eina_Bool smooth);
|
||||||
void evas_gl_common_context_flush(Evas_GL_Context *gc);
|
void evas_gl_common_context_flush(Evas_GL_Context *gc);
|
||||||
|
|
||||||
void evas_gl_common_shader_program_init(Evas_GL_Program *p,
|
void evas_gl_common_shader_program_init(Evas_GL_Program *p,
|
||||||
|
@ -264,6 +270,7 @@ Evas_GL_Image *evas_gl_common_image_new_from_copied_data(Evas_GL_Context *gc,
|
||||||
Evas_GL_Image *evas_gl_common_image_new(Evas_GL_Context *gc, int w, int h, int alpha, int cspace);
|
Evas_GL_Image *evas_gl_common_image_new(Evas_GL_Context *gc, int w, int h, int alpha, int cspace);
|
||||||
void evas_gl_common_image_free(Evas_GL_Image *im);
|
void evas_gl_common_image_free(Evas_GL_Image *im);
|
||||||
void evas_gl_common_image_dirty(Evas_GL_Image *im);
|
void evas_gl_common_image_dirty(Evas_GL_Image *im);
|
||||||
|
void evas_gl_common_image_map4_draw(Evas_GL_Context *gc, Evas_GL_Image *im, RGBA_Map_Point *p, int smooth, int level);
|
||||||
void evas_gl_common_image_draw(Evas_GL_Context *gc, Evas_GL_Image *im, int sx, int sy, int sw, int sh, int dx, int dy, int dw, int dh, int smooth);
|
void evas_gl_common_image_draw(Evas_GL_Context *gc, Evas_GL_Image *im, int sx, int sy, int sw, int sh, int dx, int dy, int dw, int dh, int smooth);
|
||||||
|
|
||||||
Evas_GL_Texture *evas_gl_font_texture_new(Evas_GL_Context *gc, RGBA_Font_Glyph *fg);
|
Evas_GL_Texture *evas_gl_font_texture_new(Evas_GL_Context *gc, RGBA_Font_Glyph *fg);
|
||||||
|
|
|
@ -545,6 +545,68 @@ evas_gl_common_context_yuv_push(Evas_GL_Context *gc,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
evas_gl_common_context_image_map4_push(Evas_GL_Context *gc,
|
||||||
|
Evas_GL_Texture *tex,
|
||||||
|
RGBA_Map_Point *p,
|
||||||
|
int clip, int cx, int cy, int cw, int ch,
|
||||||
|
int r, int g, int b, int a,
|
||||||
|
Eina_Bool smooth)
|
||||||
|
{
|
||||||
|
int pnum, nv, nc, nu, nt, i;
|
||||||
|
const int points[6] = { 0, 1, 2, 0, 2, 3 };
|
||||||
|
GLfloat tx[4], ty[4];
|
||||||
|
Eina_Bool blend = 1;
|
||||||
|
RGBA_Map_Point *pt;
|
||||||
|
DATA32 cmul;
|
||||||
|
|
||||||
|
blend = 1;
|
||||||
|
|
||||||
|
// if (tex->pt->format == GL_RGB) blend = 0;
|
||||||
|
// if (a < 255) blend = 1;
|
||||||
|
|
||||||
|
if ((gc->shader.cur_tex != tex->pt->texture)
|
||||||
|
|| (gc->shader.cur_prog != gc->shared->shader.img.prog)
|
||||||
|
|| (gc->shader.smooth != smooth)
|
||||||
|
|| (gc->shader.blend != blend)
|
||||||
|
)
|
||||||
|
{
|
||||||
|
shader_array_flush(gc);
|
||||||
|
gc->shader.cur_tex = tex->pt->texture;
|
||||||
|
gc->shader.cur_prog = gc->shared->shader.img.prog;
|
||||||
|
gc->shader.smooth = smooth;
|
||||||
|
gc->shader.blend = blend;
|
||||||
|
}
|
||||||
|
|
||||||
|
pnum = gc->array.num;
|
||||||
|
nv = pnum * 3; nc = pnum * 4; nu = pnum * 2; nt = pnum * 4;
|
||||||
|
gc->array.num += 6;
|
||||||
|
_evas_gl_common_context_array_alloc(gc);
|
||||||
|
|
||||||
|
for (i = 0; i < 4; i++)
|
||||||
|
{
|
||||||
|
tx[i] = ((double)(tex->x) + (((double)p[i].u) / FP1)) /
|
||||||
|
(double)tex->pt->w;
|
||||||
|
ty[i] = ((double)(tex->y) + (((double)p[i].v) / FP1)) /
|
||||||
|
(double)tex->pt->h;
|
||||||
|
}
|
||||||
|
cmul = ARGB_JOIN(a, r, g, b);
|
||||||
|
for (i = 0; i < 6; i++)
|
||||||
|
{
|
||||||
|
DATA32 cl = MUL4_SYM(cmul, p[points[i]].col);
|
||||||
|
PUSH_VERTEX((p[points[i]].x >> FP),
|
||||||
|
(p[points[i]].y >> FP),
|
||||||
|
0);
|
||||||
|
// (p[points[i]].z >> FP));
|
||||||
|
PUSH_TEXUV(tx[points[i]],
|
||||||
|
ty[points[i]]);
|
||||||
|
PUSH_COLOR(R_VAL(&cl),
|
||||||
|
G_VAL(&cl),
|
||||||
|
B_VAL(&cl),
|
||||||
|
A_VAL(&cl));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
evas_gl_common_context_flush(Evas_GL_Context *gc)
|
evas_gl_common_context_flush(Evas_GL_Context *gc)
|
||||||
{
|
{
|
||||||
|
|
|
@ -111,7 +111,7 @@ evas_gl_common_image_new_from_copied_data(Evas_GL_Context *gc, int w, int h, DAT
|
||||||
case EVAS_COLORSPACE_YCBCR422P601_PL:
|
case EVAS_COLORSPACE_YCBCR422P601_PL:
|
||||||
case EVAS_COLORSPACE_YCBCR422P709_PL:
|
case EVAS_COLORSPACE_YCBCR422P709_PL:
|
||||||
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.no_free = 0;
|
||||||
im->cs.data = calloc(1, im->im->cache_entry.h * sizeof(unsigned char *) * 2);
|
im->cs.data = calloc(1, im->im->cache_entry.h * sizeof(unsigned char *) * 2);
|
||||||
if ((data) && (im->cs.data))
|
if ((data) && (im->cs.data))
|
||||||
|
@ -184,33 +184,9 @@ evas_gl_common_image_dirty(Evas_GL_Image *im)
|
||||||
im->dirty = 1;
|
im->dirty = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
static void
|
||||||
evas_gl_common_image_draw(Evas_GL_Context *gc, Evas_GL_Image *im, int sx, int sy, int sw, int sh, int dx, int dy, int dw, int dh, int smooth)
|
image_update(Evas_GL_Context *gc, Evas_GL_Image *im)
|
||||||
{
|
{
|
||||||
RGBA_Draw_Context *dc;
|
|
||||||
int r, g, b, a;
|
|
||||||
double ssx, ssy, ssw, ssh;
|
|
||||||
int space;
|
|
||||||
Cutout_Rects *rects;
|
|
||||||
Cutout_Rect *rct;
|
|
||||||
int c, cx, cy, cw, ch;
|
|
||||||
int i;
|
|
||||||
int yuv = 0;
|
|
||||||
|
|
||||||
if (sw < 1) sw = 1;
|
|
||||||
if (sh < 1) sh = 1;
|
|
||||||
dc = gc->dc;
|
|
||||||
if (dc->mul.use)
|
|
||||||
{
|
|
||||||
a = (dc->mul.col >> 24) & 0xff;
|
|
||||||
r = (dc->mul.col >> 16) & 0xff;
|
|
||||||
g = (dc->mul.col >> 8 ) & 0xff;
|
|
||||||
b = (dc->mul.col ) & 0xff;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
r = g = b = a = 255;
|
|
||||||
}
|
|
||||||
/*
|
/*
|
||||||
if ((im->cs.space == EVAS_COLORSPACE_YCBCR422P601_PL) ||
|
if ((im->cs.space == EVAS_COLORSPACE_YCBCR422P601_PL) ||
|
||||||
(im->cs.space == EVAS_COLORSPACE_YCBCR422P709_PL))
|
(im->cs.space == EVAS_COLORSPACE_YCBCR422P709_PL))
|
||||||
|
@ -232,9 +208,7 @@ evas_gl_common_image_draw(Evas_GL_Context *gc, Evas_GL_Image *im, int sx, int sy
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
*/
|
*/
|
||||||
space = im->cs.space;
|
switch (im->cs.space)
|
||||||
|
|
||||||
switch (space)
|
|
||||||
{
|
{
|
||||||
case EVAS_COLORSPACE_ARGB8888:
|
case EVAS_COLORSPACE_ARGB8888:
|
||||||
evas_cache_image_load_data(&im->im->cache_entry);
|
evas_cache_image_load_data(&im->im->cache_entry);
|
||||||
|
@ -263,14 +237,78 @@ evas_gl_common_image_draw(Evas_GL_Context *gc, Evas_GL_Image *im, int sx, int sy
|
||||||
im->im->cache_entry.h);
|
im->im->cache_entry.h);
|
||||||
im->dirty = 0;
|
im->dirty = 0;
|
||||||
}
|
}
|
||||||
yuv = 1;
|
|
||||||
if (!im->tex) return;
|
if (!im->tex) return;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
printf("unhandled img format\n");
|
printf("unhandled img format\n");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
evas_gl_common_image_map4_draw(Evas_GL_Context *gc, Evas_GL_Image *im,
|
||||||
|
RGBA_Map_Point *p, int smooth, int level)
|
||||||
|
{
|
||||||
|
RGBA_Draw_Context *dc;
|
||||||
|
int r, g, b, a;
|
||||||
|
int c, cx, cy, cw, ch;
|
||||||
|
|
||||||
|
dc = gc->dc;
|
||||||
|
if (dc->mul.use)
|
||||||
|
{
|
||||||
|
a = (dc->mul.col >> 24) & 0xff;
|
||||||
|
r = (dc->mul.col >> 16) & 0xff;
|
||||||
|
g = (dc->mul.col >> 8 ) & 0xff;
|
||||||
|
b = (dc->mul.col ) & 0xff;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
r = g = b = a = 255;
|
||||||
|
}
|
||||||
|
|
||||||
|
image_update(gc, im);
|
||||||
|
|
||||||
|
c = gc->dc->clip.use;
|
||||||
|
cx = gc->dc->clip.x; cy = gc->dc->clip.y;
|
||||||
|
cw = gc->dc->clip.w; ch = gc->dc->clip.h;
|
||||||
|
evas_gl_common_context_image_map4_push(gc, im->tex, p,
|
||||||
|
c, cx, cy, cw, ch,
|
||||||
|
r, g, b, a, smooth);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
evas_gl_common_image_draw(Evas_GL_Context *gc, Evas_GL_Image *im, int sx, int sy, int sw, int sh, int dx, int dy, int dw, int dh, int smooth)
|
||||||
|
{
|
||||||
|
RGBA_Draw_Context *dc;
|
||||||
|
int r, g, b, a;
|
||||||
|
double ssx, ssy, ssw, ssh;
|
||||||
|
Cutout_Rects *rects;
|
||||||
|
Cutout_Rect *rct;
|
||||||
|
int c, cx, cy, cw, ch;
|
||||||
|
int i;
|
||||||
|
int yuv = 0;
|
||||||
|
|
||||||
|
if (sw < 1) sw = 1;
|
||||||
|
if (sh < 1) sh = 1;
|
||||||
|
dc = gc->dc;
|
||||||
|
if (dc->mul.use)
|
||||||
|
{
|
||||||
|
a = (dc->mul.col >> 24) & 0xff;
|
||||||
|
r = (dc->mul.col >> 16) & 0xff;
|
||||||
|
g = (dc->mul.col >> 8 ) & 0xff;
|
||||||
|
b = (dc->mul.col ) & 0xff;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
r = g = b = a = 255;
|
||||||
|
}
|
||||||
|
|
||||||
|
image_update(gc, im);
|
||||||
|
|
||||||
|
if ((im->cs.space == EVAS_COLORSPACE_YCBCR422P601_PL) ||
|
||||||
|
(im->cs.space == EVAS_COLORSPACE_YCBCR422P709_PL))
|
||||||
|
yuv = 1;
|
||||||
|
|
||||||
if ((!gc->dc->cutout.rects)
|
if ((!gc->dc->cutout.rects)
|
||||||
// || (gc->dc->cutout.active > 32)
|
// || (gc->dc->cutout.active > 32)
|
||||||
)
|
)
|
||||||
|
|
|
@ -787,7 +787,6 @@ eng_image_load(void *data, const char *file, const char *key, int *error, Evas_I
|
||||||
*error = 0;
|
*error = 0;
|
||||||
eng_window_use(re->win);
|
eng_window_use(re->win);
|
||||||
return evas_gl_common_image_load(re->win->gl_context, file, key, lo);
|
return evas_gl_common_image_load(re->win->gl_context, file, key, lo);
|
||||||
return NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void *
|
static void *
|
||||||
|
@ -798,7 +797,6 @@ eng_image_new_from_data(void *data, int w, int h, DATA32 *image_data, int alpha,
|
||||||
re = (Render_Engine *)data;
|
re = (Render_Engine *)data;
|
||||||
eng_window_use(re->win);
|
eng_window_use(re->win);
|
||||||
return evas_gl_common_image_new_from_data(re->win->gl_context, w, h, image_data, alpha, cspace);
|
return evas_gl_common_image_new_from_data(re->win->gl_context, w, h, image_data, alpha, cspace);
|
||||||
return NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void *
|
static void *
|
||||||
|
@ -809,7 +807,6 @@ eng_image_new_from_copied_data(void *data, int w, int h, DATA32 *image_data, int
|
||||||
re = (Render_Engine *)data;
|
re = (Render_Engine *)data;
|
||||||
eng_window_use(re->win);
|
eng_window_use(re->win);
|
||||||
return evas_gl_common_image_new_from_copied_data(re->win->gl_context, w, h, image_data, alpha, cspace);
|
return evas_gl_common_image_new_from_copied_data(re->win->gl_context, w, h, image_data, alpha, cspace);
|
||||||
return NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -1031,7 +1028,10 @@ eng_image_scale_hint_set(void *data __UNUSED__, void *image, int hint)
|
||||||
static void
|
static void
|
||||||
eng_image_map4_draw(void *data __UNUSED__, void *context, void *surface, void *image, RGBA_Map_Point *p, int smooth, int level)
|
eng_image_map4_draw(void *data __UNUSED__, void *context, void *surface, void *image, RGBA_Map_Point *p, int smooth, int level)
|
||||||
{
|
{
|
||||||
// XXX
|
Render_Engine *re;
|
||||||
|
|
||||||
|
re = (Render_Engine *)data;
|
||||||
|
evas_gl_common_image_map4_draw(re->win->gl_context, image, p, smooth, level);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void *
|
static void *
|
||||||
|
|
Loading…
Reference in New Issue