forked from enlightenment/efl
evas: factorize some code.
This commit is contained in:
parent
c1556b7112
commit
5c82716fe8
|
@ -701,13 +701,95 @@ evas_gl_common_image_map_draw(Evas_Engine_GL_Context *gc, Evas_GL_Image *im,
|
||||||
im->cs.space);
|
im->cs.space);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
evas_gl_common_image_push(Evas_Engine_GL_Context *gc, Evas_GL_Image *im,
|
||||||
|
int dx, int dy, int dw, int dh,
|
||||||
|
int sx, int sy, int sw, int sh,
|
||||||
|
int cx, int cy, int cw, int ch,
|
||||||
|
int r, int g, int b, int a, int smooth,
|
||||||
|
int yuv, int yuy2, int nv12)
|
||||||
|
{
|
||||||
|
double ssx, ssy, ssw, ssh;
|
||||||
|
int nx, ny, nw, nh;
|
||||||
|
|
||||||
|
nx = dx; ny = dy; nw = dw; nh = dh;
|
||||||
|
RECTS_CLIP_TO_RECT(nx, ny, nw, nh,
|
||||||
|
cx, cy, cw, ch);
|
||||||
|
if ((nw < 1) || (nh < 1)) return;
|
||||||
|
if ((nx == dx) && (ny == dy) && (nw == dw) && (nh == dh))
|
||||||
|
{
|
||||||
|
if (yuv)
|
||||||
|
evas_gl_common_context_yuv_push(gc,
|
||||||
|
im->tex,
|
||||||
|
sx, sy, sw, sh,
|
||||||
|
dx, dy, dw, dh,
|
||||||
|
r, g, b, a,
|
||||||
|
smooth);
|
||||||
|
else if (yuy2)
|
||||||
|
evas_gl_common_context_yuy2_push(gc,
|
||||||
|
im->tex,
|
||||||
|
sx, sy, sw, sh,
|
||||||
|
dx, dy, dw, dh,
|
||||||
|
r, g, b, a,
|
||||||
|
smooth);
|
||||||
|
else if (nv12)
|
||||||
|
evas_gl_common_context_nv12_push(gc,
|
||||||
|
im->tex,
|
||||||
|
sx, sy, sw, sh,
|
||||||
|
dx, dy, dw, dh,
|
||||||
|
r, g, b, a,
|
||||||
|
smooth);
|
||||||
|
else
|
||||||
|
evas_gl_common_context_image_push(gc,
|
||||||
|
im->tex,
|
||||||
|
sx, sy, sw, sh,
|
||||||
|
dx, dy, dw, dh,
|
||||||
|
r, g, b, a,
|
||||||
|
smooth, im->tex_only);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
ssx = (double)sx + ((double)(sw * (nx - dx)) / (double)(dw));
|
||||||
|
ssy = (double)sy + ((double)(sh * (ny - dy)) / (double)(dh));
|
||||||
|
ssw = ((double)sw * (double)(nw)) / (double)(dw);
|
||||||
|
ssh = ((double)sh * (double)(nh)) / (double)(dh);
|
||||||
|
|
||||||
|
if (yuv)
|
||||||
|
evas_gl_common_context_yuv_push(gc,
|
||||||
|
im->tex,
|
||||||
|
ssx, ssy, ssw, ssh,
|
||||||
|
nx, ny, nw, nh,
|
||||||
|
r, g, b, a,
|
||||||
|
smooth);
|
||||||
|
else if (yuy2)
|
||||||
|
evas_gl_common_context_yuy2_push(gc,
|
||||||
|
im->tex,
|
||||||
|
ssx, ssy, ssw, ssh,
|
||||||
|
nx, ny, nw, nh,
|
||||||
|
r, g, b, a,
|
||||||
|
smooth);
|
||||||
|
else if (nv12)
|
||||||
|
evas_gl_common_context_nv12_push(gc,
|
||||||
|
im->tex,
|
||||||
|
ssx, ssy, ssw, ssh,
|
||||||
|
nx, ny, nw, nh,
|
||||||
|
r, g, b, a,
|
||||||
|
smooth);
|
||||||
|
else
|
||||||
|
evas_gl_common_context_image_push(gc,
|
||||||
|
im->tex,
|
||||||
|
ssx, ssy, ssw, ssh,
|
||||||
|
nx, ny, nw, nh,
|
||||||
|
r, g, b, a,
|
||||||
|
smooth, im->tex_only);
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
evas_gl_common_image_draw(Evas_Engine_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_common_image_draw(Evas_Engine_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 Cutout_Rects *rects = NULL;
|
static Cutout_Rects *rects = NULL;
|
||||||
RGBA_Draw_Context *dc;
|
RGBA_Draw_Context *dc;
|
||||||
int r, g, b, a;
|
int r, g, b, a;
|
||||||
double ssx, ssy, ssw, ssh;
|
|
||||||
Cutout_Rect *rct;
|
Cutout_Rect *rct;
|
||||||
int c, cx, cy, cw, ch;
|
int c, cx, cy, cw, ch;
|
||||||
int i;
|
int i;
|
||||||
|
@ -755,111 +837,22 @@ evas_gl_common_image_draw(Evas_Engine_GL_Context *gc, Evas_GL_Image *im, int sx,
|
||||||
{
|
{
|
||||||
if (gc->dc->clip.use)
|
if (gc->dc->clip.use)
|
||||||
{
|
{
|
||||||
int nx, ny, nw, nh;
|
evas_gl_common_image_push(gc, im,
|
||||||
|
dx, dy, dw, dh,
|
||||||
nx = dx; ny = dy; nw = dw; nh = dh;
|
sx, sy, sw, sh,
|
||||||
RECTS_CLIP_TO_RECT(nx, ny, nw, nh,
|
|
||||||
gc->dc->clip.x, gc->dc->clip.y,
|
gc->dc->clip.x, gc->dc->clip.y,
|
||||||
gc->dc->clip.w, gc->dc->clip.h);
|
gc->dc->clip.w, gc->dc->clip.h,
|
||||||
if ((nw < 1) || (nh < 1)) return;
|
r, g, b, a, smooth,
|
||||||
if ((nx == dx) && (ny == dy) && (nw == dw) && (nh == dh))
|
yuv, yuy2, nv12);
|
||||||
{
|
|
||||||
if (yuv)
|
|
||||||
evas_gl_common_context_yuv_push(gc,
|
|
||||||
im->tex,
|
|
||||||
sx, sy, sw, sh,
|
|
||||||
dx, dy, dw, dh,
|
|
||||||
r, g, b, a,
|
|
||||||
smooth);
|
|
||||||
else if (yuy2)
|
|
||||||
evas_gl_common_context_yuy2_push(gc,
|
|
||||||
im->tex,
|
|
||||||
sx, sy, sw, sh,
|
|
||||||
dx, dy, dw, dh,
|
|
||||||
r, g, b, a,
|
|
||||||
smooth);
|
|
||||||
else if (nv12)
|
|
||||||
evas_gl_common_context_nv12_push(gc,
|
|
||||||
im->tex,
|
|
||||||
sx, sy, sw, sh,
|
|
||||||
dx, dy, dw, dh,
|
|
||||||
r, g, b, a,
|
|
||||||
smooth);
|
|
||||||
else
|
|
||||||
|
|
||||||
evas_gl_common_context_image_push(gc,
|
|
||||||
im->tex,
|
|
||||||
sx, sy, sw, sh,
|
|
||||||
dx, dy, dw, dh,
|
|
||||||
r, g, b, a,
|
|
||||||
smooth, im->tex_only);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
ssx = (double)sx + ((double)(sw * (nx - dx)) / (double)(dw));
|
|
||||||
ssy = (double)sy + ((double)(sh * (ny - dy)) / (double)(dh));
|
|
||||||
ssw = ((double)sw * (double)(nw)) / (double)(dw);
|
|
||||||
ssh = ((double)sh * (double)(nh)) / (double)(dh);
|
|
||||||
|
|
||||||
if (yuv)
|
|
||||||
evas_gl_common_context_yuv_push(gc,
|
|
||||||
im->tex,
|
|
||||||
ssx, ssy, ssw, ssh,
|
|
||||||
nx, ny, nw, nh,
|
|
||||||
r, g, b, a,
|
|
||||||
smooth);
|
|
||||||
else if (yuy2)
|
|
||||||
evas_gl_common_context_yuy2_push(gc,
|
|
||||||
im->tex,
|
|
||||||
ssx, ssy, ssw, ssh,
|
|
||||||
nx, ny, nw, nh,
|
|
||||||
r, g, b, a,
|
|
||||||
smooth);
|
|
||||||
else if (nv12)
|
|
||||||
evas_gl_common_context_nv12_push(gc,
|
|
||||||
im->tex,
|
|
||||||
ssx, ssy, ssw, ssh,
|
|
||||||
nx, ny, nw, nh,
|
|
||||||
r, g, b, a,
|
|
||||||
smooth);
|
|
||||||
else
|
|
||||||
evas_gl_common_context_image_push(gc,
|
|
||||||
im->tex,
|
|
||||||
ssx, ssy, ssw, ssh,
|
|
||||||
nx, ny, nw, nh,
|
|
||||||
r, g, b, a,
|
|
||||||
smooth, im->tex_only);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (yuv)
|
evas_gl_common_image_push(gc, im,
|
||||||
evas_gl_common_context_yuv_push(gc,
|
|
||||||
im->tex,
|
|
||||||
sx, sy, sw, sh,
|
|
||||||
dx, dy, dw, dh,
|
dx, dy, dw, dh,
|
||||||
r, g, b, a,
|
|
||||||
smooth);
|
|
||||||
else if (yuy2)
|
|
||||||
evas_gl_common_context_yuy2_push(gc,
|
|
||||||
im->tex,
|
|
||||||
sx, sy, sw, sh,
|
sx, sy, sw, sh,
|
||||||
dx, dy, dw, dh,
|
|
||||||
r, g, b, a,
|
|
||||||
smooth);
|
|
||||||
else if (nv12)
|
|
||||||
evas_gl_common_context_nv12_push(gc,
|
|
||||||
im->tex,
|
|
||||||
sx, sy, sw, sh,
|
sx, sy, sw, sh,
|
||||||
dx, dy, dw, dh,
|
r, g, b, a, smooth,
|
||||||
r, g, b, a,
|
yuv, yuy2, nv12);
|
||||||
smooth);
|
|
||||||
else
|
|
||||||
evas_gl_common_context_image_push(gc,
|
|
||||||
im->tex,
|
|
||||||
sx, sy, sw, sh,
|
|
||||||
dx, dy, dw, dh,
|
|
||||||
r, g, b, a,
|
|
||||||
smooth, im->tex_only);
|
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -877,76 +870,14 @@ evas_gl_common_image_draw(Evas_Engine_GL_Context *gc, Evas_GL_Image *im, int sx,
|
||||||
rects = evas_common_draw_context_apply_cutouts(dc, rects);
|
rects = evas_common_draw_context_apply_cutouts(dc, rects);
|
||||||
for (i = 0; i < rects->active; ++i)
|
for (i = 0; i < rects->active; ++i)
|
||||||
{
|
{
|
||||||
int nx, ny, nw, nh;
|
|
||||||
|
|
||||||
rct = rects->rects + i;
|
rct = rects->rects + i;
|
||||||
nx = dx; ny = dy; nw = dw; nh = dh;
|
|
||||||
RECTS_CLIP_TO_RECT(nx, ny, nw, nh, rct->x, rct->y, rct->w, rct->h);
|
evas_gl_common_image_push(gc, im,
|
||||||
if ((nw < 1) || (nh < 1)) continue;
|
|
||||||
if ((nx == dx) && (ny == dy) && (nw == dw) && (nh == dh))
|
|
||||||
{
|
|
||||||
if (yuv)
|
|
||||||
evas_gl_common_context_yuv_push(gc,
|
|
||||||
im->tex,
|
|
||||||
sx, sy, sw, sh,
|
|
||||||
dx, dy, dw, dh,
|
dx, dy, dw, dh,
|
||||||
r, g, b, a,
|
|
||||||
smooth);
|
|
||||||
else if (yuy2)
|
|
||||||
evas_gl_common_context_yuy2_push(gc,
|
|
||||||
im->tex,
|
|
||||||
sx, sy, sw, sh,
|
sx, sy, sw, sh,
|
||||||
dx, dy, dw, dh,
|
rct->x, rct->y, rct->w, rct->h,
|
||||||
r, g, b, a,
|
r, g, b, a, smooth,
|
||||||
smooth);
|
yuv, yuy2, nv12);
|
||||||
else if (nv12)
|
|
||||||
evas_gl_common_context_nv12_push(gc,
|
|
||||||
im->tex,
|
|
||||||
sx, sy, sw, sh,
|
|
||||||
dx, dy, dw, dh,
|
|
||||||
r, g, b, a,
|
|
||||||
smooth);
|
|
||||||
else
|
|
||||||
evas_gl_common_context_image_push(gc,
|
|
||||||
im->tex,
|
|
||||||
sx, sy, sw, sh,
|
|
||||||
dx, dy, dw, dh,
|
|
||||||
r, g, b, a,
|
|
||||||
smooth, im->tex_only);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
ssx = (double)sx + ((double)(sw * (nx - dx)) / (double)(dw));
|
|
||||||
ssy = (double)sy + ((double)(sh * (ny - dy)) / (double)(dh));
|
|
||||||
ssw = ((double)sw * (double)(nw)) / (double)(dw);
|
|
||||||
ssh = ((double)sh * (double)(nh)) / (double)(dh);
|
|
||||||
if (yuv)
|
|
||||||
evas_gl_common_context_yuv_push(gc,
|
|
||||||
im->tex,
|
|
||||||
ssx, ssy, ssw, ssh,
|
|
||||||
nx, ny, nw, nh,
|
|
||||||
r, g, b, a,
|
|
||||||
smooth);
|
|
||||||
else if (yuy2)
|
|
||||||
evas_gl_common_context_yuy2_push(gc,
|
|
||||||
im->tex,
|
|
||||||
ssx, ssy, ssw, ssh,
|
|
||||||
nx, ny, nw, nh,
|
|
||||||
r, g, b, a,
|
|
||||||
smooth);
|
|
||||||
else if (nv12)
|
|
||||||
evas_gl_common_context_nv12_push(gc,
|
|
||||||
im->tex,
|
|
||||||
ssx, ssy, ssw, ssh,
|
|
||||||
nx, ny, nw, nh,
|
|
||||||
r, g, b, a,
|
|
||||||
smooth);
|
|
||||||
else
|
|
||||||
evas_gl_common_context_image_push(gc,
|
|
||||||
im->tex,
|
|
||||||
ssx, ssy, ssw, ssh,
|
|
||||||
nx, ny, nw, nh,
|
|
||||||
r, g, b, a,
|
|
||||||
smooth, im->tex_only);
|
|
||||||
}
|
}
|
||||||
/* restore clip info */
|
/* restore clip info */
|
||||||
gc->dc->clip.use = c; gc->dc->clip.x = cx; gc->dc->clip.y = cy; gc->dc->clip.w = cw; gc->dc->clip.h = ch;
|
gc->dc->clip.use = c; gc->dc->clip.x = cx; gc->dc->clip.y = cy; gc->dc->clip.w = cw; gc->dc->clip.h = ch;
|
||||||
|
|
Loading…
Reference in New Issue