#endif
}
+static Evas_GL_Texture *
+evas_gl_common_texture_alloc(Evas_Engine_GL_Context *gc,
+ Evas_Coord w, Evas_Coord h,
+ Eina_Bool alpha)
+{
+ Evas_GL_Texture *tex;
+
+ tex = calloc(1, sizeof(Evas_GL_Texture));
+ if (!tex) return NULL;
+
+ tex->gc = gc;
+ tex->references = 1;
+ tex->alpha = alpha;
+ tex->w = w;
+ tex->h = h;
+
+ return tex;
+}
+
+static void
+evas_gl_common_texture_light_free(Evas_GL_Texture *tex)
+{
+ free(tex);
+}
+
static void
_tex_sub_2d(int x, int y, int w, int h, int fmt, int type, const void *pix)
{
Eina_List *l_after = NULL;
int u = 0, v = 0;
- tex = calloc(1, sizeof(Evas_GL_Texture));
+ tex = evas_gl_common_texture_alloc(gc, im->cache_entry.w, im->cache_entry.h, im->cache_entry.flags.alpha);
if (!tex) return NULL;
- tex->gc = gc;
- tex->references = 1;
-
#define TEX_HREP 1
#define TEX_VREP 1
im->cache_entry.h + TEX_VREP, rgba_ifmt, rgba_fmt,
&u, &v, &l_after,
gc->shared->info.tune.atlas.max_alloc_size);
- tex->alpha = 1;
}
else
{
}
if (!tex->pt)
{
- free(tex);
+ evas_gl_common_texture_light_free(tex);
return NULL;
}
tex->x = u + 1;
tex->y = v;
- tex->w = im->cache_entry.w;
- tex->h = im->cache_entry.h;
if (l_after)
tex->pt->allocations =
eina_list_append_relative_list(tex->pt->allocations, tex, l_after);
{
Evas_GL_Texture *tex;
- tex = calloc(1, sizeof(Evas_GL_Texture));
+ tex = evas_gl_common_texture_alloc(gc, w, h, alpha);
if (!tex) return NULL;
- tex->gc = gc;
- tex->references = 1;
- tex->alpha = alpha;
if (alpha)
{
if (gc->shared->info.bgra)
}
if (!tex->pt)
{
- free(tex);
+ evas_gl_common_texture_light_free(tex);
return NULL;
}
- tex->x = 0;
- tex->y = 0;
- tex->w = w;
- tex->h = h;
tex->pt->references++;
return tex;
}
{
Evas_GL_Texture *tex;
- tex = calloc(1, sizeof(Evas_GL_Texture));
+ tex = evas_gl_common_texture_alloc(gc, w, h, alpha);
if (!tex) return NULL;
- tex->gc = gc;
- tex->references = 1;
- tex->alpha = alpha;
if (alpha)
{
if (gc->shared->info.bgra)
}
if (!tex->pt)
{
- free(tex);
+ evas_gl_common_texture_light_free(tex);
return NULL;
}
- tex->x = 0;
- tex->y = 0;
- tex->w = w;
- tex->h = h;
tex->pt->references++;
return tex;
}
{
Evas_GL_Texture *tex;
- tex = calloc(1, sizeof(Evas_GL_Texture));
+ tex = evas_gl_common_texture_alloc(gc, im->w, im->h, im->alpha);
if (!tex) return NULL;
- tex->gc = gc;
- tex->references = 1;
- tex->alpha = im->alpha;
- tex->x = 0;
- tex->y = 0;
- tex->w = im->w;
- tex->h = im->h;
if (tex->alpha)
{
if (gc->shared->info.bgra)
}
if (!tex->pt)
{
- free(tex);
+ evas_gl_common_texture_light_free(tex);
return NULL;
}
tex->pt->references++;
pt_unref(tex->ptuv);
}
}
- free(tex);
+
+ evas_gl_common_texture_light_free(tex);
}
Evas_GL_Texture *
Eina_List *l_after = NULL;
int u = 0, v = 0;
- tex = calloc(1, sizeof(Evas_GL_Texture));
+ tex = evas_gl_common_texture_alloc(gc, w, h, EINA_FALSE);
if (!tex) return NULL;
- tex->gc = gc;
- tex->references = 1;
tex->pt = _pool_tex_find(gc, w + 3, fh, alpha_ifmt, alpha_fmt, &u, &v,
&l_after,
gc->shared->info.tune.atlas.max_alloc_alpha_size);
if (!tex->pt)
{
- free(tex);
+ evas_gl_common_texture_light_free(tex);
return NULL;
}
tex->x = u + 1;
tex->y = v;
- tex->w = w;
- tex->h = h;
if (l_after)
tex->pt->allocations =
eina_list_append_relative_list(tex->pt->allocations, tex, l_after);
{
Evas_GL_Texture *tex;
- tex = calloc(1, sizeof(Evas_GL_Texture));
+ tex = evas_gl_common_texture_alloc(gc, w, h, EINA_FALSE);
if (!tex) return NULL;
- tex->gc = gc;
- tex->references = 1;
tex->ptu = _pool_tex_new(gc, w / 2 + 1, h / 2 + 1, lum_ifmt, lum_fmt);
if (!tex->ptu)
{
- free(tex);
+ evas_gl_common_texture_light_free(tex);
return NULL;
}
gc->shared->tex.whole = eina_list_prepend(gc->shared->tex.whole, tex->ptu);
{
pt_unref(tex->pt);
pt_unref(tex->ptu);
- free(tex);
+ evas_gl_common_texture_light_free(tex);
return NULL;
}
gc->shared->tex.whole = eina_list_prepend(gc->shared->tex.whole, tex->ptv);
tex->pt = _pool_tex_new(gc, tex->ptu->w * 2, tex->ptu->h * 2, lum_ifmt, lum_fmt);
if (!tex->pt)
{
- free(tex);
+ evas_gl_common_texture_light_free(tex);
return NULL;
}
gc->shared->tex.whole = eina_list_prepend(gc->shared->tex.whole, tex->pt);
tex->pt->slot = -1;
tex->pt->fslot = -1;
tex->pt->whole = 1;
- tex->x = 0;
- tex->y = 0;
- tex->w = w;
- tex->h = h;
tex->pt->allocations = eina_list_prepend(tex->pt->allocations, tex);
tex->ptu->allocations = eina_list_prepend(tex->ptu->allocations, tex);
tex->ptv->allocations = eina_list_prepend(tex->ptv->allocations, tex);
yw, yh,
pt[0]->w, pt[0]->h,
ptuv[0]->w, ptuv[0]->h);
- tex = calloc(1, sizeof(Evas_GL_Texture));
+ tex = evas_gl_common_texture_alloc(gc, yw, yh, EINA_FALSE);
if (!tex)
goto on_error;
- tex->gc = gc;
- tex->references = 1;
tex->pt = pt[0];
tex->ptuv = ptuv[0];
tex->dyn = dynamic;
pt_link(gc, tex, ptuv[0]);
pt_link(gc, tex, ptuv[1]);
- tex->x = 0;
- tex->y = 0;
- tex->w = yw;
- tex->h = yh;
tex->double_buffer.source = 0;
memcpy(tex->double_buffer.pt, pt, sizeof (Evas_GL_Texture_Pool *) * 2);
memcpy(tex->double_buffer.ptuv, ptuv, sizeof (Evas_GL_Texture_Pool *) * 2);