This is an automated email from the git hooks/post-receive script.

git pushed a commit to branch master
in repository legacy-imlib2.

View the commit online.

commit 96e95920dc5cb4818505d13881e1c2efba786a01
Author: Kim Woelders <[email protected]>
AuthorDate: Fri Jul 22 14:47:21 2022 +0200

    Enable disabling filter functions
    
    To optionally reduce footprint.
---
 configure.ac            | 11 +++++++++++
 src/bin/Makefile.am     |  5 ++++-
 src/bin/imlib2_show.c   | 11 +++++++++++
 src/lib/Makefile.am     | 11 +++++++----
 src/lib/api.c           |  2 ++
 src/lib/api.h           |  5 +++--
 src/modules/Makefile.am |  5 ++++-
 7 files changed, 42 insertions(+), 8 deletions(-)

diff --git a/configure.ac b/configure.ac
index 4115a7b..48c8f93 100644
--- a/configure.ac
+++ b/configure.ac
@@ -223,6 +223,16 @@ EC_LOADER_CHECK(ID3,  auto, id3tag)
 
 AM_CONDITIONAL(BUILD_TEST, false)
 
+AC_ARG_ENABLE([filters],
+  [AS_HELP_STRING([--enable-filters], [Enable filters @<:@default=yes@:>@])],
+  enable_filters="$enableval",
+  enable_filters="yes"
+)
+if test "$enable_filters" = "yes"; then
+  AC_DEFINE(ENABLE_FILTERS, 1, [Enable filters])
+fi
+AM_CONDITIONAL(ENABLE_FILTERS, test "$enable_filters" = "yes")
+
 AC_ARG_ENABLE([debug],
   [AS_HELP_STRING([--enable-debug], [Enable debug features @<:@default=no@:>@])],
   [
@@ -306,6 +316,7 @@ echo
 echo "Use X86 MMX for speed.....: $mmx"
 echo "Use AMD64 for speed.......: $amd64"
 echo
+echo "Include filters...........: $enable_filters"
 echo "Use visibility hiding.....: $enable_visibility_hiding"
 echo
 echo "Installation path.........: $prefix"
diff --git a/src/bin/Makefile.am b/src/bin/Makefile.am
index 9cb1f43..6768acd 100644
--- a/src/bin/Makefile.am
+++ b/src/bin/Makefile.am
@@ -5,7 +5,10 @@ AM_CPPFLAGS = \
 $(X_CFLAGS)
 
 if BUILD_X11
-X_BASED_PROGS = imlib2_show imlib2_test imlib2_bumpmap imlib2_poly imlib2_colorspace imlib2_view imlib2_grab
+X_BASED_PROGS = imlib2_show imlib2_test imlib2_poly imlib2_colorspace imlib2_view imlib2_grab
+if ENABLE_FILTERS
+X_BASED_PROGS += imlib2_bumpmap
+endif
 endif
 
 bin_PROGRAMS = \
diff --git a/src/bin/imlib2_show.c b/src/bin/imlib2_show.c
index a3f4ce6..3dbc654 100644
--- a/src/bin/imlib2_show.c
+++ b/src/bin/imlib2_show.c
@@ -56,7 +56,10 @@ main(int argc, char **argv)
    int                 blend = 1;
    int                 interactive = 1;
    int                 blendtest = 0;
+
+#if ENABLE_FILTERS
    int                 filter = 0;
+#endif
    int                 pol = 0;
    int                 rotate = 0;
    int                 rottest = 0;
@@ -121,9 +124,13 @@ main(int argc, char **argv)
         printf("-loop\t\tScales down the image.\n");
         printf("-blendtest\tPerforms a blending test on the file.\n");
         printf("-rotatetest\tPerforms a rotate test on the file.\n");
+#if ENABLE_FILTERS
         printf
            ("-filter\t\tPerforms filtering. Possible filters are,\n\t\t\t1:Blur filter, 2:Sharpen filter, 3:Color blur filter, \n\t\t\t4:Emboss filter, 5:Grayscale filter, 6:Saturation filter,\n\t\t\t7:Edge detection filter.\n");
+#endif
+#if 0
         printf("-bmp2pt\t\tPerformas Bump Mapping to a point\n");
+#endif
         return 0;
      }
 
@@ -227,11 +234,13 @@ main(int argc, char **argv)
           }
         else if (!strcmp(argv[i], "-rotate"))
            rotate = 1;
+#if ENABLE_FILTERS
         else if (!strcmp(argv[i], "-filter"))
           {
              filter = atoi(argv[++i]);
              interactive = 0;
           }
+#endif
         else if (!strcmp(argv[i], "-rotatetest"))
           {
              rottest = 1;
@@ -682,6 +691,7 @@ main(int argc, char **argv)
           }
         imlib_free_image();
      }
+#if ENABLE_FILTERS
    else if (filter)
      {
         imlib_context_set_filter(imlib_create_filter(0));
@@ -766,6 +776,7 @@ main(int argc, char **argv)
           }
         imlib_free_filter();
      }
+#endif /* ENABLE_FILTERS */
    else if (interactive)
      {
         int                 px, py, first = 1;
diff --git a/src/lib/Makefile.am b/src/lib/Makefile.am
index bcd8869..9136d28 100644
--- a/src/lib/Makefile.am
+++ b/src/lib/Makefile.am
@@ -15,7 +15,6 @@ libImlib2_la_LIBADD  =
 
 libImlib2_la_SOURCES = \
 api.c 		api.h		\
-api_filter.c	\
 api_obsolete.c	\
 asm.h \
 asm_c.c		asm_c.h		\
@@ -28,9 +27,7 @@ draw_ellipse.c \
 draw_line.c \
 draw_polygon.c \
 draw_rectangle.c \
-dynamic_filters.c	dynamic_filters.h \
 file.c		file.h		\
-filter.c	filter.h	\
 font.h \
 font_draw.c \
 font_load.c \
@@ -45,11 +42,17 @@ object.c	object.h	\
 rgbadraw.c	rgbadraw.h	\
 rotate.c	rotate.h	\
 scale.c		scale.h		\
-script.c	script.h	\
 span.c		span.h		\
 strutils.c	strutils.h	\
 types.h	\
 updates.c	updates.h
+if ENABLE_FILTERS
+libImlib2_la_SOURCES += \
+api_filter.c	\
+dynamic_filters.c	dynamic_filters.h	\
+filter.c	filter.h	\
+script.c	script.h
+endif
 
 libImlib2_la_LIBADD += $(FREETYPE_LIBS)
 
diff --git a/src/lib/api.c b/src/lib/api.c
index 6a27b00..9e6f8a6 100644
--- a/src/lib/api.c
+++ b/src/lib/api.c
@@ -143,11 +143,13 @@ __imlib_free_context(ImlibContext * context)
         imlib_free_color_modifier();
         ctx->color_modifier = NULL;
      }
+#if ENABLE_FILTERS
    if (ctx->filter)
      {
         imlib_free_filter();
         ctx->filter = NULL;
      }
+#endif
 
    free(ctx);
    ctx = next->context;
diff --git a/src/lib/api.h b/src/lib/api.h
index 435a7f0..24bd0c1 100644
--- a/src/lib/api.h
+++ b/src/lib/api.h
@@ -58,11 +58,12 @@ typedef struct {
    char                progress_granularity;
    char                dither_mask;
    int                 mask_alpha_threshold;
-   Imlib_Filter        filter;
    Imlib_Rectangle     cliprect;
-
    int                 references;
    char                dirty;
+#if ENABLE_FILTERS
+   Imlib_Filter        filter;
+#endif
 } ImlibContext;
 
 extern ImlibContext *ctx;
diff --git a/src/modules/Makefile.am b/src/modules/Makefile.am
index 381f030..40145d9 100644
--- a/src/modules/Makefile.am
+++ b/src/modules/Makefile.am
@@ -1 +1,4 @@
-SUBDIRS = loaders filters
+SUBDIRS = loaders
+if ENABLE_FILTERS
+SUBDIRS += filters
+endif

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.

Reply via email to