summaryrefslogtreecommitdiff
path: root/legacy/elementary/src/lib
diff options
context:
space:
mode:
authorJi-Youn Park <jy0703.park@samsung.com>2016-03-22 22:44:04 +0830
committerJi-Youn Park <jy0703.park@samsung.com>2016-03-22 22:44:09 +0830
commitadcc8c218c487fb118a94bac7327bb538d2c672d (patch)
tree79efc5a5f43d06297704ee3483c7f61d02b417df /legacy/elementary/src/lib
parentb76f9c8f6e96b9bc5d468bb0d2d26343a4011e4d (diff)
elm_image: remove elm_image_memfile_set api from eo API.
memfile_set feature will be deprecated. instead of memfile_set, use Efl.file.mmap. and merge elm_image_obj_mmap_set and elm_image_efl_file_mmap_set
Diffstat (limited to '')
-rw-r--r--legacy/elementary/src/lib/elm_icon.c29
-rw-r--r--legacy/elementary/src/lib/elm_icon.eo1
-rw-r--r--legacy/elementary/src/lib/elm_image.c130
-rw-r--r--legacy/elementary/src/lib/elm_image.eo47
-rw-r--r--legacy/elementary/src/lib/elm_image_legacy.h26
5 files changed, 104 insertions, 129 deletions
diff --git a/legacy/elementary/src/lib/elm_icon.c b/legacy/elementary/src/lib/elm_icon.c
index e2ec1614ca..1432d78691 100644
--- a/legacy/elementary/src/lib/elm_icon.c
+++ b/legacy/elementary/src/lib/elm_icon.c
@@ -393,21 +393,6 @@ _elm_icon_efl_file_file_set(Eo *obj, Elm_Icon_Data *sd, const char *file, const
393} 393}
394 394
395EOLIAN static Eina_Bool 395EOLIAN static Eina_Bool
396_elm_icon_elm_image_memfile_set(Eo *obj, Elm_Icon_Data *sd, const void *img, size_t size, const char *format, const char *key)
397{
398 Eina_Bool int_ret = EINA_FALSE;
399
400 EINA_SAFETY_ON_NULL_RETURN_VAL(img, EINA_FALSE);
401 EINA_SAFETY_ON_TRUE_RETURN_VAL(!size, EINA_FALSE);
402 ELM_SAFE_FREE(sd->stdicon, eina_stringshare_del);
403
404 _edje_signals_free(sd);
405
406 int_ret = elm_obj_image_memfile_set(eo_super(obj, MY_CLASS), img, size, format, key);
407 return int_ret;
408}
409
410EOLIAN static Eina_Bool
411_elm_icon_elm_widget_theme_apply(Eo *obj, Elm_Icon_Data *sd) 396_elm_icon_elm_widget_theme_apply(Eo *obj, Elm_Icon_Data *sd)
412{ 397{
413 Eina_Bool int_ret = EINA_FALSE; 398 Eina_Bool int_ret = EINA_FALSE;
@@ -683,11 +668,19 @@ elm_icon_memfile_set(Evas_Object *obj,
683 const char *format, 668 const char *format,
684 const char *key) 669 const char *key)
685{ 670{
671 Eina_Bool int_ret = EINA_FALSE;
686 ELM_ICON_CHECK(obj) EINA_FALSE; 672 ELM_ICON_CHECK(obj) EINA_FALSE;
687 673
688 Eina_Bool ret = EINA_FALSE; 674 EINA_SAFETY_ON_NULL_RETURN_VAL(img, EINA_FALSE);
689 ret = elm_obj_image_memfile_set(obj, img, size, format, key); 675 EINA_SAFETY_ON_TRUE_RETURN_VAL(!size, EINA_FALSE);
690 return ret; 676
677 ELM_ICON_DATA_GET(obj, sd);
678 ELM_SAFE_FREE(sd->stdicon, eina_stringshare_del);
679
680 _edje_signals_free(sd);
681
682 int_ret = elm_image_memfile_set(eo_super(obj, MY_CLASS), img, size, format, key);
683 return int_ret;
691} 684}
692 685
693EAPI Eina_Bool 686EAPI Eina_Bool
diff --git a/legacy/elementary/src/lib/elm_icon.eo b/legacy/elementary/src/lib/elm_icon.eo
index 016a4bbcbe..421d0d0c75 100644
--- a/legacy/elementary/src/lib/elm_icon.eo
+++ b/legacy/elementary/src/lib/elm_icon.eo
@@ -104,7 +104,6 @@ class Elm.Icon (Elm.Image)
104 Evas.Object_Smart.add; 104 Evas.Object_Smart.add;
105 Evas.Object_Smart.del; 105 Evas.Object_Smart.del;
106 Elm.Widget.theme_apply; 106 Elm.Widget.theme_apply;
107 Elm.Image.memfile.set;
108 Efl.File.file.set; 107 Efl.File.file.set;
109 } 108 }
110 events { 109 events {
diff --git a/legacy/elementary/src/lib/elm_image.c b/legacy/elementary/src/lib/elm_image.c
index 9edeea955b..a32a666f29 100644
--- a/legacy/elementary/src/lib/elm_image.c
+++ b/legacy/elementary/src/lib/elm_image.c
@@ -885,35 +885,6 @@ _elm_image_file_set_do(Evas_Object *obj)
885 } 885 }
886} 886}
887 887
888EOLIAN static Eina_Bool
889_elm_image_memfile_set(Eo *obj, Elm_Image_Data *sd, const void *img, size_t size, const char *format, const char *key)
890{
891 Evas_Load_Error err;
892
893 _elm_image_file_set_do(obj);
894
895 evas_object_image_memfile_set
896 (sd->img, (void *)img, size, (char *)format, (char *)key);
897
898 sd->preload_status = ELM_IMAGE_PRELOADING;
899 evas_object_image_preload(sd->img, EINA_FALSE);
900
901 err = evas_object_image_load_error_get(sd->img);
902 if (err != EVAS_LOAD_ERROR_NONE)
903 {
904 if (img)
905 ERR("Failed to load image from memory block (" FMT_SIZE_T
906 " bytes): %s (%p)", size, evas_load_error_str(err), sd->img);
907 else
908 ERR("NULL image data passed (%p)", sd->img);
909 return EINA_FALSE;
910 }
911
912 _elm_image_internal_sizing_eval(obj, sd);
913
914 return EINA_TRUE;
915}
916
917EOLIAN static void 888EOLIAN static void
918_elm_image_scale_set(Eo *obj, Elm_Image_Data *sd, double scale) 889_elm_image_scale_set(Eo *obj, Elm_Image_Data *sd, double scale)
919{ 890{
@@ -947,45 +918,19 @@ _elm_image_eo_base_constructor(Eo *obj, Elm_Image_Data *_pd EINA_UNUSED)
947 return obj; 918 return obj;
948} 919}
949 920
950EAPI Eina_Bool
951elm_image_file_set(Evas_Object *obj,
952 const char *file,
953 const char *group)
954{
955 Eina_Bool ret = EINA_FALSE;
956
957 ELM_IMAGE_CHECK(obj) EINA_FALSE;
958 ret = efl_file_set(obj, file, group);
959 elm_obj_image_sizing_eval(obj);
960 return ret;
961}
962
963EAPI void
964elm_image_file_get(const Eo *obj, const char **file, const char **group)
965{
966 efl_file_get((Eo *) obj, file, group);
967}
968
969EAPI Eina_Bool
970elm_image_mmap_set(Evas_Object *obj,
971 const Eina_File *file,
972 const char *group)
973{
974 Eina_Bool ret = EINA_FALSE;
975
976 ELM_IMAGE_CHECK(obj) EINA_FALSE;
977 ret = efl_file_mmap_set(obj, file, group);
978 return ret;
979}
980
981EOLIAN Eina_Bool 921EOLIAN Eina_Bool
982_elm_image_efl_file_mmap_set(Eo *obj, Elm_Image_Data *pd EINA_UNUSED, 922_elm_image_efl_file_mmap_set(Eo *obj, Elm_Image_Data *sd,
983 const Eina_File *file, const char *key) 923 const Eina_File *file, const char *key)
984{ 924{
985 Eina_Bool ret = EINA_FALSE; 925 Eina_Bool ret = EINA_FALSE;
986 926
987 ret = elm_obj_image_mmap_set(obj, file, key); 927 if (sd->remote) _elm_url_cancel(sd->remote);
988 elm_obj_image_sizing_eval(obj); 928 sd->remote = NULL;
929
930 if (!sd->async_enable)
931 ret = _elm_image_smart_internal_file_set(obj, sd, eina_file_filename_get(file), file, key);
932 else
933 ret = _elm_image_async_file_set(obj, sd, eina_file_filename_get(file), file, key);
989 934
990 return ret; 935 return ret;
991} 936}
@@ -1658,4 +1603,63 @@ elm_image_editable_get(const Evas_Object *obj)
1658 return evas_draggable_interface_drag_target_get(obj); 1603 return evas_draggable_interface_drag_target_get(obj);
1659} 1604}
1660 1605
1606EAPI Eina_Bool
1607elm_image_file_set(Evas_Object *obj, const char *file, const char *group)
1608{
1609 Eina_Bool ret = EINA_FALSE;
1610
1611 ELM_IMAGE_CHECK(obj) EINA_FALSE;
1612 ret = efl_file_set(obj, file, group);
1613 elm_obj_image_sizing_eval(obj);
1614 return ret;
1615}
1616
1617EAPI void
1618elm_image_file_get(const Eo *obj, const char **file, const char **group)
1619{
1620 efl_file_get((Eo *) obj, file, group);
1621}
1622
1623EAPI Eina_Bool
1624elm_image_mmap_set(Evas_Object *obj, const Eina_File *file, const char *group)
1625{
1626 Eina_Bool ret = EINA_FALSE;
1627
1628 ELM_IMAGE_CHECK(obj) EINA_FALSE;
1629 ret = efl_file_mmap_set(obj, file, group);
1630 return ret;
1631}
1632
1633EAPI Eina_Bool
1634elm_image_memfile_set(Evas_Object *obj, const void *img, size_t size, const char *format, const char *key)
1635{
1636 Evas_Load_Error err;
1637
1638 ELM_IMAGE_CHECK(obj) EINA_FALSE;
1639 ELM_IMAGE_DATA_GET(obj, sd);
1640
1641 _elm_image_file_set_do(obj);
1642
1643 evas_object_image_memfile_set
1644 (sd->img, (void *)img, size, (char *)format, (char *)key);
1645
1646 sd->preload_status = ELM_IMAGE_PRELOADING;
1647 evas_object_image_preload(sd->img, EINA_FALSE);
1648
1649 err = evas_object_image_load_error_get(sd->img);
1650 if (err != EVAS_LOAD_ERROR_NONE)
1651 {
1652 if (img)
1653 ERR("Failed to load image from memory block (" FMT_SIZE_T
1654 " bytes): %s (%p)", size, evas_load_error_str(err), sd->img);
1655 else
1656 ERR("NULL image data passed (%p)", sd->img);
1657 return EINA_FALSE;
1658 }
1659
1660 _elm_image_internal_sizing_eval(obj, sd);
1661
1662 return EINA_TRUE;
1663}
1664
1661#include "elm_image.eo.c" 1665#include "elm_image.eo.c"
diff --git a/legacy/elementary/src/lib/elm_image.eo b/legacy/elementary/src/lib/elm_image.eo
index f3c8cbb4fb..52ca4b07b6 100644
--- a/legacy/elementary/src/lib/elm_image.eo
+++ b/legacy/elementary/src/lib/elm_image.eo
@@ -198,53 +198,6 @@ class Elm.Image (Elm.Widget, Efl.File, Efl.Image_Load, Evas.Clickable_Interface,
198 disabled: bool; [[If true, preloading will be disabled]] 198 disabled: bool; [[If true, preloading will be disabled]]
199 } 199 }
200 } 200 }
201 @property mmap {
202 set {
203 [[Set the file that will be used as the image's source.
204
205 See: elm_image_file_set()
206
207 Note: This function will trigger the Edje file case based on the
208 extension of the $file string use to create the Eina_File (expects
209 $".edj", for this case).
210
211 Note: If you use animated gif image and create multiple image objects with
212 one gif image file, you should set the $group differently for each object.
213 Or image objects will share one evas image cache entry and you will get
214 unwanted frames.]]
215
216 return: bool; [[$true = success, $false = error]]
217 legacy: null;
218 }
219 values {
220 file: const(Eina.File)*; [[The handler to an Eina_File that will be used as image source]]
221 group: const(char)* @optional; [[The group that the image belongs to, in case it's an EET (including Edje case) file. This can be used as a key inside evas image cache if this is a normal image file not eet file.]]
222 }
223 }
224 @property memfile {
225 set {
226 [[Set a location in memory to be used as an image object's source bitmap.
227
228 This function is handy when the contents of an image file are
229 mapped in memory, for example.
230
231 The $format string should be something like $"png", $"jpg",
232 $"tga", $"tiff", $"bmp" etc, when provided ($NULL, on the
233 contrary). This improves the loader performance as it tries the
234 "correct" loader first, before trying a range of other possible
235 loaders until one succeeds.
236
237 @since 1.7]]
238
239 return: bool; [[$true = success, $false = error]]
240 }
241 values {
242 img: const(void)*; [[The binary data that will be used as image source]]
243 size: size; [[The size of binary data blob $img]]
244 format: const(char)* @optional; [[(Optional) expected format of $img bytes]]
245 key: const(char)* @optional; [[Optional indexing key of $img to be passed to the image loader (eg. if $img is a memory-mapped EET file)]]
246 }
247 }
248 @property object { 201 @property object {
249 get { 202 get {
250 [[Get the inlined image object of the image widget. 203 [[Get the inlined image object of the image widget.
diff --git a/legacy/elementary/src/lib/elm_image_legacy.h b/legacy/elementary/src/lib/elm_image_legacy.h
index 01df5fe3ab..db798831d5 100644
--- a/legacy/elementary/src/lib/elm_image_legacy.h
+++ b/legacy/elementary/src/lib/elm_image_legacy.h
@@ -272,4 +272,30 @@ EAPI void elm_image_editable_set(Evas_Object *obj, Eina_Bool set);
272 * @ingroup Elm_Image 272 * @ingroup Elm_Image
273 */ 273 */
274EAPI Eina_Bool elm_image_editable_get(const Evas_Object *obj); 274EAPI Eina_Bool elm_image_editable_get(const Evas_Object *obj);
275
276/**
277 * @brief Set a location in memory to be used as an image object's source
278 * bitmap.
279 *
280 * This function is handy when the contents of an image file are mapped in
281 * memory, for example.
282 *
283 * The @c format string should be something like $"png", $"jpg", $"tga",
284 * $"tiff", $"bmp" etc, when provided ($NULL, on the contrary). This improves
285 * the loader performance as it tries the "correct" loader first, before trying
286 * a range of other possible loaders until one succeeds.
287 *
288 * @param[in] img The binary data that will be used as image source
289 * @param[in] size The size of binary data blob @c img
290 * @param[in] format (Optional) expected format of @c img bytes
291 * @param[in] key Optional indexing key of @c img to be passed to the image
292 * loader (eg. if @c img is a memory-mapped EET file)
293 *
294 * @return @c true = success, @c false = error
295 *
296 * @since 1.7
297 *
298 * @ingroup Elm_Image
299 */
300EAPI Eina_Bool elm_image_memfile_set(Evas_Object *obj, const void *img, size_t size, const char *format, const char *key);
275#include "elm_image.eo.legacy.h" 301#include "elm_image.eo.legacy.h"