forked from enlightenment/efl
Evas masking: Aaaand fix another series of memleaks
Don't inc-ref more than we can dec-ref.
This commit is contained in:
parent
bc436ba95f
commit
04ba5a3b99
|
@ -1727,9 +1727,15 @@ eng_context_clip_image_set(void *data EINA_UNUSED, void *context, void *surface,
|
||||||
{
|
{
|
||||||
RGBA_Draw_Context *ctx = context;
|
RGBA_Draw_Context *ctx = context;
|
||||||
Evas_GL_Image *im = surface;
|
Evas_GL_Image *im = surface;
|
||||||
|
Eina_Bool noinc = EINA_FALSE;
|
||||||
|
|
||||||
if (ctx->clip.mask && ctx->clip.mask != surface)
|
if (ctx->clip.mask)
|
||||||
eng_context_clip_image_unset(data, context);
|
{
|
||||||
|
if (ctx->clip.mask != surface)
|
||||||
|
eng_context_clip_image_unset(data, context);
|
||||||
|
else
|
||||||
|
noinc = EINA_TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
ctx->clip.mask = surface;
|
ctx->clip.mask = surface;
|
||||||
ctx->clip.mask_x = x;
|
ctx->clip.mask_x = x;
|
||||||
|
@ -1738,18 +1744,21 @@ eng_context_clip_image_set(void *data EINA_UNUSED, void *context, void *surface,
|
||||||
if (EINA_UNLIKELY(im && im->im))
|
if (EINA_UNLIKELY(im && im->im))
|
||||||
{
|
{
|
||||||
// Unlikely to happen because masks are render surfaces.
|
// Unlikely to happen because masks are render surfaces.
|
||||||
|
if (!noinc)
|
||||||
|
{
|
||||||
#ifdef EVAS_CSERVE2
|
#ifdef EVAS_CSERVE2
|
||||||
if (evas_cserve2_use_get())
|
if (evas_cserve2_use_get())
|
||||||
evas_cache2_image_ref(&im->im->cache_entry);
|
evas_cache2_image_ref(&im->im->cache_entry);
|
||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
evas_cache_image_ref(&im->im->cache_entry);
|
evas_cache_image_ref(&im->im->cache_entry);
|
||||||
|
}
|
||||||
RECTS_CLIP_TO_RECT(ctx->clip.x, ctx->clip.y, ctx->clip.w, ctx->clip.h,
|
RECTS_CLIP_TO_RECT(ctx->clip.x, ctx->clip.y, ctx->clip.w, ctx->clip.h,
|
||||||
x, y, im->im->cache_entry.w, im->im->cache_entry.h);
|
x, y, im->im->cache_entry.w, im->im->cache_entry.h);
|
||||||
}
|
}
|
||||||
else if (im)
|
else if (im)
|
||||||
{
|
{
|
||||||
im->references++;
|
if (!noinc) im->references++;
|
||||||
RECTS_CLIP_TO_RECT(ctx->clip.x, ctx->clip.y, ctx->clip.w, ctx->clip.h,
|
RECTS_CLIP_TO_RECT(ctx->clip.x, ctx->clip.y, ctx->clip.w, ctx->clip.h,
|
||||||
x, y, im->w, im->h);
|
x, y, im->w, im->h);
|
||||||
}
|
}
|
||||||
|
|
|
@ -440,9 +440,15 @@ static void
|
||||||
eng_context_clip_image_set(void *data EINA_UNUSED, void *context, void *surface, int x, int y)
|
eng_context_clip_image_set(void *data EINA_UNUSED, void *context, void *surface, int x, int y)
|
||||||
{
|
{
|
||||||
RGBA_Draw_Context *ctx = context;
|
RGBA_Draw_Context *ctx = context;
|
||||||
|
Eina_Bool noinc = EINA_FALSE;
|
||||||
|
|
||||||
if (ctx->clip.mask && ctx->clip.mask != surface)
|
if (ctx->clip.mask)
|
||||||
eng_context_clip_image_unset(data, context);
|
{
|
||||||
|
if (ctx->clip.mask != surface)
|
||||||
|
eng_context_clip_image_unset(data, context);
|
||||||
|
else
|
||||||
|
noinc = EINA_TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
ctx->clip.mask = surface;
|
ctx->clip.mask = surface;
|
||||||
ctx->clip.mask_x = x;
|
ctx->clip.mask_x = x;
|
||||||
|
@ -451,13 +457,15 @@ eng_context_clip_image_set(void *data EINA_UNUSED, void *context, void *surface,
|
||||||
if (surface)
|
if (surface)
|
||||||
{
|
{
|
||||||
Image_Entry *ie = surface;
|
Image_Entry *ie = surface;
|
||||||
|
if (!noinc)
|
||||||
|
{
|
||||||
#ifdef EVAS_CSERVE2
|
#ifdef EVAS_CSERVE2
|
||||||
if (evas_cserve2_use_get())
|
if (evas_cserve2_use_get())
|
||||||
evas_cache2_image_ref(ie);
|
evas_cache2_image_ref(ie);
|
||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
evas_cache_image_ref(ie);
|
evas_cache_image_ref(ie);
|
||||||
|
}
|
||||||
RECTS_CLIP_TO_RECT(ctx->clip.x, ctx->clip.y, ctx->clip.w, ctx->clip.h,
|
RECTS_CLIP_TO_RECT(ctx->clip.x, ctx->clip.y, ctx->clip.w, ctx->clip.h,
|
||||||
x, y, ie->w, ie->h);
|
x, y, ie->w, ie->h);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue