rimmed pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=f12a08ab15617378885e62eaa53f603b4d9e7649

commit f12a08ab15617378885e62eaa53f603b4d9e7649
Author: Vyacheslav Reutskiy <v.reuts...@samsung.com>
Date:   Thu Dec 22 18:08:27 2016 +0200

    edje_cc: add svg file name '.png' if it use as image
    
    This path add notify for user in case when svg use in image section. It
    need for clear understanding why vertor image scale like bitmap. And
    add to file name new extension '.png'
---
 src/bin/edje/edje_cc_handlers.c |  2 ++
 src/bin/edje/edje_cc_out.c      | 18 ++++++++++++++++--
 2 files changed, 18 insertions(+), 2 deletions(-)

diff --git a/src/bin/edje/edje_cc_handlers.c b/src/bin/edje/edje_cc_handlers.c
index 94eff48..f95189a 100644
--- a/src/bin/edje/edje_cc_handlers.c
+++ b/src/bin/edje/edje_cc_handlers.c
@@ -2212,6 +2212,8 @@ st_externals_external(void)
         included inside other blocks, normally "collections", "group" and
         "part", easing maintenance of the file list when the theme is split
         among multiple files.
+        @note if svg file use as image, not vector, it will be converted to 
bitmap
+        and '.png' will be add to file name.
     @endblock
 
     @property
diff --git a/src/bin/edje/edje_cc_out.c b/src/bin/edje/edje_cc_out.c
index 6717508..3f4a79b 100644
--- a/src/bin/edje/edje_cc_out.c
+++ b/src/bin/edje/edje_cc_out.c
@@ -1320,6 +1320,7 @@ data_write_images(Eet_File *ef, int *image_num)
    int i;
    Ecore_Evas *ee;
    Evas *evas;
+   const char *ext = NULL;
 
    if (!((edje_file) && (edje_file->image_dir))) return;
 
@@ -1345,7 +1346,7 @@ data_write_images(Eet_File *ef, int *image_num)
         if (img->source_type == EDJE_IMAGE_SOURCE_TYPE_INLINE_LOSSY_ETC1 ||
             img->source_type == EDJE_IMAGE_SOURCE_TYPE_INLINE_LOSSY_ETC2)
           {
-             const char *ext = strrchr(img->entry, '.');
+             ext = strrchr(img->entry, '.');
              if (ext && !strcasecmp(ext, ".tgv"))
                {
                   if (tgv_file_check_and_add(ef, img, image_num))
@@ -1409,6 +1410,19 @@ data_write_images(Eet_File *ef, int *image_num)
                   exit(1); // ensure static analysis tools know we exit
                }
           }
+        if (img->source_type != EDJE_IMAGE_SOURCE_TYPE_EXTERNAL)
+          {
+             ext = strrchr(img->entry, '.');
+             if (ext && (!strcasecmp(ext, ".svg") || !strcasecmp(ext, 
".svgz")))
+               {
+                  int size = strlen(img->entry) + strlen(".png") + 1;
+                  char *tmp = malloc(size);
+                  snprintf(tmp, size, "%s.png", img->entry);
+                  INF("Vector '%s' used as image, convert to bitmap '%s'", 
img->entry, tmp);
+                  free(img->entry);
+                  img->entry = tmp;
+               }
+          }
      }
 }
 
@@ -2644,7 +2658,6 @@ data_write(void)
 
    pending_threads++;
    t = ecore_time_get();
-   data_write_header(ef);
 
    INF("header: %3.5f", ecore_time_get() - t); t = ecore_time_get();
    data_write_groups(ef, &collection_num);
@@ -2705,6 +2718,7 @@ data_write(void)
    pending_threads--;
    if (pending_threads > 0) ecore_main_loop_begin();
    INF("THREADS: %3.5f", ecore_time_get() - t);
+   data_write_header(ef);
 
    err = eet_close(ef);
    if (err)

-- 


Reply via email to