Evas: Fixed the compilation warning with sw8 engine. This is not just to beautify...
authortasn <tasn@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Tue, 10 Aug 2010 07:36:23 +0000 (07:36 +0000)
committertasn <tasn@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Tue, 10 Aug 2010 07:36:23 +0000 (07:36 +0000)
git-svn-id: svn+ssh://svn.enlightenment.org/var/svn/e/trunk/evas@50954 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33

src/lib/engines/common/evas_convert_rgb_8.c
src/lib/include/evas_common.h

index a2b355b..f69f398 100644 (file)
@@ -21,8 +21,8 @@ void evas_common_convert_rgba_to_8bpp_rgb_332_dith     (DATA32 *src, DATA8 *dst,
 
    CONVERT_LOOP_START_ROT_0();
 
-   dith = DM_TABLE[(x + dith_x) & DM_MSK][(y + dith_y) & DM_MSK] >> DM_SHF(3);
-   dith2 = DM_TABLE[(x + dith_x) & DM_MSK][(y + dith_y) & DM_MSK] >> DM_SHF(2);
+   dith = DM_SHR(DM_TABLE[(x + dith_x) & DM_MSK][(y + dith_y) & DM_MSK], 3);
+   dith2 = DM_SHR(DM_TABLE[(x + dith_x) & DM_MSK][(y + dith_y) & DM_MSK], 2);
 /*   r = (R_VAL(src_ptr)) >> (8 - 3);*/
 /*   g = (G_VAL(src_ptr)) >> (8 - 3);*/
 /*   b = (B_VAL(src_ptr)) >> (8 - 2);*/
@@ -94,8 +94,8 @@ void evas_common_convert_rgba_to_8bpp_rgb_232_dith     (DATA32 *src, DATA8 *dst,
 
    CONVERT_LOOP_START_ROT_0();
 
-   dith = DM_TABLE[(x + dith_x) & DM_MSK][(y + dith_y) & DM_MSK] >> DM_SHF(3);
-   dith2 = DM_TABLE[(x + dith_x) & DM_MSK][(y + dith_y) & DM_MSK] >> DM_SHF(2);
+   dith = DM_SHR(DM_TABLE[(x + dith_x) & DM_MSK][(y + dith_y) & DM_MSK], 3);
+   dith2 = DM_SHR(DM_TABLE[(x + dith_x) & DM_MSK][(y + dith_y) & DM_MSK], 2);
 /*   r = (R_VAL(src_ptr)) >> (8 - 2);*/
 /*   g = (G_VAL(src_ptr)) >> (8 - 3);*/
 /*   b = (B_VAL(src_ptr)) >> (8 - 2);*/
@@ -127,7 +127,7 @@ void evas_common_convert_rgba_to_8bpp_rgb_222_dith     (DATA32 *src, DATA8 *dst,
 
    CONVERT_LOOP_START_ROT_0();
 
-   dith = DM_TABLE[(x + dith_x) & DM_MSK][(y + dith_y) & DM_MSK] >> DM_SHF(2);
+   dith = DM_SHR(DM_TABLE[(x + dith_x) & DM_MSK][(y + dith_y) & DM_MSK], 2);
 /*   r = (R_VAL(src_ptr)) >> (8 - 2);*/
 /*   g = (G_VAL(src_ptr)) >> (8 - 2);*/
 /*   b = (B_VAL(src_ptr)) >> (8 - 2);*/
@@ -159,8 +159,8 @@ void evas_common_convert_rgba_to_8bpp_rgb_221_dith     (DATA32 *src, DATA8 *dst,
 
    CONVERT_LOOP_START_ROT_0();
 
-   dith = DM_TABLE[(x + dith_x) & DM_MSK][(y + dith_y) & DM_MSK] >> DM_SHF(2);
-   dith2 = DM_TABLE[(x + dith_x) & DM_MSK][(y + dith_y) & DM_MSK] >> DM_SHF(1);
+   dith = DM_SHR(DM_TABLE[(x + dith_x) & DM_MSK][(y + dith_y) & DM_MSK], 2);
+   dith2 = DM_SHR(DM_TABLE[(x + dith_x) & DM_MSK][(y + dith_y) & DM_MSK], 1);
 /*   r = (R_VAL(src_ptr)) >> (8 - 2);*/
 /*   g = (G_VAL(src_ptr)) >> (8 - 2);*/
 /*   b = (B_VAL(src_ptr)) >> (8 - 1);*/
@@ -192,8 +192,8 @@ void evas_common_convert_rgba_to_8bpp_rgb_121_dith     (DATA32 *src, DATA8 *dst,
 
    CONVERT_LOOP_START_ROT_0();
 
-   dith = DM_TABLE[(x + dith_x) & DM_MSK][(y + dith_y) & DM_MSK] >> DM_SHF(2);
-   dith2 = DM_TABLE[(x + dith_x) & DM_MSK][(y + dith_y) & DM_MSK] >> DM_SHF(1);
+   dith = DM_SHR(DM_TABLE[(x + dith_x) & DM_MSK][(y + dith_y) & DM_MSK], 2);
+   dith2 = DM_SHR(DM_TABLE[(x + dith_x) & DM_MSK][(y + dith_y) & DM_MSK], 1);
 /*   r = (R_VAL(src_ptr)) >> (8 - 1);*/
 /*   g = (G_VAL(src_ptr)) >> (8 - 2);*/
 /*   b = (B_VAL(src_ptr)) >> (8 - 1);*/
@@ -226,7 +226,7 @@ void evas_common_convert_rgba_to_8bpp_rgb_111_dith     (DATA32 *src, DATA8 *dst,
 
    CONVERT_LOOP_START_ROT_0();
 
-   dith = DM_TABLE[(x + dith_x) & DM_MSK][(y + dith_y) & DM_MSK] >> DM_SHF(1);
+   dith = DM_SHR(DM_TABLE[(x + dith_x) & DM_MSK][(y + dith_y) & DM_MSK], 1);
 /*   r = (R_VAL(src_ptr)) >> (8 - 1);*/
 /*   g = (G_VAL(src_ptr)) >> (8 - 1);*/
 /*   b = (B_VAL(src_ptr)) >> (8 - 1);*/
index a86799f..8c2835d 100644 (file)
@@ -248,18 +248,20 @@ void *alloca (size_t);
 # define DM_BITS      4
 # define DM_DIV       16
 # define USE_DITHER_44 1
-# define DM_MSK       (DM_SIZE - 1)
-# define DM_SHF(_b)   (DM_BITS - (8 - _b))
 #else
 # define DM_TABLE     _evas_dither_128128
 # define DM_SIZE      128
 # define DM_BITS      6
 # define DM_DIV       64
 # define USE_DITHER_128128 1
-# define DM_MSK       (DM_SIZE - 1)
-# define DM_SHF(_b)   (DM_BITS - (8 - _b))
 #endif
 
+#define DM_MSK       (DM_SIZE - 1)
+#define DM_SHF(_b)   (DM_BITS - (8 - _b))
+/* Supports negative right shifts */
+#define DM_SHR(x, _b)   ((DM_SHF(_b) >= 0) ? \
+      ((x) >> DM_SHF(_b)) : ((x) << -DM_SHF(_b)))
+
 /* if more than 1/ALPHA_SPARSE_INV_FRACTION is "alpha" (1-254) then sparse
  * alpha flag gets set */
 #define ALPHA_SPARSE_INV_FRACTION 3