evas gl - fixz minor leak on exit of rectangles

these were static rect cutouts, so they stayed around on exit and thus
we "lost" them. this nukes them on context free and each new frame.
fixes the "leak"
This commit is contained in:
Carsten Haitzler 2014-08-07 18:13:07 +09:00
parent 4e5d70511a
commit 8b796edce7
6 changed files with 29 additions and 17 deletions

View File

@ -11,6 +11,7 @@
static int sym_done = 0;
int _evas_engine_GL_common_log_dom = -1;
Cutout_Rects *_evas_gl_common_cutout_rects = NULL;
typedef void (*glsym_func_void) ();
typedef void *(*glsym_func_void_ptr) ();
@ -934,6 +935,11 @@ evas_gl_common_context_free(Evas_Engine_GL_Context *gc)
}
if (gc == _evas_gl_common_context) _evas_gl_common_context = NULL;
free(gc);
if (_evas_gl_common_cutout_rects)
{
evas_common_draw_context_apply_clear_cutouts(_evas_gl_common_cutout_rects);
_evas_gl_common_cutout_rects = NULL;
}
}
EAPI void
@ -949,6 +955,11 @@ evas_gl_common_context_newframe(Evas_Engine_GL_Context *gc)
{
int i;
if (_evas_gl_common_cutout_rects)
{
evas_common_draw_context_apply_clear_cutouts(_evas_gl_common_cutout_rects);
_evas_gl_common_cutout_rects = NULL;
}
if (dbgflushnum < 0)
{
dbgflushnum = 0;
@ -3332,7 +3343,6 @@ finish:
else return 0;
}
Eina_Bool
evas_gl_common_module_open(void)
{

View File

@ -62,7 +62,6 @@ 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_Texture *tex;
static Cutout_Rects *rects = NULL;
Cutout_Rect *rct;
int r, g, b, a;
double ssx, ssy, ssw, ssh;
@ -130,12 +129,12 @@ evas_gl_font_texture_draw(void *context, void *surface EINA_UNUSED, void *draw_c
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;
return;
}
rects = evas_common_draw_context_apply_cutouts(dc, rects);
for (i = 0; i < rects->active; ++i)
_evas_gl_common_cutout_rects = evas_common_draw_context_apply_cutouts(dc, _evas_gl_common_cutout_rects);
for (i = 0; i < _evas_gl_common_cutout_rects->active; ++i)
{
int nx, ny, nw, nh;
rct = rects->rects + i;
rct = _evas_gl_common_cutout_rects->rects + i;
nx = x; ny = y; nw = tex->w; nh = tex->h;
RECTS_CLIP_TO_RECT(nx, ny, nw, nh, rct->x, rct->y, rct->w, rct->h);
if ((nw < 1) || (nh < 1)) continue;
@ -157,6 +156,7 @@ evas_gl_font_texture_draw(void *context, void *surface EINA_UNUSED, void *draw_c
nx, ny, nw, nh,
r, g, b, a);
}
evas_common_draw_context_cutouts_free(_evas_gl_common_cutout_rects);
/* 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;
}

View File

@ -1074,7 +1074,6 @@ _evas_gl_common_image_push(Evas_Engine_GL_Context *gc, Evas_GL_Image *im,
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)
{
static Cutout_Rects *rects = NULL;
RGBA_Draw_Context *dc;
int r, g, b, a;
Cutout_Rect *rct;
@ -1165,10 +1164,10 @@ evas_gl_common_image_draw(Evas_Engine_GL_Context *gc, Evas_GL_Image *im, int sx,
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;
return;
}
rects = evas_common_draw_context_apply_cutouts(dc, rects);
for (i = 0; i < rects->active; ++i)
_evas_gl_common_cutout_rects = evas_common_draw_context_apply_cutouts(dc, _evas_gl_common_cutout_rects);
for (i = 0; i < _evas_gl_common_cutout_rects->active; ++i)
{
rct = rects->rects + i;
rct = _evas_gl_common_cutout_rects->rects + i;
_evas_gl_common_image_push(gc, im,
dx, dy, dw, dh,
@ -1177,6 +1176,7 @@ evas_gl_common_image_draw(Evas_Engine_GL_Context *gc, Evas_GL_Image *im, int sx,
r, g, b, a, smooth,
yuv, yuy2, nv12, rgb_a_pair);
}
evas_common_draw_context_cutouts_free(_evas_gl_common_cutout_rects);
/* 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;
}

View File

@ -128,7 +128,6 @@ polygon_edge_sorter(const void *a, const void *b)
void
evas_gl_common_poly_draw(Evas_Engine_GL_Context *gc, Evas_GL_Polygon *poly, int dx, int dy)
{
static Cutout_Rects *rects = NULL;
Cutout_Rect *r;
int c, cx, cy, cw, ch, cr, cg, cb, ca, i;
int x = 0, y = 0, w = 0, h = 0;
@ -277,10 +276,10 @@ evas_gl_common_poly_draw(Evas_Engine_GL_Context *gc, Evas_GL_Polygon *poly, int
/* our clip is 0 size.. abort */
if ((gc->dc->clip.w > 0) && (gc->dc->clip.h > 0))
{
rects = evas_common_draw_context_apply_cutouts(gc->dc, rects);
for (i = 0; i < rects->active; ++i)
_evas_gl_common_cutout_rects = evas_common_draw_context_apply_cutouts(gc->dc, _evas_gl_common_cutout_rects);
for (i = 0; i < _evas_gl_common_cutout_rects->active; ++i)
{
r = rects->rects + i;
r = _evas_gl_common_cutout_rects->rects + i;
if ((r->w > 0) && (r->h > 0))
{
EINA_INLIST_FOREACH(spans, span)
@ -295,6 +294,7 @@ evas_gl_common_poly_draw(Evas_Engine_GL_Context *gc, Evas_GL_Polygon *poly, int
}
}
}
evas_common_draw_context_cutouts_free(_evas_gl_common_cutout_rects);
}
}
while (spans)

View File

@ -29,4 +29,6 @@ extern int _evas_engine_GL_common_log_dom;
#endif
#define CRI(...) EINA_LOG_DOM_CRIT(_evas_engine_GL_common_log_dom, __VA_ARGS__)
extern Cutout_Rects *_evas_gl_common_cutout_rects;
#endif

View File

@ -3,7 +3,6 @@
void
evas_gl_common_rect_draw(Evas_Engine_GL_Context *gc, int x, int y, int w, int h)
{
static Cutout_Rects *rects = NULL;
Cutout_Rect *r;
int c, cx, cy, cw, ch, cr, cg, cb, ca, i;
@ -37,15 +36,16 @@ evas_gl_common_rect_draw(Evas_Engine_GL_Context *gc, int x, int y, int w, int h)
/* our clip is 0 size.. abort */
if ((gc->dc->clip.w > 0) && (gc->dc->clip.h > 0))
{
rects = evas_common_draw_context_apply_cutouts(gc->dc, rects);
for (i = 0; i < rects->active; ++i)
_evas_gl_common_cutout_rects = evas_common_draw_context_apply_cutouts(gc->dc, _evas_gl_common_cutout_rects);
for (i = 0; i < _evas_gl_common_cutout_rects->active; ++i)
{
r = rects->rects + i;
r = _evas_gl_common_cutout_rects->rects + i;
if ((r->w > 0) && (r->h > 0))
{
evas_gl_common_context_rectangle_push(gc, r->x, r->y, r->w, r->h, cr, cg, cb, ca);
}
}
evas_common_draw_context_cutouts_free(_evas_gl_common_cutout_rects);
}
}
/* restore clip info */