forked from enlightenment/efl
evas vg: fix gradient stroke fill memory leaks.
There were continous creation of gradient objects, We can stop it by caching it properly, Also, fix mismatched ref/unref counts.
This commit is contained in:
parent
3b1f7bea75
commit
44d362e1ef
|
@ -23,6 +23,8 @@ _efl_canvas_vg_shape_fill_set(Eo *obj EINA_UNUSED,
|
||||||
Efl_Canvas_Vg_Shape_Data *pd,
|
Efl_Canvas_Vg_Shape_Data *pd,
|
||||||
Efl_Canvas_Vg_Node *f)
|
Efl_Canvas_Vg_Node *f)
|
||||||
{
|
{
|
||||||
|
if (pd->fill == f) return;
|
||||||
|
|
||||||
Efl_Canvas_Vg_Node *tmp = pd->fill;
|
Efl_Canvas_Vg_Node *tmp = pd->fill;
|
||||||
|
|
||||||
pd->fill = efl_ref(f);
|
pd->fill = efl_ref(f);
|
||||||
|
@ -40,8 +42,9 @@ _efl_canvas_vg_shape_stroke_fill_set(Eo *obj EINA_UNUSED,
|
||||||
Efl_Canvas_Vg_Shape_Data *pd,
|
Efl_Canvas_Vg_Shape_Data *pd,
|
||||||
Efl_Canvas_Vg_Node *f)
|
Efl_Canvas_Vg_Node *f)
|
||||||
{
|
{
|
||||||
Efl_Canvas_Vg_Node *tmp = pd->fill;
|
if (pd->stroke.fill == f) return;
|
||||||
|
|
||||||
|
Efl_Canvas_Vg_Node *tmp = pd->stroke.fill;
|
||||||
pd->stroke.fill = efl_ref(f);
|
pd->stroke.fill = efl_ref(f);
|
||||||
efl_unref(tmp);
|
efl_unref(tmp);
|
||||||
}
|
}
|
||||||
|
|
|
@ -176,14 +176,26 @@ _construct_drawable_nodes(Efl_Canvas_Vg_Container *parent, const LOTLayerNode *l
|
||||||
Efl_Canvas_Vg_Gradient* grad = NULL;
|
Efl_Canvas_Vg_Gradient* grad = NULL;
|
||||||
|
|
||||||
if (node->mGradient.type == GradientLinear)
|
if (node->mGradient.type == GradientLinear)
|
||||||
|
{
|
||||||
|
char *key = _get_key_val(shape);
|
||||||
|
grad = efl_key_data_get(shape, key);
|
||||||
|
if (!grad)
|
||||||
{
|
{
|
||||||
grad = efl_add(EFL_CANVAS_VG_GRADIENT_LINEAR_CLASS, parent);
|
grad = efl_add(EFL_CANVAS_VG_GRADIENT_LINEAR_CLASS, parent);
|
||||||
|
efl_key_data_set(shape, key, grad);
|
||||||
|
}
|
||||||
efl_gfx_gradient_linear_start_set(grad, node->mGradient.start.x, node->mGradient.start.y);
|
efl_gfx_gradient_linear_start_set(grad, node->mGradient.start.x, node->mGradient.start.y);
|
||||||
efl_gfx_gradient_linear_end_set(grad, node->mGradient.end.x, node->mGradient.end.y);
|
efl_gfx_gradient_linear_end_set(grad, node->mGradient.end.x, node->mGradient.end.y);
|
||||||
}
|
}
|
||||||
else if (node->mGradient.type == GradientRadial)
|
else if (node->mGradient.type == GradientRadial)
|
||||||
|
{
|
||||||
|
char *key = _get_key_val(shape);
|
||||||
|
grad = efl_key_data_get(shape, key);
|
||||||
|
if (!grad)
|
||||||
{
|
{
|
||||||
grad = efl_add(EFL_CANVAS_VG_GRADIENT_RADIAL_CLASS, parent);
|
grad = efl_add(EFL_CANVAS_VG_GRADIENT_RADIAL_CLASS, parent);
|
||||||
|
efl_key_data_set(shape, key, grad);
|
||||||
|
}
|
||||||
efl_gfx_gradient_radial_center_set(grad, node->mGradient.center.x, node->mGradient.center.y);
|
efl_gfx_gradient_radial_center_set(grad, node->mGradient.center.x, node->mGradient.center.y);
|
||||||
efl_gfx_gradient_radial_focal_set(grad, node->mGradient.focal.x, node->mGradient.focal.y);
|
efl_gfx_gradient_radial_focal_set(grad, node->mGradient.focal.x, node->mGradient.focal.y);
|
||||||
efl_gfx_gradient_radial_radius_set(grad, node->mGradient.cradius);
|
efl_gfx_gradient_radial_radius_set(grad, node->mGradient.cradius);
|
||||||
|
|
Loading…
Reference in New Issue