From c269c219b2246c0391e1369b10e49719b9b40d50 Mon Sep 17 00:00:00 2001 From: sam Date: Fri, 8 Aug 2008 18:11:12 +0000 Subject: [PATCH] * Get rid of test.c, it was no longer useful anyway. git-svn-id: file:///srv/caca.zoy.org/var/lib/svn/libpipi/trunk@2679 92316355-f0b4-4df1-b90c-862c8a59935f --- examples/img2rubik.c | 1 - pipi/Makefile.am | 32 ++++++++++++-------- pipi/pipi.h | 2 -- pipi/test.c | 71 -------------------------------------------- 4 files changed, 19 insertions(+), 87 deletions(-) delete mode 100644 pipi/test.c diff --git a/examples/img2rubik.c b/examples/img2rubik.c index d992896..815cbeb 100644 --- a/examples/img2rubik.c +++ b/examples/img2rubik.c @@ -22,7 +22,6 @@ int main(int argc, char *argv[]) dstname = argv[2]; img = pipi_load(srcname); - pipi_test(img); pipi_save(img, dstname); pipi_free(img); diff --git a/pipi/Makefile.am b/pipi/Makefile.am index 899640c..20f67ca 100644 --- a/pipi/Makefile.am +++ b/pipi/Makefile.am @@ -10,11 +10,6 @@ pkgconfigdir = $(libdir)/pkgconfig include_HEADERS = pipi.h -# Conditional sources -codec_cflags = -codec_libs = -codec_sources = - # The main library lib_LTLIBRARIES = libpipi.la libpipi_la_SOURCES = \ @@ -26,20 +21,31 @@ libpipi_la_SOURCES = \ resize.c \ dither.c \ measure.c \ - test.c \ + fill/floodfill.c \ $(codec_sources) \ + $(filter_sources) \ + $(dither_sources) \ + $(NULL) +libpipi_la_CFLAGS = $(codec_cflags) +libpipi_la_LDFLAGS = $(codec_libs) \ + -no-undefined -version-number @LT_VERSION@ + +# Conditional sources +codec_cflags = +codec_libs = +codec_sources = + +# Submodules +filter_sources = \ filter/blur.c \ - filter/convolution.c \ + filter/convolution.c + +dither_sources = \ dither/floydsteinberg.c \ dither/ordered.c \ dither/ostromoukhov.c \ dither/dbs.c \ - dither/random.c \ - fill/floodfill.c \ - $(NULL) -libpipi_la_CFLAGS = $(codec_cflags) -libpipi_la_LDFLAGS = $(codec_libs) \ - -no-undefined -version-number @LT_VERSION@ + dither/random.c if USE_SDL codec_cflags += `sdl-config --cflags` diff --git a/pipi/pipi.h b/pipi/pipi.h index 658e190..828a23a 100644 --- a/pipi/pipi.h +++ b/pipi/pipi.h @@ -92,8 +92,6 @@ extern pipi_image_t *pipi_dither_ostromoukhov(pipi_image_t *, pipi_scan_t); extern pipi_image_t *pipi_dither_dbs(pipi_image_t *); extern void pipi_dither_24to16(pipi_image_t *); -extern void pipi_test(pipi_image_t *); - #ifdef __cplusplus } #endif diff --git a/pipi/test.c b/pipi/test.c deleted file mode 100644 index 5a45dfc..0000000 --- a/pipi/test.c +++ /dev/null @@ -1,71 +0,0 @@ -/* - * libpipi Proper image processing implementation library - * Copyright (c) 2004-2008 Sam Hocevar - * All Rights Reserved - * - * $Id$ - * - * This library is free software. It comes without any warranty, to - * the extent permitted by applicable law. You can redistribute it - * and/or modify it under the terms of the Do What The Fuck You Want - * To Public License, Version 2, as published by Sam Hocevar. See - * http://sam.zoy.org/wtfpl/COPYING for more details. - */ - -/* - * test.c: my repository of test functions - */ - -#include "config.h" -#include "common.h" - -#include -#include - -#include "pipi.h" -#include "pipi_internals.h" - -void pipi_test(pipi_image_t *img) -{ - pipi_pixels_t *pixels; - float *data; - int x, y; - - pixels = pipi_getpixels(img, PIPI_PIXELS_RGBA_F); - data = (float *)pixels->pixels; - - for(y = 0; y < img->h; y++) - { - for(x = 0; x < img->w; x++) - { - double r = 0, g = 0, b = 0; - - r = data[(y * img->w + x) * 4]; - g = data[(y * img->w + x) * 4 + 1]; - b = data[(y * img->w + x) * 4 + 2]; - - if(r + g + b == 0) - r = g = b = 1. / 3; - else if(r + g + b < 1.) - { - double d = (1. - r - g - b) / 3; - r += d; g += d; b += d; - } - else if(2. - r + g - b < 1.) - { - double d = (-1. + r - g + b) / 3; - r -= d; g += d; b -= d; - } - else if(2. + r - g - b < 1.) - { - double d = (-1. - r + g + b) / 3; - r += d; g -= d; b -= d; - } - - data[(y * img->w + x) * 4] = r; - data[(y * img->w + x) * 4 + 1] = g; - data[(y * img->w + x) * 4 + 2] = b; - } - } -} -