This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project gfxprim.git.
The branch, master has been updated via 3cefa3907f68f96ec6e2e7ecc4ecf1fb26b96cdb (commit) from 44de9a46432c45949764964d3c49e65e2bb9701b (commit)
Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below.
- Log ----------------------------------------------------------------- http://repo.or.cz/w/gfxprim.git/commit/3cefa3907f68f96ec6e2e7ecc4ecf1fb26b96...
commit 3cefa3907f68f96ec6e2e7ecc4ecf1fb26b96cdb Author: Cyril Hrubis metan@ucw.cz Date: Sun May 22 22:16:28 2011 +0200
Fix the directory layout and build system.
And so the man divided the darkness from the light, the wild from the home, the work from the relief and so the chaos was ordered and calculated and finally disappeared.
diff --git a/Makefile b/Makefile index c0c29af..6b16da8 100644 --- a/Makefile +++ b/Makefile @@ -1,49 +1,37 @@ -HEADER_LOC=/usr/include/ -LIB_LOC=/usr/lib/ - -.PHONY: all core sdl drivers loaders install filters clean tar - -all: core sdl drivers loaders filters - -drivers: - cd drivers && $(MAKE) all - -core: - cd core && $(MAKE) all +TOPDIR=. +SUBDIRS=libs tests +include include.mk
-sdl: core - cd targets/sdl && $(MAKE) all +tests: libs
-loaders: - cd loaders && $(MAKE) all +clean: +ifdef VERBOSE + $(MAKE) -C build clean +else + @echo "/build" + @$(MAKE) --no-print-directory -C build clean +endif
-filters: - cd filters && $(MAKE) all +HEADER_LOC=/usr/include/ +LIB_LOC=/usr/lib/
-install: +#install: # core library - install -m 775 -d $(HEADER_LOC)GP/ - install -m 664 core/*.h $(HEADER_LOC)GP/ - install -m 664 core/*.so core/*.so.0 core/*.a $(LIB_LOC) +# install -m 775 -d $(HEADER_LOC)GP/ +# install -m 664 core/*.h $(HEADER_LOC)GP/ +# install -m 664 core/*.so core/*.so.0 core/*.a $(LIB_LOC) # bitmap loaders - install -m 775 -d $(HEADER_LOC)GP/loaders/ - install -m 664 loaders/*.h $(HEADER_LOC)GP/loaders/ - install -m 664 loaders/*.so loaders/*.so.0 loaders/*.a $(LIB_LOC) +# install -m 775 -d $(HEADER_LOC)GP/loaders/ +# install -m 664 loaders/*.h $(HEADER_LOC)GP/loaders/ +# install -m 664 loaders/*.so loaders/*.so.0 loaders/*.a $(LIB_LOC) # context filters - install -m 775 -d $(HEADER_LOC)GP/filters/ - install -m 664 filters/*.h $(HEADER_LOC)GP/filters/ - install -m 664 filters/*.so filters/*.so.0 filters/*.a $(LIB_LOC) +# install -m 775 -d $(HEADER_LOC)GP/filters/ +# install -m 664 filters/*.h $(HEADER_LOC)GP/filters/ +# install -m 664 filters/*.so filters/*.so.0 filters/*.a $(LIB_LOC) # sdl target - install -m 775 -d $(HEADER_LOC)GP/SDL/ - install -m 664 targets/sdl/*.h $(HEADER_LOC)GP/SDL/ - install -m 664 targets/sdl/*.so targets/sdl/*.so.0 targets/sdl/*.a $(LIB_LOC) - -clean: - cd core && $(MAKE) clean - cd targets/sdl && $(MAKE) clean - cd drivers && $(MAKE) clean - cd loaders && $(MAKE) clean - cd filters && $(MAKE) clean +# install -m 775 -d $(HEADER_LOC)GP/SDL/ +# install -m 664 targets/sdl/*.h $(HEADER_LOC)GP/SDL/ +# install -m 664 targets/sdl/*.so targets/sdl/*.so.0 targets/sdl/*.a $(LIB_LOC)
tar: clean cd .. && tar cjf gfxprim-`date +%Y-%b-%d-%HH%MM`.tar.bz2 gfxprim diff --git a/algo/README b/algo/README deleted file mode 100644 index 7ec8962..0000000 --- a/algo/README +++ /dev/null @@ -1,7 +0,0 @@ -This directory contains implementations of various drawing algorithms -in form of macros. Each macro generates a function that draws a shape -using lower-level primitives that are specified by the user. - -This allows for having multiple drawing functions customized for various -conditions, typically various bit depths. - diff --git a/app.mk b/app.mk new file mode 100644 index 0000000..4c90884 --- /dev/null +++ b/app.mk @@ -0,0 +1,15 @@ +ifndef APPS +$(error APPS not defined, fix your library Makefile) +endif + +all: $(APPS) + +CLEAN+=$(APPS) + +%: %.o +ifdef VERBOSE + $(CC) $(CFLAGS) $(LDFLAGS) -Wl,--start-group $(LDLIBS) $^ -Wl,--end-group -o $@ +else + @echo "LD $@" + @$(CC) $(CFLAGS) $(LDFLAGS) -Wl,--start-group $(LDLIBS) $^ -Wl,--end-group -o $@ +endif diff --git a/build/Makefile b/build/Makefile new file mode 100644 index 0000000..a0fe717 --- /dev/null +++ b/build/Makefile @@ -0,0 +1,41 @@ +all: print libs + +print: +ifndef VERBOSE + @echo "GEN (linker) libGP.a libGP.so" +endif + +libs: print libGP.a libGP.so + +# +# Do NOT remove this +# +.PHONY: libGP.a libGP.so + +clean: +ifdef VERBOSE + rm -f libGP.a libGP.so +else + @echo "RM libGP.a libGP.so" + @rm -f libGP.a libGP.so +endif + +libGP.a: + @. ./liblock.sh; spinlock . +ifdef VERBOSE + ./link.sh libGP.a +else + @echo "AR libGP.a" + @./link.sh libGP.a +endif + @. ./liblock.sh; spinunlock . + +libGP.so: + @. ./liblock.sh; spinlock . +ifdef VERBOSE + ./link.sh libGP.so +else + @echo "LD libGP.so" + @./link.sh libGP.so +endif + @. ./liblock.sh; spinunlock . diff --git a/build/liblock.sh b/build/liblock.sh new file mode 100644 index 0000000..159d23b --- /dev/null +++ b/build/liblock.sh @@ -0,0 +1,24 @@ +# +# Takes directory as parameter +# +spinlock() +{ + I=0 + #echo -n "Trying to acquire lock in '$1' ." + while ! mkdir "$1/.lock" &> /dev/null; do + sleep 1; + ((I=I+1)) + if [ $I -gt 10 ]; then + echo "Failed to acquire lock '`pwd`/.lock'" + exit 1 + fi + # echo -n . + done + #echo " done" +} + +spinunlock() +{ + #echo "Removing lock in '$1'" + rmdir "$1/.lock" &> /dev/null +} diff --git a/build/link.sh b/build/link.sh new file mode 100755 index 0000000..580ff19 --- /dev/null +++ b/build/link.sh @@ -0,0 +1,27 @@ +#!/bin/sh + +TOPDIR=.. +LIBDIRS="core gfx text loaders filters backends input" + +get_objects() +{ + for i in $LIBDIRS; do + OBJECTS=`echo $TOPDIR/libs/$i/*.o`; + + if [ "$OBJECTS" != "$TOPDIR/libs/$i/*.o" ]; then + echo "$OBJECTS" + fi + done +} + +if [ "$1" == "libGP.a" ]; then + OBJECTS=$(get_objects) + + ar rcs libGP.a $OBJECTS +fi + +if [ "$1" == "libGP.so" ]; then + OBJECTS=$(get_objects) + + gcc -fPIC -dPIC --shared -Wl,-soname -Wl,libGP.so.0 $OBJECTS -o libGP.so +fi diff --git a/config.mk b/config.mk new file mode 100644 index 0000000..6653c55 --- /dev/null +++ b/config.mk @@ -0,0 +1,3 @@ +CFLAGS+=-W -Wall -Wextra -fPIC -ggdb -O2 -std=gnu99 +CFLAGS+=-I$(TOPDIR)/include/ +LDLIBS+=-ldl diff --git a/core/GP_Circle.c b/core/GP_Circle.c deleted file mode 100644 index 8be5f55..0000000 --- a/core/GP_Circle.c +++ /dev/null @@ -1,57 +0,0 @@ -/***************************************************************************** - * This file is part of gfxprim library. * - * * - * Gfxprim is free software; you can redistribute it and/or * - * modify it under the terms of the GNU Lesser General Public * - * License as published by the Free Software Foundation; either * - * version 2.1 of the License, or (at your option) any later version. * - * * - * Gfxprim is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * - * Lesser General Public License for more details. * - * * - * You should have received a copy of the GNU Lesser General Public * - * License along with gfxprim; if not, write to the Free Software * - * Foundation, Inc., 51 Franklin Street, Fifth Floor, * - * Boston, MA 02110-1301 USA * - * * - * Copyright (C) 2009-2010 Jiri "BlueBear" Dluhos * - * jiri.bluebear.dluhos@gmail.com * - * * - * Copyright (C) 2009-2010 Cyril Hrubis metan@ucw.cz * - * * - *****************************************************************************/ - -#include "GP.h" -#include "algo/Circle.algo.h" -#include "GP_FnPerBpp.h" - -/* Generate drawing functions for various bit depths. */ -DEF_CIRCLE_FN(GP_Circle1bpp, GP_Context *, GP_Pixel, GP_PutPixel1bpp) -DEF_CIRCLE_FN(GP_Circle2bpp, GP_Context *, GP_Pixel, GP_PutPixel2bpp) -DEF_CIRCLE_FN(GP_Circle4bpp, GP_Context *, GP_Pixel, GP_PutPixel4bpp) -DEF_CIRCLE_FN(GP_Circle8bpp, GP_Context *, GP_Pixel, GP_PutPixel8bpp) -DEF_CIRCLE_FN(GP_Circle16bpp, GP_Context *, GP_Pixel, GP_PutPixel16bpp) -DEF_CIRCLE_FN(GP_Circle24bpp, GP_Context *, GP_Pixel, GP_PutPixel24bpp) -DEF_CIRCLE_FN(GP_Circle32bpp, GP_Context *, GP_Pixel, GP_PutPixel32bpp) - -void GP_Circle(GP_Context *context, int xcenter, int ycenter, - unsigned int r, GP_Pixel pixel) -{ - GP_CHECK_CONTEXT(context); - - GP_FN_PER_BPP(GP_Circle, context->bpp, context, - xcenter, ycenter, r, pixel); -} - -void GP_TCircle(GP_Context *context, int xcenter, int ycenter, - unsigned int r, GP_Pixel pixel) -{ - GP_CHECK_CONTEXT(context); - - /* Just recalculate center point */ - GP_TRANSFORM_POINT(context, xcenter, ycenter); - - GP_Circle(context, xcenter, ycenter, r, pixel); -} diff --git a/core/GP_FillEllipse.c b/core/GP_FillEllipse.c deleted file mode 100644 index 5625012..0000000 --- a/core/GP_FillEllipse.c +++ /dev/null @@ -1,57 +0,0 @@ -/***************************************************************************** - * This file is part of gfxprim library. * - * * - * Gfxprim is free software; you can redistribute it and/or * - * modify it under the terms of the GNU Lesser General Public * - * License as published by the Free Software Foundation; either * - * version 2.1 of the License, or (at your option) any later version. * - * * - * Gfxprim is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * - * Lesser General Public License for more details. * - * * - * You should have received a copy of the GNU Lesser General Public * - * License along with gfxprim; if not, write to the Free Software * - * Foundation, Inc., 51 Franklin Street, Fifth Floor, * - * Boston, MA 02110-1301 USA * - * * - * Copyright (C) 2009-2010 Jiri "BlueBear" Dluhos * - * jiri.bluebear.dluhos@gmail.com * - * * - * Copyright (C) 2009-2010 Cyril Hrubis metan@ucw.cz * - * * - *****************************************************************************/ - -#include "GP.h" -#include "GP_FnPerBpp.h" -#include "algo/FillEllipse.algo.h" - -/* Generate drawing functions for various bit depths. */ -DEF_FILLELLIPSE_FN(GP_FillEllipse1bpp, GP_Context *, GP_Pixel, GP_HLine1bpp) -DEF_FILLELLIPSE_FN(GP_FillEllipse2bpp, GP_Context *, GP_Pixel, GP_HLine2bpp) -DEF_FILLELLIPSE_FN(GP_FillEllipse4bpp, GP_Context *, GP_Pixel, GP_HLine4bpp) -DEF_FILLELLIPSE_FN(GP_FillEllipse8bpp, GP_Context *, GP_Pixel, GP_HLine8bpp) -DEF_FILLELLIPSE_FN(GP_FillEllipse16bpp, GP_Context *, GP_Pixel, GP_HLine16bpp) -DEF_FILLELLIPSE_FN(GP_FillEllipse24bpp, GP_Context *, GP_Pixel, GP_HLine24bpp) -DEF_FILLELLIPSE_FN(GP_FillEllipse32bpp, GP_Context *, GP_Pixel, GP_HLine32bpp) - -void GP_FillEllipse(GP_Context *context, int xcenter, int ycenter, - unsigned int a, unsigned int b, GP_Pixel pixel) -{ - GP_CHECK_CONTEXT(context); - - GP_FN_PER_BPP(GP_FillEllipse, context->bpp, context, - xcenter, ycenter, a, b, pixel); -} - -void GP_TFillEllipse(GP_Context *context, int xcenter, int ycenter, - unsigned int a, unsigned int b, GP_Pixel pixel) -{ - GP_CHECK_CONTEXT(context); - - GP_TRANSFORM_POINT(context, xcenter, ycenter); - GP_TRANSFORM_SWAP(context, a, b); - - GP_FillEllipse(context, xcenter, ycenter, a, b, pixel); -} diff --git a/core/GP_FillEllipse.h b/core/GP_FillEllipse.h deleted file mode 100644 index cf0c7c5..0000000 --- a/core/GP_FillEllipse.h +++ /dev/null @@ -1,39 +0,0 @@ -/***************************************************************************** - * This file is part of gfxprim library. * - * * - * Gfxprim is free software; you can redistribute it and/or * - * modify it under the terms of the GNU Lesser General Public * - * License as published by the Free Software Foundation; either * - * version 2.1 of the License, or (at your option) any later version. * - * * - * Gfxprim is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * - * Lesser General Public License for more details. * - * * - * You should have received a copy of the GNU Lesser General Public * - * License along with gfxprim; if not, write to the Free Software * - * Foundation, Inc., 51 Franklin Street, Fifth Floor, * - * Boston, MA 02110-1301 USA * - * * - * Copyright (C) 2009-2010 Jiri "BlueBear" Dluhos * - * jiri.bluebear.dluhos@gmail.com * - * * - * Copyright (C) 2009-2010 Cyril Hrubis metan@ucw.cz * - * * - *****************************************************************************/ - -#ifndef GP_FILLELLIPSE_H -#define GP_FILLELLIPSE_H - -#include "GP_Context.h" - -#include <stdint.h> - -void GP_FillEllipse(GP_Context *context, int xcenter, int ycenter, - unsigned int a, unsigned int b, GP_Pixel pixel); - -void GP_TFillEllipse(GP_Context *context, int xcenter, int ycenter, - unsigned int a, unsigned int b, GP_Pixel pixel); - -#endif /* GP_FILLELLIPSE_H */ diff --git a/core/GP_FillRect.h b/core/GP_FillRect.h deleted file mode 100644 index c12f57e..0000000 --- a/core/GP_FillRect.h +++ /dev/null @@ -1,46 +0,0 @@ -/***************************************************************************** - * This file is part of gfxprim library. * - * * - * Gfxprim is free software; you can redistribute it and/or * - * modify it under the terms of the GNU Lesser General Public * - * License as published by the Free Software Foundation; either * - * version 2.1 of the License, or (at your option) any later version. * - * * - * Gfxprim is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * - * Lesser General Public License for more details. * - * * - * You should have received a copy of the GNU Lesser General Public * - * License along with gfxprim; if not, write to the Free Software * - * Foundation, Inc., 51 Franklin Street, Fifth Floor, * - * Boston, MA 02110-1301 USA * - * * - * Copyright (C) 2009-2010 Jiri "BlueBear" Dluhos * - * jiri.bluebear.dluhos@gmail.com * - * * - * Copyright (C) 2009-2010 Cyril Hrubis metan@ucw.cz * - * * - *****************************************************************************/ - -#ifndef GP_FILLRECT_H -#define GP_FILLRECT_H - -#include "GP_Context.h" - -void GP_FillRectXYXY(GP_Context *context, int x0, int y0, int x1, int y1, - GP_Pixel pixel); - -void GP_FillRectXYWH(GP_Context *context, int x, int y, - unsigned int w, unsigned int h, GP_Pixel pixel); - -void GP_TFillRectXYXY(GP_Context *context, int x0, int y0, int x1, int y1, - GP_Pixel pixel); - -void GP_TFillRectXYWH(GP_Context *context, int x, int y, - unsigned int w, unsigned int h, GP_Pixel pixel); - -#define GP_FillRect GP_FillRectXYXY -#define GP_TFillRect GP_TFillRectXYXY - -#endif /* GP_FILLRECT_H */ diff --git a/core/GP_LineTrack.c b/core/GP_LineTrack.c deleted file mode 100644 index fbf21b4..0000000 --- a/core/GP_LineTrack.c +++ /dev/null @@ -1,76 +0,0 @@ -/***************************************************************************** - * This file is part of gfxprim library. * - * * - * Gfxprim is free software; you can redistribute it and/or * - * modify it under the terms of the GNU Lesser General Public * - * License as published by the Free Software Foundation; either * - * version 2.1 of the License, or (at your option) any later version. * - * * - * Gfxprim is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * - * Lesser General Public License for more details. * - * * - * You should have received a copy of the GNU Lesser General Public * - * License along with gfxprim; if not, write to the Free Software * - * Foundation, Inc., 51 Franklin Street, Fifth Floor, * - * Boston, MA 02110-1301 USA * - * * - * Copyright (C) 2009-2010 Jiri "BlueBear" Dluhos * - * jiri.bluebear.dluhos@gmail.com * - * * - * Copyright (C) 2009-2010 Cyril Hrubis metan@ucw.cz * - * * - *****************************************************************************/ - -#include "GP.h" - -inline void GP_LineTrackInit(struct GP_LineTrack *track, int x0, int y0, - int x1, int y1) -{ - track->x0 = x0; - track->y0 = y0; - track->x1 = x1; - track->y1 = y1; - - track->dx = abs(x1 - x0); - track->dy = abs(y1 - y0); - track->xstep = (x0 < x1) ? 1 : -1; - track->ystep = (y0 < y1) ? 1 : -1; - - track->x = x0; - track->y = y0; - track->err = track->dx - track->dy; - track->xmin = x0; - track->xmax = x0; -} - -inline void GP_LineTrackNext(struct GP_LineTrack *track) -{ - int x = track->x; - int xmin = track->x; - int xmax = track->x; - - for (;;) { - xmin = GP_MIN(x, xmin); - xmax = GP_MAX(x, xmax); - - if (x == track->x1 && track->y == track->y1) - break; - - int err2 = 2*track->err; - if (err2 > -track->dy) { - track->err -= track->dy; - x += track->xstep; - } - if (err2 < track->dx) { - track->err += track->dx; - track->y += track->ystep; - break; - } - } - - track->x = x; - track->xmin = xmin; - track->xmax = xmax; -} diff --git a/core/GP_LineTrack.h b/core/GP_LineTrack.h deleted file mode 100644 index 4a505b8..0000000 --- a/core/GP_LineTrack.h +++ /dev/null @@ -1,72 +0,0 @@ -/***************************************************************************** - * This file is part of gfxprim library. * - * * - * Gfxprim is free software; you can redistribute it and/or * - * modify it under the terms of the GNU Lesser General Public * - * License as published by the Free Software Foundation; either * - * version 2.1 of the License, or (at your option) any later version. * - * * - * Gfxprim is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * - * Lesser General Public License for more details. * - * * - * You should have received a copy of the GNU Lesser General Public * - * License along with gfxprim; if not, write to the Free Software * - * Foundation, Inc., 51 Franklin Street, Fifth Floor, * - * Boston, MA 02110-1301 USA * - * * - * Copyright (C) 2009-2010 Jiri "BlueBear" Dluhos * - * jiri.bluebear.dluhos@gmail.com * - * * - * Copyright (C) 2009-2010 Cyril Hrubis metan@ucw.cz * - * * - *****************************************************************************/ - -#ifndef GP_LINE_TRACK_H -#define GP_LINE_TRACK_H - -#define GP_KEEP_FIRST 1 -#define GP_KEEP_XMIN 2 -#define GP_KEEP_XMAX 4 - -/* This structure is used to track the starting and ending points of a line - * drawn by Bresenham algorithm, scanline by scanline (in a top-down manner). - * Use GP_LineTrackInit() to initialize the structure. - * Use GP_LineTrackNext() to calculate the next scanline. - */ -struct GP_LineTrack { - - /* these values are constant during the tracking */ - - int x0, y0; /* starting point (inclusive) */ - int x1, y1; /* ending point (inclusive) */ - int dx; /* absolute difference between x0 and x1 */ - int dy; /* ditto for Y */ - int xstep; /* +1 if X increases, -1 if it decreases */ - int ystep; /* ditto for Y */ - - /* only the values below are changing during the tracking */ - - int x, y; /* current X and Y position */ - int err; /* error term (difference in Y from ideal line) */ - - /* output values, written by GP_LineTrackNext(), never reused */ - - int xmin; /* minimum X value for the PREVIOUS scanline */ - int xmax; /* maximum X value for the PREVIOUS scanline */ -}; - -/* Initializes the GP_LineTrack structure and prepares for tracking the line - * from (x0, y0) to (x1, y1), inclusive. - * IMPORTANT: At this point, the 'xmin', 'xmax' fields are not yet computed! - * You must call GP_LineTrackNext() to obtain values for the first scanline. - */ -inline void GP_LineTrackInit(struct GP_LineTrack *track, int x0, int y0, int x1, int y1); - -/* Calculates the next scanline of the Bresenham line algorithm, - * updating the 'x', 'y', 'err' fields and writing 'xmin', 'xmax'. - */ -inline void GP_LineTrackNext(struct GP_LineTrack *track); - -#endif /* GP_LINE_TRACK_H */ diff --git a/core/GP_Rect.c b/core/GP_Rect.c deleted file mode 100644 index 08cecc1..0000000 --- a/core/GP_Rect.c +++ /dev/null @@ -1,65 +0,0 @@ -/***************************************************************************** - * This file is part of gfxprim library. * - * * - * Gfxprim is free software; you can redistribute it and/or * - * modify it under the terms of the GNU Lesser General Public * - * License as published by the Free Software Foundation; either * - * version 2.1 of the License, or (at your option) any later version. * - * * - * Gfxprim is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * - * Lesser General Public License for more details. * - * * - * You should have received a copy of the GNU Lesser General Public * - * License along with gfxprim; if not, write to the Free Software * - * Foundation, Inc., 51 Franklin Street, Fifth Floor, * - * Boston, MA 02110-1301 USA * - * * - * Copyright (C) 2009-2010 Jiri "BlueBear" Dluhos * - * jiri.bluebear.dluhos@gmail.com * - * * - * Copyright (C) 2009-2010 Cyril Hrubis metan@ucw.cz * - * * - *****************************************************************************/ - -#include "GP.h" - -void GP_RectXYXY(GP_Context *context, int x0, int y0, int x1, int y1, - GP_Pixel pixel) -{ - GP_CHECK_CONTEXT(context); - - GP_HLine(context, x0, x1, y0, pixel); - GP_HLine(context, x0, x1, y1, pixel); - GP_VLine(context, x0, y0, y1, pixel); - GP_VLine(context, x1, y0, y1, pixel); -} - -void GP_RectXYWH(GP_Context *context, int x, int y, - unsigned int w, unsigned int h, GP_Pixel pixel) -{ - GP_CHECK_CONTEXT(context); - - GP_HLine(context, x, x + w, y, pixel); - GP_HLine(context, x, x + w, y + h, pixel); - GP_VLine(context, x, y, y + h, pixel); - GP_VLine(context, x + w, y, y + h, pixel); -} - -void GP_TRectXYXY(GP_Context *context, int x0, int y0, int x1, int y1, - GP_Pixel pixel) -{ - GP_CHECK_CONTEXT(context); - - GP_TRANSFORM_POINT(context, x0, y0); - GP_TRANSFORM_POINT(context, x1, y1); - - GP_RectXYXY(context, x0, y0, x1, y1, pixel); -} - -void GP_TRectXYWH(GP_Context *context, int x, int y, - unsigned int w, unsigned int h, GP_Pixel pixel) -{ - GP_TRectXYXY(context, x, y, x + w, y + h, pixel); -} diff --git a/core/Makefile b/core/Makefile deleted file mode 100644 index b23dad4..0000000 --- a/core/Makefile +++ /dev/null @@ -1,38 +0,0 @@ -COREDIR=`pwd` -LIBRARY=libGP_core -SOURCES=$(wildcard *.c) $(wildcard ../backends/*.c) -OBJECTS=$(SOURCES:.c=.o) -HEADERS=$(wildcard *.h) $(wildcard ../backends/*.h) -ALGORITHMS=$(wildcard ../algo/*.algo.h) -CFLAGS=-W -Wall -O2 -fPIC -I$(COREDIR) -I$(COREDIR)/../ - -HEADER_LOC=/usr/include/ -LIB_LOC=/usr/lib/ - -.PHONY: all clean tests - -all: $(LIBRARY) - -tests: $(LIBRARY) - cd tests && $(MAKE) all - -$(LIBRARY): $(LIBRARY).a $(LIBRARY).so - -$(OBJECTS): $(HEADERS) $(ALGORITHMS) - -$(LIBRARY).a: $(OBJECTS) - ar crus $@ $^ - -$(LIBRARY).so: $(OBJECTS) - $(CC) -fPIC -dPIC -lm -ldl --shared -Wl,-soname -Wl,$@.0 $(CFLAGS) $^ -o $@ - ln -sf $@ $@.0 - -%.o: %.c $(ALGORITHMS) - $(CC) $(CFLAGS) $< -c -o $@ - -clean: - rm -f $(LIBRARY).a $(LIBRARY).so $(LIBRARY).so.0 - rm -f *.o - rm -f ../backends/*.o - cd tests && $(MAKE) clean - diff --git a/core/tests/Makefile b/core/tests/Makefile deleted file mode 100644 index b56bcc6..0000000 --- a/core/tests/Makefile +++ /dev/null @@ -1,33 +0,0 @@ -LIBRARY=../libGP_core.a -LDFLAGS=-L../ -lGP_core - -INCLUDE=-I../ - -CFLAGS=$(INCLUDE) -ggdb -W -Wall -O -std=gnu99 - -TESTS=core_tests - -# General stuff - -.PHONY: all clean run - -all: $(TESTS) - -clean: - rm -f *.o *.tmp - rm -f $(TESTS) - rm -f core_tests.gen.c - -run: $(TESTS) - for test in $(TESTS); do LD_LIBRARY_PATH=../ ./"$$test" -v ; done - -# Check tests - -TEST_SRCS=$(wildcard *.test.c) -TEST_OBJS=$(patsubst %.c,%.o,$(TEST_SRCS)) - -core_tests.gen.c: $(TEST_SRCS) find_tests.py - python find_tests.py -c $@ $(TEST_SRCS) - -core_tests: $(TEST_OBJS) core_tests.o core_tests.gen.o - $(CC) $(CFLAGS) $(LDFLAGS) $^ $(LIBRARY) -lcheck -o $@ diff --git a/drivers/Makefile b/drivers/Makefile deleted file mode 100644 index ffd891b..0000000 --- a/drivers/Makefile +++ /dev/null @@ -1,29 +0,0 @@ -LIBRARY=libGP_drivers -SOURCES=$(wildcard *.c) -OBJECTS=$(SOURCES:.c=.o) -HEADERS=$(wildcard *.h) -CFLAGS=-I../core/ -W -Wall -O2 -fPIC - -.PHONY: all clean - -all: $(LIBRARY) - cd tests && $(MAKE) all - -$(LIBRARY): $(LIBRARY).a $(LIBRARY).so - -$(OBJECTS): $(HEADERS) - -$(LIBRARY).a: $(OBJECTS) - ar crus $@ $^ - -$(LIBRARY).so: $(OBJECTS) - $(CC) -fPIC -dPIC --shared -Wl,-soname -Wl,$@.0 $(CFLAGS) $^ -o $@ - ln -sf $@ $@.0 - -%.o: %.c - $(CC) $(CFLAGS) $< -c -o $@ - -clean: - rm -f $(LIBRARY).a $(LIBRARY).so $(LIBRARY).so.0 - rm -f *.o - cd tests && $(MAKE) clean diff --git a/filters/Makefile b/filters/Makefile deleted file mode 100644 index 58b807b..0000000 --- a/filters/Makefile +++ /dev/null @@ -1,29 +0,0 @@ -LIBRARY=libGP_filters -SOURCES=$(wildcard *.c) -OBJECTS=$(SOURCES:.c=.o) -HEADERS=$(wildcard *.h) -CFLAGS=-I../core/ -W -Wall -O2 -fPIC - -.PHONY: all clean - -all: $(LIBRARY) - cd tests && $(MAKE) all - -$(LIBRARY): $(LIBRARY).a $(LIBRARY).so - -$(OBJECTS): $(HEADERS) - -$(LIBRARY).a: $(OBJECTS) - ar crus $@ $^ - -$(LIBRARY).so: $(OBJECTS) - $(CC) -fPIC -dPIC --shared -Wl,-soname -Wl,$@.0 $(CFLAGS) $^ -o $@ - ln -sf $@ $@.0 - -%.o: %.c - $(CC) $(CFLAGS) $< -c -o $@ - -clean: - rm -f $(LIBRARY).a $(LIBRARY).so $(LIBRARY).so.0 - rm -f *.o - cd tests && $(MAKE) clean diff --git a/filters/tests/Makefile b/filters/tests/Makefile deleted file mode 100644 index 4fe81db..0000000 --- a/filters/tests/Makefile +++ /dev/null @@ -1,17 +0,0 @@ -LDFLAGS=-L../ -L../../core/ -L../../loaders/ -lGP_core -lGP_loaders -lGP_filters - -INCLUDE=-I../ -I../../core/ -I../../loaders/ -# Some warnings are triggered only with -O2 -# thuss added here -CFLAGS=$(INCLUDE) -ggdb -W -Wall -O2 -lm -SOURCES=$(wildcard *.c) -TESTS=$(SOURCES:.c=) - -all: $(TESTS) - -%: %.c - $(CC) $(CFLAGS) $(LDFLAGS) $(LIBRARY) $^ -o $@ - -clean: - rm -f *.o $(TESTS) - rm -f test-mv.pgm test-mh.pgm test-cw.pgm test-ccw.pgm diff --git a/include.mk b/include.mk new file mode 100644 index 0000000..68fab64 --- /dev/null +++ b/include.mk @@ -0,0 +1,101 @@ +.PHONY: $(SUBDIRS) all clean help + +all: $(SUBDIRS) +clean: $(SUBDIRS) + +help: + @echo "*** Available targets ***" + @echo "" + @echo "help: prints this help" + @echo "" + @echo "clean: cleans current directory and all subdirectories" + @echo "" + @echo "all: make current directory and all subdirectories" + @echo "" + @echo "The default silent output could be turned off by defining" + @echo "'VERBOSE' shell variable as 'VERBOSE=1 make'" + @echo "" + +include $(TOPDIR)/config.mk + +# +# Determine mode (eg do not generate anything if not in compile mode +# +COMPILE=no + +ifeq ($(MAKECMDGOALS),all) +COMPILE=yes +endif + +ifeq ($(MAKECMDGOALS),) +COMPILE=yes +endif + +# +# 1. Generate and include dependencies for all C sources +# 2. Generate OBJECTS list from CSOURCES list +# 3. Adds OBJECTS to CLEAN list +# +ifdef CSOURCES +DEPFILES=$(subst .c,.dep,$(CSOURCES)) +ifeq ($(COMPILE),yes) +-include $(DEPFILES) +endif +CLEAN+=$(subst .c,.dep,$(CSOURCES)) +OBJECTS=$(CSOURCES:.c=.o) +CLEAN+=$(OBJECTS) +endif + +# +# Automatically include library headers +# +ifdef LIBNAME +INCLUDE+=$(LIBNAME) +endif + +# +# If there was anything in INCLUDE list, create CFLAGS for each entry +# +ifdef INCLUDE +CFLAGS+=$(addprefix -I$(TOPDIR)/include/, $(INCLUDE)) +endif + +# +# Walk trought SUBDIRS, this code works even for -jX +# +$(SUBDIRS): +ifdef VERBOSE + $(MAKE) -C $@ $(MAKECMDGOALS) +else + @export CURSUBDIR="$$CURSUBDIR/$@" && echo "DIR $$CURSUBDIR" &&+ $(MAKE) --no-print-directory -C $@ $(MAKECMDGOALS) +endif + +# +# Actual make rules +# +$(DEPFILES): %.dep: %.c +ifdef VERBOSE + $(CC) -MM $(CFLAGS) $< -o $@ +else + @echo "DEP -I(include $(INCLUDE)) $@" + @$(CC) -MM $(CFLAGS) $< -o $@ +endif + +$(OBJECTS): %.o: %.c +ifdef VERBOSE + $(CC) $(CFLAGS) -c $< -o $@ +else + @echo "CC -I(include $(INCLUDE)) $@" + @$(CC) $(CFLAGS) -c $< -o $@ +endif + +ifdef CLEAN +clean: +ifdef VERBOSE + rm -f $(CLEAN) +else + @echo "RM $(CLEAN)" + @rm -f $(CLEAN) +endif +endif diff --git a/filters/GP_Filters.h b/include/GP.h similarity index 90% copy from filters/GP_Filters.h copy to include/GP.h index eb63d43..e68b747 100644 --- a/filters/GP_Filters.h +++ b/include/GP.h @@ -23,15 +23,16 @@ * * *****************************************************************************/
-/* +#ifndef GP_H +#define GP_H
- GP_Context filters. +/* library core */ +#include "core/GP_Core.h"
- */ +/* public drawing API */ +#include "gfx/GP_Gfx.h"
-#ifndef GP_FILTERS_H -#define GP_FILTERS_H +/* fonts and text drawing */ +#include "text/GP_Text.h"
-#include "GP_Rotate.h" - -#endif /* GP_FILTERS_H */ +#endif /* GP_H */ diff --git a/core/GP_Backend.h b/include/backends/GP_Backend.h similarity index 99% rename from core/GP_Backend.h rename to include/backends/GP_Backend.h index d1dff51..3f81ed7 100644 --- a/core/GP_Backend.h +++ b/include/backends/GP_Backend.h @@ -26,7 +26,7 @@ #ifndef GP_BACKEND_H #define GP_BACKEND_H
-#include "GP_Context.h" +#include "core/GP_Context.h"
/* * Types of events provided by the backend. diff --git a/core/config.h b/include/config.h similarity index 91% rename from core/config.h rename to include/config.h index baac35b..cd640ca 100644 --- a/core/config.h +++ b/include/config.h @@ -1,3 +1 @@ - #define GP_HAVE_SDL 1 - diff --git a/core/GP_Clip.h b/include/core/GP_Clip.h similarity index 100% rename from core/GP_Clip.h rename to include/core/GP_Clip.h diff --git a/core/GP_Color.h b/include/core/GP_Color.h similarity index 100% rename from core/GP_Color.h rename to include/core/GP_Color.h diff --git a/core/GP_Common.h b/include/core/GP_Common.h similarity index 100% rename from core/GP_Common.h rename to include/core/GP_Common.h diff --git a/core/GP_Context.h b/include/core/GP_Context.h similarity index 98% rename from core/GP_Context.h rename to include/core/GP_Context.h index 67851b5..acb04f9 100644 --- a/core/GP_Context.h +++ b/include/core/GP_Context.h @@ -57,7 +57,10 @@ typedef struct GP_Context { } GP_Context;
/* Returns the pixel type used by the context. */ -inline GP_PixelType GP_GetContextPixelType(const GP_Context *context); +static inline GP_PixelType GP_GetContextPixelType(const GP_Context *context) +{ + return context->pixel_type; +}
/* Determines the address of a pixel within the context's image. * Rows and columns are specified in the image's orientation diff --git a/core/GP_FillCircle.h b/include/core/GP_Core.h similarity index 84% rename from core/GP_FillCircle.h rename to include/core/GP_Core.h index 208a6b8..dd70700 100644 --- a/core/GP_FillCircle.h +++ b/include/core/GP_Core.h @@ -23,15 +23,26 @@ * * *****************************************************************************/
-#ifndef GP_FILLCIRCLE_H -#define GP_FILLCIRCLE_H +/*
-#include "GP_Context.h" + This is header file for public core API.
-void GP_FillCircle(GP_Context *context, int xcenter, int ycenter, - unsigned int r, GP_Pixel pixel); + */
-void GP_TFillCircle(GP_Context *context, int xcenter, int ycenter, - unsigned int r, GP_Pixel pixel); +#ifndef GP_CORE_H +#define GP_CORE_H
-#endif /* GP_FILLCIRCLE_H */ +/* Common building blocks */ +#include "core/GP_Common.h" + +/* Context ... */ +#include "core/GP_Context.h" + +/* ... and it's trasformations */ +#include "core/GP_Transform.h" + +/* Pixels */ +#include "GP_GetPixel.h" +#include "GP_PutPixel.h" + +#endif /* GP_CORE_H */ diff --git a/core/GP_FnPerBpp.h b/include/core/GP_FnPerBpp.h similarity index 99% rename from core/GP_FnPerBpp.h rename to include/core/GP_FnPerBpp.h index 2a745e7..22f15c4 100644 --- a/core/GP_FnPerBpp.h +++ b/include/core/GP_FnPerBpp.h @@ -23,8 +23,6 @@ * * *****************************************************************************/
-#include "GP.h" - /* * Macro that generates a switch-case block that calls various variants * of the specified function depending on the bit depth of the context. diff --git a/core/GP_GetPixel.h b/include/core/GP_GetPixel.h similarity index 100% rename from core/GP_GetPixel.h rename to include/core/GP_GetPixel.h diff --git a/core/GP_Palette.h b/include/core/GP_Palette.h similarity index 100% rename from core/GP_Palette.h rename to include/core/GP_Palette.h diff --git a/core/GP_Pixel.h b/include/core/GP_Pixel.h similarity index 100% rename from core/GP_Pixel.h rename to include/core/GP_Pixel.h diff --git a/core/GP_PutPixel.h b/include/core/GP_PutPixel.h similarity index 100% rename from core/GP_PutPixel.h rename to include/core/GP_PutPixel.h diff --git a/core/GP_RetCode.h b/include/core/GP_RetCode.h similarity index 100% rename from core/GP_RetCode.h rename to include/core/GP_RetCode.h diff --git a/core/GP_Transform.h b/include/core/GP_Transform.h similarity index 100% rename from core/GP_Transform.h rename to include/core/GP_Transform.h diff --git a/core/GP_WritePixel.h b/include/core/GP_WritePixel.h similarity index 100% rename from core/GP_WritePixel.h rename to include/core/GP_WritePixel.h diff --git a/filters/GP_Filters.h b/include/filters/GP_Filters.h similarity index 100% rename from filters/GP_Filters.h rename to include/filters/GP_Filters.h diff --git a/filters/GP_Rotate.h b/include/filters/GP_Rotate.h similarity index 98% rename from filters/GP_Rotate.h rename to include/filters/GP_Rotate.h index f1ec0c8..e73b0fe 100644 --- a/filters/GP_Rotate.h +++ b/include/filters/GP_Rotate.h @@ -32,7 +32,7 @@ #ifndef GP_ROTATE_H #define GP_ROTATE_H
-#include "GP_Context.h" +#include "core/GP_Context.h"
/* * Mirror horizontally. @@ -54,5 +54,4 @@ GP_RetCode GP_RotateCW(GP_Context *context); */ GP_RetCode GP_RotateCCW(GP_Context *context);
- #endif /* GP_ROTATE_H */ diff --git a/core/GP_Circle.h b/include/gfx/GP_Circle.h similarity index 89% rename from core/GP_Circle.h rename to include/gfx/GP_Circle.h index 9c2d4ea..6360e72 100644 --- a/core/GP_Circle.h +++ b/include/gfx/GP_Circle.h @@ -26,7 +26,7 @@ #ifndef GP_CIRCLE_H #define GP_CIRCLE_H
-#include "GP_Context.h" +#include "core/GP_Context.h"
void GP_Circle(GP_Context *context, int xcenter, int ycenter, unsigned int r, GP_Pixel pixel); @@ -34,4 +34,10 @@ void GP_Circle(GP_Context *context, int xcenter, int ycenter, void GP_TCircle(GP_Context *context, int xcenter, int ycenter, unsigned int r, GP_Pixel pixel);
+void GP_FillCircle(GP_Context *context, int xcenter, int ycenter, + unsigned int r, GP_Pixel pixel); + +void GP_TFillCircle(GP_Context *context, int xcenter, int ycenter, + unsigned int r, GP_Pixel pixel); + #endif /* GP_CIRCLE_H */ diff --git a/core/GP_Ellipse.h b/include/gfx/GP_Ellipse.h similarity index 87% rename from core/GP_Ellipse.h rename to include/gfx/GP_Ellipse.h index 5f29458..eeb6d5a 100644 --- a/core/GP_Ellipse.h +++ b/include/gfx/GP_Ellipse.h @@ -26,7 +26,7 @@ #ifndef GP_ELLIPSE_H #define GP_ELLIPSE_H
-#include "GP_Context.h" +#include "core/GP_Context.h"
void GP_Ellipse(GP_Context *context, int xcenter, int ycenter, unsigned int a, unsigned int b, GP_Pixel pixel); @@ -34,4 +34,11 @@ void GP_Ellipse(GP_Context *context, int xcenter, int ycenter, void GP_TEllipse(GP_Context *context, int xcenter, int ycenter, unsigned int a, unsigned int b, GP_Pixel pixel);
+void GP_FillEllipse(GP_Context *context, int xcenter, int ycenter, + unsigned int a, unsigned int b, GP_Pixel pixel); + +void GP_TFillEllipse(GP_Context *context, int xcenter, int ycenter, + unsigned int a, unsigned int b, GP_Pixel pixel); + + #endif /* GP_ELLIPSE_H */ diff --git a/core/GP_Fill.h b/include/gfx/GP_Fill.h similarity index 98% rename from core/GP_Fill.h rename to include/gfx/GP_Fill.h index 87af0d4..6b6139d 100644 --- a/core/GP_Fill.h +++ b/include/gfx/GP_Fill.h @@ -26,7 +26,7 @@ #ifndef GP_FILL_H #define GP_FILL_H
-#include "GP_Context.h" +#include "core/GP_Context.h"
void GP_Fill(GP_Context *context, GP_Pixel pixel);
diff --git a/core/GP.h b/include/gfx/GP_Gfx.h similarity index 79% rename from core/GP.h rename to include/gfx/GP_Gfx.h index 77ba1b0..19bad4e 100644 --- a/core/GP.h +++ b/include/gfx/GP_Gfx.h @@ -23,49 +23,35 @@ * * *****************************************************************************/
-#ifndef GP_H -#define GP_H +/*
-#include <stdint.h> + This is a main header for gfx part.
-/* basic definitions and structures */ -#include "GP_Common.h" -#include "GP_Transform.h" -#include "GP_Context.h" + */
-/* semi-public, low-level drawing API */ -#include "GP_WritePixel.h" +#ifndef GP_GFX_H +#define GP_GFX_H
-/* colors */ -#include "GP_Color.h" -#include "GP_Palette.h" +/* basic definitions and structures */ +#include "core/GP_Common.h" +#include "core/GP_Transform.h" +#include "core/GP_Context.h" +#include "core/GP_WritePixel.h" +#include "core/GP_GetPixel.h" +#include "core/GP_PutPixel.h" +#include "core/GP_Color.h"
/* public drawing API */ #include "GP_Fill.h" -#include "GP_GetPixel.h" -#include "GP_PutPixel.h" #include "GP_HLine.h" #include "GP_VLine.h" #include "GP_Line.h" -#include "GP_LineTrack.h" #include "GP_Rect.h" -#include "GP_FillRect.h" #include "GP_Triangle.h" #include "GP_Tetragon.h" #include "GP_Circle.h" -#include "GP_FillCircle.h" #include "GP_Ellipse.h" -#include "GP_FillEllipse.h" #include "GP_Polygon.h" #include "GP_Symbol.h"
-/* fonts */ -#include "GP_Font.h" -#include "GP_TextStyle.h" -#include "GP_TextMetric.h" -#include "GP_Text.h" - -/* backends */ -#include "GP_Backend.h" - -#endif /* GP_H */ +#endif /* GP_GFX_H */ diff --git a/core/GP_HLine.h b/include/gfx/GP_HLine.h similarity index 98% rename from core/GP_HLine.h rename to include/gfx/GP_HLine.h index 7cdd11c..ee3c674 100644 --- a/core/GP_HLine.h +++ b/include/gfx/GP_HLine.h @@ -26,9 +26,7 @@ #ifndef GP_HLINE_H #define GP_HLINE_H
-#include "GP_Context.h" - -#include <stdint.h> +#include "core/GP_Context.h"
void GP_HLine1bpp(GP_Context *context, int x0, int x1, int y, GP_Pixel pixel); void GP_HLine2bpp(GP_Context *context, int x0, int x1, int y, GP_Pixel pixel); diff --git a/core/GP_Line.h b/include/gfx/GP_Line.h similarity index 98% rename from core/GP_Line.h rename to include/gfx/GP_Line.h index 38c0290..b5587bd 100644 --- a/core/GP_Line.h +++ b/include/gfx/GP_Line.h @@ -26,9 +26,7 @@ #ifndef GP_LINE_H #define GP_LINE_H
-#include "GP_Context.h" - -#include <stdint.h> +#include "core/GP_Context.h"
void GP_Line8bpp(GP_Context *context, int x0, int y0, int x1, int y1, GP_Pixel pixel); diff --git a/core/GP_Polygon.h b/include/gfx/GP_Polygon.h similarity index 97% rename from core/GP_Polygon.h rename to include/gfx/GP_Polygon.h index bbbdf9b..dc4a6e1 100644 --- a/core/GP_Polygon.h +++ b/include/gfx/GP_Polygon.h @@ -26,9 +26,9 @@ #ifndef GP_FILL_POLYGON_H #define GP_FILL_POLYGON_H
-#include "GP_Context.h" +#include "core/GP_Context.h"
void GP_FillPolygon(GP_Context *context, int vertex_count, const int *xy, GP_Pixel pixel);
-#endif /* GP_RECT_H */ +#endif /* GP_FILL_POLYGON_H */ diff --git a/core/GP_Rect.h b/include/gfx/GP_Rect.h similarity index 81% rename from core/GP_Rect.h rename to include/gfx/GP_Rect.h index 63ef486..a0085e8 100644 --- a/core/GP_Rect.h +++ b/include/gfx/GP_Rect.h @@ -26,7 +26,7 @@ #ifndef GP_RECT_H #define GP_RECT_H
-#include "GP_Context.h" +#include "core/GP_Context.h"
void GP_RectXYXY(GP_Context *context, int x0, int y0, int x1, int y1, GP_Pixel pixel); @@ -44,4 +44,19 @@ void GP_TRectXYWH(GP_Context *context, int x, int y, #define GP_Rect GP_RectXYXY #define GP_TRect GP_TRectXYXY
+void GP_FillRectXYXY(GP_Context *context, int x0, int y0, int x1, int y1, + GP_Pixel pixel); + +void GP_FillRectXYWH(GP_Context *context, int x, int y, + unsigned int w, unsigned int h, GP_Pixel pixel); + +void GP_TFillRectXYXY(GP_Context *context, int x0, int y0, int x1, int y1, + GP_Pixel pixel); + +void GP_TFillRectXYWH(GP_Context *context, int x, int y, + unsigned int w, unsigned int h, GP_Pixel pixel); + +#define GP_FillRect GP_FillRectXYXY +#define GP_TFillRect GP_TFillRectXYXY + #endif /* GP_RECT_H */ diff --git a/core/GP_Symbol.h b/include/gfx/GP_Symbol.h similarity index 98% rename from core/GP_Symbol.h rename to include/gfx/GP_Symbol.h index 259bddb..5aa3f2c 100644 --- a/core/GP_Symbol.h +++ b/include/gfx/GP_Symbol.h @@ -30,9 +30,7 @@ #ifndef GP_SYMBOL_H #define GP_SYMBOL_H
-#include "GP_Context.h" - -#include <stdint.h> +#include "core/GP_Context.h"
typedef enum GP_SymbolType { GP_SYM_TRIANGLE_UP, diff --git a/core/GP_Tetragon.h b/include/gfx/GP_Tetragon.h similarity index 98% rename from core/GP_Tetragon.h rename to include/gfx/GP_Tetragon.h index f69aee8..3f9d027 100644 --- a/core/GP_Tetragon.h +++ b/include/gfx/GP_Tetragon.h @@ -26,7 +26,7 @@ #ifndef GP_TETRAGON_H #define GP_TETRAGON_H
-#include "GP_Context.h" +#include "core/GP_Context.h"
void GP_Tetragon(GP_Context *context, int x0, int y0, int x1, int y1, int x2, int y2, int x3, int y3, GP_Pixel pixel); diff --git a/core/GP_Triangle.h b/include/gfx/GP_Triangle.h similarity index 98% rename from core/GP_Triangle.h rename to include/gfx/GP_Triangle.h index 4bc5523..128a721 100644 --- a/core/GP_Triangle.h +++ b/include/gfx/GP_Triangle.h @@ -26,7 +26,7 @@ #ifndef GP_TRIANGLE_H #define GP_TRIANGLE_H
-#include "GP_Context.h" +#include "core/GP_Context.h"
void GP_Triangle(GP_Context *context, int x0, int y0, int x1, int y1, int x2, int y2, GP_Pixel pixel); diff --git a/core/GP_VLine.h b/include/gfx/GP_VLine.h similarity index 98% rename from core/GP_VLine.h rename to include/gfx/GP_VLine.h index 3f943ec..9e857b4 100644 --- a/core/GP_VLine.h +++ b/include/gfx/GP_VLine.h @@ -26,7 +26,7 @@ #ifndef GP_VLINE_H #define GP_VLINE_H
-#include "GP_Context.h" +#include "core/GP_Context.h"
void GP_VLineXYY(GP_Context *context, int x, int y0, int y1, GP_Pixel pixel);
diff --git a/input/GP_Event.h b/include/input/GP_Event.h similarity index 100% rename from input/GP_Event.h rename to include/input/GP_Event.h diff --git a/loaders/GP_Loaders.h b/include/loaders/GP_Loaders.h similarity index 97% rename from loaders/GP_Loaders.h rename to include/loaders/GP_Loaders.h index ea4f9f9..44d1405 100644 --- a/loaders/GP_Loaders.h +++ b/include/loaders/GP_Loaders.h @@ -23,6 +23,12 @@ * * *****************************************************************************/
+ /* + + Core include file for loaders API. + + */ + #ifndef GP_LOADERS_H #define GP_LOADERS_H
diff --git a/loaders/GP_PBM.h b/include/loaders/GP_PBM.h similarity index 98% rename from loaders/GP_PBM.h rename to include/loaders/GP_PBM.h index c858160..19c52a4 100644 --- a/loaders/GP_PBM.h +++ b/include/loaders/GP_PBM.h @@ -26,7 +26,7 @@ #ifndef GP_PBM_H #define GP_PBM_H
-#include "GP_Context.h" +#include "core/GP_Context.h"
GP_RetCode GP_LoadPBM(const char *src, GP_Context **res);
diff --git a/loaders/GP_PGM.h b/include/loaders/GP_PGM.h similarity index 98% rename from loaders/GP_PGM.h rename to include/loaders/GP_PGM.h index 998a6f2..272c50c 100644 --- a/loaders/GP_PGM.h +++ b/include/loaders/GP_PGM.h @@ -26,7 +26,7 @@ #ifndef GP_PGM_H #define GP_PGM_H
-#include "GP_Context.h" +#include "core/GP_Context.h"
GP_RetCode GP_LoadPGM(const char *src, GP_Context **res);
diff --git a/core/GP_Font.h b/include/text/GP_Font.h similarity index 99% rename from core/GP_Font.h rename to include/text/GP_Font.h index 0354948..e84d459 100644 --- a/core/GP_Font.h +++ b/include/text/GP_Font.h @@ -154,7 +154,7 @@ const GP_CharData *GP_GetCharData(const GP_Font *font, int c); */ unsigned int GP_GetFontDataSize(const GP_Font *font);
-#include "GP_RetCode.h" +#include "core/GP_RetCode.h"
GP_RetCode GP_FontLoad(GP_Font **font, const char *filename); GP_RetCode GP_FontSave(const GP_Font *font, const char *filename); diff --git a/core/GP_Text.h b/include/text/GP_Text.h similarity index 97% rename from core/GP_Text.h rename to include/text/GP_Text.h index 35fc68e..e1144fa 100644 --- a/core/GP_Text.h +++ b/include/text/GP_Text.h @@ -26,7 +26,10 @@ #ifndef GP_TEXT_H #define GP_TEXT_H
-#include "GP_Context.h" +#include "core/GP_Context.h" + +#include "GP_TextStyle.h" +#include "GP_TextMetric.h"
/* How the rendered text should be aligned. * For GP_Text(), the alignment is relative to the specified point: diff --git a/core/GP_TextMetric.h b/include/text/GP_TextMetric.h similarity index 100% rename from core/GP_TextMetric.h rename to include/text/GP_TextMetric.h diff --git a/core/GP_TextStyle.h b/include/text/GP_TextStyle.h similarity index 99% rename from core/GP_TextStyle.h rename to include/text/GP_TextStyle.h index d79a326..d57e678 100644 --- a/core/GP_TextStyle.h +++ b/include/text/GP_TextStyle.h @@ -27,7 +27,7 @@ #define GP_TEXTSTYLE_H
#include "GP_Font.h" -#include "GP_RetCode.h" +#include "core/GP_RetCode.h"
/* * This structure describes how a text should be rendered. diff --git a/input/Makefile b/input/Makefile deleted file mode 100644 index 2254ef5..0000000 --- a/input/Makefile +++ /dev/null @@ -1,27 +0,0 @@ -LIBRARY=libGP_input -SOURCES=$(wildcard *.c) -OBJECTS=$(SOURCES:.c=.o) -HEADERS=$(wildcard *.h) -CFLAGS=-I../core/ -W -Wall -O2 -fPIC - -.PHONY: all clean - -all: $(LIBRARY) - -$(LIBRARY): $(LIBRARY).a $(LIBRARY).so - -$(OBJECTS): $(HEADERS) - -$(LIBRARY).a: $(OBJECTS) - ar crus $@ $^ - -$(LIBRARY).so: $(OBJECTS) - $(CC) -fPIC -dPIC --shared -Wl,-soname -Wl,$@.0 $(CFLAGS) $^ -o $@ - ln -sf $@ $@.0 - -%.o: %.c - $(CC) $(CFLAGS) $< -c -o $@ - -clean: - rm -f $(LIBRARY).a $(LIBRARY).so $(LIBRARY).so.0 - rm -f *.o diff --git a/lib.mk b/lib.mk new file mode 100644 index 0000000..a8bccff --- /dev/null +++ b/lib.mk @@ -0,0 +1,11 @@ +ifndef LIBNAME +$(error LIBNAME not defined, fix your library Makefile) +endif + +# +# Trigger library rebuild +# +all: $(OBJECTS) + @$(MAKE) --no-print-directory -C $(TOPDIR)/build/ + +CLEAN+=$(OBJECTS) diff --git a/libs/Makefile b/libs/Makefile new file mode 100644 index 0000000..1c3d990 --- /dev/null +++ b/libs/Makefile @@ -0,0 +1,3 @@ +TOPDIR=.. +SUBDIRS=core gfx text loaders filters input backends +include $(TOPDIR)/include.mk diff --git a/core/GP_Backend.c b/libs/backends/GP_Backend.c similarity index 98% rename from core/GP_Backend.c rename to libs/backends/GP_Backend.c index 12d2e5d..40f3d21 100644 --- a/core/GP_Backend.c +++ b/libs/backends/GP_Backend.c @@ -23,7 +23,8 @@ * * *****************************************************************************/
-#include "GP.h" +#include "core/GP_Core.h" +#include "GP_Backend.h" #include "config.h"
#include <string.h> diff --git a/backends/GP_Backend_SDL.c b/libs/backends/GP_Backend_SDL.c similarity index 99% rename from backends/GP_Backend_SDL.c rename to libs/backends/GP_Backend_SDL.c index af746c1..2cf4fe4 100644 --- a/backends/GP_Backend_SDL.c +++ b/libs/backends/GP_Backend_SDL.c @@ -23,7 +23,7 @@ * * *****************************************************************************/
-#include "GP.h" +#include "GP_Backend.h" #include "config.h"
#ifdef GP_HAVE_SDL diff --git a/libs/backends/Makefile b/libs/backends/Makefile new file mode 100644 index 0000000..da08bb7 --- /dev/null +++ b/libs/backends/Makefile @@ -0,0 +1,5 @@ +TOPDIR=../.. +CSOURCES=$(shell ls *.c) +LIBNAME=backends +include $(TOPDIR)/include.mk +include $(TOPDIR)/lib.mk diff --git a/core/GP_Color.c b/libs/core/GP_Color.c similarity index 100% rename from core/GP_Color.c rename to libs/core/GP_Color.c diff --git a/core/GP_Context.c b/libs/core/GP_Context.c similarity index 97% rename from core/GP_Context.c rename to libs/core/GP_Context.c index faaa64c..1660d25 100644 --- a/core/GP_Context.c +++ b/libs/core/GP_Context.c @@ -23,15 +23,10 @@ * * *****************************************************************************/
-#include "GP.h" +#include "GP_Core.h"
#include <string.h>
-inline GP_PixelType GP_GetContextPixelType(const GP_Context *context) -{ - return context->pixel_type; -} - GP_Context *GP_ContextCopy(GP_Context *context, int flag) { GP_Context *new; diff --git a/core/GP_GetPixel.c b/libs/core/GP_GetPixel.c similarity index 99% rename from core/GP_GetPixel.c rename to libs/core/GP_GetPixel.c index 3bbd201..76013b4 100644 --- a/core/GP_GetPixel.c +++ b/libs/core/GP_GetPixel.c @@ -23,7 +23,7 @@ * * *****************************************************************************/
-#include "GP_GetPixel.h" +#include "GP_Core.h" #include "GP_FnPerBpp.h"
#define DO_GETPIXEL(bits) diff --git a/core/GP_Palette.c b/libs/core/GP_Palette.c similarity index 100% rename from core/GP_Palette.c rename to libs/core/GP_Palette.c diff --git a/core/GP_Pixel.c b/libs/core/GP_Pixel.c similarity index 99% rename from core/GP_Pixel.c rename to libs/core/GP_Pixel.c index 1ae9bbd..0ed154e 100644 --- a/core/GP_Pixel.c +++ b/libs/core/GP_Pixel.c @@ -23,7 +23,7 @@ * * *****************************************************************************/
-#include "GP.h" +#include "GP_Core.h"
struct PixelTypeInfo { const char *type_name; /* human-readable name */ diff --git a/core/GP_PutPixel.c b/libs/core/GP_PutPixel.c similarity index 99% rename from core/GP_PutPixel.c rename to libs/core/GP_PutPixel.c index 70bd85d..40a8363 100644 --- a/core/GP_PutPixel.c +++ b/libs/core/GP_PutPixel.c @@ -23,7 +23,7 @@ * * *****************************************************************************/
-#include "GP.h" +#include "GP_Core.h"
#include "GP_FnPerBpp.h"
diff --git a/core/GP_RetCode.c b/libs/core/GP_RetCode.c similarity index 100% rename from core/GP_RetCode.c rename to libs/core/GP_RetCode.c diff --git a/core/GP_WritePixel.c b/libs/core/GP_WritePixel.c similarity index 99% rename from core/GP_WritePixel.c rename to libs/core/GP_WritePixel.c index 40a8683..01fbedd 100644 --- a/core/GP_WritePixel.c +++ b/libs/core/GP_WritePixel.c @@ -23,7 +23,8 @@ * * *****************************************************************************/
-#include "GP.h" +#include "GP_Core.h" +#include "GP_WritePixel.h"
static const uint8_t chunks_1bpp[8] = { 0x00, 0x80, 0xc0, 0xe0, 0xf0, 0xf8, 0xfc, 0xfe, diff --git a/libs/core/Makefile b/libs/core/Makefile new file mode 100644 index 0000000..e740c3b --- /dev/null +++ b/libs/core/Makefile @@ -0,0 +1,5 @@ +TOPDIR=../.. +CSOURCES=$(shell ls *.c) +LIBNAME=core +include $(TOPDIR)/include.mk +include $(TOPDIR)/lib.mk diff --git a/filters/GP_Rotate.c b/libs/filters/GP_Rotate.c similarity index 97% rename from filters/GP_Rotate.c rename to libs/filters/GP_Rotate.c index 6f595fc..e73c106 100644 --- a/filters/GP_Rotate.c +++ b/libs/filters/GP_Rotate.c @@ -23,14 +23,13 @@ * * *****************************************************************************/
-#include "GP_Rotate.h" +#include "core/GP_Core.h" +#include "core/GP_FnPerBpp.h"
-#include "GP_GetPixel.h" -#include "GP_PutPixel.h" -#include "GP_FnPerBpp.h" +#include "GP_Rotate.h"
-#include "GP_MirrorV.algo.h" -#include "GP_Rotate.algo.h" +#include "algo/GP_MirrorV.algo.h" +#include "algo/GP_Rotate.algo.h"
#include <string.h>
diff --git a/libs/filters/Makefile b/libs/filters/Makefile new file mode 100644 index 0000000..7fc92d3 --- /dev/null +++ b/libs/filters/Makefile @@ -0,0 +1,5 @@ +TOPDIR=../.. +CSOURCES=$(shell ls *.c) +LIBNAME=filters +include $(TOPDIR)/include.mk +include $(TOPDIR)/lib.mk diff --git a/filters/GP_MirrorV.algo.h b/libs/filters/algo/GP_MirrorV.algo.h similarity index 98% rename from filters/GP_MirrorV.algo.h rename to libs/filters/algo/GP_MirrorV.algo.h index 0518b41..3ea1438 100644 --- a/filters/GP_MirrorV.algo.h +++ b/libs/filters/algo/GP_MirrorV.algo.h @@ -24,7 +24,7 @@ *****************************************************************************/
-#include "GP_Clip.h" +#include "core/GP_Clip.h"
#define DEF_MIRRORV_FN(FN_NAME, CONTEXT_T, PIXEL_T, PUTPIXEL, GETPIXEL) void FN_NAME(CONTEXT_T context) diff --git a/filters/GP_Rotate.algo.h b/libs/filters/algo/GP_Rotate.algo.h similarity index 97% rename from filters/GP_Rotate.algo.h rename to libs/filters/algo/GP_Rotate.algo.h index cdcfa35..2d5cf28 100644 --- a/filters/GP_Rotate.algo.h +++ b/libs/filters/algo/GP_Rotate.algo.h @@ -23,9 +23,9 @@ * * *****************************************************************************/
-#include "GP_Clip.h" -#include "GP_Common.h" -#include "GP_Context.h" +#include "core/GP_Clip.h" +#include "core/GP_Common.h" +#include "core/GP_Context.h"
#define DEF_ROTATECW_FN(FN_NAME, CONTEXT_T, PUTPIXEL, GETPIXEL) GP_RetCode FN_NAME(CONTEXT_T context) diff --git a/core/GP_FillCircle.c b/libs/gfx/GP_Circle.c similarity index 77% rename from core/GP_FillCircle.c rename to libs/gfx/GP_Circle.c index a7cacb1..9522c1b 100644 --- a/core/GP_FillCircle.c +++ b/libs/gfx/GP_Circle.c @@ -23,8 +23,28 @@ * * *****************************************************************************/
-#include "GP.h" -#include "GP_FnPerBpp.h" +#include "GP_Gfx.h" +#include "algo/Circle.algo.h" +#include "core/GP_FnPerBpp.h" + +/* Generate drawing functions for various bit depths. */ +DEF_CIRCLE_FN(GP_Circle1bpp, GP_Context *, GP_Pixel, GP_PutPixel1bpp) +DEF_CIRCLE_FN(GP_Circle2bpp, GP_Context *, GP_Pixel, GP_PutPixel2bpp) +DEF_CIRCLE_FN(GP_Circle4bpp, GP_Context *, GP_Pixel, GP_PutPixel4bpp) +DEF_CIRCLE_FN(GP_Circle8bpp, GP_Context *, GP_Pixel, GP_PutPixel8bpp) +DEF_CIRCLE_FN(GP_Circle16bpp, GP_Context *, GP_Pixel, GP_PutPixel16bpp) +DEF_CIRCLE_FN(GP_Circle24bpp, GP_Context *, GP_Pixel, GP_PutPixel24bpp) +DEF_CIRCLE_FN(GP_Circle32bpp, GP_Context *, GP_Pixel, GP_PutPixel32bpp) + +void GP_Circle(GP_Context *context, int xcenter, int ycenter, + unsigned int r, GP_Pixel pixel) +{ + GP_CHECK_CONTEXT(context); + + GP_FN_PER_BPP(GP_Circle, context->bpp, context, + xcenter, ycenter, r, pixel); +} + #include "algo/FillCircle.algo.h"
/* Generate drawing functions for various bit depths. */ diff --git a/core/GP_Ellipse.c b/libs/gfx/GP_Ellipse.c similarity index 71% rename from core/GP_Ellipse.c rename to libs/gfx/GP_Ellipse.c index c3fefbb..701f9bb 100644 --- a/core/GP_Ellipse.c +++ b/libs/gfx/GP_Ellipse.c @@ -23,9 +23,9 @@ * * *****************************************************************************/
-#include "GP.h" +#include "GP_Gfx.h" #include "algo/Ellipse.algo.h" -#include "GP_FnPerBpp.h" +#include "core/GP_FnPerBpp.h"
/* Generate drawing functions for various bit depths. */ DEF_ELLIPSE_FN(GP_Ellipse1bpp, GP_Context *, GP_Pixel, GP_PutPixel1bpp); @@ -56,3 +56,34 @@ void GP_TEllipse(GP_Context *context, int xcenter, int ycenter, GP_Ellipse(context, xcenter, ycenter, a, b, pixel); } + +#include "algo/FillEllipse.algo.h" + +/* Generate drawing functions for various bit depths. */ +DEF_FILLELLIPSE_FN(GP_FillEllipse1bpp, GP_Context *, GP_Pixel, GP_HLine1bpp) +DEF_FILLELLIPSE_FN(GP_FillEllipse2bpp, GP_Context *, GP_Pixel, GP_HLine2bpp) +DEF_FILLELLIPSE_FN(GP_FillEllipse4bpp, GP_Context *, GP_Pixel, GP_HLine4bpp) +DEF_FILLELLIPSE_FN(GP_FillEllipse8bpp, GP_Context *, GP_Pixel, GP_HLine8bpp) +DEF_FILLELLIPSE_FN(GP_FillEllipse16bpp, GP_Context *, GP_Pixel, GP_HLine16bpp) +DEF_FILLELLIPSE_FN(GP_FillEllipse24bpp, GP_Context *, GP_Pixel, GP_HLine24bpp) +DEF_FILLELLIPSE_FN(GP_FillEllipse32bpp, GP_Context *, GP_Pixel, GP_HLine32bpp) + +void GP_FillEllipse(GP_Context *context, int xcenter, int ycenter, + unsigned int a, unsigned int b, GP_Pixel pixel) +{ + GP_CHECK_CONTEXT(context); + + GP_FN_PER_BPP(GP_FillEllipse, context->bpp, context, + xcenter, ycenter, a, b, pixel); +} + +void GP_TFillEllipse(GP_Context *context, int xcenter, int ycenter, + unsigned int a, unsigned int b, GP_Pixel pixel) +{ + GP_CHECK_CONTEXT(context); + + GP_TRANSFORM_POINT(context, xcenter, ycenter); + GP_TRANSFORM_SWAP(context, a, b); + + GP_FillEllipse(context, xcenter, ycenter, a, b, pixel); +} diff --git a/core/GP_Fill.c b/libs/gfx/GP_Fill.c similarity index 99% rename from core/GP_Fill.c rename to libs/gfx/GP_Fill.c index 65065cc..c99df23 100644 --- a/core/GP_Fill.c +++ b/libs/gfx/GP_Fill.c @@ -26,7 +26,7 @@ #ifndef GP_FILL_H #define GP_FILL_H
-#include "GP.h" +#include "GP_Gfx.h"
void GP_Fill(GP_Context *context, GP_Pixel pixel) { diff --git a/core/GP_HLine.c b/libs/gfx/GP_HLine.c similarity index 98% rename from core/GP_HLine.c rename to libs/gfx/GP_HLine.c index 71c4671..ede37ef 100644 --- a/core/GP_HLine.c +++ b/libs/gfx/GP_HLine.c @@ -23,9 +23,9 @@ * * *****************************************************************************/
-#include "GP.h" +#include "GP_Gfx.h" #include "algo/HLine.algo.h" -#include "GP_FnPerBpp.h" +#include "core/GP_FnPerBpp.h"
/* Generate drawing functions for various bit depths. */ DEF_HLINE_BU_FN(GP_HLine1bpp, GP_Context *, GP_Pixel, GP_PIXEL_ADDR, GP_WritePixels1bpp) diff --git a/core/GP_Line.c b/libs/gfx/GP_Line.c similarity index 98% rename from core/GP_Line.c rename to libs/gfx/GP_Line.c index 23ea98d..42a6cbc 100644 --- a/core/GP_Line.c +++ b/libs/gfx/GP_Line.c @@ -23,9 +23,9 @@ * * *****************************************************************************/
-#include "GP.h" +#include "GP_Gfx.h" #include "algo/Line.algo.h" -#include "GP_FnPerBpp.h" +#include "core/GP_FnPerBpp.h"
/* Generate drawing functions for various bit depths. */ DEF_LINE_FN(GP_Line1bpp, GP_Context *, GP_Pixel, GP_PutPixel1bpp) diff --git a/core/GP_Polygon.c b/libs/gfx/GP_Polygon.c similarity index 99% rename from core/GP_Polygon.c rename to libs/gfx/GP_Polygon.c index a72b114..bf47baf 100644 --- a/core/GP_Polygon.c +++ b/libs/gfx/GP_Polygon.c @@ -23,7 +23,7 @@ * * *****************************************************************************/
-#include "GP.h" +#include "GP_Gfx.h"
#include <limits.h> #include <stdlib.h> diff --git a/core/GP_FillRect.c b/libs/gfx/GP_Rect.c similarity index 73% rename from core/GP_FillRect.c rename to libs/gfx/GP_Rect.c index 05f7c65..52e3a36 100644 --- a/core/GP_FillRect.c +++ b/libs/gfx/GP_Rect.c @@ -23,7 +23,46 @@ * * *****************************************************************************/
-#include "GP.h" +#include "GP_Gfx.h" + +void GP_RectXYXY(GP_Context *context, int x0, int y0, int x1, int y1, + GP_Pixel pixel) +{ + GP_CHECK_CONTEXT(context); + + GP_HLine(context, x0, x1, y0, pixel); + GP_HLine(context, x0, x1, y1, pixel); + GP_VLine(context, x0, y0, y1, pixel); + GP_VLine(context, x1, y0, y1, pixel); +} + +void GP_RectXYWH(GP_Context *context, int x, int y, + unsigned int w, unsigned int h, GP_Pixel pixel) +{ + GP_CHECK_CONTEXT(context); + + GP_HLine(context, x, x + w, y, pixel); + GP_HLine(context, x, x + w, y + h, pixel); + GP_VLine(context, x, y, y + h, pixel); + GP_VLine(context, x + w, y, y + h, pixel); +} + +void GP_TRectXYXY(GP_Context *context, int x0, int y0, int x1, int y1, + GP_Pixel pixel) +{ + GP_CHECK_CONTEXT(context); + + GP_TRANSFORM_POINT(context, x0, y0); + GP_TRANSFORM_POINT(context, x1, y1); + + GP_RectXYXY(context, x0, y0, x1, y1, pixel); +} + +void GP_TRectXYWH(GP_Context *context, int x, int y, + unsigned int w, unsigned int h, GP_Pixel pixel) +{ + GP_TRectXYXY(context, x, y, x + w, y + h, pixel); +}
void GP_FillRectXYXY(GP_Context *context, int x0, int y0, int x1, int y1, GP_Pixel pixel) diff --git a/core/GP_Symbol.c b/libs/gfx/GP_Symbol.c similarity index 99% rename from core/GP_Symbol.c rename to libs/gfx/GP_Symbol.c index 95bd3b8..1103673 100644 --- a/core/GP_Symbol.c +++ b/libs/gfx/GP_Symbol.c @@ -23,7 +23,7 @@ * * *****************************************************************************/
-#include "GP.h" +#include "GP_Gfx.h"
#define DO_TRIANGLE_UP(x, y, w, h) x, y + h, x + w, y + h, x + w/2, y diff --git a/core/GP_Tetragon.c b/libs/gfx/GP_Tetragon.c similarity index 99% rename from core/GP_Tetragon.c rename to libs/gfx/GP_Tetragon.c index 2f0b777..ff9100e 100644 --- a/core/GP_Tetragon.c +++ b/libs/gfx/GP_Tetragon.c @@ -23,7 +23,7 @@ * * *****************************************************************************/
-#include "GP.h" +#include "GP_Gfx.h"
void GP_Tetragon(GP_Context *context, int x0, int y0, int x1, int y1, int x2, int y2, int x3, int y3, GP_Pixel pixel) diff --git a/core/GP_Triangle.c b/libs/gfx/GP_Triangle.c similarity index 99% rename from core/GP_Triangle.c rename to libs/gfx/GP_Triangle.c index 9a8d87b..46f6939 100644 --- a/core/GP_Triangle.c +++ b/libs/gfx/GP_Triangle.c @@ -23,7 +23,7 @@ * * *****************************************************************************/
-#include "GP.h" +#include "GP_Gfx.h"
void GP_Triangle(GP_Context *context, int x0, int y0, int x1, int y1, int x2, int y2, GP_Pixel pixel) diff --git a/core/GP_VLine.c b/libs/gfx/GP_VLine.c similarity index 98% rename from core/GP_VLine.c rename to libs/gfx/GP_VLine.c index 3985329..7a27768 100644 --- a/core/GP_VLine.c +++ b/libs/gfx/GP_VLine.c @@ -23,9 +23,9 @@ * * *****************************************************************************/
-#include "GP.h" +#include "GP_Gfx.h" #include "algo/VLine.algo.h" -#include "GP_FnPerBpp.h" +#include "core/GP_FnPerBpp.h"
/* Generate drawing functions for various bit depths. */ DEF_VLINE_FN(GP_VLine1bpp, GP_Context *, GP_Pixel, GP_PutPixel1bpp) diff --git a/libs/gfx/Makefile b/libs/gfx/Makefile new file mode 100644 index 0000000..a3e7da2 --- /dev/null +++ b/libs/gfx/Makefile @@ -0,0 +1,5 @@ +TOPDIR=../.. +CSOURCES=$(shell ls *.c) +LIBNAME=gfx +include $(TOPDIR)/include.mk +include $(TOPDIR)/lib.mk diff --git a/algo/Circle.algo.h b/libs/gfx/algo/Circle.algo.h similarity index 100% rename from algo/Circle.algo.h rename to libs/gfx/algo/Circle.algo.h diff --git a/algo/Ellipse.algo.h b/libs/gfx/algo/Ellipse.algo.h similarity index 100% rename from algo/Ellipse.algo.h rename to libs/gfx/algo/Ellipse.algo.h diff --git a/algo/FillCircle.algo.h b/libs/gfx/algo/FillCircle.algo.h similarity index 100% rename from algo/FillCircle.algo.h rename to libs/gfx/algo/FillCircle.algo.h diff --git a/algo/FillEllipse.algo.h b/libs/gfx/algo/FillEllipse.algo.h similarity index 100% rename from algo/FillEllipse.algo.h rename to libs/gfx/algo/FillEllipse.algo.h diff --git a/algo/FillTriangle.algo.h b/libs/gfx/algo/FillTriangle.algo.h similarity index 100% rename from algo/FillTriangle.algo.h rename to libs/gfx/algo/FillTriangle.algo.h diff --git a/algo/HLine.algo.h b/libs/gfx/algo/HLine.algo.h similarity index 100% rename from algo/HLine.algo.h rename to libs/gfx/algo/HLine.algo.h diff --git a/algo/Line.algo.h b/libs/gfx/algo/Line.algo.h similarity index 100% rename from algo/Line.algo.h rename to libs/gfx/algo/Line.algo.h diff --git a/algo/VLine.algo.h b/libs/gfx/algo/VLine.algo.h similarity index 100% rename from algo/VLine.algo.h rename to libs/gfx/algo/VLine.algo.h diff --git a/input/GP_Event.c b/libs/input/GP_Event.c similarity index 100% rename from input/GP_Event.c rename to libs/input/GP_Event.c diff --git a/libs/input/Makefile b/libs/input/Makefile new file mode 100644 index 0000000..0dcb208 --- /dev/null +++ b/libs/input/Makefile @@ -0,0 +1,5 @@ +TOPDIR=../.. +CSOURCES=$(shell ls *.c) +LIBNAME=input +include $(TOPDIR)/include.mk +include $(TOPDIR)/lib.mk diff --git a/loaders/GP_PBM.c b/libs/loaders/GP_PBM.c similarity index 100% rename from loaders/GP_PBM.c rename to libs/loaders/GP_PBM.c diff --git a/loaders/GP_PGM.c b/libs/loaders/GP_PGM.c similarity index 100% rename from loaders/GP_PGM.c rename to libs/loaders/GP_PGM.c diff --git a/loaders/GP_PXMCommon.c b/libs/loaders/GP_PXMCommon.c similarity index 100% rename from loaders/GP_PXMCommon.c rename to libs/loaders/GP_PXMCommon.c diff --git a/loaders/GP_PXMCommon.h b/libs/loaders/GP_PXMCommon.h similarity index 99% rename from loaders/GP_PXMCommon.h rename to libs/loaders/GP_PXMCommon.h index 586cf65..0c52e71 100644 --- a/loaders/GP_PXMCommon.h +++ b/libs/loaders/GP_PXMCommon.h @@ -33,7 +33,7 @@ #define GP_PXM_COMMON_H
#include <stdio.h> -#include "GP.h" +#include "core/GP_Core.h"
/* * Save context to ascii file. diff --git a/libs/loaders/Makefile b/libs/loaders/Makefile new file mode 100644 index 0000000..1e88e78 --- /dev/null +++ b/libs/loaders/Makefile @@ -0,0 +1,5 @@ +TOPDIR=../.. +CSOURCES=$(shell ls *.c) +LIBNAME=loaders +include $(TOPDIR)/include.mk +include $(TOPDIR)/lib.mk diff --git a/core/GP_DefaultFont.c b/libs/text/GP_DefaultFont.c similarity index 100% rename from core/GP_DefaultFont.c rename to libs/text/GP_DefaultFont.c diff --git a/core/GP_Font.c b/libs/text/GP_Font.c similarity index 99% rename from core/GP_Font.c rename to libs/text/GP_Font.c index 1c7d0a0..8778ce3 100644 --- a/core/GP_Font.c +++ b/libs/text/GP_Font.c @@ -23,7 +23,8 @@ * * *****************************************************************************/
-#include "GP.h" +#include "GP_Font.h" +#include "core/GP_Common.h"
#include <stdio.h>
diff --git a/core/GP_Text.c b/libs/text/GP_Text.c similarity index 98% rename from core/GP_Text.c rename to libs/text/GP_Text.c index 4e331b0..af11a48 100644 --- a/core/GP_Text.c +++ b/libs/text/GP_Text.c @@ -23,9 +23,10 @@ * * *****************************************************************************/
-#include "GP.h" #include "algo/Text.algo.h" -#include "GP_FnPerBpp.h" +#include "gfx/GP_Gfx.h" +#include "core/GP_FnPerBpp.h" +#include "GP_Text.h"
static GP_TextStyle DefaultStyle = GP_DEFAULT_TEXT_STYLE;
diff --git a/core/GP_TextMetric.c b/libs/text/GP_TextMetric.c similarity index 98% rename from core/GP_TextMetric.c rename to libs/text/GP_TextMetric.c index 247f191..cac94cf 100644 --- a/core/GP_TextMetric.c +++ b/libs/text/GP_TextMetric.c @@ -23,7 +23,8 @@ * * *****************************************************************************/
-#include "GP.h" +#include "core/GP_Common.h" +#include "GP_TextMetric.h"
static unsigned int SpaceWidth(const GP_TextStyle *style) { diff --git a/core/GP_TextStyle.c b/libs/text/GP_TextStyle.c similarity index 98% rename from core/GP_TextStyle.c rename to libs/text/GP_TextStyle.c index 3c7fc00..4d4d4bd 100644 --- a/core/GP_TextStyle.c +++ b/libs/text/GP_TextStyle.c @@ -23,7 +23,7 @@ * * *****************************************************************************/
-#include "GP.h" +#include "GP_TextStyle.h"
void GP_DefaultTextStyle(GP_TextStyle *style) { diff --git a/libs/text/Makefile b/libs/text/Makefile new file mode 100644 index 0000000..300ad6e --- /dev/null +++ b/libs/text/Makefile @@ -0,0 +1,5 @@ +TOPDIR=../.. +CSOURCES=$(shell ls *.c) +LIBNAME=text +include $(TOPDIR)/include.mk +include $(TOPDIR)/lib.mk diff --git a/algo/Text.algo.h b/libs/text/algo/Text.algo.h similarity index 100% rename from algo/Text.algo.h rename to libs/text/algo/Text.algo.h diff --git a/loaders/Makefile b/loaders/Makefile deleted file mode 100644 index e69679a..0000000 --- a/loaders/Makefile +++ /dev/null @@ -1,29 +0,0 @@ -LIBRARY=libGP_loaders -SOURCES=$(wildcard *.c) -OBJECTS=$(SOURCES:.c=.o) -HEADERS=$(wildcard *.h) -CFLAGS=-I../core/ -W -Wall -O2 -fPIC - -.PHONY: all clean - -all: $(LIBRARY) - cd tests && $(MAKE) all - -$(LIBRARY): $(LIBRARY).a $(LIBRARY).so - -$(OBJECTS): $(HEADERS) - -$(LIBRARY).a: $(OBJECTS) - ar crus $@ $^ - -$(LIBRARY).so: $(OBJECTS) - $(CC) -fPIC -dPIC --shared -Wl,-soname -Wl,$@.0 $(CFLAGS) $^ -o $@ - ln -sf $@ $@.0 - -%.o: %.c - $(CC) $(CFLAGS) $< -c -o $@ - -clean: - rm -f $(LIBRARY).a $(LIBRARY).so $(LIBRARY).so.0 - rm -f *.o - cd tests && $(MAKE) clean diff --git a/loaders/tests/Makefile b/loaders/tests/Makefile deleted file mode 100644 index e272a2a..0000000 --- a/loaders/tests/Makefile +++ /dev/null @@ -1,17 +0,0 @@ -LDFLAGS=-L../ -L../../core/ -lGP_core -lGP_loaders - -INCLUDE=-I../ -I../../core/ -# Some warnings are triggered only with -O2 -# thuss added here -CFLAGS=$(INCLUDE) -ggdb -W -Wall -O2 -lm -SOURCES=$(wildcard *.c) -TESTS=$(SOURCES:.c=) - -all: $(TESTS) - -%: %.c - $(CC) $(CFLAGS) $(LDFLAGS) $(LIBRARY) $^ -o $@ - -clean: - rm -f *.o - rm -f $(TESTS) test.pbm test.pgm diff --git a/old_tests/Makefile b/old_tests/Makefile deleted file mode 100644 index f21f263..0000000 --- a/old_tests/Makefile +++ /dev/null @@ -1,26 +0,0 @@ -# -# Comment one of these lines. -# -# First one triggers static linking. -# -# Second one triggers dynamic. -# -LIBRARY=../libGP.a -#LDFLAGS=-lGP -lSDL -L.. - -INCLUDE=-I.. -# Some warnings are triggered only with -O2 -# thuss added here -CFLAGS=$(INCLUDE) -ggdb -W -Wall -O2 -SOURCES=$(shell ls *.c) -TESTS=$(SOURCES:.c=) - -all: $(TESTS) - -%: %.c $(LIBRARY) - $(CC) $(CFLAGS) $(LDFLAGS) $^ $(LIBRARY) -o $@ -lSDL - -clean: - rm -f *.o - rm -f $(TESTS) - diff --git a/old_tests/circlefps.c b/old_tests/circlefps.c deleted file mode 100644 index 63d7560..0000000 --- a/old_tests/circlefps.c +++ /dev/null @@ -1,148 +0,0 @@ -/***************************************************************************** - * This file is part of gfxprim library. * - * * - * Gfxprim is free software; you can redistribute it and/or * - * modify it under the terms of the GNU Lesser General Public * - * License as published by the Free Software Foundation; either * - * version 2.1 of the License, or (at your option) any later version. * - * * - * Gfxprim is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * - * Lesser General Public License for more details. * - * * - * You should have received a copy of the GNU Lesser General Public * - * License along with gfxprim; if not, write to the Free Software * - * Foundation, Inc., 51 Franklin Street, Fifth Floor, * - * Boston, MA 02110-1301 USA * - * * - * Copyright (C) 2009-2010 Jiri "BlueBear" Dluhos * - * jiri.bluebear.dluhos@gmail.com * - * * - * Copyright (C) 2009-2010 Cyril Hrubis metan@ucw.cz * - * * - *****************************************************************************/ - -#include <math.h> -#include <stdio.h> -#include <stdlib.h> -#include <SDL/SDL.h> - -#include "GP.h" - -/* The surface used as a display (in fact it is a software surface). */ -SDL_Surface *display = NULL; - -/* Frames per second. */ -int fps = 0, fps_min = 1000000, fps_max = 0; - -/* - * Timer used for FPS measurement and key reactions. - * SDL_USEREVENT is triggered each second. - */ - -SDL_TimerID timer; - -SDL_UserEvent timer_event; - -Uint32 timer_callback(__attribute__((unused)) Uint32 interval, - __attribute__((unused)) void * param) -{ - timer_event.type = SDL_USEREVENT; - SDL_PushEvent((SDL_Event *) &timer_event); - return 1000; -} - -/* Values for color pixels in display format. */ -static long colors[GP_BASIC_COLOR_COUNT]; - -void draw_frame(void) -{ - int x = display->w/2 + 120 - random() % 240; - int y = display->h/2 + 120 - random() % 240; - - long color = SDL_MapRGB(display->format, random() % 255, random() % 255, random() % 255); - - GP_Circle(display, color, x, y, display->h/2); -} - -void event_loop(void) -{ - SDL_Event event; - - for (;;) { - while (SDL_PollEvent(&event) > 0) { - switch (event.type) { - case SDL_USEREVENT: - SDL_Flip(display); - fprintf(stdout, "%d FPS, min = %d, max = %dr", fps, fps_min, fps_max); - fflush(stdout); - - /* Update frames per second */ - if (fps < fps_min) - fps_min = fps; - if (fps > fps_max) - fps_max = fps; - fps = 0; - break; - case SDL_KEYDOWN: - case SDL_QUIT: - return; - } - } - draw_frame(); - fps++; - } -} - -int main(void) -{ - /* Initialize SDL */ - if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_TIMER) != 0) { - fprintf(stderr, "Could not initialize SDL: %sn", SDL_GetError()); - return 1; - } - - /* Create a window with a software back surface */ - display = SDL_SetVideoMode(640, 480, 0, SDL_SWSURFACE); - if (display == NULL) { - fprintf(stderr, "Could not open display: %sn", SDL_GetError()); - goto fail; - } - - /* Print basic information about the surface */ - printf("Display surface properties:n"); - printf(" width: %4d, height: %4d, pitch: %4dn", - display->w, display->h, display->pitch); - printf(" bits per pixel: %2d, bytes per pixel: %2dn", - display->format->BitsPerPixel, display->format->BytesPerPixel); - - /* Get colors */ - GP_LoadBasicColors(display, colors); - - /* Set up a clipping rectangle to test proper clipping of pixels */ - SDL_Rect clip_rect = { 10, 10, 620, 460 }; - SDL_SetClipRect(display, &clip_rect); - - /* Set up the timer */ - timer = SDL_AddTimer(1000, timer_callback, NULL); - if (timer == 0) { - fprintf(stderr, "Could not set up timer: %sn", SDL_GetError()); - goto fail; - } - - /* Enter the event loop */ - event_loop(); - - /* Preserve the last result by a newline */ - fprintf(stdout, "n"); - - /* We're done */ - SDL_Quit(); - return 0; - -fail: - SDL_Quit(); - return 1; -} - diff --git a/old_tests/circlestest.c b/old_tests/circlestest.c deleted file mode 100644 index 1935c69..0000000 --- a/old_tests/circlestest.c +++ /dev/null @@ -1,220 +0,0 @@ -/***************************************************************************** - * This file is part of gfxprim library. * - * * - * Gfxprim is free software; you can redistribute it and/or * - * modify it under the terms of the GNU Lesser General Public * - * License as published by the Free Software Foundation; either * - * version 2.1 of the License, or (at your option) any later version. * - * * - * Gfxprim is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * - * Lesser General Public License for more details. * - * * - * You should have received a copy of the GNU Lesser General Public * - * License along with gfxprim; if not, write to the Free Software * - * Foundation, Inc., 51 Franklin Street, Fifth Floor, * - * Boston, MA 02110-1301 USA * - * * - * Copyright (C) 2009-2010 Jiri "BlueBear" Dluhos * - * jiri.bluebear.dluhos@gmail.com * - * * - * Copyright (C) 2009-2010 Cyril Hrubis metan@ucw.cz * - * * - *****************************************************************************/ - -#include <stdio.h> -#include <stdlib.h> -#include <SDL/SDL.h> - -#include "GP.h" - -SDL_Surface *display = NULL; - -static int state; - -void draw1(void) -{ - long pixel; - int x = 160; - int y = 120; - int r; - - SDL_LockSurface(display); - - for (r = 202; r > 0; r -= 3) { - pixel = SDL_MapRGB(display->format, 150*(r%2) + r/2, 0, 0); - GP_FillCircle(display, pixel, x, y, r); - } - - - SDL_UnlockSurface(display); -} - -void draw2(void) -{ - long pixel; - int x = 160; - int y = 120; - int r; - - SDL_LockSurface(display); - - for (r = 203; r > 0; r -= 3) { - pixel = SDL_MapRGB(display->format, 0, 150*(r%2) + r/2, 0); - GP_FillCircle(display, pixel, x, y, r); - } - - - SDL_UnlockSurface(display); -} - -void draw3(void) -{ - long pixel; - int x = 160; - int y = 120; - int r; - - SDL_LockSurface(display); - - for (r = 201; r > 0; r -= 3) { - pixel = SDL_MapRGB(display->format, 0, 0, 150*(r%2) + r/2); - GP_FillCircle(display, pixel, x, y, r); - } - - - SDL_UnlockSurface(display); -} - -void draw4(void) -{ - long pixel; - int x = 160; - int y = 120; - int r; - - SDL_LockSurface(display); - - SDL_FillRect(display, NULL, 0xff000000); - - for (r = 202; r > 0; r -= 3) { - pixel = SDL_MapRGB(display->format, 150 + r/2, 0, 0); - GP_Circle(display, pixel, x, y, r); - } - - - SDL_UnlockSurface(display); -} - -void draw5(void) -{ - long pixel; - int x = 160; - int y = 120; - int r; - - SDL_LockSurface(display); - - SDL_FillRect(display, NULL, 0xff000000); - - for (r = 203; r > 0; r -= 3) { - pixel = SDL_MapRGB(display->format, 0, 150 + r/2, 0); - GP_Circle(display, pixel, x, y, r); - } - - - SDL_UnlockSurface(display); -} - -void draw6(void) -{ - long pixel; - int x = 160; - int y = 120; - int r; - - SDL_LockSurface(display); - - SDL_FillRect(display, NULL, 0xff000000); - - for (r = 201; r > 0; r -= 3) { - pixel = SDL_MapRGB(display->format, 0, 0, 150 + r/2); - GP_Circle(display, pixel, x, y, r); - } - - - SDL_UnlockSurface(display); -} - -void event_loop(void) -{ - SDL_Event event; - - while (SDL_WaitEvent(&event) > 0) { - - switch (event.type) { - case SDL_KEYDOWN: - switch (state++) { - case 0: - draw2(); - SDL_Flip(display); - break; - case 1: - draw3(); - SDL_Flip(display); - break; - case 2: - draw4(); - SDL_Flip(display); - break; - case 3: - draw5(); - SDL_Flip(display); - break; - case 4: - draw6(); - SDL_Flip(display); - break; - default: - return; - } - break; - case SDL_QUIT: - return; - } - } -} - -int main(void) -{ - /* Initialize SDL */ - if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_TIMER) != 0) { - fprintf(stderr, "Could not initialize SDL: %sn", SDL_GetError()); - return 1; - } - - /* Create a window with a software back surface */ - display = SDL_SetVideoMode(320, 240, 0, SDL_SWSURFACE); - if (display == NULL) { - fprintf(stderr, "Could not open display: %sn", SDL_GetError()); - goto fail; - } - - /* Set up a clipping rectangle to test proper clipping of pixels */ - SDL_Rect clip_rect = { 10, 10, 300, 220 }; - SDL_SetClipRect(display, &clip_rect); - - draw1(); - SDL_Flip(display); - - event_loop(); - - SDL_Quit(); - return 0; - -fail: - SDL_Quit(); - return 1; -} - diff --git a/old_tests/ellipsetest.c b/old_tests/ellipsetest.c deleted file mode 100644 index 21abd07..0000000 --- a/old_tests/ellipsetest.c +++ /dev/null @@ -1,240 +0,0 @@ -/***************************************************************************** - * This file is part of gfxprim library. * - * * - * Gfxprim is free software; you can redistribute it and/or * - * modify it under the terms of the GNU Lesser General Public * - * License as published by the Free Software Foundation; either * - * version 2.1 of the License, or (at your option) any later version. * - * * - * Gfxprim is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * - * Lesser General Public License for more details. * - * * - * You should have received a copy of the GNU Lesser General Public * - * License along with gfxprim; if not, write to the Free Software * - * Foundation, Inc., 51 Franklin Street, Fifth Floor, * - * Boston, MA 02110-1301 USA * - * * - * Copyright (C) 2009-2010 Jiri "BlueBear" Dluhos * - * jiri.bluebear.dluhos@gmail.com * - * * - * Copyright (C) 2009-2010 Cyril Hrubis metan@ucw.cz * - * * - *****************************************************************************/ - -#include <stdio.h> -#include <stdlib.h> -#include <SDL/SDL.h> - -#include "GP.h" - -/* The surface used as a display (in fact it is a software surface). */ -SDL_Surface *display = NULL; - -/* Timer used for refreshing the display */ -SDL_TimerID timer; - -/* An event used for signaling that the timer was triggered. */ -SDL_UserEvent timer_event; - -Uint32 timer_callback(__attribute__((unused)) Uint32 interval, - __attribute__((unused)) void * param) -{ - timer_event.type = SDL_USEREVENT; - SDL_PushEvent((SDL_Event *) &timer_event); - return 60; -} - -/* Orientation flag (horizontal or vertical). */ -int orientation_flag = 0; - -/* Fill flag. */ -int fill_flag = 0; - -/* Radius ratio. */ -int rratio = 2; - -/* True if filling is drawn first, false if shapes are drawn first. */ -int fill_first = 0; - -/* True to draw axes. */ -int draw_axes = 0; - -/* Minimum radius. */ -int min_radius = 3; - -/* Basic colors in display format. */ -static long colors[GP_BASIC_COLOR_COUNT]; - -void draw_pixels(void) -{ - int rx, ry, active_rx, active_ry; - int intensity; - long fill_color; - - /* Set up a clipping rectangle to test proper clipping of pixels */ - SDL_Rect clip_rect = { 20, 20, 600, 440 }; - SDL_SetClipRect(display, &clip_rect); - - SDL_LockSurface(display); - - /* Clear screen */ - GP_Clear(display, colors[GP_BLACK]); - - for (rx = 210 + min_radius; rx >= min_radius; rx -= 7) { - ry = rratio*rx; - intensity = (rx % 4) * 50; - fill_color = SDL_MapRGB(display->format, intensity, intensity, intensity); - - if (orientation_flag) { - active_rx = ry; - active_ry = rx; - } - else { - active_rx = rx; - active_ry = ry; - } - - if (fill_flag) { - if (fill_first) { - GP_FillEllipse(display, fill_color, 320, 240, active_rx, active_ry); - GP_Ellipse(display, colors[GP_WHITE], 320, 240, active_rx, active_ry); - } - else { - GP_Ellipse(display, colors[GP_WHITE], 320, 240, active_rx, active_ry); - GP_FillEllipse(display, fill_color, 320, 240, active_rx, active_ry); - } - } - else { - GP_Ellipse(display, colors[GP_WHITE], 320, 240, active_rx, active_ry); - } - } - - if (draw_axes) { - - if (orientation_flag) { - active_rx = rratio * min_radius; - active_ry = min_radius; - } else { - active_rx = min_radius; - active_ry = rratio*min_radius; - } - - GP_Line(display, colors[GP_RED], 0, 240, 640, 240); - GP_Line(display, colors[GP_RED], 320, 0, 320, 640); - GP_Line(display, colors[GP_GREEN], 0, 240+active_ry, 640, 240+active_ry); - GP_Line(display, colors[GP_GREEN], 0, 240-active_ry, 640, 240-active_ry); - GP_Line(display, colors[GP_GREEN], 320+active_rx, 0, 320+active_rx, 640); - GP_Line(display, colors[GP_GREEN], 320-active_rx, 0, 320-active_rx, 640); - } - - SDL_UnlockSurface(display); -} - -void event_loop(void) -{ - SDL_Event event; - - /* Initial redraw */ - draw_pixels(); - SDL_Flip(display); - - while (SDL_WaitEvent(&event) > 0) { - - switch (event.type) { - -#if 0 - case SDL_USEREVENT: - draw_pixels(); - SDL_Flip(display); - break; -#endif - - case SDL_VIDEOEXPOSE: - draw_pixels(); - SDL_Flip(display); - break; - - case SDL_KEYDOWN: - if (event.key.keysym.sym == SDLK_ESCAPE) { - return; - } - else if (event.key.keysym.sym == SDLK_o) { - orientation_flag = !orientation_flag; - } - else if (event.key.keysym.sym == SDLK_f) { - fill_flag = !fill_flag; - } - else if (event.key.keysym.sym == SDLK_1) { - rratio = 1; - } - else if (event.key.keysym.sym == SDLK_2) { - rratio = 2; - } - else if (event.key.keysym.sym == SDLK_3) { - rratio = 3; - } - else if (event.key.keysym.sym == SDLK_4) { - rratio = 4; - } - else if (event.key.keysym.sym == SDLK_m) { - fill_first = !fill_first; - } - else if (event.key.keysym.sym == SDLK_r) { - min_radius++; - if (min_radius > 10) - min_radius = 3; - } - else if (event.key.keysym.sym == SDLK_x) { - draw_axes = !draw_axes; - } - - draw_pixels(); - SDL_Flip(display); - break; - - case SDL_QUIT: - return; - } - } -} - -int main(void) -{ - /* Initialize SDL */ - if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_TIMER) != 0) { - fprintf(stderr, "Could not initialize SDL: %sn", SDL_GetError()); - return 1; - } - - /* Create a window with a software back surface */ - display = SDL_SetVideoMode(640, 480, 0, SDL_SWSURFACE); - if (display == NULL) { - fprintf(stderr, "Could not open display: %sn", SDL_GetError()); - goto fail; - } - -#if 0 - /* Set up the refresh timer */ - timer = SDL_AddTimer(60, timer_callback, NULL); - if (timer == 0) { - fprintf(stderr, "Could not set up timer: %sn", SDL_GetError()); - goto fail; - } -#endif - - GP_LoadBasicColors(display, colors); - - /* Enter the event loop */ - event_loop(); - - /* We're done */ - SDL_Quit(); - return 0; - -fail: - SDL_Quit(); - return 1; -} - diff --git a/old_tests/linefps.c b/old_tests/linefps.c deleted file mode 100644 index d88d427..0000000 --- a/old_tests/linefps.c +++ /dev/null @@ -1,149 +0,0 @@ -/***************************************************************************** - * This file is part of gfxprim library. * - * * - * Gfxprim is free software; you can redistribute it and/or * - * modify it under the terms of the GNU Lesser General Public * - * License as published by the Free Software Foundation; either * - * version 2.1 of the License, or (at your option) any later version. * - * * - * Gfxprim is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * - * Lesser General Public License for more details. * - * * - * You should have received a copy of the GNU Lesser General Public * - * License along with gfxprim; if not, write to the Free Software * - * Foundation, Inc., 51 Franklin Street, Fifth Floor, * - * Boston, MA 02110-1301 USA * - * * - * Copyright (C) 2009-2010 Jiri "BlueBear" Dluhos * - * jiri.bluebear.dluhos@gmail.com * - * * - * Copyright (C) 2009-2010 Cyril Hrubis metan@ucw.cz * - * * - *****************************************************************************/ - -#include <math.h> -#include <stdio.h> -#include <stdlib.h> -#include <SDL/SDL.h> - -#include "GP.h" - -/* The surface used as a display (in fact it is a software surface). */ -SDL_Surface *display = NULL; - -/* Frames per second. */ -int fps = 0, fps_min = 1000000, fps_max = 0; - -/* - * Timer used for FPS measurement and key reactions. - * SDL_USEREVENT is triggered each second. - */ - -SDL_TimerID timer; - -SDL_UserEvent timer_event; - -Uint32 timer_callback(__attribute__((unused)) Uint32 interval, - __attribute__((unused)) void * param) -{ - timer_event.type = SDL_USEREVENT; - SDL_PushEvent((SDL_Event *) &timer_event); - return 1000; -} - -/* Values for color pixels in display format. */ -static long colors[GP_BASIC_COLOR_COUNT]; - -void draw_frame(void) -{ - int x0 = 0; - int y0 = random() % display->h; - int x1 = display->w; - int y1 = random() % display->h; - long color = SDL_MapRGB(display->format, random() % 255, random() % 255, random() % 255); - - GP_Line(display, color, x0, y0, x1, y1); -} - -void event_loop(void) -{ - SDL_Event event; - - for (;;) { - while (SDL_PollEvent(&event) > 0) { - switch (event.type) { - case SDL_USEREVENT: - SDL_Flip(display); - fprintf(stdout, "%d FPS, min = %d, max = %dr", fps, fps_min, fps_max); - fflush(stdout); - - /* Update frames per second */ - if (fps < fps_min) - fps_min = fps; - if (fps > fps_max) - fps_max = fps; - fps = 0; - break; - case SDL_KEYDOWN: - case SDL_QUIT: - return; - } - } - draw_frame(); - fps++; - } -} - -int main(void) -{ - /* Initialize SDL */ - if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_TIMER) != 0) { - fprintf(stderr, "Could not initialize SDL: %sn", SDL_GetError()); - return 1; - } - - /* Create a window with a software back surface */ - display = SDL_SetVideoMode(640, 480, 0, SDL_SWSURFACE); - if (display == NULL) { - fprintf(stderr, "Could not open display: %sn", SDL_GetError()); - goto fail; - } - - /* Print basic information about the surface */ - printf("Display surface properties:n"); - printf(" width: %4d, height: %4d, pitch: %4dn", - display->w, display->h, display->pitch); - printf(" bits per pixel: %2d, bytes per pixel: %2dn", - display->format->BitsPerPixel, display->format->BytesPerPixel); - - /* Get colors */ - GP_LoadBasicColors(display, colors); - - /* Set up a clipping rectangle to test proper clipping of pixels */ - SDL_Rect clip_rect = { 10, 10, 620, 460 }; - SDL_SetClipRect(display, &clip_rect); - - /* Set up the timer */ - timer = SDL_AddTimer(1000, timer_callback, NULL); - if (timer == 0) { - fprintf(stderr, "Could not set up timer: %sn", SDL_GetError()); - goto fail; - } - - /* Enter the event loop */ - event_loop(); - - /* Preserve the last result by a newline */ - fprintf(stdout, "n"); - - /* We're done */ - SDL_Quit(); - return 0; - -fail: - SDL_Quit(); - return 1; -} - diff --git a/old_tests/linetest.c b/old_tests/linetest.c deleted file mode 100644 index 962f577..0000000 --- a/old_tests/linetest.c +++ /dev/null @@ -1,158 +0,0 @@ -/***************************************************************************** - * This file is part of gfxprim library. * - * * - * Gfxprim is free software; you can redistribute it and/or * - * modify it under the terms of the GNU Lesser General Public * - * License as published by the Free Software Foundation; either * - * version 2.1 of the License, or (at your option) any later version. * - * * - * Gfxprim is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * - * Lesser General Public License for more details. * - * * - * You should have received a copy of the GNU Lesser General Public * - * License along with gfxprim; if not, write to the Free Software * - * Foundation, Inc., 51 Franklin Street, Fifth Floor, * - * Boston, MA 02110-1301 USA * - * * - * Copyright (C) 2009-2010 Jiri "BlueBear" Dluhos * - * jiri.bluebear.dluhos@gmail.com * - * * - * Copyright (C) 2009-2010 Cyril Hrubis metan@ucw.cz * - * * - *****************************************************************************/ - -#include <math.h> -#include <stdio.h> -#include <stdlib.h> -#include <SDL/SDL.h> - -#include "GP.h" - -/* The surface used as a display (in fact it is a software surface). */ -SDL_Surface *display = NULL; - -/* Timer used for refreshing the display */ -SDL_TimerID timer; - -/* An event used for signaling that the timer was triggered. */ -SDL_UserEvent timer_event; - -/* Values for color pixels in display format. */ -static long colors[GP_BASIC_COLOR_COUNT]; - -Uint32 timer_callback(__attribute__((unused)) Uint32 interval, - __attribute__((unused)) void * param) -{ - timer_event.type = SDL_USEREVENT; - SDL_PushEvent((SDL_Event *) &timer_event); - return 30; -} - -double start_angle = 0.0; - -void redraw_screen(void) -{ - double angle; - int x, y; - int xcenter = display->w/2; - int ycenter = display->h/2; - - SDL_LockSurface(display); - - GP_Clear(display, colors[GP_BLACK]); - - for (angle = 0.0; angle < 2*M_PI; angle += 0.1) { - x = (int) (display->w/2 * cos(start_angle + angle)); - y = (int) (display->h/2 * sin(start_angle + angle)); - - Uint8 r = 127.0 + 127.0 * cos(start_angle + angle); - Uint8 g = 127.0 + 127.0 * sin(start_angle + angle); - - Uint32 color = SDL_MapRGB(display->format, r, 0, g); - - /* - * Draw the line forth and back to detect any pixel change - * between one direction and the other. - */ - GP_Line(display, color, xcenter, ycenter, xcenter + x, ycenter + y); - GP_Line(display, color, xcenter + x, ycenter + y, xcenter, ycenter); - } - - /* axes */ - GP_HLine(display, colors[GP_WHITE], 0, display->w, ycenter); - GP_VLine(display, colors[GP_WHITE], xcenter, 0, display->h); - - SDL_UnlockSurface(display); -} - -void event_loop(void) -{ - SDL_Event event; - - while (SDL_WaitEvent(&event) > 0) { - switch (event.type) { - case SDL_USEREVENT: - redraw_screen(); - SDL_Flip(display); - start_angle += 0.01; - if (start_angle > 2*M_PI) { - start_angle = 0.0; - } - break; - case SDL_KEYDOWN: - case SDL_QUIT: - return; - } - } -} - -int main(void) -{ - /* Initialize SDL */ - if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_TIMER) != 0) { - fprintf(stderr, "Could not initialize SDL: %sn", SDL_GetError()); - return 1; - } - - /* Create a window with a software back surface */ - display = SDL_SetVideoMode(640, 480, 0, SDL_SWSURFACE); - if (display == NULL) { - fprintf(stderr, "Could not open display: %sn", SDL_GetError()); - goto fail; - } - - /* Print basic information about the surface */ - printf("Display surface properties:n"); - printf(" width: %4d, height: %4d, pitch: %4dn", - display->w, display->h, display->pitch); - printf(" bits per pixel: %2d, bytes per pixel: %2dn", - display->format->BitsPerPixel, display->format->BytesPerPixel); - - /* Get colors */ - GP_LoadBasicColors(display, colors); - - /* Set up a clipping rectangle to test proper clipping of pixels */ - SDL_Rect clip_rect = { 10, 10, 620, 460 }; - SDL_SetClipRect(display, &clip_rect); - - /* Set up the refresh timer */ - timer = SDL_AddTimer(30, timer_callback, NULL); - if (timer == 0) { - fprintf(stderr, "Could not set up timer: %sn", SDL_GetError()); - goto fail; - } - - /* Enter the event loop */ - event_loop(); - - /* We're done */ - SDL_Quit(); - return 0; - -fail: - SDL_Quit(); - return 1; -} - diff --git a/old_tests/pixeltest.c b/old_tests/pixeltest.c deleted file mode 100644 index b4bea6e..0000000 --- a/old_tests/pixeltest.c +++ /dev/null @@ -1,138 +0,0 @@ -/***************************************************************************** - * This file is part of gfxprim library. * - * * - * Gfxprim is free software; you can redistribute it and/or * - * modify it under the terms of the GNU Lesser General Public * - * License as published by the Free Software Foundation; either * - * version 2.1 of the License, or (at your option) any later version. * - * * - * Gfxprim is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * - * Lesser General Public License for more details. * - * * - * You should have received a copy of the GNU Lesser General Public * - * License along with gfxprim; if not, write to the Free Software * - * Foundation, Inc., 51 Franklin Street, Fifth Floor, * - * Boston, MA 02110-1301 USA * - * * - * Copyright (C) 2009-2010 Jiri "BlueBear" Dluhos * - * jiri.bluebear.dluhos@gmail.com * - * * - * Copyright (C) 2009-2010 Cyril Hrubis metan@ucw.cz * - * * - *****************************************************************************/ - -#include <stdio.h> -#include <stdlib.h> -#include <SDL/SDL.h> - -#include "GP.h" - -/* The surface used as a display (in fact it is a software surface). */ -SDL_Surface *display = NULL; - -/* Timer used for refreshing the display */ -SDL_TimerID timer; - -/* An event used for signaling that the timer was triggered. */ -SDL_UserEvent timer_event; - -/* Values for color pixels in display format. */ -long red; -long green; -long blue; - -Uint32 timer_callback(__attribute__((unused)) Uint32 interval, - __attribute__((unused)) void *param) -{ - timer_event.type = SDL_USEREVENT; - SDL_PushEvent((SDL_Event *) &timer_event); - return 30; -} - -void draw_pixels(void) -{ - long pixel; - int x = random() % 320; - int y = random() % 240; - - SDL_LockSurface(display); - pixel = GP_GetPixel(display, x, y); - - if (pixel == green) - GP_SetPixel(display, blue, x, y); - else - GP_SetPixel(display, green, x, y); - - SDL_UnlockSurface(display); -} - -void event_loop(void) -{ - SDL_Event event; - - while (SDL_WaitEvent(&event) > 0) { - - switch (event.type) { - case SDL_USEREVENT: - draw_pixels(); - SDL_Flip(display); - break; - case SDL_KEYDOWN: - case SDL_QUIT: - return; - } - } -} - -int main(void) -{ - /* Initialize SDL */ - if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_TIMER) != 0) { - fprintf(stderr, "Could not initialize SDL: %sn", SDL_GetError()); - return 1; - } - - /* Create a window with a software back surface */ - display = SDL_SetVideoMode(320, 240, 0, SDL_SWSURFACE); - if (display == NULL) { - fprintf(stderr, "Could not open display: %sn", SDL_GetError()); - goto fail; - } - - /* Print basic information about the surface */ - printf("Display surface properties:n"); - printf(" width: %4d, height: %4d, pitch: %4dn", - display->w, display->h, display->pitch); - printf(" bits per pixel: %2d, bytes per pixel: %2dn", - display->format->BitsPerPixel, display->format->BytesPerPixel); - - /* Get colors */ - red = SDL_MapRGB(display->format, 255, 0, 0); - green = SDL_MapRGB(display->format, 0, 255, 0); - blue = SDL_MapRGB(display->format, 0, 0, 255); - - /* Set up a clipping rectangle to test proper clipping of pixels */ - SDL_Rect clip_rect = {10, 10, 300, 220}; - SDL_SetClipRect(display, &clip_rect); - - /* Set up the refresh timer */ - timer = SDL_AddTimer(30, timer_callback, NULL); - if (timer == 0) { - fprintf(stderr, "Could not set up timer: %sn", SDL_GetError()); - goto fail; - } - - /* Enter the event loop */ - event_loop(); - - /* We're done */ - SDL_Quit(); - return 0; - -fail: - SDL_Quit(); - return 1; -} - diff --git a/old_tests/runtest.sh b/old_tests/runtest.sh deleted file mode 100755 index 372498f..0000000 --- a/old_tests/runtest.sh +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/bash -# -# Run dynamically linked test. -# - -PROG="$1" -shift - -echo "LD_LIBRARY_PATH=../ ./$PROG $@" -LD_LIBRARY_PATH=../ ./$PROG $@ diff --git a/old_tests/shapetest.c b/old_tests/shapetest.c deleted file mode 100644 index c451202..0000000 --- a/old_tests/shapetest.c +++ /dev/null @@ -1,402 +0,0 @@ -/***************************************************************************** - * This file is part of gfxprim library. * - * * - * Gfxprim is free software; you can redistribute it and/or * - * modify it under the terms of the GNU Lesser General Public * - * License as published by the Free Software Foundation; either * - * version 2.1 of the License, or (at your option) any later version. * - * * - * Gfxprim is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * - * Lesser General Public License for more details. * - * * - * You should have received a copy of the GNU Lesser General Public * - * License along with gfxprim; if not, write to the Free Software * - * Foundation, Inc., 51 Franklin Street, Fifth Floor, * - * Boston, MA 02110-1301 USA * - * * - * Copyright (C) 2009-2010 Jiri "BlueBear" Dluhos * - * jiri.bluebear.dluhos@gmail.com * - * * - * Copyright (C) 2009-2010 Cyril Hrubis metan@ucw.cz * - * * - *****************************************************************************/ - -#include <stdio.h> -#include <stdlib.h> -#include <SDL/SDL.h> - -#include "GP.h" - -/* The surface used as a display (in fact it is a software surface). */ -SDL_Surface *display = NULL; - -/* Timer used for refreshing the display */ -SDL_TimerID timer; - -/* An event used for signaling that the timer was triggered. */ -SDL_UserEvent timer_event; - -Uint32 timer_callback(__attribute__((unused)) Uint32 interval, - __attribute__((unused)) void * param) -{ - timer_event.type = SDL_USEREVENT; - SDL_PushEvent((SDL_Event *) &timer_event); - return 60; -} - -/* Basic colors in display-specific format. */ -long colors[GP_BASIC_COLOR_COUNT]; - -/* Radius of the shape being drawn */ -static int xradius = 5; -static int yradius = 5; - -/* Draw outline? */ -static int outline = 0; - -/* Fill the shape? */ -static int fill = 1; - -/* Show axes? */ -static int show_axes = 1; - -/* Shape to be drawn */ -#define SHAPE_FIRST 1 -#define SHAPE_TRIANGLE 1 -#define SHAPE_CIRCLE 2 -#define SHAPE_ELLIPSE 3 -#define SHAPE_RECTANGLE 4 -#define SHAPE_LAST 4 -static int shape = SHAPE_FIRST; - -/* Variants in coordinates, if applicable */ -static int variant = 1; - -/* Increments added to radii in every timeframe (0 = no change). */ -static int xradius_add = 0; -static int yradius_add = 0; - -void draw_testing_triangle(int x, int y, int xradius, int yradius) -{ - int x0, y0, x1, y1, x2, y2; - switch (variant) { - case 1: - x0 = x; - y0 = y - yradius; - x1 = x - xradius; - y1 = y; - x2 = x + xradius; - y2 = y + yradius; - break; - case 2: - x0 = x - xradius; - y0 = y - yradius; - x1 = x + xradius; - y1 = y; - x2 = x + xradius; - y2 = y + yradius; - break; - - case 3: - default: - x0 = x; - y0 = y - yradius; - x1 = x + xradius; - y1 = y + yradius; - x2 = x - xradius; - y2 = y + yradius; - break; - } - - if (fill) { - GP_FillTriangle(display, colors[GP_RED], x0, y0, x1, y1, x2, y2); - } - - if (outline) { - GP_Triangle(display, colors[GP_WHITE], x0, y0, x1, y1, x2, y2); - } -} - -void draw_testing_circle(int x, int y, int xradius, - __attribute__((unused)) int yradius) -{ - if (fill) { - GP_FillCircle(display, colors[GP_RED], x, y, xradius); - } - if (outline) { - GP_Circle(display, colors[GP_WHITE], x, y, xradius); - } -} - -void draw_testing_ellipse(int x, int y, int xradius, int yradius) -{ - if (fill) { - GP_FillEllipse(display, colors[GP_RED], x, y, xradius, yradius); - } - if (outline) { - GP_Ellipse(display, colors[GP_WHITE], x, y, xradius, yradius); - } -} - -void draw_testing_rectangle(int x, int y, int xradius, int yradius) -{ - if (fill) { - GP_FillRect(display, colors[GP_RED], x - xradius, y - yradius, x + xradius, y + yradius); - } - if (outline) { - GP_Rect(display, colors[GP_WHITE], x - xradius, y - yradius, x + xradius, y + yradius); - } -} - -void redraw_screen(void) -{ - int x = 320; - int y = 240; - - /* text style for the label */ - GP_TextStyle style = { - .font = &GP_default_console_font, -// .foreground = colors[GP_WHITE], - .pixel_xmul = 2, - .pixel_ymul = 1, - .pixel_xspace = 0, - .pixel_yspace = 1, - }; - - SDL_LockSurface(display); - GP_Clear(display, colors[GP_BLACK]); - - /* axes */ - if (show_axes) { - GP_HLine(display, colors[GP_GRAY], 0, 640, y); - GP_HLine(display, colors[GP_DARK_GRAY], 0, 640, y-yradius); - GP_HLine(display, colors[GP_DARK_GRAY], 0, 640, y+yradius); - GP_VLine(display, colors[GP_GRAY], x, 0, 480); - GP_VLine(display, colors[GP_DARK_GRAY], x-xradius, 0, 480); - GP_VLine(display, colors[GP_DARK_GRAY], x+xradius, 0, 480); - } - - /* the shape */ - const char *title = NULL; - switch (shape) { - case SHAPE_TRIANGLE: - draw_testing_triangle(x, y, xradius, yradius); - title = "TRIANGLE"; - break; - case SHAPE_CIRCLE: - draw_testing_circle(x, y, xradius, yradius); - title = "CIRCLE"; - break; - case SHAPE_ELLIPSE: - draw_testing_ellipse(x, y, xradius, yradius); - title = "ELLIPSE"; - break; - case SHAPE_RECTANGLE: - draw_testing_rectangle(x, y, xradius, yradius); - title = "RECTANGLE"; - break; - } - GP_Text(display, colors[GP_WHITE], &style, 16, 16, title); - - SDL_UnlockSurface(display); -} - -void event_loop(void) -{ - SDL_Event event; - - while (SDL_WaitEvent(&event) > 0) { - - switch (event.type) { - case SDL_USEREVENT: - - if (xradius + xradius_add > 1 && xradius + xradius_add < 400) - xradius += xradius_add; - if (yradius + yradius_add > 1 && yradius + yradius_add < 400) - yradius += yradius_add; - - redraw_screen(); - SDL_Flip(display); - break; - - case SDL_KEYDOWN: - switch (event.key.keysym.sym) { - - case SDLK_f: - fill = !fill; - if (!fill && !outline) { - outline = 1; - } - break; - - case SDLK_o: - outline = !outline; - if (!fill && !outline) { - fill = 1; - } - break; - - case SDLK_x: - show_axes = !show_axes; - break; - - case SDLK_ESCAPE: - return; - - case SDLK_LEFT: - xradius_add = -1; - break; - - case SDLK_RIGHT: - xradius_add = 1; - break; - - case SDLK_UP: - yradius_add = 1; - break; - - case SDLK_DOWN: - yradius_add = -1; - break; - - case SDLK_PAGEUP: - xradius_add = 1; - yradius_add = 1; - break; - - case SDLK_PAGEDOWN: - xradius_add = -1; - yradius_add = -1; - break; - - case SDLK_1: - variant = 1; - break; - - case SDLK_2: - variant = 2; - break; - - case SDLK_3: - variant = 3; - break; - - case SDLK_SPACE: - shape++; - if (shape > SHAPE_LAST) - shape = SHAPE_FIRST; - break; - - case SDLK_EQUALS: - if (xradius > yradius) - yradius = xradius; - else - xradius = yradius; - break; - - default: - break; - } - break; - case SDL_KEYUP: - switch (event.key.keysym.sym) { - - /* Stop incrementing as soon as the key is released. */ - case SDLK_LEFT: - case SDLK_RIGHT: - xradius_add = 0; - break; - case SDLK_UP: - case SDLK_DOWN: - yradius_add = 0; - break; - - case SDLK_PAGEUP: - case SDLK_PAGEDOWN: - xradius_add = 0; - yradius_add = 0; - break; - - default: - break; - } - break; - case SDL_QUIT: - return; - } - } -} - -void print_instructions(void) -{ - printf("Use the following keys to control the test:n"); - printf(" Esc ......... exitn"); - printf(" Space ....... change shapesn"); - printf(" O ........... toggle outline drawingn"); - printf(" F ........... toggle fillingn"); - printf(" X ........... show/hide axesn"); - printf(" left/right .. increase/decrease horizontal radiusn"); - printf(" up/down ..... increase/decrease vertical radiusn"); - printf(" PgUp/PgDn ... increase/decrease both radiin"); - printf(" = ........... reset radii to the same valuen"); - printf(" 1/2/3 ....... choose shape variant (if applicable)n"); -} - -int main(int argc, char ** argv) -{ - int display_bpp = 0; - - int i; - for (i = 1; i < argc; i++) { - if (strcmp(argv[i], "-16") == 0) { - display_bpp = 16; - } - else if (strcmp(argv[i], "-24") == 0) { - display_bpp = 24; - } - } - - /* Initialize SDL */ - if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_TIMER) != 0) { - fprintf(stderr, "Could not initialize SDL: %sn", SDL_GetError()); - return 1; - } - - /* Create a window with a software back surface */ - display = SDL_SetVideoMode(640, 480, display_bpp, SDL_SWSURFACE); - if (display == NULL) { - fprintf(stderr, "Could not open display: %sn", SDL_GetError()); - goto fail; - } - - /* Find pixel representations of needed colors */ - GP_LoadBasicColors(display, colors); - - /* Set up a clipping rectangle to exercise clipping */ - SDL_Rect clip_rect = {10, 10, 620, 460}; - SDL_SetClipRect(display, &clip_rect); - - /* Set up the refresh timer */ - timer = SDL_AddTimer(60, timer_callback, NULL); - if (timer == 0) { - fprintf(stderr, "Could not set up timer: %sn", SDL_GetError()); - goto fail; - } - - /* Print a short info how to use this test. */ - print_instructions(); - - /* Enter the event loop */ - event_loop(); - - /* We're done */ - SDL_Quit(); - return 0; - -fail: - SDL_Quit(); - return 1; -} - diff --git a/old_tests/widelinetest.c b/old_tests/widelinetest.c deleted file mode 100644 index 395885d..0000000 --- a/old_tests/widelinetest.c +++ /dev/null @@ -1,138 +0,0 @@ -/***************************************************************************** - * This file is part of gfxprim library. * - * * - * Gfxprim is free software; you can redistribute it and/or * - * modify it under the terms of the GNU Lesser General Public * - * License as published by the Free Software Foundation; either * - * version 2.1 of the License, or (at your option) any later version. * - * * - * Gfxprim is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * - * Lesser General Public License for more details. * - * * - * You should have received a copy of the GNU Lesser General Public * - * License along with gfxprim; if not, write to the Free Software * - * Foundation, Inc., 51 Franklin Street, Fifth Floor, * - * Boston, MA 02110-1301 USA * - * * - * Copyright (C) 2009-2010 Jiri "BlueBear" Dluhos * - * jiri.bluebear.dluhos@gmail.com * - * * - * Copyright (C) 2009-2010 Cyril Hrubis metan@ucw.cz * - * * - *****************************************************************************/ - -#include <math.h> -#include <stdio.h> -#include <stdlib.h> -#include <SDL/SDL.h> - -#include "GP.h" - -/* The surface used as a display (in fact it is a software surface). */ -SDL_Surface *display = NULL; - -/* Timer used for refreshing the display */ -SDL_TimerID timer; - -/* An event used for signaling that the timer was triggered. */ -SDL_UserEvent timer_event; - -/* Values for color pixels in display format. */ -static long colors[GP_BASIC_COLOR_COUNT]; - -Uint32 timer_callback(__attribute__((unused)) Uint32 interval, - __attribute__((unused)) void *param) -{ - timer_event.type = SDL_USEREVENT; - SDL_PushEvent((SDL_Event *) &timer_event); - return 30; -} - -double start_angle = 0.0; - -void redraw_screen(void) -{ - int i; - - for (i = 1; i < 10; i++) { - GP_HLineWide(display, colors[GP_WHITE], GP_LINE_CENTER, i, 10, 100, 20*i); - GP_HLine(display, colors[GP_RED], 10, 100, 20*i); - } - - for (i = 1; i < 10; i++) { - GP_VLineWide(display, colors[GP_WHITE], GP_LINE_CENTER, i, 100 + 20*i, 100, 190); - GP_VLine(display, colors[GP_RED], 100 + 20*i, 100, 190); - } -} - -void event_loop(void) -{ - SDL_Event event; - - while (SDL_WaitEvent(&event) > 0) { - switch (event.type) { - case SDL_USEREVENT: - redraw_screen(); - SDL_Flip(display); - start_angle += 0.01; - if (start_angle > 2*M_PI) { - start_angle = 0.0; - } - break; - case SDL_KEYDOWN: - case SDL_QUIT: - return; - } - } -} - -int main(void) -{ - /* Initialize SDL */ - if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_TIMER) != 0) { - fprintf(stderr, "Could not initialize SDL: %sn", SDL_GetError()); - return 1; - } - - /* Create a window with a software back surface */ - display = SDL_SetVideoMode(640, 480, 0, SDL_SWSURFACE); - if (display == NULL) { - fprintf(stderr, "Could not open display: %sn", SDL_GetError()); - goto fail; - } - - /* Print basic information about the surface */ - printf("Display surface properties:n"); - printf(" width: %4d, height: %4d, pitch: %4dn", - display->w, display->h, display->pitch); - printf(" bits per pixel: %2d, bytes per pixel: %2dn", - display->format->BitsPerPixel, display->format->BytesPerPixel); - - /* Get colors */ - GP_LoadBasicColors(display, colors); - - /* Set up a clipping rectangle to test proper clipping of pixels */ - SDL_Rect clip_rect = { 10, 10, 620, 460 }; - SDL_SetClipRect(display, &clip_rect); - - /* Set up the refresh timer */ - timer = SDL_AddTimer(30, timer_callback, NULL); - if (timer == 0) { - fprintf(stderr, "Could not set up timer: %sn", SDL_GetError()); - goto fail; - } - - /* Enter the event loop */ - event_loop(); - - /* We're done */ - SDL_Quit(); - return 0; - -fail: - SDL_Quit(); - return 1; -} - diff --git a/targets/sdl/Makefile b/targets/sdl/Makefile deleted file mode 100644 index 6c088f8..0000000 --- a/targets/sdl/Makefile +++ /dev/null @@ -1,61 +0,0 @@ -LIBRARY=libGP_SDL - -HEADERS=GP_SDL.h - GP_SDL_Context.h - GP_SDL_VideoInit.h - -EXTRA_DEPS= - -OBJECTS=GP_SDL_Context.o - GP_SDL_VideoInit.o - -.PHONY: library tests clean tar install - -all: library tests - -library: $(LIBRARY) - -tests: - cd tests && $(MAKE) all - -$(LIBRARY): $(LIBRARY).a $(LIBRARY).so - -$(OBJECTS): GP_SDL.h - -############################################################################# -# Building rules. -############################################################################# - -CFLAGS=-W -Wall -O2 -fPIC -I../.. -I../../core - -%.o: %.c $(HEADERS) - $(CC) $(CFLAGS) $< -c -o $@ - -$(LIBRARY).a: $(OBJECTS) $(EXTRA_DEPS) - ar crus $@ $^ - -$(LIBRARY).so: $(OBJECTS) $(EXTRA_DEPS) - $(CC) -fPIC -dPIC --shared -Wl,-soname -Wl,$@.0 $(CFLAGS) $^ -o $@ - ln -sf $@ $@.0 - -############################################################################# -# Installation, cleanup, and packing. -############################################################################# - -HEADER_LOC=/usr/include/ -LIB_LOC=/usr/lib/ - -install: - install -m 775 -d $(HEADER_LOC)GP/ - install -m 664 *.h $(HEADER_LOC)GP/ - install -m 775 -d $(HEADER_LOC)GP/backends/ - install -m 664 backends/*.h $(HEADER_LOC)GP/backends/ - install -m 664 *.so *.so.0 *.a $(LIB_LOC) - -clean: - rm -f $(OBJECTS) - rm -f $(LIBRARY).a $(LIBRARY).so $(LIBRARY).so.0 - cd tests && $(MAKE) clean - -tar: clean - cd .. && tar cjf gfxprim-`date +%Y-%b-%d`.tar.bz2 gfxprim diff --git a/tests/Makefile b/tests/Makefile new file mode 100644 index 0000000..676ca51 --- /dev/null +++ b/tests/Makefile @@ -0,0 +1,3 @@ +TOPDIR=.. +SUBDIRS=loaders filters #core +include $(TOPDIR)/include.mk diff --git a/core/tests/GP_Comon.test.c b/tests/core/GP_Comon.test.c similarity index 100% rename from core/tests/GP_Comon.test.c rename to tests/core/GP_Comon.test.c diff --git a/core/tests/GP_Tests.h b/tests/core/GP_Tests.h similarity index 100% rename from core/tests/GP_Tests.h rename to tests/core/GP_Tests.h diff --git a/tests/core/Makefile b/tests/core/Makefile new file mode 100644 index 0000000..b1da0ed --- /dev/null +++ b/tests/core/Makefile @@ -0,0 +1,31 @@ +TOPDIR=../.. + +CSOURCES=$(shell echo *.test.c) core_tests.gen.c + +INCLUDE=core +LDLIBS+=-lGP -L$(TOPDIR)/build/ -lcheck + +APPS=core_tests + +include $(TOPDIR)/include.mk +include $(TOPDIR)/app.mk + +.PHONY: run + +TEST_SRCS=$(wildcard *.test.c) +TEST_OBJS=$(patsubst %.c,%.o,$(TEST_SRCS)) + +CLEAN+=core_tests.gen.c + +run: $(TESTS) + for test in $(TESTS); do LD_LIBRARY_PATH=../ ./"$$test" -v ; done + +core_tests.gen.c: $(TEST_SRCS) find_tests.py +ifdef VERBOSE + python find_tests.py -c $@ $(TEST_SRCS) +else + @echo "GEN (python) $@" + @python find_tests.py -c $@ $(TEST_SRCS) +endif + +core_tests: $(TEST_OBJS) core_tests.gen.o diff --git a/core/tests/core_tests.c b/tests/core/core_tests.c similarity index 100% rename from core/tests/core_tests.c rename to tests/core/core_tests.c diff --git a/core/tests/find_tests.py b/tests/core/find_tests.py similarity index 100% rename from core/tests/find_tests.py rename to tests/core/find_tests.py diff --git a/core/tests/font.test.c b/tests/core/font.test.c similarity index 100% rename from core/tests/font.test.c rename to tests/core/font.test.c diff --git a/drivers/GP_Framebuffer.c b/tests/drivers/GP_Framebuffer.c similarity index 100% rename from drivers/GP_Framebuffer.c rename to tests/drivers/GP_Framebuffer.c diff --git a/drivers/GP_Framebuffer.h b/tests/drivers/GP_Framebuffer.h similarity index 100% rename from drivers/GP_Framebuffer.h rename to tests/drivers/GP_Framebuffer.h diff --git a/drivers/tests/Makefile b/tests/drivers/tests/Makefile similarity index 100% rename from drivers/tests/Makefile rename to tests/drivers/tests/Makefile diff --git a/drivers/tests/framebuffer_test.c b/tests/drivers/tests/framebuffer_test.c similarity index 100% rename from drivers/tests/framebuffer_test.c rename to tests/drivers/tests/framebuffer_test.c diff --git a/drivers/tests/runtest.sh b/tests/drivers/tests/runtest.sh similarity index 100% rename from drivers/tests/runtest.sh rename to tests/drivers/tests/runtest.sh diff --git a/drivers/tests/sierpinsky.c b/tests/drivers/tests/sierpinsky.c similarity index 100% rename from drivers/tests/sierpinsky.c rename to tests/drivers/tests/sierpinsky.c diff --git a/tests/filters/Makefile b/tests/filters/Makefile new file mode 100644 index 0000000..7e43d98 --- /dev/null +++ b/tests/filters/Makefile @@ -0,0 +1,11 @@ +TOPDIR=../.. + +CSOURCES=$(shell echo *.c) + +INCLUDE=filters loaders +LDLIBS+=-lGP -L$(TOPDIR)/build/ + +APPS=PGM_rotate rotate_test + +include $(TOPDIR)/include.mk +include $(TOPDIR)/app.mk diff --git a/filters/tests/PGM_rotate.c b/tests/filters/PGM_rotate.c similarity index 100% rename from filters/tests/PGM_rotate.c rename to tests/filters/PGM_rotate.c diff --git a/filters/tests/rotate_test.c b/tests/filters/rotate_test.c similarity index 100% rename from filters/tests/rotate_test.c rename to tests/filters/rotate_test.c diff --git a/filters/tests/runtest.sh b/tests/filters/runtest.sh similarity index 100% rename from filters/tests/runtest.sh rename to tests/filters/runtest.sh diff --git a/filters/tests/test-big.pgm b/tests/filters/test-big.pgm similarity index 100% rename from filters/tests/test-big.pgm rename to tests/filters/test-big.pgm diff --git a/tests/loaders/Makefile b/tests/loaders/Makefile new file mode 100644 index 0000000..e079177 --- /dev/null +++ b/tests/loaders/Makefile @@ -0,0 +1,11 @@ +TOPDIR=../.. + +CSOURCES=$(shell echo *.c) + +INCLUDE=loaders +LDLIBS+=-lGP -L$(TOPDIR)/build/ + +APPS=PBM_invert PBM_test PGM_invert PGM_test + +include $(TOPDIR)/include.mk +include $(TOPDIR)/app.mk diff --git a/loaders/tests/PBM_invert.c b/tests/loaders/PBM_invert.c similarity index 100% rename from loaders/tests/PBM_invert.c rename to tests/loaders/PBM_invert.c diff --git a/loaders/tests/PBM_test.c b/tests/loaders/PBM_test.c similarity index 100% rename from loaders/tests/PBM_test.c rename to tests/loaders/PBM_test.c diff --git a/loaders/tests/PGM_invert.c b/tests/loaders/PGM_invert.c similarity index 100% rename from loaders/tests/PGM_invert.c rename to tests/loaders/PGM_invert.c diff --git a/loaders/tests/PGM_test.c b/tests/loaders/PGM_test.c similarity index 100% rename from loaders/tests/PGM_test.c rename to tests/loaders/PGM_test.c diff --git a/loaders/tests/autotest.sh b/tests/loaders/autotest.sh similarity index 100% rename from loaders/tests/autotest.sh rename to tests/loaders/autotest.sh diff --git a/loaders/tests/runtest.sh b/tests/loaders/runtest.sh similarity index 100% rename from loaders/tests/runtest.sh rename to tests/loaders/runtest.sh diff --git a/targets/sdl/GP_SDL.h b/tests/sdl/GP_SDL.h similarity index 100% rename from targets/sdl/GP_SDL.h rename to tests/sdl/GP_SDL.h diff --git a/targets/sdl/GP_SDL_Context.c b/tests/sdl/GP_SDL_Context.c similarity index 100% rename from targets/sdl/GP_SDL_Context.c rename to tests/sdl/GP_SDL_Context.c diff --git a/targets/sdl/GP_SDL_Context.h b/tests/sdl/GP_SDL_Context.h similarity index 100% rename from targets/sdl/GP_SDL_Context.h rename to tests/sdl/GP_SDL_Context.h diff --git a/targets/sdl/GP_SDL_VideoInit.c b/tests/sdl/GP_SDL_VideoInit.c similarity index 100% rename from targets/sdl/GP_SDL_VideoInit.c rename to tests/sdl/GP_SDL_VideoInit.c diff --git a/targets/sdl/GP_SDL_VideoInit.h b/tests/sdl/GP_SDL_VideoInit.h similarity index 100% rename from targets/sdl/GP_SDL_VideoInit.h rename to tests/sdl/GP_SDL_VideoInit.h diff --git a/tests/sdl/Makefile b/tests/sdl/Makefile new file mode 100644 index 0000000..e7c006f --- /dev/null +++ b/tests/sdl/Makefile @@ -0,0 +1,2 @@ +all: +clean: diff --git a/targets/sdl/tests/Makefile b/tests/sdl/tests/Makefile similarity index 100% rename from targets/sdl/tests/Makefile rename to tests/sdl/tests/Makefile diff --git a/targets/sdl/tests/fileview.c b/tests/sdl/tests/fileview.c similarity index 100% rename from targets/sdl/tests/fileview.c rename to tests/sdl/tests/fileview.c diff --git a/targets/sdl/tests/fonttest.c b/tests/sdl/tests/fonttest.c similarity index 100% rename from targets/sdl/tests/fonttest.c rename to tests/sdl/tests/fonttest.c diff --git a/targets/sdl/tests/linetest.c b/tests/sdl/tests/linetest.c similarity index 100% rename from targets/sdl/tests/linetest.c rename to tests/sdl/tests/linetest.c diff --git a/targets/sdl/tests/pixeltest.c b/tests/sdl/tests/pixeltest.c similarity index 100% rename from targets/sdl/tests/pixeltest.c rename to tests/sdl/tests/pixeltest.c diff --git a/targets/sdl/tests/randomshapetest.c b/tests/sdl/tests/randomshapetest.c similarity index 100% rename from targets/sdl/tests/randomshapetest.c rename to tests/sdl/tests/randomshapetest.c diff --git a/targets/sdl/tests/runtest.sh b/tests/sdl/tests/runtest.sh similarity index 100% rename from targets/sdl/tests/runtest.sh rename to tests/sdl/tests/runtest.sh diff --git a/targets/sdl/tests/shapetest.c b/tests/sdl/tests/shapetest.c similarity index 100% rename from targets/sdl/tests/shapetest.c rename to tests/sdl/tests/shapetest.c diff --git a/targets/sdl/tests/sierpinsky.c b/tests/sdl/tests/sierpinsky.c similarity index 100% rename from targets/sdl/tests/sierpinsky.c rename to tests/sdl/tests/sierpinsky.c diff --git a/targets/sdl/tests/symbolstest.c b/tests/sdl/tests/symbolstest.c similarity index 100% rename from targets/sdl/tests/symbolstest.c rename to tests/sdl/tests/symbolstest.c diff --git a/targets/sdl/tests/textaligntest.c b/tests/sdl/tests/textaligntest.c similarity index 100% rename from targets/sdl/tests/textaligntest.c rename to tests/sdl/tests/textaligntest.c diff --git a/targets/sdl/tests/trianglefps.c b/tests/sdl/tests/trianglefps.c similarity index 100% rename from targets/sdl/tests/trianglefps.c rename to tests/sdl/tests/trianglefps.c
-----------------------------------------------------------------------
Summary of changes: Makefile | 64 ++-- algo/README | 7 - app.mk | 15 + build/Makefile | 41 ++ build/liblock.sh | 24 ++ build/link.sh | 27 ++ config.mk | 3 + core/GP_Circle.c | 57 --- core/GP_FillEllipse.c | 57 --- core/GP_FillEllipse.h | 39 -- core/GP_FillRect.h | 46 --- core/GP_LineTrack.c | 76 ---- core/GP_LineTrack.h | 72 ---- core/GP_Rect.c | 65 ---- core/Makefile | 38 -- core/tests/Makefile | 33 -- drivers/Makefile | 29 -- filters/Makefile | 29 -- filters/tests/Makefile | 17 - include.mk | 101 +++++ filters/GP_Filters.h => include/GP.h | 17 +- {core => include/backends}/GP_Backend.h | 2 +- {core => include}/config.h | 2 - {core => include/core}/GP_Clip.h | 0 {core => include/core}/GP_Color.h | 0 {core => include/core}/GP_Common.h | 0 {core => include/core}/GP_Context.h | 5 +- core/GP_FillCircle.h => include/core/GP_Core.h | 27 +- {core => include/core}/GP_FnPerBpp.h | 2 - {core => include/core}/GP_GetPixel.h | 0 {core => include/core}/GP_Palette.h | 0 {core => include/core}/GP_Pixel.h | 0 {core => include/core}/GP_PutPixel.h | 0 {core => include/core}/GP_RetCode.h | 0 {core => include/core}/GP_Transform.h | 0 {core => include/core}/GP_WritePixel.h | 0 {filters => include/filters}/GP_Filters.h | 0 {filters => include/filters}/GP_Rotate.h | 3 +- {core => include/gfx}/GP_Circle.h | 8 +- {core => include/gfx}/GP_Ellipse.h | 9 +- {core => include/gfx}/GP_Fill.h | 2 +- core/GP.h => include/gfx/GP_Gfx.h | 42 +-- {core => include/gfx}/GP_HLine.h | 4 +- {core => include/gfx}/GP_Line.h | 4 +- {core => include/gfx}/GP_Polygon.h | 4 +- {core => include/gfx}/GP_Rect.h | 17 +- {core => include/gfx}/GP_Symbol.h | 4 +- {core => include/gfx}/GP_Tetragon.h | 2 +- {core => include/gfx}/GP_Triangle.h | 2 +- {core => include/gfx}/GP_VLine.h | 2 +- {input => include/input}/GP_Event.h | 0 {loaders => include/loaders}/GP_Loaders.h | 6 + {loaders => include/loaders}/GP_PBM.h | 2 +- {loaders => include/loaders}/GP_PGM.h | 2 +- {core => include/text}/GP_Font.h | 2 +- {core => include/text}/GP_Text.h | 5 +- {core => include/text}/GP_TextMetric.h | 0 {core => include/text}/GP_TextStyle.h | 2 +- input/Makefile | 27 -- lib.mk | 11 + libs/Makefile | 3 + {core => libs/backends}/GP_Backend.c | 3 +- {backends => libs/backends}/GP_Backend_SDL.c | 2 +- libs/backends/Makefile | 5 + {core => libs/core}/GP_Color.c | 0 {core => libs/core}/GP_Context.c | 7 +- {core => libs/core}/GP_GetPixel.c | 2 +- {core => libs/core}/GP_Palette.c | 0 {core => libs/core}/GP_Pixel.c | 2 +- {core => libs/core}/GP_PutPixel.c | 2 +- {core => libs/core}/GP_RetCode.c | 0 {core => libs/core}/GP_WritePixel.c | 3 +- libs/core/Makefile | 5 + {filters => libs/filters}/GP_Rotate.c | 11 +- libs/filters/Makefile | 5 + {filters => libs/filters/algo}/GP_MirrorV.algo.h | 2 +- {filters => libs/filters/algo}/GP_Rotate.algo.h | 6 +- core/GP_FillCircle.c => libs/gfx/GP_Circle.c | 24 +- {core => libs/gfx}/GP_Ellipse.c | 35 ++- {core => libs/gfx}/GP_Fill.c | 2 +- {core => libs/gfx}/GP_HLine.c | 4 +- {core => libs/gfx}/GP_Line.c | 4 +- {core => libs/gfx}/GP_Polygon.c | 2 +- core/GP_FillRect.c => libs/gfx/GP_Rect.c | 41 ++- {core => libs/gfx}/GP_Symbol.c | 2 +- {core => libs/gfx}/GP_Tetragon.c | 2 +- {core => libs/gfx}/GP_Triangle.c | 2 +- {core => libs/gfx}/GP_VLine.c | 4 +- libs/gfx/Makefile | 5 + {algo => libs/gfx/algo}/Circle.algo.h | 0 {algo => libs/gfx/algo}/Ellipse.algo.h | 0 {algo => libs/gfx/algo}/FillCircle.algo.h | 0 {algo => libs/gfx/algo}/FillEllipse.algo.h | 0 {algo => libs/gfx/algo}/FillTriangle.algo.h | 0 {algo => libs/gfx/algo}/HLine.algo.h | 0 {algo => libs/gfx/algo}/Line.algo.h | 0 {algo => libs/gfx/algo}/VLine.algo.h | 0 {input => libs/input}/GP_Event.c | 0 libs/input/Makefile | 5 + {loaders => libs/loaders}/GP_PBM.c | 0 {loaders => libs/loaders}/GP_PGM.c | 0 {loaders => libs/loaders}/GP_PXMCommon.c | 0 {loaders => libs/loaders}/GP_PXMCommon.h | 2 +- libs/loaders/Makefile | 5 + {core => libs/text}/GP_DefaultFont.c | 0 {core => libs/text}/GP_Font.c | 3 +- {core => libs/text}/GP_Text.c | 5 +- {core => libs/text}/GP_TextMetric.c | 3 +- {core => libs/text}/GP_TextStyle.c | 2 +- libs/text/Makefile | 5 + {algo => libs/text/algo}/Text.algo.h | 0 loaders/Makefile | 29 -- loaders/tests/Makefile | 17 - old_tests/Makefile | 26 -- old_tests/circlefps.c | 148 ------- old_tests/circlestest.c | 220 ----------- old_tests/ellipsetest.c | 240 ------------ old_tests/linefps.c | 149 -------- old_tests/linetest.c | 158 -------- old_tests/pixeltest.c | 138 ------- old_tests/runtest.sh | 10 - old_tests/shapetest.c | 402 -------------------- old_tests/widelinetest.c | 138 ------- targets/sdl/Makefile | 61 --- tests/Makefile | 3 + {core/tests => tests/core}/GP_Comon.test.c | 0 {core/tests => tests/core}/GP_Tests.h | 0 tests/core/Makefile | 31 ++ {core/tests => tests/core}/core_tests.c | 0 {core/tests => tests/core}/find_tests.py | 0 {core/tests => tests/core}/font.test.c | 0 {drivers => tests/drivers}/GP_Framebuffer.c | 0 {drivers => tests/drivers}/GP_Framebuffer.h | 0 {drivers => tests/drivers}/tests/Makefile | 0 .../drivers}/tests/framebuffer_test.c | 0 {drivers => tests/drivers}/tests/runtest.sh | 0 {drivers => tests/drivers}/tests/sierpinsky.c | 0 tests/filters/Makefile | 11 + {filters/tests => tests/filters}/PGM_rotate.c | 0 {filters/tests => tests/filters}/rotate_test.c | 0 {filters/tests => tests/filters}/runtest.sh | 0 {filters/tests => tests/filters}/test-big.pgm | 0 tests/loaders/Makefile | 11 + {loaders/tests => tests/loaders}/PBM_invert.c | 0 {loaders/tests => tests/loaders}/PBM_test.c | 0 {loaders/tests => tests/loaders}/PGM_invert.c | 0 {loaders/tests => tests/loaders}/PGM_test.c | 0 {loaders/tests => tests/loaders}/autotest.sh | 0 {loaders/tests => tests/loaders}/runtest.sh | 0 {targets => tests}/sdl/GP_SDL.h | 0 {targets => tests}/sdl/GP_SDL_Context.c | 0 {targets => tests}/sdl/GP_SDL_Context.h | 0 {targets => tests}/sdl/GP_SDL_VideoInit.c | 0 {targets => tests}/sdl/GP_SDL_VideoInit.h | 0 tests/sdl/Makefile | 2 + {targets => tests}/sdl/tests/Makefile | 0 {targets => tests}/sdl/tests/fileview.c | 0 {targets => tests}/sdl/tests/fonttest.c | 0 {targets => tests}/sdl/tests/linetest.c | 0 {targets => tests}/sdl/tests/pixeltest.c | 0 {targets => tests}/sdl/tests/randomshapetest.c | 0 {targets => tests}/sdl/tests/runtest.sh | 0 {targets => tests}/sdl/tests/shapetest.c | 0 {targets => tests}/sdl/tests/sierpinsky.c | 0 {targets => tests}/sdl/tests/symbolstest.c | 0 {targets => tests}/sdl/tests/textaligntest.c | 0 {targets => tests}/sdl/tests/trianglefps.c | 0 167 files changed, 579 insertions(+), 2485 deletions(-) delete mode 100644 algo/README create mode 100644 app.mk create mode 100644 build/Makefile create mode 100644 build/liblock.sh create mode 100755 build/link.sh create mode 100644 config.mk delete mode 100644 core/GP_Circle.c delete mode 100644 core/GP_FillEllipse.c delete mode 100644 core/GP_FillEllipse.h delete mode 100644 core/GP_FillRect.h delete mode 100644 core/GP_LineTrack.c delete mode 100644 core/GP_LineTrack.h delete mode 100644 core/GP_Rect.c delete mode 100644 core/Makefile delete mode 100644 core/tests/Makefile delete mode 100644 drivers/Makefile delete mode 100644 filters/Makefile delete mode 100644 filters/tests/Makefile create mode 100644 include.mk copy filters/GP_Filters.h => include/GP.h (90%) rename {core => include/backends}/GP_Backend.h (99%) rename {core => include}/config.h (91%) rename {core => include/core}/GP_Clip.h (100%) rename {core => include/core}/GP_Color.h (100%) rename {core => include/core}/GP_Common.h (100%) rename {core => include/core}/GP_Context.h (98%) rename core/GP_FillCircle.h => include/core/GP_Core.h (84%) rename {core => include/core}/GP_FnPerBpp.h (99%) rename {core => include/core}/GP_GetPixel.h (100%) rename {core => include/core}/GP_Palette.h (100%) rename {core => include/core}/GP_Pixel.h (100%) rename {core => include/core}/GP_PutPixel.h (100%) rename {core => include/core}/GP_RetCode.h (100%) rename {core => include/core}/GP_Transform.h (100%) rename {core => include/core}/GP_WritePixel.h (100%) rename {filters => include/filters}/GP_Filters.h (100%) rename {filters => include/filters}/GP_Rotate.h (98%) rename {core => include/gfx}/GP_Circle.h (89%) rename {core => include/gfx}/GP_Ellipse.h (87%) rename {core => include/gfx}/GP_Fill.h (98%) rename core/GP.h => include/gfx/GP_Gfx.h (79%) rename {core => include/gfx}/GP_HLine.h (98%) rename {core => include/gfx}/GP_Line.h (98%) rename {core => include/gfx}/GP_Polygon.h (97%) rename {core => include/gfx}/GP_Rect.h (81%) rename {core => include/gfx}/GP_Symbol.h (98%) rename {core => include/gfx}/GP_Tetragon.h (98%) rename {core => include/gfx}/GP_Triangle.h (98%) rename {core => include/gfx}/GP_VLine.h (98%) rename {input => include/input}/GP_Event.h (100%) rename {loaders => include/loaders}/GP_Loaders.h (97%) rename {loaders => include/loaders}/GP_PBM.h (98%) rename {loaders => include/loaders}/GP_PGM.h (98%) rename {core => include/text}/GP_Font.h (99%) rename {core => include/text}/GP_Text.h (97%) rename {core => include/text}/GP_TextMetric.h (100%) rename {core => include/text}/GP_TextStyle.h (99%) delete mode 100644 input/Makefile create mode 100644 lib.mk create mode 100644 libs/Makefile rename {core => libs/backends}/GP_Backend.c (98%) rename {backends => libs/backends}/GP_Backend_SDL.c (99%) create mode 100644 libs/backends/Makefile rename {core => libs/core}/GP_Color.c (100%) rename {core => libs/core}/GP_Context.c (97%) rename {core => libs/core}/GP_GetPixel.c (99%) rename {core => libs/core}/GP_Palette.c (100%) rename {core => libs/core}/GP_Pixel.c (99%) rename {core => libs/core}/GP_PutPixel.c (99%) rename {core => libs/core}/GP_RetCode.c (100%) rename {core => libs/core}/GP_WritePixel.c (99%) create mode 100644 libs/core/Makefile rename {filters => libs/filters}/GP_Rotate.c (97%) create mode 100644 libs/filters/Makefile rename {filters => libs/filters/algo}/GP_MirrorV.algo.h (98%) rename {filters => libs/filters/algo}/GP_Rotate.algo.h (97%) rename core/GP_FillCircle.c => libs/gfx/GP_Circle.c (77%) rename {core => libs/gfx}/GP_Ellipse.c (71%) rename {core => libs/gfx}/GP_Fill.c (99%) rename {core => libs/gfx}/GP_HLine.c (98%) rename {core => libs/gfx}/GP_Line.c (98%) rename {core => libs/gfx}/GP_Polygon.c (99%) rename core/GP_FillRect.c => libs/gfx/GP_Rect.c (73%) rename {core => libs/gfx}/GP_Symbol.c (99%) rename {core => libs/gfx}/GP_Tetragon.c (99%) rename {core => libs/gfx}/GP_Triangle.c (99%) rename {core => libs/gfx}/GP_VLine.c (98%) create mode 100644 libs/gfx/Makefile rename {algo => libs/gfx/algo}/Circle.algo.h (100%) rename {algo => libs/gfx/algo}/Ellipse.algo.h (100%) rename {algo => libs/gfx/algo}/FillCircle.algo.h (100%) rename {algo => libs/gfx/algo}/FillEllipse.algo.h (100%) rename {algo => libs/gfx/algo}/FillTriangle.algo.h (100%) rename {algo => libs/gfx/algo}/HLine.algo.h (100%) rename {algo => libs/gfx/algo}/Line.algo.h (100%) rename {algo => libs/gfx/algo}/VLine.algo.h (100%) rename {input => libs/input}/GP_Event.c (100%) create mode 100644 libs/input/Makefile rename {loaders => libs/loaders}/GP_PBM.c (100%) rename {loaders => libs/loaders}/GP_PGM.c (100%) rename {loaders => libs/loaders}/GP_PXMCommon.c (100%) rename {loaders => libs/loaders}/GP_PXMCommon.h (99%) create mode 100644 libs/loaders/Makefile rename {core => libs/text}/GP_DefaultFont.c (100%) rename {core => libs/text}/GP_Font.c (99%) rename {core => libs/text}/GP_Text.c (98%) rename {core => libs/text}/GP_TextMetric.c (98%) rename {core => libs/text}/GP_TextStyle.c (98%) create mode 100644 libs/text/Makefile rename {algo => libs/text/algo}/Text.algo.h (100%) delete mode 100644 loaders/Makefile delete mode 100644 loaders/tests/Makefile delete mode 100644 old_tests/Makefile delete mode 100644 old_tests/circlefps.c delete mode 100644 old_tests/circlestest.c delete mode 100644 old_tests/ellipsetest.c delete mode 100644 old_tests/linefps.c delete mode 100644 old_tests/linetest.c delete mode 100644 old_tests/pixeltest.c delete mode 100755 old_tests/runtest.sh delete mode 100644 old_tests/shapetest.c delete mode 100644 old_tests/widelinetest.c delete mode 100644 targets/sdl/Makefile create mode 100644 tests/Makefile rename {core/tests => tests/core}/GP_Comon.test.c (100%) rename {core/tests => tests/core}/GP_Tests.h (100%) create mode 100644 tests/core/Makefile rename {core/tests => tests/core}/core_tests.c (100%) rename {core/tests => tests/core}/find_tests.py (100%) rename {core/tests => tests/core}/font.test.c (100%) rename {drivers => tests/drivers}/GP_Framebuffer.c (100%) rename {drivers => tests/drivers}/GP_Framebuffer.h (100%) rename {drivers => tests/drivers}/tests/Makefile (100%) rename {drivers => tests/drivers}/tests/framebuffer_test.c (100%) rename {drivers => tests/drivers}/tests/runtest.sh (100%) rename {drivers => tests/drivers}/tests/sierpinsky.c (100%) create mode 100644 tests/filters/Makefile rename {filters/tests => tests/filters}/PGM_rotate.c (100%) rename {filters/tests => tests/filters}/rotate_test.c (100%) rename {filters/tests => tests/filters}/runtest.sh (100%) rename {filters/tests => tests/filters}/test-big.pgm (100%) create mode 100644 tests/loaders/Makefile rename {loaders/tests => tests/loaders}/PBM_invert.c (100%) rename {loaders/tests => tests/loaders}/PBM_test.c (100%) rename {loaders/tests => tests/loaders}/PGM_invert.c (100%) rename {loaders/tests => tests/loaders}/PGM_test.c (100%) rename {loaders/tests => tests/loaders}/autotest.sh (100%) rename {loaders/tests => tests/loaders}/runtest.sh (100%) rename {targets => tests}/sdl/GP_SDL.h (100%) rename {targets => tests}/sdl/GP_SDL_Context.c (100%) rename {targets => tests}/sdl/GP_SDL_Context.h (100%) rename {targets => tests}/sdl/GP_SDL_VideoInit.c (100%) rename {targets => tests}/sdl/GP_SDL_VideoInit.h (100%) create mode 100644 tests/sdl/Makefile rename {targets => tests}/sdl/tests/Makefile (100%) rename {targets => tests}/sdl/tests/fileview.c (100%) rename {targets => tests}/sdl/tests/fonttest.c (100%) rename {targets => tests}/sdl/tests/linetest.c (100%) rename {targets => tests}/sdl/tests/pixeltest.c (100%) rename {targets => tests}/sdl/tests/randomshapetest.c (100%) rename {targets => tests}/sdl/tests/runtest.sh (100%) rename {targets => tests}/sdl/tests/shapetest.c (100%) rename {targets => tests}/sdl/tests/sierpinsky.c (100%) rename {targets => tests}/sdl/tests/symbolstest.c (100%) rename {targets => tests}/sdl/tests/textaligntest.c (100%) rename {targets => tests}/sdl/tests/trianglefps.c (100%)
repo.or.cz automatic notification. Contact project admin jiri.bluebear.dluhos@gmail.com if you want to unsubscribe, or site admin admin@repo.or.cz if you receive no reply.