diff options
author | Jean-Philippe Andre <jp.andre@samsung.com> | 2015-04-01 10:54:45 +0900 |
---|---|---|
committer | Jean-Philippe Andre <jp.andre@samsung.com> | 2015-04-01 11:02:18 +0900 |
commit | e38f5cafd579d714f3793fe7b4ef75747e62233f (patch) | |
tree | 164dc127638d070e6a97c82160c1e9d614da588c | |
parent | 2b1e221fd9ca7a8e3394955ffd98b4ea003d9367 (diff) | |
download | efl-e38f5cafd579d714f3793fe7b4ef75747e62233f.tar.gz |
Evas masking: Ensure texture is up-to-date before drawing (GL)
4 files changed, 59 insertions, 48 deletions
diff --git a/src/modules/evas/engines/gl_common/evas_gl_font.c b/src/modules/evas/engines/gl_common/evas_gl_font.c index f7001fbe64..968168d9b5 100644 --- a/src/modules/evas/engines/gl_common/evas_gl_font.c +++ b/src/modules/evas/engines/gl_common/evas_gl_font.c @@ -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) && diff --git a/src/modules/evas/engines/gl_common/evas_gl_image.c b/src/modules/evas/engines/gl_common/evas_gl_image.c index 1541afd881..6f62844242 100644 --- a/src/modules/evas/engines/gl_common/evas_gl_image.c +++ b/src/modules/evas/engines/gl_common/evas_gl_image.c @@ -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: diff --git a/src/modules/evas/engines/gl_common/evas_gl_line.c b/src/modules/evas/engines/gl_common/evas_gl_line.c index 3ad4e86085..1b7def125f 100644 --- a/src/modules/evas/engines/gl_common/evas_gl_line.c +++ b/src/modules/evas/engines/gl_common/evas_gl_line.c @@ -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) { diff --git a/src/modules/evas/engines/gl_common/evas_gl_rectangle.c b/src/modules/evas/engines/gl_common/evas_gl_rectangle.c index d0042c9264..2cbd26f6fb 100644 --- a/src/modules/evas/engines/gl_common/evas_gl_rectangle.c +++ b/src/modules/evas/engines/gl_common/evas_gl_rectangle.c @@ -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) { |