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 037f2ffabeabd1a2522169b7b766333a64680762 (commit) from 21f013df6c1f9ff561304ef0543589baefd79a9b (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/037f2ffabeabd1a2522169b7b766333a64680...
commit 037f2ffabeabd1a2522169b7b766333a64680762 Author: BlueBear jiri.bluebear.dluhos@gmail.com Date: Sun May 8 14:59:20 2011 +0200
Tetragons now drawn with the polygon routine.
diff --git a/core/GP.h b/core/GP.h index 9600772..8254d49 100644 --- a/core/GP.h +++ b/core/GP.h @@ -52,7 +52,6 @@ #include "GP_FillRect.h" #include "GP_Triangle.h" #include "GP_Tetragon.h" -#include "GP_FillTetragon.h" #include "GP_Circle.h" #include "GP_FillCircle.h" #include "GP_Ellipse.h" diff --git a/core/GP_FillTetragon.c b/core/GP_FillTetragon.c deleted file mode 100644 index 9f7e36a..0000000 --- a/core/GP_FillTetragon.c +++ /dev/null @@ -1,49 +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_FillTetragon(GP_Context * context, int x0, int y0, int x1, int y1, - int x2, int y2, int x3, int y3, GP_Pixel pixel) -{ - GP_CHECK_CONTEXT(context); - - //TODO: fix this! - GP_FillTriangle(context, x0, y0, x1, y1, x2, y2, pixel); - GP_FillTriangle(context, x3, y3, x1, y1, x2, y2, pixel); -} - -void GP_TFillTetragon(GP_Context* context, int x0, int y0, int x1, int y1, - int x2, int y2, int x3, int y3, GP_Pixel pixel) -{ - GP_CHECK_CONTEXT(context); - - GP_TRANSFORM_POINT(context, x0, y0); - GP_TRANSFORM_POINT(context, x1, y1); - GP_TRANSFORM_POINT(context, x2, y2); - GP_TRANSFORM_POINT(context, x3, y3); - - GP_FillTetragon(context, x0, y0, x1, y1, x2, y2, x3, y3, pixel); -} diff --git a/core/GP_FillTetragon.h b/core/GP_FillTetragon.h deleted file mode 100644 index 0335648..0000000 --- a/core/GP_FillTetragon.h +++ /dev/null @@ -1,37 +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_FILLTETRAGON_H -#define GP_FILLTETRAGON_H - -#include "GP_Context.h" - -void GP_FillTetragon(GP_Context *context, int x0, int y0, int x1, int y1, - int x2, int y2, int x3, int y3, GP_Pixel pixel); - -void GP_TFillTetragon(GP_Context *context, int x0, int y0, int x1, int y1, - int x2, int y2, int x3, int y3, GP_Pixel pixel); - -#endif /* GP_FILLTETRAGON_H */ diff --git a/core/GP_Tetragon.c b/core/GP_Tetragon.c index 4618002..2f0b777 100644 --- a/core/GP_Tetragon.c +++ b/core/GP_Tetragon.c @@ -48,3 +48,26 @@ void GP_TTetragon(GP_Context *context, int x0, int y0, int x1, int y1,
GP_Tetragon(context, x0, y0, x1, y1, x2, y2, x3, y3, pixel); } + +void GP_FillTetragon(GP_Context *context, int x0, int y0, int x1, int y1, + int x2, int y2, int x3, int y3, GP_Pixel pixel) +{ + GP_CHECK_CONTEXT(context); + + int xy[8] = { x0, y0, x1, y1, x2, y2, x3, y3 }; + GP_FillPolygon(context, 4, (const int *) xy, pixel); +} + +void GP_TFillTetragon(GP_Context* context, int x0, int y0, int x1, int y1, + int x2, int y2, int x3, int y3, GP_Pixel pixel) +{ + GP_CHECK_CONTEXT(context); + + GP_TRANSFORM_POINT(context, x0, y0); + GP_TRANSFORM_POINT(context, x1, y1); + GP_TRANSFORM_POINT(context, x2, y2); + GP_TRANSFORM_POINT(context, x3, y3); + + int xy[8] = { x0, y0, x1, y1, x2, y2, x3, y3 }; + GP_FillPolygon(context, 4, (const int *) xy, pixel); +} diff --git a/core/GP_Tetragon.h b/core/GP_Tetragon.h index 5ed30d0..f69aee8 100644 --- a/core/GP_Tetragon.h +++ b/core/GP_Tetragon.h @@ -34,4 +34,10 @@ void GP_Tetragon(GP_Context *context, int x0, int y0, int x1, int y1, void GP_TTetragon(GP_Context *context, int x0, int y0, int x1, int y1, int x2, int y2, int x3, int y3, GP_Pixel pixel);
+void GP_FillTetragon(GP_Context *context, int x0, int y0, int x1, int y1, + int x2, int y2, int x3, int y3, GP_Pixel pixel); + +void GP_TFillTetragon(GP_Context *context, int x0, int y0, int x1, int y1, + int x2, int y2, int x3, int y3, GP_Pixel pixel); + #endif /* GP_TETRAGON_H */ diff --git a/targets/sdl/tests/randomshapetest.c b/targets/sdl/tests/randomshapetest.c index 3cb267f..b46125d 100644 --- a/targets/sdl/tests/randomshapetest.c +++ b/targets/sdl/tests/randomshapetest.c @@ -59,7 +59,8 @@ Uint32 timer_callback(__attribute__((unused)) Uint32 interval, #define SHAPE_ELLIPSE 2 #define SHAPE_TRIANGLE 3 #define SHAPE_RECTANGLE 4 -#define SHAPE_LAST 4 +#define SHAPE_TETRAGON 5 +#define SHAPE_LAST 5 static int shape = SHAPE_FIRST;
/* Draw outlines? */ @@ -144,6 +145,23 @@ void draw_random_rectangle(GP_Pixel pixel) } }
+void draw_random_tetragon(GP_Pixel pixel) +{ + int x0, y0, x1, y1, x2, y2, x3, y3; + random_point(display, &x0, &y0); + random_point(display, &x1, &y1); + random_point(display, &x2, &y2); + random_point(display, &x3, &y3); + + if (fill_flag) { + GP_FillTetragon(&context, x0, y0, x1, y1, x2, y2, x3, y3, pixel); + } + + if (outline_flag) { + GP_Tetragon(&context, x0, y0, x1, y1, x2, y2, x3, y3, pixel); + } +} + void clear_screen(void) { SDL_LockSurface(display); @@ -178,6 +196,10 @@ void redraw_screen(void) case SHAPE_RECTANGLE: draw_random_rectangle(pixel); break; + + case SHAPE_TETRAGON: + draw_random_tetragon(pixel); + break; }
SDL_UnlockSurface(display); diff --git a/targets/sdl/tests/shapetest.c b/targets/sdl/tests/shapetest.c index 6e17cc1..fb85b2e 100644 --- a/targets/sdl/tests/shapetest.c +++ b/targets/sdl/tests/shapetest.c @@ -136,8 +136,9 @@ void draw_testing_triangle(int x, int y, int xradius, int yradius) if (outline == 1) GP_TTriangle(&context, x0, y0, x1, y1, x2, y2, yellow);
- if (fill) + if (fill) { GP_TFillTriangle(&context, x0, y0, x1, y1, x2, y2, red); + }
if (outline == 2) GP_TTriangle(&context, x0, y0, x1, y1, x2, y2, white);
-----------------------------------------------------------------------
Summary of changes: core/GP.h | 1 - core/GP_FillTetragon.c | 49 ----------------------------------- core/GP_FillTetragon.h | 37 -------------------------- core/GP_Tetragon.c | 23 ++++++++++++++++ core/GP_Tetragon.h | 6 ++++ targets/sdl/tests/randomshapetest.c | 24 ++++++++++++++++- targets/sdl/tests/shapetest.c | 3 +- 7 files changed, 54 insertions(+), 89 deletions(-) delete mode 100644 core/GP_FillTetragon.c delete mode 100644 core/GP_FillTetragon.h
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.