forked from enlightenment/efl
Evas masking: Ensure texture is up-to-date before drawing (GL)
This commit is contained in:
parent
2b1e221fd9
commit
e38f5cafd5
|
@ -62,7 +62,7 @@ evas_gl_font_texture_draw(void *context, void *surface EINA_UNUSED, void *draw_c
|
|||
Evas_Engine_GL_Context *gc = context;
|
||||
RGBA_Draw_Context *dc = draw_context;
|
||||
Evas_GL_Image *mask = gc->dc->clip.mask;
|
||||
Evas_GL_Texture *tex, *mtex = mask ? mask->tex : NULL;
|
||||
Evas_GL_Texture *tex, *mtex = NULL;
|
||||
Cutout_Rect *rct;
|
||||
int r, g, b, a;
|
||||
double ssx, ssy, ssw, ssh;
|
||||
|
@ -82,16 +82,21 @@ evas_gl_font_texture_draw(void *context, void *surface EINA_UNUSED, void *draw_c
|
|||
b = (dc->col.col ) & 0xff;
|
||||
sx = 0; sy = 0; sw = tex->w, sh = tex->h;
|
||||
|
||||
if (mtex && mtex->pt && mtex->pt->w && mtex->pt->h)
|
||||
if (mask)
|
||||
{
|
||||
// canvas coords
|
||||
mx = gc->dc->clip.mask_x;
|
||||
my = gc->dc->clip.mask_y;
|
||||
mw = mask->w;
|
||||
mh = mask->h;
|
||||
mask_smooth = mask->scaled.smooth;
|
||||
evas_gl_common_image_update(gc, mask);
|
||||
mtex = mask->tex;
|
||||
if (mtex && mtex->pt && mtex->pt->w && mtex->pt->h)
|
||||
{
|
||||
// canvas coords
|
||||
mx = gc->dc->clip.mask_x;
|
||||
my = gc->dc->clip.mask_y;
|
||||
mw = mask->w;
|
||||
mh = mask->h;
|
||||
mask_smooth = mask->scaled.smooth;
|
||||
}
|
||||
else mtex = NULL;
|
||||
}
|
||||
else mtex = NULL;
|
||||
|
||||
if ((!gc->dc->cutout.rects) ||
|
||||
((gc->shared->info.tune.cutout.max > 0) &&
|
||||
|
|
|
@ -933,7 +933,7 @@ evas_gl_common_image_map_draw(Evas_Engine_GL_Context *gc, Evas_GL_Image *im,
|
|||
RGBA_Draw_Context *dc = gc->dc;
|
||||
Eina_Bool mask_smooth = EINA_FALSE;
|
||||
Evas_GL_Image *mask = dc->clip.mask;
|
||||
Evas_GL_Texture *mtex = mask ? mask->tex : NULL;
|
||||
Evas_GL_Texture *mtex = NULL;
|
||||
int r, g, b, a;
|
||||
int c, cx, cy, cw, ch;
|
||||
|
||||
|
@ -957,16 +957,21 @@ evas_gl_common_image_map_draw(Evas_Engine_GL_Context *gc, Evas_GL_Image *im,
|
|||
if (!im->tex) return;
|
||||
im->tex->im = im;
|
||||
|
||||
if (mtex && mtex->pt && mtex->pt->w && mtex->pt->h)
|
||||
if (mask)
|
||||
{
|
||||
// canvas coords
|
||||
mx = gc->dc->clip.mask_x;
|
||||
my = gc->dc->clip.mask_y;
|
||||
mw = mask->w;
|
||||
mh = mask->h;
|
||||
mask_smooth = mask->scaled.smooth;
|
||||
evas_gl_common_image_update(gc, mask);
|
||||
mtex = mask->tex;
|
||||
if (mtex && mtex->pt && mtex->pt->w && mtex->pt->h)
|
||||
{
|
||||
// canvas coords
|
||||
mx = gc->dc->clip.mask_x;
|
||||
my = gc->dc->clip.mask_y;
|
||||
mw = mask->w;
|
||||
mh = mask->h;
|
||||
mask_smooth = mask->scaled.smooth;
|
||||
}
|
||||
else mtex = NULL;
|
||||
}
|
||||
else mtex = NULL;
|
||||
|
||||
evas_gl_common_context_image_map_push(gc, im->tex, npoints, p,
|
||||
c, cx, cy, cw, ch,
|
||||
|
@ -988,7 +993,7 @@ _evas_gl_common_image_push(Evas_Engine_GL_Context *gc, Evas_GL_Image *im,
|
|||
{
|
||||
int mx = 0, my = 0, mw = 0, mh = 0;
|
||||
double ssx, ssy, ssw, ssh;
|
||||
Evas_GL_Texture *mtex = mask ? mask->tex : NULL;
|
||||
Evas_GL_Texture *mtex = NULL;
|
||||
Eina_Bool mask_smooth = EINA_FALSE;
|
||||
int nx, ny, nw, nh;
|
||||
|
||||
|
@ -998,16 +1003,21 @@ _evas_gl_common_image_push(Evas_Engine_GL_Context *gc, Evas_GL_Image *im,
|
|||
if ((nw < 1) || (nh < 1)) return;
|
||||
if (!im->tex) return;
|
||||
|
||||
if (mtex && mtex->pt && mtex->pt->w && mtex->pt->h)
|
||||
if (mask)
|
||||
{
|
||||
// canvas coords
|
||||
mx = gc->dc->clip.mask_x;
|
||||
my = gc->dc->clip.mask_y;
|
||||
mw = mask->w;
|
||||
mh = mask->h;
|
||||
mask_smooth = mask->scaled.smooth;
|
||||
evas_gl_common_image_update(gc, mask);
|
||||
mtex = mask->tex;
|
||||
if (mtex && mtex->pt && mtex->pt->w && mtex->pt->h)
|
||||
{
|
||||
// canvas coords
|
||||
mx = gc->dc->clip.mask_x;
|
||||
my = gc->dc->clip.mask_y;
|
||||
mw = mask->w;
|
||||
mh = mask->h;
|
||||
mask_smooth = mask->scaled.smooth;
|
||||
}
|
||||
else mtex = NULL;
|
||||
}
|
||||
else mtex = NULL;
|
||||
|
||||
if ((nx == dx) && (ny == dy) && (nw == dw) && (nh == dh))
|
||||
{
|
||||
|
@ -1130,18 +1140,6 @@ evas_gl_common_image_draw(Evas_Engine_GL_Context *gc, Evas_GL_Image *im, int sx,
|
|||
r = g = b = a = 255;
|
||||
}
|
||||
|
||||
// Prepare mask image, if there is one
|
||||
mask = dc->clip.mask;
|
||||
if (mask)
|
||||
{
|
||||
evas_gl_common_image_update(gc, mask);
|
||||
if (!mask->tex)
|
||||
{
|
||||
ERR("Failed to apply mask image");
|
||||
mask = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
evas_gl_common_image_update(gc, im);
|
||||
if (!im->tex)
|
||||
{
|
||||
|
@ -1149,6 +1147,8 @@ evas_gl_common_image_draw(Evas_Engine_GL_Context *gc, Evas_GL_Image *im, int sx,
|
|||
return;
|
||||
}
|
||||
|
||||
mask = gc->dc->clip.mask;
|
||||
|
||||
switch (im->cs.space)
|
||||
{
|
||||
case EVAS_COLORSPACE_YCBCR422P601_PL:
|
||||
|
|
|
@ -38,6 +38,7 @@ evas_gl_common_line_draw(Evas_Engine_GL_Context *gc, int x1, int y1, int x2, int
|
|||
mask = gc->dc->clip.mask;
|
||||
if (mask)
|
||||
{
|
||||
evas_gl_common_image_update(gc, mask);
|
||||
mtex = mask->tex;
|
||||
if (mtex && mtex->pt && mtex->pt->w && mtex->pt->h)
|
||||
{
|
||||
|
|
|
@ -8,7 +8,7 @@ evas_gl_common_rect_draw(Evas_Engine_GL_Context *gc, int x, int y, int w, int h)
|
|||
int mx = 0, my = 0, mw = 0, mh = 0;
|
||||
Eina_Bool mask_smooth = EINA_FALSE;
|
||||
Evas_GL_Image *mask = gc->dc->clip.mask;
|
||||
Evas_GL_Texture *mtex = mask ? mask->tex : NULL;
|
||||
Evas_GL_Texture *mtex = NULL;
|
||||
|
||||
if ((w <= 0) || (h <= 0)) return;
|
||||
if (!(RECTS_INTERSECT(x, y, w, h, 0, 0, gc->w, gc->h))) return;
|
||||
|
@ -30,16 +30,21 @@ evas_gl_common_rect_draw(Evas_Engine_GL_Context *gc, int x, int y, int w, int h)
|
|||
gc->dc->clip.w, gc->dc->clip.h);
|
||||
}
|
||||
|
||||
if (mtex && mtex->pt && mtex->pt->w && mtex->pt->h)
|
||||
if (mask)
|
||||
{
|
||||
// canvas coords
|
||||
mx = gc->dc->clip.mask_x;
|
||||
my = gc->dc->clip.mask_y;
|
||||
mw = mask->w;
|
||||
mh = mask->h;
|
||||
mask_smooth = mask->scaled.smooth;
|
||||
evas_gl_common_image_update(gc, mask);
|
||||
mtex = mask->tex;
|
||||
if (mtex && mtex->pt && mtex->pt->w && mtex->pt->h)
|
||||
{
|
||||
// canvas coords
|
||||
mx = gc->dc->clip.mask_x;
|
||||
my = gc->dc->clip.mask_y;
|
||||
mw = mask->w;
|
||||
mh = mask->h;
|
||||
mask_smooth = mask->scaled.smooth;
|
||||
}
|
||||
else mtex = NULL;
|
||||
}
|
||||
else mtex = NULL;
|
||||
|
||||
if (!gc->dc->cutout.rects)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue