efl_ui_image: keep efl_ui_image size for internal image

Summary:
The size of internal image could be bigger than the size of efl_ui_image
with following code.

   image = elm_image_add
   elm_image_fill_outside_set(image, EINA_TRUE);

If the internal image object is 300x300, and efl_ui_image is 360x77, then
the internal image object will resize to 360x360 which is bigger than the
size of efl_ui_image.

This is a compatibility issue. This patch will make efl_ui_image work as
before commit 8cb6c3e Elm_image: implement 'scale_type' and 'scalable'...

Test Plan:
This is old example to reproduce the problem.
{F3859361}

This is newly added example to check if this patch breaks compatibility or not.
{F3859390}

You can use the example with following image.
{F3859391}

This is result before applying this patch.
{F3859388}

This is result after applying this patch.
{F3859389}

The translucent rectangle is the size of the efl_ui_image.
As you might be noticed, only FIT_WIDTH (the 4th one of each row),
and EXPAND (the 6th one of each row) are different.

One more difference the 1st one of 2nd row; NONE.

F.Y.I. and for quick understanding of example.
The 1st row efl_ui_image is bigger than internal image.
The 2nd row efl_ui_image is smaller than internal image.
From the left the scale type is NONE, FILL, FIT, FIT_WIDTH,
FIT_HEIGHT, EXPAND, and TILE.

Reviewers: Hermet, jsuya, herb

Reviewed By: Hermet

Subscribers: cedric, #reviewers, #committers

Tags: #efl

Differential Revision: https://phab.enlightenment.org/D11587
This commit is contained in:
Shinwoo Kim 2020-03-25 19:12:16 +09:00 committed by Hermet Park
parent 8e4b798c51
commit d4e6303d9e
1 changed files with 2 additions and 2 deletions

View File

@ -294,12 +294,12 @@ _image_sizing_eval(Eo *obj, Efl_Ui_Image_Data *sd, Evas_Object *img)
evas_object_image_fill_set(img, offset_x, offset_y, w, h);
if (offset_x < 0)
if (ow - w < 0)
{
x = ox;
w = ow;
}
if (offset_y < 0)
if (oh - h < 0)
{
y = oy;
h = oh;