summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJean-Philippe Andre <jp.andre@samsung.com>2014-04-17 19:04:31 +0900
committerJean-Philippe Andre <jp.andre@samsung.com>2014-04-18 15:43:04 +0900
commitd531816b1240199b7d3e510cce4238cac79f83a8 (patch)
tree4da131dcb390713c9e6cb403958f38f5d8e53a1b
parentf7150570b08bb4db781fd319ecc8197ea54bbeea (diff)
Edje: Add support for ETC1 encoding
Edje will compress images as ETC1 provided that they don't contain any alpha AND the command line includes -etc1.
-rw-r--r--src/bin/edje/edje_cc.c16
-rw-r--r--src/bin/edje/edje_cc.h1
-rw-r--r--src/bin/edje/edje_cc_out.c5
3 files changed, 18 insertions, 4 deletions
diff --git a/src/bin/edje/edje_cc.c b/src/bin/edje/edje_cc.c
index 5f36270..b3bb014 100644
--- a/src/bin/edje/edje_cc.c
+++ b/src/bin/edje/edje_cc.c
@@ -36,7 +36,8 @@ int min_quality = 0;
36int max_quality = 100; 36int max_quality = 100;
37int compress_mode = EET_COMPRESSION_HI; 37int compress_mode = EET_COMPRESSION_HI;
38int threads = 0; 38int threads = 0;
39int anotate = 0; 39int anotate = 0;
40int allow_etc1 = 0;
40 41
41static void 42static void
42_edje_cc_log_cb(const Eina_Log_Domain *d, 43_edje_cc_log_cb(const Eina_Log_Domain *d,
@@ -92,7 +93,7 @@ main_help(void)
92 "-id image/directory Add a directory to look in for relative path images\n" 93 "-id image/directory Add a directory to look in for relative path images\n"
93 "-fd font/directory Add a directory to look in for relative path fonts\n" 94 "-fd font/directory Add a directory to look in for relative path fonts\n"
94 "-sd sound/directory Add a directory to look in for relative path sounds samples\n" 95 "-sd sound/directory Add a directory to look in for relative path sounds samples\n"
95 "-vd vbiration/directory Add a directory to look in for relative path vibration samples\n" 96 "-vd vibration/directory Add a directory to look in for relative path vibration samples\n"
96 "-dd data/directory Add a directory to look in for relative path data.file entries\n" 97 "-dd data/directory Add a directory to look in for relative path data.file entries\n"
97 "-td temp/directory Directory to store temporary files\n" 98 "-td temp/directory Directory to store temporary files\n"
98 "-l license Specify the license of a theme\n" 99 "-l license Specify the license of a theme\n"
@@ -101,6 +102,7 @@ main_help(void)
101 "-no-lossy Do NOT allow images to be lossy\n" 102 "-no-lossy Do NOT allow images to be lossy\n"
102 "-no-comp Do NOT allow images to be stored with lossless compression\n" 103 "-no-comp Do NOT allow images to be stored with lossless compression\n"
103 "-no-raw Do NOT allow images to be stored with zero compression (raw)\n" 104 "-no-raw Do NOT allow images to be stored with zero compression (raw)\n"
105 "-etc1 Allow images to be stored as ETC1 in the EDJ file (incompatible with -no-lossy, default: no)\n"
104 "-no-save Do NOT store the input EDC file in the EDJ file\n" 106 "-no-save Do NOT store the input EDC file in the EDJ file\n"
105 "-min-quality VAL Do NOT allow lossy images with quality < VAL (0-100)\n" 107 "-min-quality VAL Do NOT allow lossy images with quality < VAL (0-100)\n"
106 "-max-quality VAL Do NOT allow lossy images with quality > VAL (0-100)\n" 108 "-max-quality VAL Do NOT allow lossy images with quality > VAL (0-100)\n"
@@ -171,6 +173,10 @@ main(int argc, char **argv)
171 { 173 {
172 no_raw = 1; 174 no_raw = 1;
173 } 175 }
176 else if (!strcmp(argv[i], "-etc1") || !strcmp(argv[i], "--allow-etc1"))
177 {
178 allow_etc1 = 1;
179 }
174 else if (!strcmp(argv[i], "-no-save")) 180 else if (!strcmp(argv[i], "-no-save"))
175 { 181 {
176 no_save = 1; 182 no_save = 1;
@@ -282,7 +288,11 @@ main(int argc, char **argv)
282 exit(-1); 288 exit(-1);
283 } 289 }
284 290
285 291 if (allow_etc1 && no_lossy)
292 {
293 WRN("-etc1 and -no-lossy are not compatible, discarded -etc1");
294 allow_etc1 = 0;
295 }
286 296
287 pfx = eina_prefix_new(argv[0], /* argv[0] value (optional) */ 297 pfx = eina_prefix_new(argv[0], /* argv[0] value (optional) */
288 main, /* an optional symbol to check path of */ 298 main, /* an optional symbol to check path of */
diff --git a/src/bin/edje/edje_cc.h b/src/bin/edje/edje_cc.h
index c611af0..80952a6 100644
--- a/src/bin/edje/edje_cc.h
+++ b/src/bin/edje/edje_cc.h
@@ -237,6 +237,7 @@ extern Eina_List *licenses;
237extern int no_lossy; 237extern int no_lossy;
238extern int no_comp; 238extern int no_comp;
239extern int no_raw; 239extern int no_raw;
240extern int allow_etc1;
240extern int no_save; 241extern int no_save;
241extern int min_quality; 242extern int min_quality;
242extern int max_quality; 243extern int max_quality;
diff --git a/src/bin/edje/edje_cc_out.c b/src/bin/edje/edje_cc_out.c
index b89dd45..3302fa6 100644
--- a/src/bin/edje/edje_cc_out.c
+++ b/src/bin/edje/edje_cc_out.c
@@ -753,6 +753,7 @@ data_thread_image(void *data, Ecore_Thread *thread EINA_UNUSED)
753 753
754 if ((iw->data) && (iw->w > 0) && (iw->h > 0)) 754 if ((iw->data) && (iw->w > 0) && (iw->h > 0))
755 { 755 {
756 Eet_Image_Encoding lossy = EET_IMAGE_LOSSLESS;
756 int mode, qual; 757 int mode, qual;
757 758
758 snprintf(buf, sizeof(buf), "edje/images/%i", iw->img->id); 759 snprintf(buf, sizeof(buf), "edje/images/%i", iw->img->id);
@@ -785,6 +786,8 @@ data_thread_image(void *data, Ecore_Thread *thread EINA_UNUSED)
785 qual = iw->img->source_param; 786 qual = iw->img->source_param;
786 if (qual < min_quality) qual = min_quality; 787 if (qual < min_quality) qual = min_quality;
787 if (qual > max_quality) qual = max_quality; 788 if (qual > max_quality) qual = max_quality;
789 if (!allow_etc1 || (iw->alpha)) lossy = EET_IMAGE_JPEG;
790 else lossy = EET_IMAGE_ETC1;
788 } 791 }
789 if (iw->alpha) 792 if (iw->alpha)
790 { 793 {
@@ -816,7 +819,7 @@ data_thread_image(void *data, Ecore_Thread *thread EINA_UNUSED)
816 bytes = eet_data_image_write(iw->ef, buf, 819 bytes = eet_data_image_write(iw->ef, buf,
817 iw->data, iw->w, iw->h, 820 iw->data, iw->w, iw->h,
818 iw->alpha, 821 iw->alpha,
819 0, qual, 1); 822 0, qual, lossy);
820 if (bytes <= 0) 823 if (bytes <= 0)
821 { 824 {
822 snprintf(buf2, sizeof(buf2), 825 snprintf(buf2, sizeof(buf2),