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 14d0a7da4df6fac46b50da3afd0ab8fe35653e6f (commit) via 4e3436903e82cb8d907c20f466f74861a1d4f8d0 (commit) from 3bb0c27b1b845641f8e8d69a28244b2ecc028d08 (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/14d0a7da4df6fac46b50da3afd0ab8fe35653...
commit 14d0a7da4df6fac46b50da3afd0ab8fe35653e6f Author: Cyril Hrubis metan@ucw.cz Date: Tue Jul 31 23:24:42 2012 +0200
demos: rename sierpinsky to koch (the name was wrong to begin with).
diff --git a/demos/c_simple/Makefile b/demos/c_simple/Makefile index cefd2bb..ec6ac66 100644 --- a/demos/c_simple/Makefile +++ b/demos/c_simple/Makefile @@ -8,7 +8,7 @@ LDLIBS+=-lrt `$(TOPDIR)/gfxprim-config --libs --libs-backends`
APPS=backend_example loaders_example loaders filters_symmetry gfx_koch virtual_backend_example meta_data meta_data_dump tmp_file showimage- v4l2_show v4l2_grab convolution weighted_median shapetest sierpinsky + v4l2_show v4l2_grab convolution weighted_median shapetest koch
v4l2_show: LDLIBS+=-lGP_grabbers v4l2_grab: LDLIBS+=-lGP_grabbers diff --git a/demos/c_simple/sierpinsky.c b/demos/c_simple/koch.c similarity index 98% rename from demos/c_simple/sierpinsky.c rename to demos/c_simple/koch.c index db52a04..6668cb0 100644 --- a/demos/c_simple/sierpinsky.c +++ b/demos/c_simple/koch.c @@ -128,7 +128,7 @@ int main(void) { const char *backend_opts = "X11"; - backend = GP_BackendInit(backend_opts, "Shapetest", stderr); + backend = GP_BackendInit(backend_opts, "Koch", stderr);
if (backend == NULL) { fprintf(stderr, "Failed to initalize backend '%s'n",
http://repo.or.cz/w/gfxprim.git/commit/4e3436903e82cb8d907c20f466f74861a1d4f...
commit 4e3436903e82cb8d907c20f466f74861a1d4f8d0 Author: Cyril Hrubis metan@ucw.cz Date: Tue Jul 31 23:22:40 2012 +0200
demos: Port sierpinsky from SDL to GFXprim backends.
diff --git a/demos/c_simple/Makefile b/demos/c_simple/Makefile index 32adf69..cefd2bb 100644 --- a/demos/c_simple/Makefile +++ b/demos/c_simple/Makefile @@ -8,7 +8,7 @@ LDLIBS+=-lrt `$(TOPDIR)/gfxprim-config --libs --libs-backends`
APPS=backend_example loaders_example loaders filters_symmetry gfx_koch virtual_backend_example meta_data meta_data_dump tmp_file showimage- v4l2_show v4l2_grab convolution weighted_median shapetest + v4l2_show v4l2_grab convolution weighted_median shapetest sierpinsky
v4l2_show: LDLIBS+=-lGP_grabbers v4l2_grab: LDLIBS+=-lGP_grabbers diff --git a/demos/c_simple/shapetest.c b/demos/c_simple/shapetest.c index 3f50d5a..ef33b04 100644 --- a/demos/c_simple/shapetest.c +++ b/demos/c_simple/shapetest.c @@ -434,8 +434,6 @@ int main(int argc, char ** argv)
// GP_SetDebugLevel(10);
- backend_opts = "SDL:320x240"; - backend = GP_BackendInit(backend_opts, "Shapetest", stderr);
if (backend == NULL) { diff --git a/tests/SDL/sierpinsky.c b/demos/c_simple/sierpinsky.c similarity index 72% rename from tests/SDL/sierpinsky.c rename to demos/c_simple/sierpinsky.c index 5d1e0f9..db52a04 100644 --- a/tests/SDL/sierpinsky.c +++ b/demos/c_simple/sierpinsky.c @@ -19,7 +19,7 @@ * Copyright (C) 2009-2010 Jiri "BlueBear" Dluhos * * jiri.bluebear.dluhos@gmail.com * * * - * Copyright (C) 2009-2011 Cyril Hrubis metan@ucw.cz * + * Copyright (C) 2009-2012 Cyril Hrubis metan@ucw.cz * * * *****************************************************************************/
@@ -29,27 +29,21 @@
*/
-#include "GP_SDL.h" - -#include <SDL/SDL.h> #include <math.h>
-#define TIMER_TICK 50 +#include <GP.h> + +#define TIMER_TICK 10000 #define DISPLAY_W 640 #define DISPLAY_H 480 #define sqr(x) ((x)*(x)) #define sgn(x) ((x)>0 ? 1 : -1)
-SDL_Surface *display; -GP_Context *context, ctx; - -SDL_TimerID timer; - -int iter, l, way = 1; +static GP_Backend *backend; +static GP_Context *context;
-GP_Pixel black, blue, gray, red; - -int draw_edge = 1; +static int iter, l, way = 1, draw_edge = 1; +static GP_Pixel black, blue, gray, red;
static void sierpinsky(double x1, double y1, double x4, double y4, int iter) { @@ -109,92 +103,80 @@ static void draw(int x, int y, int l, int iter) sierpinsky(x2, y2, x3, y3, iter/60%6); sierpinsky(x3, y3, x1, y1, iter/60%6);
- SDL_Flip(display); + GP_BackendFlip(backend); }
-int paused = 0; +static int paused = 0;
-Uint32 timer_callback(Uint32 interval __attribute__ ((unused)), - void *ptr __attribute__ ((unused))) +void redraw(void) { if (paused) - return TIMER_TICK; + return;
iter += 2 * way; - if (iter + 2 * way > 350) + if (iter > 350) way *= -1; - if (iter < 2 * way) - way *= 1; - - draw(display->w/2, display->h/2, l, iter); + if (iter < 0) + way *= -1;
- return TIMER_TICK; + draw(context->w/2, context->h/2, l, iter); }
int main(void) { - SDL_Event ev; - - if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_TIMER) != 0) - return -1; - - display = SDL_SetVideoMode(DISPLAY_W, DISPLAY_H, 0, SDL_SWSURFACE | SDL_RESIZABLE | SDL_DOUBLEBUF); + const char *backend_opts = "X11"; + + backend = GP_BackendInit(backend_opts, "Shapetest", stderr);
- if (display == NULL) { - SDL_Quit(); - return -1; + if (backend == NULL) { + fprintf(stderr, "Failed to initalize backend '%s'n", + backend_opts); + return 1; } - - GP_SDL_ContextFromSurface(&ctx, display); - - context = &ctx; - + + context = backend->context; + black = GP_ColorToContextPixel(GP_COL_BLACK, context); blue = GP_ColorToContextPixel(GP_COL_BLUE, context); gray = GP_ColorToContextPixel(GP_COL_GRAY_LIGHT, context); red = GP_ColorToContextPixel(GP_COL_RED, context); - + iter = 0; - draw(display->w/2, display->h/2, l, iter); + draw(context->w/2, context->h/2, l, iter);
- timer = SDL_AddTimer(0, timer_callback, NULL); + for (;;) { + GP_Event ev;
- if (timer == 0) { - SDL_Quit(); - return -1; - } - - while (SDL_WaitEvent(&ev) > 0) { - switch (ev.type) { - case SDL_KEYDOWN: - switch(ev.key.keysym.sym) { - case SDLK_p: - paused = !paused; - break; - case SDLK_e: - draw_edge = !draw_edge; - break; - case SDLK_ESCAPE: - SDL_Quit(); - return 0; - break; - default: - break; + redraw(); + + GP_BackendPoll(backend); + + while (GP_EventGet(&ev)) { + GP_EventDump(&ev); + + switch (ev.type) { + case GP_EV_KEY: + if (ev.code != GP_EV_KEY_DOWN) + continue; + + switch (ev.val.key.key) { + case GP_KEY_P: + paused = !paused; + break; + case GP_KEY_E: + draw_edge = !draw_edge; + break; + case GP_KEY_ESC: + GP_BackendExit(backend); + return 0; + break; } - break; - case SDL_QUIT: - SDL_Quit(); - return 0; - break; - default: - break; + } } + usleep(TIMER_TICK); } - - SDL_Quit(); - + return 0; } - diff --git a/tests/SDL/Makefile b/tests/SDL/Makefile index 26cfa60..228df9e 100644 --- a/tests/SDL/Makefile +++ b/tests/SDL/Makefile @@ -7,7 +7,7 @@ LDLIBS+=-lGP -L$(TOPDIR)/build/ -lGP_SDL -lSDL ifeq ($(HAVE_LIBSDL),yes) CSOURCES=$(shell echo *.c)
-APPS=pixeltest fileview fonttest linetest randomshapetest sierpinsky+APPS=pixeltest fileview fonttest linetest randomshapetest symbolstest textaligntest trianglefps input blittest subcontext showimage aatest mixpixeltest endif
-----------------------------------------------------------------------
Summary of changes: demos/c_simple/Makefile | 2 +- tests/SDL/sierpinsky.c => demos/c_simple/koch.c | 130 ++++++++++------------- demos/c_simple/shapetest.c | 2 - tests/SDL/Makefile | 2 +- 4 files changed, 58 insertions(+), 78 deletions(-) rename tests/SDL/sierpinsky.c => demos/c_simple/koch.c (72%)
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.