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:
Carsten Haitzler 2009-11-11 11:39:25 +00:00
parent 43fb7ca168
commit 6e22b36451
4 changed files with 142 additions and 35 deletions

View File

@ -241,6 +241,12 @@ void evas_gl_common_context_yuv_push(Evas_GL_Context *gc,
int x, int y, int w, int h,
int r, int g, int b, int a,
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_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);
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_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);
Evas_GL_Texture *evas_gl_font_texture_new(Evas_GL_Context *gc, RGBA_Font_Glyph *fg);

View File

@ -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
evas_gl_common_context_flush(Evas_GL_Context *gc)
{

View File

@ -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_YCBCR422P709_PL:
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->cache_entry.h * sizeof(unsigned char *) * 2);
if ((data) && (im->cs.data))
@ -184,33 +184,9 @@ evas_gl_common_image_dirty(Evas_GL_Image *im)
im->dirty = 1;
}
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)
static void
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) ||
(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
*/
space = im->cs.space;
switch (space)
switch (im->cs.space)
{
case EVAS_COLORSPACE_ARGB8888:
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->dirty = 0;
}
yuv = 1;
if (!im->tex) return;
break;
default:
printf("unhandled img format\n");
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)
// || (gc->dc->cutout.active > 32)
)

View File

@ -787,7 +787,6 @@ eng_image_load(void *data, const char *file, const char *key, int *error, Evas_I
*error = 0;
eng_window_use(re->win);
return evas_gl_common_image_load(re->win->gl_context, file, key, lo);
return NULL;
}
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;
eng_window_use(re->win);
return evas_gl_common_image_new_from_data(re->win->gl_context, w, h, image_data, alpha, cspace);
return NULL;
}
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;
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 NULL;
}
static void
@ -1031,7 +1028,10 @@ eng_image_scale_hint_set(void *data __UNUSED__, void *image, int hint)
static void
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 *