From d2bc8961f9836433613ba0eb9a8bbe3bc3de258b Mon Sep 17 00:00:00 2001 From: Patryk Kaczmarek Date: Thu, 15 Feb 2024 09:37:16 +0100 Subject: [PATCH] evas_image_load_webp: load 9-patch files with non-black borders Change-Id: Ie32743505e788e1bc6352531b8797fb96969c4e1 --- .../evas/image_loaders/webp/evas_image_load_webp.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/src/modules/evas/image_loaders/webp/evas_image_load_webp.c b/src/modules/evas/image_loaders/webp/evas_image_load_webp.c index 8468345..d1478d3 100644 --- a/src/modules/evas/image_loaders/webp/evas_image_load_webp.c +++ b/src/modules/evas/image_loaders/webp/evas_image_load_webp.c @@ -180,12 +180,12 @@ _evas_image_webp_update_y_content(Eina_Rectangle *r, int index) r->h = index - r->y; } } - +//TIZEN_ONLY(20240215): Support 9-patch files with non-black borders static inline Eina_Bool -_is_black(DATA32 *ptr) +_is_color(DATA32 *ptr) { - if (*ptr == BLACK) return EINA_TRUE; - return EINA_FALSE; + if (*ptr == 0) return EINA_FALSE; + return EINA_TRUE; } static Eina_Bool @@ -420,8 +420,9 @@ evas_image_load_file_head_with_data_webp(void *loader_data, for (i = 1; i < image_w - 1; i++, src_ptr1++, src_ptr2++) { - Eina_Bool bp1 = _is_black(src_ptr1); - Eina_Bool bp2 = _is_black(src_ptr2); + //TIZEN_ONLY(20240215): Support 9-patch files with non-black borders + Eina_Bool bp1 = _is_color(src_ptr1); + Eina_Bool bp2 = _is_color(src_ptr2); // Updating horizontal area where content can be located if (bp2) @@ -467,8 +468,9 @@ evas_image_load_file_head_with_data_webp(void *loader_data, for (i = 1; i < image_h - 1; i++, src_ptr1 += image_w, src_ptr2 += image_w) { - Eina_Bool bp1 = _is_black(src_ptr1); - Eina_Bool bp2 = _is_black(src_ptr2); + //TIZEN_ONLY(20240215): Support 9-patch files with non-black borders + Eina_Bool bp1 = _is_color(src_ptr1); + Eina_Bool bp2 = _is_color(src_ptr2); // Updating vertical area where content can be located if (bp2) -- 2.7.4