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 ce13a7e7695f7264c8fe0047a912bcc1b9cf5126 (commit) from 6c3a610f5c62bbcfbdabd7a538d97bc455fae1b4 (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/ce13a7e7695f7264c8fe0047a912bcc1b9cf5...
commit ce13a7e7695f7264c8fe0047a912bcc1b9cf5126 Author: Jiri BlueBear Dluhos jiri.bluebear.dluhos@gmail.com Date: Sat Dec 8 22:49:44 2012 +0100
Templatized GP_FillCircle.
diff --git a/libs/gfx/GP_Circle.c b/libs/gfx/GP_Circle.c index 66e63c5..d8973e4 100644 --- a/libs/gfx/GP_Circle.c +++ b/libs/gfx/GP_Circle.c @@ -53,29 +53,10 @@ void GP_Circle(GP_Context *context, GP_Coord xcenter, GP_Coord ycenter, GP_Circle_Raw(context, xcenter, ycenter, r, pixel); }
-#include "algo/FillCircle.algo.h" +/* #include "algo/FillCircle.algo.h" */
/* Generate drawing functions for various bit depths. */ -GP_DEF_FILL_FN_PER_BPP(GP_FillCircle_Raw, DEF_FILLCIRCLE_FN) - -void GP_FillCircle_Raw(GP_Context *context, GP_Coord xcenter, GP_Coord ycenter, - GP_Size r, GP_Pixel pixel) -{ - GP_CHECK_CONTEXT(context); - - GP_FN_PER_BPP_CONTEXT(GP_FillCircle_Raw, context, context, - xcenter, ycenter, r, pixel); -} - -void GP_FillCircle(GP_Context *context, GP_Coord xcenter, GP_Coord ycenter, - GP_Size r, GP_Pixel pixel) -{ - GP_CHECK_CONTEXT(context); - - GP_TRANSFORM_POINT(context, xcenter, ycenter); - - GP_FillCircle_Raw(context, xcenter, ycenter, r, pixel); -} +//GP_DEF_FILL_FN_PER_BPP(GP_FillCircle_Raw, DEF_FILLCIRCLE_FN)
void GP_Ring_Raw(GP_Context *context, GP_Coord xcenter, GP_Coord ycenter, GP_Size r1, GP_Size r2, GP_Pixel pixel) diff --git a/libs/gfx/GP_FillCircle.gen.c.t b/libs/gfx/GP_FillCircle.gen.c.t new file mode 100644 index 0000000..db72768 --- /dev/null +++ b/libs/gfx/GP_FillCircle.gen.c.t @@ -0,0 +1,66 @@ +%% extends "base.c.t" + +{% block descr %}Circle filling algorithm{% endblock %} + +%% block body + +#include "core/GP_GetPutPixel.h" +#include "core/GP_FnPerBpp.h" +#include "gfx/GP_Circle.h" +#include "gfx/GP_HLine.h" + +/* + * A filled circle drawing algorithm. + * + * A filled circle is drawn in the same way as an unfilled one, + * in a top-down, line per line manner, except that we don't need to draw + * four points in each X step. Instead, we just iterate X + * until we accumulate enough Y changes to reach the next line, + * and then draw the full line. The top and bottom half are mirrored. + */ + +%% for ps in pixelsizes + +void GP_FillCircle_Raw_{{ ps.suffix }}(GP_Context *context, + GP_Coord xcenter, GP_Coord ycenter, GP_Size r, GP_Pixel pixel) +{ + /* for r == 0, circle degenerates to a point */ + if (r == 0) { + GP_PutPixel_Raw_{{ ps.suffix }}(context, xcenter, ycenter, pixel); + return; + } + + int x, y, error; + for (x = 0, error = -r, y = r; y >= 0; y--) { + while (error < 0) { + error += 2*x + 1; + x++; + } + error += -2*y + 1; + GP_HLine_Raw_{{ ps.suffix }}(context, xcenter-x+1, xcenter+x-1, ycenter-y, pixel); + GP_HLine_Raw_{{ ps.suffix }}(context, xcenter-x+1, xcenter+x-1, ycenter+y, pixel); + } +} + +%% endfor + +void GP_FillCircle_Raw(GP_Context *context, GP_Coord xcenter, GP_Coord ycenter, + GP_Size r, GP_Pixel pixel) +{ + GP_CHECK_CONTEXT(context); + + GP_FN_PER_BPP_CONTEXT(GP_FillCircle_Raw, context, context, + xcenter, ycenter, r, pixel); +} + +void GP_FillCircle(GP_Context *context, GP_Coord xcenter, GP_Coord ycenter, + GP_Size r, GP_Pixel pixel) +{ + GP_CHECK_CONTEXT(context); + + GP_TRANSFORM_POINT(context, xcenter, ycenter); + + GP_FillCircle_Raw(context, xcenter, ycenter, r, pixel); +} + +%% endblock body diff --git a/libs/gfx/Makefile b/libs/gfx/Makefile index dae754e..0641888 100644 --- a/libs/gfx/Makefile +++ b/libs/gfx/Makefile @@ -1,7 +1,7 @@ TOPDIR=../.. CSOURCES=$(filter-out $(wildcard *.gen.c),$(wildcard *.c)) GENSOURCES=GP_LineAA.gen.c GP_PutPixelAA.gen.c GP_HLineAA.gen.c - GP_VLineAA.gen.c + GP_VLineAA.gen.c GP_FillCircle.gen.c LIBNAME=gfx
include $(TOPDIR)/pre.mk diff --git a/libs/gfx/algo/FillCircle.algo.h b/libs/gfx/algo/FillCircle.algo.h deleted file mode 100644 index b3eeb6b..0000000 --- a/libs/gfx/algo/FillCircle.algo.h +++ /dev/null @@ -1,64 +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 * - * * - *****************************************************************************/ - -/* - * A filled circle drawing algorithm. - * - * A filled circle is drawn in the same way as an unfilled one, - * in a top-down, line per line manner, except that we don't need to draw - * four points in each X step. Instead, we just iterate X - * until we accumulate enough Y changes to reach the next line, - * and then draw the full line. - */ - -/* - * This macro defines a filled circle drawing function. - * Arguments: - * CONTEXT_T - user-defined type of drawing context (passed to HLINE) - * PIXVAL_T - user-defined pixel value type (passed to HLINE) - * HLINE - horizontal line drawing function f(context, x0, x1, y, pixval) - * FN_NAME - name of the function to be defined - */ -#define DEF_FILLCIRCLE_FN(FN_NAME, CONTEXT_T, PIXVAL_T, HLINE) -void FN_NAME(CONTEXT_T context, int xcenter, int ycenter, - unsigned int r, PIXVAL_T pixval) -{ - /* for r == 0, circle degenerates to a point */ - if (r == 0) { - HLINE(context, xcenter, xcenter, ycenter, pixval); - return; - } -- int x, y, error; - for (x = 0, error = -r, y = r; y >= 0; y--) { - while (error < 0) { - error += 2*x + 1; - x++; - } - error += -2*y + 1; - HLINE(context, xcenter-x+1, xcenter+x-1, ycenter-y, pixval); - HLINE(context, xcenter-x+1, xcenter+x-1, ycenter+y, pixval); - } -}
-----------------------------------------------------------------------
Summary of changes: libs/gfx/GP_Circle.c | 23 +------------ libs/gfx/GP_FillCircle.gen.c.t | 66 +++++++++++++++++++++++++++++++++++++++ libs/gfx/Makefile | 2 +- libs/gfx/algo/FillCircle.algo.h | 64 ------------------------------------- 4 files changed, 69 insertions(+), 86 deletions(-) create mode 100644 libs/gfx/GP_FillCircle.gen.c.t delete mode 100644 libs/gfx/algo/FillCircle.algo.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.