From: Jean-Philippe Andre Date: Mon, 23 Jun 2014 00:31:15 +0000 (+0900) Subject: Evas ETC2: Remove some useless operations X-Git-Tag: upstream/1.10.0+1149+ga3a15b1~504 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=37431fb1a18bfa0c940a1f93b67c2e5d9cbb920a;p=platform%2Fupstream%2Fefl.git Evas ETC2: Remove some useless operations No need to write out alpha in a RGBA color when only the RGB values are used by the distance op. Also, add a comment on the byte order. Maybe I'm wrong but I believe the operations are fine wrt. byte order :) --- diff --git a/src/static_libs/rg_etc/etc2_encoder.c b/src/static_libs/rg_etc/etc2_encoder.c index 54481e8..8f7fe3c 100644 --- a/src/static_libs/rg_etc/etc2_encoder.c +++ b/src/static_libs/rg_etc/etc2_encoder.c @@ -129,6 +129,14 @@ absi(int a) #define G_VAL(v) ((uint8_t) ((v & 0x0000FF00) >> 8)) #define B_VAL(v) ((uint8_t) ((v & 0x000000FF))) +#ifndef WORDS_BIGENDIAN +# define RGB_START 0 +# define RGB_END 2 +#else +# define RGB_START 1 +# define RGB_END 3 +#endif + #ifndef DBG # ifdef DEBUG # define DBG(fmt, ...) fprintf(stderr, "%s:%d: " fmt "\n", __FUNCTION__, __LINE__, ## __VA_ARGS__) @@ -463,6 +471,10 @@ _etc2_th_mode_block_pack(uint8_t *etc2, Eina_Bool h_mode, } paint_colors[4], color1, color2; int errAcc = 0; + paint_colors[0].v = 0; + paint_colors[1].v = 0; + paint_colors[2].v = 0; + paint_colors[3].v = 0; color1.v = c1; color2.v = c2; @@ -488,7 +500,8 @@ _etc2_th_mode_block_pack(uint8_t *etc2, Eina_Bool h_mode, } } - for (int k = 0; k < 4; k++) + // Set paint_colors using R,G,B values (byte order is preserved) + for (int k = RGB_START; k <= RGB_END; k++) { if (!h_mode) {