efl/evas: simplify dither mask handling.
authorGustavo Sverzut Barbieri <barbieri@gmail.com>
Thu, 6 Dec 2012 19:44:11 +0000 (19:44 +0000)
committerGustavo Sverzut Barbieri <barbieri@gmail.com>
Thu, 6 Dec 2012 19:44:11 +0000 (19:44 +0000)
 * a single option --with-evas-dither-mask=TYPE (big, small, line or none).

 * make a wise decision to fallback to small dither mask for
   conversions that do not support "no-dither" or "line". Before if
   you did not specify it would fallback to big (128x128).

SVN revision: 80383

configure.ac
m4/evas_dither.m4 [deleted file]
src/lib/evas/include/evas_common.h

index d96c5e0..d3ab314 100644 (file)
@@ -1842,12 +1842,30 @@ fi
 
 ## dither options
 
-# Small dither mask instead of big one (lower quality)
-EVAS_CHECK_DITHER([small-dither-mask], [small dither mask], [conv_small_dither="yes"], [conv_small_dither="no"])
-# Alternate Line dither mask instead of big one (lower quality - but fastest)
-EVAS_CHECK_DITHER([line-dither-mask], [line dither mask], [conv_line_dither="yes"], [conv_line_dither="no"])
-# No dither mask at all for 16bpp
-EVAS_CHECK_DITHER([no-dither-mask], [conversion to 16bpp without dither mask], [conv_no_dither="yes"], [conv_no_dither="no"])
+AC_ARG_WITH([evas-dither-mask],
+   [AC_HELP_STRING([--with-evas-dither-mask=TYPE],
+                   [use the specified dither mask to convert bitdepths in Evas, one of: big, small, line or none.
+                    @<:@default=big@:>@])],
+   [build_evas_dither_mask=${withval}],
+   [build_evas_dither_mask=big])
+
+case "${build_evas_dither_mask}" in
+   big)
+     AC_DEFINE([BUILD_BIG_DITHER_MASK], [1], [Use biggest dither mask while converting in Evas])
+     ;;
+   small)
+     AC_DEFINE([BUILD_SMALL_DITHER_MASK], [1], [Use smaller dither mask while converting in Evas])
+     ;;
+   line)
+     AC_DEFINE([BUILD_LINE_DITHER_MASK], [1], [Use simpler line-only dither mask while converting in Evas])
+     ;;
+   none)
+     AC_DEFINE([BUILD_NO_DITHER_MASK], [1], [Do not use dither masks while converting in Evas])
+     ;;
+   *)
+     AC_MSG_ERROR([Unknown Evas dither mask --with-evas-dither-mask=${build_evas_dither_mask}])
+     ;;
+esac
 
 #### End of Evas
 
@@ -4067,9 +4085,7 @@ echo "    Pixman Images...........: $have_pixman_image"
 echo "    Pixman Image ScaleSample: $have_pixman_image_scale_sample"
 echo
 echo "  Conversion Options:"
-echo "    Smaller Dither Mask.....: $conv_small_dither"
-echo "    Line Dither Mask........: $conv_line_dither"
-echo "    No Dither Mask for 16bpp: $conv_no_dither"
+echo "    Dither Mask.............: $build_evas_dither_mask"
 echo "    Tiled 32BPP rotate......: $have_tile_rotate"
 echo
 
diff --git a/m4/evas_dither.m4 b/m4/evas_dither.m4
deleted file mode 100644 (file)
index f8dcca3..0000000
+++ /dev/null
@@ -1,44 +0,0 @@
-dnl Copyright (C) 2009 Vincent Torri <vtorri at univ-evry dot fr>
-dnl That code is public domain and can be freely used or copied.
-
-dnl Macro that enables dithering support is wanted.
-
-dnl Usage: EVAS_CHECK_DITHER(dither, description [, ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]])
-dnl The parameter 'dither' is the type of dithering.
-dnl The parameter 'description' is the description of the dithering.
-dnl Defines BUILD_[TYPEOFDITHERING]
-
-AC_DEFUN([EVAS_CHECK_DITHER],
-[
-m4_pushdef([UP], m4_translit([$1], [-a-z], [_A-Z]))dnl
-m4_pushdef([DOWN], m4_translit([$1], [-A-Z], [_a-z]))dnl
-
-AC_ARG_ENABLE([$1],
-   AC_HELP_STRING([--enable-$1], [enable $2 @<:@default=disabled@:>@]),
-   [
-    if test "x${enableval}" = "xyes" ; then
-       _efl_enable_dither_option_[]DOWN="yes"
-    else
-       _efl_enable_dither_option_[]DOWN="no"
-    fi
-   ],
-   [_efl_enable_dither_option_[]DOWN="no"])
-
-AC_MSG_CHECKING(whether to build $2)
-AC_MSG_RESULT([${_efl_enable_dither_option_[]DOWN}])
-
-if test "x${_efl_enable_dither_option_[]DOWN}" = "xyes" ; then
-   AC_DEFINE([BUILD_]UP[], [1], [define to 1 if you have the $2 support])
-fi
-
-if test "x${_efl_enable_dither_option_[]DOWN}" = "xyes" ; then
-   m4_default([$3], [:])
-else
-   m4_default([$4], [:])
-fi
-
-m4_popdef([UP])
-m4_popdef([DOWN])
-])
-
-dnl End of evas_dither.m4
index 1795ca9..b8b2c33 100644 (file)
@@ -222,6 +222,15 @@ extern EAPI int _evas_log_dom_global;
    ((((unsigned long long)w) * ((unsigned long long)h)) >= \
        ((1ULL << (29 * (sizeof(void *) / 4))) - 2048))
 
+/* not every converter supports no-dither or line-dither, then they will
+ * fallback to table version, in these cases default to small table.
+ */
+#if defined(BUILD_NO_DITHER_MASK) || defined(BUILD_LINE_DITHER_MASK)
+#ifndef BUILD_SMALL_DITHER_MASK
+#define BUILD_SMALL_DITHER_MASK 1
+#endif
+#endif
+
 #ifdef BUILD_SMALL_DITHER_MASK
 # define DM_TABLE     _evas_dither_44
 # define DM_SIZE      4