summaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
authorHermet Park <chuneon.park@samsung.com>2020-10-05 12:56:03 +0900
committerHermet Park <chuneon.park@samsung.com>2020-10-05 12:56:03 +0900
commitb6a98bb3be03dde89d633670a6eef298733885e8 (patch)
tree98b7fd539aeed210a68c73fcc5f9f9144ae1678a /src/lib
parent42c123d1d7b4b5fa1251b3ae7768912f480d36a3 (diff)
elementary image zoomable: fix non supported oversized image.
Summary: if image size is larger than system support, photocam can not show the image. Not like other types of image, photocam is originally designed for huge-size of image, this result is not allowed by users, we should avoid the worst case as we can do. This might not be the best idea, so you can improve it if you have a better solution. Reviewers: kimcinoo Reviewed By: kimcinoo Subscribers: cedric, #reviewers, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D12164
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/elementary/efl_ui_image_zoomable.c34
1 files changed, 32 insertions, 2 deletions
diff --git a/src/lib/elementary/efl_ui_image_zoomable.c b/src/lib/elementary/efl_ui_image_zoomable.c
index 689555180a..fb05a56115 100644
--- a/src/lib/elementary/efl_ui_image_zoomable.c
+++ b/src/lib/elementary/efl_ui_image_zoomable.c
@@ -2080,6 +2080,38 @@ _internal_file_set(Eo *obj, Efl_Ui_Image_Zoomable_Data *sd, Evas_Load_Error *ret
2080 evas_object_image_file_set(sd->img, NULL, NULL); 2080 evas_object_image_file_set(sd->img, NULL, NULL);
2081 evas_object_image_load_scale_down_set(sd->img, 0); 2081 evas_object_image_load_scale_down_set(sd->img, 0);
2082 _photocam_image_file_set(sd->img, sd); 2082 _photocam_image_file_set(sd->img, sd);
2083
2084 //Check whether image size is bigger than maxium texture
2085 evas_object_image_size_get(sd->img, &w, &h);
2086 int maxw = 0, maxh = 0;
2087 evas_image_max_size_get(evas_object_evas_get(sd->img), &maxw, &maxh);
2088
2089 /* Image is too large than system support,
2090 This case it won't be available,
2091 Alternatively, reduce size by half and make it visible at least.
2092 Btw, is this the best solution for this?... */
2093 if (maxw > 0 && maxh > 0)
2094 {
2095 int w2 = w;
2096 int h2 = h;
2097
2098 if (w2 > maxw || h2 > maxh)
2099 {
2100 //Scale down by half
2101 int scale_down = 1;
2102
2103 while (w2 > maxw || h2 > maxh)
2104 {
2105 w2 /= 2;
2106 h2 /= 2;
2107 scale_down *= 2;
2108 }
2109
2110 //This might not work at some format...
2111 evas_object_image_load_scale_down_set(sd->img, scale_down);
2112 }
2113 }
2114
2083 err = evas_object_image_load_error_get(sd->img); 2115 err = evas_object_image_load_error_get(sd->img);
2084 if (err != EVAS_LOAD_ERROR_NONE) 2116 if (err != EVAS_LOAD_ERROR_NONE)
2085 { 2117 {
@@ -2087,8 +2119,6 @@ _internal_file_set(Eo *obj, Efl_Ui_Image_Zoomable_Data *sd, Evas_Load_Error *ret
2087 if (ret) *ret = err; 2119 if (ret) *ret = err;
2088 return err; 2120 return err;
2089 } 2121 }
2090 evas_object_image_size_get(sd->img, &w, &h);
2091
2092 sd->do_region = evas_object_image_region_support_get(sd->img); 2122 sd->do_region = evas_object_image_region_support_get(sd->img);
2093 sd->size.imw = w; 2123 sd->size.imw = w;
2094 sd->size.imh = h; 2124 sd->size.imh = h;