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 37cb764fee13f5de90edebad64c54d22870590ea (commit) from b3779d6def780f74dc0dbaed7ed5f5172a9faa7c (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/37cb764fee13f5de90edebad64c54d2287059...
commit 37cb764fee13f5de90edebad64c54d22870590ea Author: BlueBear jiri.bluebear.dluhos@gmail.com Date: Sun Jul 17 21:59:51 2011 +0200
Fixed some +/-1 errors in Ring and improved API.
diff --git a/include/gfx/GP_Circle.h b/include/gfx/GP_Circle.h index 57b5a0a..e743abd 100644 --- a/include/gfx/GP_Circle.h +++ b/include/gfx/GP_Circle.h @@ -41,9 +41,9 @@ void GP_TFillCircle(GP_Context *context, int xcenter, int ycenter, unsigned int r, GP_Pixel pixel);
void GP_FillRing(GP_Context *context, int xcenter, int ycenter, - unsigned int outer_r, unsigned int inner_r, GP_Pixel pixel); + unsigned int r1, unsigned int r2, GP_Pixel pixel);
void GP_TFillRing(GP_Context *context, int xcenter, int ycenter, - unsigned int outer_r, unsigned int inner_r, GP_Pixel pixel); + unsigned int r1, unsigned int r2, GP_Pixel pixel);
#endif /* GP_CIRCLE_H */ diff --git a/libs/gfx/GP_Circle.c b/libs/gfx/GP_Circle.c index 427a9ad..b63fc98 100644 --- a/libs/gfx/GP_Circle.c +++ b/libs/gfx/GP_Circle.c @@ -97,20 +97,20 @@ DEF_FILLRING_FN(GP_FillRing24bpp, GP_Context *, GP_Pixel, GP_HLine24bpp) DEF_FILLRING_FN(GP_FillRing32bpp, GP_Context *, GP_Pixel, GP_HLine32bpp)
void GP_FillRing(GP_Context *context, int xcenter, int ycenter, - unsigned int outer_r, unsigned int inner_r, GP_Pixel pixel) + unsigned int r1, unsigned int r2, GP_Pixel pixel) { GP_CHECK_CONTEXT(context);
GP_FN_PER_BPP(GP_FillRing, context->bpp, context, - xcenter, ycenter, outer_r, inner_r, pixel); + xcenter, ycenter, r1, r2, pixel); }
void GP_TFillRing(GP_Context *context, int xcenter, int ycenter, - unsigned int outer_r, unsigned int inner_r, GP_Pixel pixel) + unsigned int r1, unsigned int r2, GP_Pixel pixel) { GP_CHECK_CONTEXT(context); GP_TRANSFORM_POINT(context, xcenter, ycenter); - GP_FillRing(context, xcenter, ycenter, outer_r, inner_r, pixel); + GP_FillRing(context, xcenter, ycenter, r1, r2, pixel); } diff --git a/libs/gfx/algo/FillRing.algo.h b/libs/gfx/algo/FillRing.algo.h index 4458bec..96dfa79 100644 --- a/libs/gfx/algo/FillRing.algo.h +++ b/libs/gfx/algo/FillRing.algo.h @@ -37,10 +37,10 @@ */ #define DEF_FILLRING_FN(FN_NAME, CONTEXT_T, PIXVAL_T, HLINE) void FN_NAME(CONTEXT_T context, int xcenter, int ycenter, - unsigned int outer_r, unsigned int inner_r, PIXVAL_T pixval) + unsigned int r1, unsigned int r2, PIXVAL_T pixval) { - if (inner_r >= outer_r) return; -+ int outer_r = (int) GP_MAX(r1, r2); + int inner_r = (int) GP_MIN(r1, r2); int outer_x = 0; int inner_x = 0; int y; @@ -54,17 +54,17 @@ void FN_NAME(CONTEXT_T context, int xcenter, int ycenter, } outer_error += -2*y + 1; - if (y < (int) inner_r && y > -((int) inner_r)) { + if (y <= (int) inner_r && y >= -((int) inner_r)) { while (inner_error < 0) { inner_error += 2*inner_x + 1; inner_x++; } inner_error += -2*y + 1; - HLINE(context, xcenter - outer_x + 1, xcenter - inner_x - 1, ycenter - y, pixval); - HLINE(context, xcenter + inner_x + 1, xcenter + outer_x - 1, ycenter - y, pixval); - HLINE(context, xcenter - outer_x + 1, xcenter - inner_x - 1, ycenter + y, pixva l); - HLINE(context, xcenter + inner_x + 1, xcenter + outer_x - 1, ycenter + y, pixval); + HLINE(context, xcenter - outer_x + 1, xcenter - inner_x + 1, ycenter - y, pixval); + HLINE(context, xcenter + inner_x - 1, xcenter + outer_x - 1, ycenter - y, pixval); + HLINE(context, xcenter - outer_x + 1, xcenter - inner_x + 1, ycenter + y, pixval); + HLINE(context, xcenter + inner_x - 1, xcenter + outer_x - 1, ycenter + y, pixval); } else { HLINE(context, xcenter - outer_x + 1, xcenter + outer_x - 1, ycenter-y, pixval); HLINE(context, xcenter - outer_x + 1, xcenter + outer_x - 1, ycenter+y, pixval); diff --git a/tests/SDL/shapetest.c b/tests/SDL/shapetest.c index d1009d9..0587c55 100644 --- a/tests/SDL/shapetest.c +++ b/tests/SDL/shapetest.c @@ -164,14 +164,8 @@ void draw_testing_ring(int x, int y, int xradius, if (outline == 1) GP_TCircle(&context, x, y, xradius, yellow);
- if (fill) { - if (xradius == yradius) { - GP_TFillRing(&context, x, y, xradius, xradius/2, red); - } else { - GP_TFillRing(&context, x, y, GP_MAX(xradius, yradius), - GP_MIN(xradius, yradius), red); - } - } + if (fill) + GP_TFillRing(&context, x, y, xradius, yradius, red);
if (outline == 2) GP_TCircle(&context, x, y, xradius, white);
-----------------------------------------------------------------------
Summary of changes: include/gfx/GP_Circle.h | 4 ++-- libs/gfx/GP_Circle.c | 8 ++++---- libs/gfx/algo/FillRing.algo.h | 16 ++++++++-------- tests/SDL/shapetest.c | 10 ++-------- 4 files changed, 16 insertions(+), 22 deletions(-)
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.