evas: fix adjustment logic about image border

Summary:
If border left+right >= image width, center area does not rendered.
Although adjusement logic, _draw_image()'s src_w can be a 0.
This commit try to secure center area at least 1 pixel.

This should fix T5057

@fix

Reviewers: raster, jypark, jpeg

Subscribers: cedric

Maniphest Tasks: T5057

Differential Revision: https://phab.enlightenment.org/D4538
This commit is contained in:
Jiwon Kim 2017-01-02 18:38:59 +09:00 committed by Jean-Philippe Andre
parent 6d0a2398ad
commit 090ee28ca4
1 changed files with 14 additions and 4 deletions

View File

@ -2068,21 +2068,31 @@ _evas_image_render(Eo *eo_obj, Evas_Object_Protected_Data *obj,
bt = o->cur->border.t;
bb = o->cur->border.b;
// fix impossible border settings if img pixels not enough
if ((bl + br) > imw)
if ((bl + br) > 0)
{
if ((bl + br) > 0)
if ((bl + br) > imw)
{
bl = (bl * imw) / (bl + br);
br = imw - bl;
}
if ((bl + br) == imw)
{
if (bl < br) br--;
else bl--;
}
}
if ((bt + bb) > imh)
if ((bt + bb) > 0)
{
if ((bt + bb) > 0)
if ((bt + bb) > imh)
{
bt = (bt * imh) / (bt + bb);
bb = imh - bt;
}
if ((bt + bb) == imh)
{
if (bt < bb) bb--;
else bt--;
}
}
if (!EINA_DBL_CMP(o->cur->border.scale, 1.0))
{