summaryrefslogtreecommitdiff
path: root/src/modules
diff options
context:
space:
mode:
authorHermet Park <chuneon.park@samsung.com>2020-09-21 12:16:57 +0900
committerHermet Park <chuneon.park@samsung.com>2020-09-21 12:16:57 +0900
commit223a303847ea162a025b060679d76e196bddee7b (patch)
tree0b55c69b1c33302b17cb051f06da8c4f6155cac7 /src/modules
parent2b6dfcf8581e450da93fc9def9c2827aa0786b1e (diff)
parent52b02055f45ccb32b55b39bb5b518403c55c86b6 (diff)
Merge branch 'master' into devs/hermet/lottiedevs/hermet/lottie
Diffstat (limited to 'src/modules')
-rw-r--r--src/modules/ethumb/emotion/emotion.c5
-rw-r--r--src/modules/evas/image_loaders/psd/evas_image_load_psd.c38
-rw-r--r--src/modules/evas/vg_loaders/svg/evas_vg_load_svg.c34
3 files changed, 59 insertions, 18 deletions
diff --git a/src/modules/ethumb/emotion/emotion.c b/src/modules/ethumb/emotion/emotion.c
index ccad1c9074..0a8447f49b 100644
--- a/src/modules/ethumb/emotion/emotion.c
+++ b/src/modules/ethumb/emotion/emotion.c
@@ -319,8 +319,9 @@ _frame_grab(void *data)
319 319
320 pixels = ecore_evas_buffer_pixels_get(ee); 320 pixels = ecore_evas_buffer_pixels_get(ee);
321 snprintf(buf, sizeof(buf), "images/%d", _plugin->frnum); 321 snprintf(buf, sizeof(buf), "images/%d", _plugin->frnum);
322 eet_data_image_write(_plugin->ef, buf, pixels, _plugin->w, _plugin->h, 322 if (!eet_data_image_write(_plugin->ef, buf, pixels, _plugin->w, _plugin->h,
323 0, compress, quality, quality); 323 0, compress, quality, quality))
324 return EINA_TRUE;
324 _plugin->frnum++; 325 _plugin->frnum++;
325 } 326 }
326 327
diff --git a/src/modules/evas/image_loaders/psd/evas_image_load_psd.c b/src/modules/evas/image_loaders/psd/evas_image_load_psd.c
index 5dcf31039b..58cd961acf 100644
--- a/src/modules/evas/image_loaders/psd/evas_image_load_psd.c
+++ b/src/modules/evas/image_loaders/psd/evas_image_load_psd.c
@@ -61,7 +61,7 @@ static Eina_Bool get_compressed_channels_length(PSD_Header *Head,
61static int 61static int
62read_ushort(const unsigned char *map, size_t length, size_t *position, unsigned short *ret) 62read_ushort(const unsigned char *map, size_t length, size_t *position, unsigned short *ret)
63{ 63{
64 if (*position + 2 > length) return 0; 64 if (((*position) + 2) > length) return 0;
65 // FIXME: need to check order 65 // FIXME: need to check order
66 *ret = (map[(*position) + 0] << 8) | map[(*position) + 1]; 66 *ret = (map[(*position) + 0] << 8) | map[(*position) + 1];
67 *position += 2; 67 *position += 2;
@@ -71,7 +71,7 @@ read_ushort(const unsigned char *map, size_t length, size_t *position, unsigned
71static int 71static int
72read_uint(const unsigned char *map, size_t length, size_t *position, unsigned int *ret) 72read_uint(const unsigned char *map, size_t length, size_t *position, unsigned int *ret)
73{ 73{
74 if (*position + 4 > length) return 0; 74 if (((*position) + 4) > length) return 0;
75 // FIXME: need to check order 75 // FIXME: need to check order
76 *ret = ARGB_JOIN(map[(*position) + 0], map[(*position) + 1], map[(*position) + 2], map[(*position) + 3]); 76 *ret = ARGB_JOIN(map[(*position) + 0], map[(*position) + 1], map[(*position) + 2], map[(*position) + 3]);
77 *position += 4; 77 *position += 4;
@@ -81,14 +81,14 @@ read_uint(const unsigned char *map, size_t length, size_t *position, unsigned in
81static int 81static int
82read_block(const unsigned char *map, size_t length, size_t *position, void *target, size_t size) 82read_block(const unsigned char *map, size_t length, size_t *position, void *target, size_t size)
83{ 83{
84 if (*position + size > length) return 0; 84 if (((*position) + size) > length) return 0;
85 memcpy(target, map + *position, size); 85 memcpy(target, map + *position, size);
86 *position += size; 86 *position += size;
87 return 1; 87 return 1;
88} 88}
89 89
90// Internal function used to get the Psd header from the current file. 90// Internal function used to get the Psd header from the current file.
91Eina_Bool 91static Eina_Bool
92psd_get_header(PSD_Header *header, const unsigned char *map, size_t length, size_t *position) 92psd_get_header(PSD_Header *header, const unsigned char *map, size_t length, size_t *position)
93{ 93{
94 unsigned short tmp; 94 unsigned short tmp;
@@ -114,7 +114,7 @@ psd_get_header(PSD_Header *header, const unsigned char *map, size_t length, size
114 114
115 115
116// Internal function used to check if the HEADER is a valid Psd header. 116// Internal function used to check if the HEADER is a valid Psd header.
117Eina_Bool 117static Eina_Bool
118is_psd(PSD_Header *header) 118is_psd(PSD_Header *header)
119{ 119{
120 if (strncmp((char*)header->signature, "8BPS", 4)) 120 if (strncmp((char*)header->signature, "8BPS", 4))
@@ -238,7 +238,7 @@ read_compressed_channel(const unsigned char *map, size_t length, size_t *positio
238} 238}
239 239
240 240
241Eina_Bool 241static Eina_Bool
242psd_get_data(PSD_Header *head, 242psd_get_data(PSD_Header *head,
243 const unsigned char *map, size_t length, size_t *position, 243 const unsigned char *map, size_t length, size_t *position,
244 unsigned char *buffer, Eina_Bool compressed, 244 unsigned char *buffer, Eina_Bool compressed,
@@ -492,7 +492,7 @@ psd_get_data(PSD_Header *head,
492} 492}
493 493
494 494
495Eina_Bool 495static Eina_Bool
496get_single_channel(PSD_Header *head, 496get_single_channel(PSD_Header *head,
497 const unsigned char *map, size_t length, size_t *position, 497 const unsigned char *map, size_t length, size_t *position,
498 unsigned char *buffer, 498 unsigned char *buffer,
@@ -552,7 +552,7 @@ get_single_channel(PSD_Header *head,
552 return EINA_TRUE; 552 return EINA_TRUE;
553} 553}
554 554
555Eina_Bool 555static Eina_Bool
556read_psd_grey(void *pixels, PSD_Header *head, const unsigned char *map, size_t length, size_t *position, int *error) 556read_psd_grey(void *pixels, PSD_Header *head, const unsigned char *map, size_t length, size_t *position, int *error)
557{ 557{
558 unsigned int color_mode, resource_size, misc_info; 558 unsigned int color_mode, resource_size, misc_info;
@@ -566,15 +566,19 @@ read_psd_grey(void *pixels, PSD_Header *head, const unsigned char *map, size_t l
566 CHECK_RET(read_uint(map, length, position, &color_mode)); 566 CHECK_RET(read_uint(map, length, position, &color_mode));
567 // Skip over the 'color mode data section' 567 // Skip over the 'color mode data section'
568 *position += color_mode; 568 *position += color_mode;
569 if ((*position) >= length) return EINA_FALSE;
569 570
570 CHECK_RET(read_uint(map, length, position, &resource_size)); 571 CHECK_RET(read_uint(map, length, position, &resource_size));
571 // Read the 'image resources section' 572 // Read the 'image resources section'
572 *position += resource_size; 573 *position += resource_size;
574 if ((*position) >= length) return EINA_FALSE;
573 575
574 CHECK_RET(read_uint(map, length, position, &misc_info)); 576 CHECK_RET(read_uint(map, length, position, &misc_info));
575 *position += misc_info; 577 *position += misc_info;
578 if ((*position) >= length) return EINA_FALSE;
576 579
577 CHECK_RET(read_ushort(map, length, position, &compressed)); 580 CHECK_RET(read_ushort(map, length, position, &compressed));
581 if (compressed != 0) compressed = EINA_TRUE;
578 582
579 head->channel_num = head->channels; 583 head->channel_num = head->channels;
580 // Temporary to read only one channel...some greyscale .psd files have 2. 584 // Temporary to read only one channel...some greyscale .psd files have 2.
@@ -602,7 +606,7 @@ read_psd_grey(void *pixels, PSD_Header *head, const unsigned char *map, size_t l
602} 606}
603 607
604 608
605Eina_Bool 609static Eina_Bool
606read_psd_indexed(void *pixels, PSD_Header *head, const unsigned char *map, size_t length, size_t *position, int *error) 610read_psd_indexed(void *pixels, PSD_Header *head, const unsigned char *map, size_t length, size_t *position, int *error)
607{ 611{
608 unsigned int color_mode, resource_size, misc_info; 612 unsigned int color_mode, resource_size, misc_info;
@@ -624,15 +628,19 @@ read_psd_indexed(void *pixels, PSD_Header *head, const unsigned char *map, size_
624 */ 628 */
625 // Skip over the 'color mode data section' 629 // Skip over the 'color mode data section'
626 *position += color_mode; 630 *position += color_mode;
631 if ((*position) >= length) return EINA_FALSE;
627 632
628 // Read the 'image resources section' 633 // Read the 'image resources section'
629 CHECK_RET(read_uint(map, length, position, &resource_size)); 634 CHECK_RET(read_uint(map, length, position, &resource_size));
630 *position += resource_size; 635 *position += resource_size;
636 if ((*position) >= length) return EINA_FALSE;
631 637
632 CHECK_RET(read_uint(map, length, position, &misc_info)); 638 CHECK_RET(read_uint(map, length, position, &misc_info));
633 *position += misc_info; 639 *position += misc_info;
640 if ((*position) >= length) return EINA_FALSE;
634 641
635 CHECK_RET(read_ushort(map, length, position, &compressed)); 642 CHECK_RET(read_ushort(map, length, position, &compressed));
643 if (compressed != 0) compressed = EINA_TRUE;
636 644
637 if (head->channels != 1 || head->depth != 8) 645 if (head->channels != 1 || head->depth != 8)
638 { 646 {
@@ -648,7 +656,7 @@ read_psd_indexed(void *pixels, PSD_Header *head, const unsigned char *map, size_
648#undef CHECK_RET 656#undef CHECK_RET
649} 657}
650 658
651Eina_Bool 659static Eina_Bool
652read_psd_rgb(void *pixels, PSD_Header *head, const unsigned char *map, size_t length, size_t *position, int *error) 660read_psd_rgb(void *pixels, PSD_Header *head, const unsigned char *map, size_t length, size_t *position, int *error)
653{ 661{
654 unsigned int color_mode, resource_size, misc_info; 662 unsigned int color_mode, resource_size, misc_info;
@@ -660,15 +668,19 @@ read_psd_rgb(void *pixels, PSD_Header *head, const unsigned char *map, size_t le
660 CHECK_RET(read_uint(map, length, position, &color_mode)); 668 CHECK_RET(read_uint(map, length, position, &color_mode));
661 // Skip over the 'color mode data section' 669 // Skip over the 'color mode data section'
662 *position += color_mode; 670 *position += color_mode;
671 if ((*position) >= length) return EINA_FALSE;
663 672
664 // Read the 'image resources section' 673 // Read the 'image resources section'
665 CHECK_RET(read_uint(map, length, position, &resource_size)); 674 CHECK_RET(read_uint(map, length, position, &resource_size));
666 *position += resource_size; 675 *position += resource_size;
676 if ((*position) >= length) return EINA_FALSE;
667 677
668 CHECK_RET(read_uint(map, length, position, &misc_info)); 678 CHECK_RET(read_uint(map, length, position, &misc_info));
669 *position += misc_info; 679 *position += misc_info;
680 if ((*position) >= length) return EINA_FALSE;
670 681
671 CHECK_RET(read_ushort(map, length, position, &compressed)); 682 CHECK_RET(read_ushort(map, length, position, &compressed));
683 if (compressed != 0) compressed = EINA_TRUE;
672 684
673 head->channel_num = head->channels; 685 head->channel_num = head->channels;
674 686
@@ -690,7 +702,7 @@ read_psd_rgb(void *pixels, PSD_Header *head, const unsigned char *map, size_t le
690#undef CHECK_RET 702#undef CHECK_RET
691} 703}
692 704
693Eina_Bool 705static Eina_Bool
694read_psd_cmyk(Emile_Image_Property *prop, void *pixels, PSD_Header *head, const unsigned char *map, size_t length, size_t *position, int *error) 706read_psd_cmyk(Emile_Image_Property *prop, void *pixels, PSD_Header *head, const unsigned char *map, size_t length, size_t *position, int *error)
695{ 707{
696 unsigned int color_mode, resource_size, misc_info, size, j, data_size; 708 unsigned int color_mode, resource_size, misc_info, size, j, data_size;
@@ -707,15 +719,19 @@ read_psd_cmyk(Emile_Image_Property *prop, void *pixels, PSD_Header *head, const
707 CHECK_RET(read_uint(map, length, position, &color_mode)); 719 CHECK_RET(read_uint(map, length, position, &color_mode));
708 // Skip over the 'color mode data section' 720 // Skip over the 'color mode data section'
709 *position += color_mode; 721 *position += color_mode;
722 if ((*position) >= length) return EINA_FALSE;
710 723
711 CHECK_RET(read_uint(map, length, position, &resource_size)); 724 CHECK_RET(read_uint(map, length, position, &resource_size));
712 // Read the 'image resources section' 725 // Read the 'image resources section'
713 *position += resource_size; 726 *position += resource_size;
727 if ((*position) >= length) return EINA_FALSE;
714 728
715 CHECK_RET(read_uint(map, length, position, &misc_info)); 729 CHECK_RET(read_uint(map, length, position, &misc_info));
716 *position += misc_info; 730 *position += misc_info;
731 if ((*position) >= length) return EINA_FALSE;
717 732
718 CHECK_RET(read_ushort(map, length, position, &compressed)); 733 CHECK_RET(read_ushort(map, length, position, &compressed));
734 if (compressed != 0) compressed = EINA_TRUE;
719 735
720 switch (head->channels) 736 switch (head->channels)
721 { 737 {
diff --git a/src/modules/evas/vg_loaders/svg/evas_vg_load_svg.c b/src/modules/evas/vg_loaders/svg/evas_vg_load_svg.c
index f40bfa4915..246e3e2a0e 100644
--- a/src/modules/evas/vg_loaders/svg/evas_vg_load_svg.c
+++ b/src/modules/evas/vg_loaders/svg/evas_vg_load_svg.c
@@ -259,8 +259,6 @@ static struct {
259 259
260_PARSE_TAG(Efl_Gfx_Fill_Rule, fill_rule, fill_rule_tags, EFL_GFX_FILL_RULE_WINDING); 260_PARSE_TAG(Efl_Gfx_Fill_Rule, fill_rule, fill_rule_tags, EFL_GFX_FILL_RULE_WINDING);
261 261
262#if 0
263// unused at the moment
264/* parse the dash pattern used during stroking a path. 262/* parse the dash pattern used during stroking a path.
265 * Value: none | <dasharray> | inherit 263 * Value: none | <dasharray> | inherit
266 * Initial: none 264 * Initial: none
@@ -269,7 +267,8 @@ _PARSE_TAG(Efl_Gfx_Fill_Rule, fill_rule, fill_rule_tags, EFL_GFX_FILL_RULE_WINDI
269static inline void 267static inline void
270_parse_dash_array(const char *str, Efl_Gfx_Dash** dash, int *length) 268_parse_dash_array(const char *str, Efl_Gfx_Dash** dash, int *length)
271{ 269{
272 double tmp[30]; 270 // It is assumed that the length of the dasharray string is 255 or less.
271 double tmp[255];
273 char *end = NULL; 272 char *end = NULL;
274 int leni, gapi, count = 0, index = 0; 273 int leni, gapi, count = 0, index = 0;
275 274
@@ -291,20 +290,21 @@ _parse_dash_array(const char *str, Efl_Gfx_Dash** dash, int *length)
291 gapi = (2 * index + 1) % count; 290 gapi = (2 * index + 1) % count;
292 (*dash)[index].length = tmp[leni]; 291 (*dash)[index].length = tmp[leni];
293 (*dash)[index].gap = tmp[gapi]; 292 (*dash)[index].gap = tmp[gapi];
293 index++;
294 } 294 }
295 } 295 }
296 else 296 else
297 { // even case 297 { // even case
298 *length = count/2; 298 *length = count/2;
299 *dash = calloc(*length, sizeof(Efl_Gfx_Dash)); 299 *dash = calloc(*length, sizeof(Efl_Gfx_Dash));
300 while (index < count) 300 while (index < *length)
301 { 301 {
302 (*dash)[index].length = tmp[2 * index]; 302 (*dash)[index].length = tmp[2 * index];
303 (*dash)[index].gap = tmp[2 * index + 1]; 303 (*dash)[index].gap = tmp[2 * index + 1];
304 index++;
304 } 305 }
305 } 306 }
306} 307}
307#endif
308 308
309static Eina_Stringshare * 309static Eina_Stringshare *
310 _id_from_url(const char *url) 310 _id_from_url(const char *url)
@@ -865,6 +865,13 @@ _handle_stroke_opacity_attr(Evas_SVG_Loader *loader EINA_UNUSED, Svg_Node* node,
865} 865}
866 866
867static void 867static void
868_handle_stroke_dasharray_attr(Evas_SVG_Loader *loader EINA_UNUSED, Svg_Node* node, const char *value)
869{
870 node->style->stroke.flags |= SVG_STROKE_FLAGS_DASH;
871 _parse_dash_array(value, &node->style->stroke.dash, &node->style->stroke.dash_count);
872}
873
874static void
868_handle_stroke_width_attr(Evas_SVG_Loader *loader, Svg_Node* node, const char *value) 875_handle_stroke_width_attr(Evas_SVG_Loader *loader, Svg_Node* node, const char *value)
869{ 876{
870 node->style->stroke.flags |= SVG_STROKE_FLAGS_WIDTH; 877 node->style->stroke.flags |= SVG_STROKE_FLAGS_WIDTH;
@@ -942,6 +949,7 @@ static const struct {
942 STYLE_DEF(stroke-linejoin, stroke_linejoin), 949 STYLE_DEF(stroke-linejoin, stroke_linejoin),
943 STYLE_DEF(stroke-linecap, stroke_linecap), 950 STYLE_DEF(stroke-linecap, stroke_linecap),
944 STYLE_DEF(stroke-opacity, stroke_opacity), 951 STYLE_DEF(stroke-opacity, stroke_opacity),
952 STYLE_DEF(stroke-dasharray, stroke_dasharray),
945 STYLE_DEF(transform, transform), 953 STYLE_DEF(transform, transform),
946 STYLE_DEF(display, display) 954 STYLE_DEF(display, display)
947}; 955};
@@ -2367,6 +2375,22 @@ _inherit_style(Svg_Style_Property *child, Svg_Style_Property *parent)
2367 { 2375 {
2368 child->stroke.join = parent->stroke.join; 2376 child->stroke.join = parent->stroke.join;
2369 } 2377 }
2378 if (!(child->stroke.flags & SVG_STROKE_FLAGS_DASH))
2379 {
2380 int i = 0;
2381 int count = parent->stroke.dash_count;
2382 if (count > 0)
2383 {
2384 if (child->stroke.dash) free(child->stroke.dash);
2385 child->stroke.dash = calloc(count, sizeof(Efl_Gfx_Dash));
2386 child->stroke.dash_count = count;
2387 for (i = 0; i < count; i++)
2388 {
2389 child->stroke.dash[i].length = parent->stroke.dash[i].length;
2390 child->stroke.dash[i].gap = parent->stroke.dash[i].gap;
2391 }
2392 }
2393 }
2370} 2394}
2371 2395
2372void 2396void