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'
This commit is contained in:
Vyacheslav Reutskiy 2016-12-22 18:08:27 +02:00
parent 715a66ed11
commit f12a08ab15
2 changed files with 18 additions and 2 deletions

View File

@ -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

View File

@ -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)