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 2cf30f8101ea618085a197ea6bb8bad9d5cb0708 (commit)
via 1f85f38df0b1e641ff42cd36279162436e74fcb0 (commit)
via bee55d2f8ce82f2cae2ad16fa0f61af7aa9801da (commit)
from fd8d609eb63fb8753bcbf69c882a9b9b4b58e966 (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/2cf30f8101ea618085a197ea6bb8bad9d5cb…
commit 2cf30f8101ea618085a197ea6bb8bad9d5cb0708
Merge: 1f85f38 fd8d609
Author: Jiri BlueBear Dluhos <jiri.bluebear.dluhos(a)gmail.com>
Date: Sun Dec 9 17:30:23 2012 +0100
Merge branch 'master' of ssh://repo.or.cz/srv/git/gfxprim
http://repo.or.cz/w/gfxprim.git/commit/1f85f38df0b1e641ff42cd36279162436e74…
commit 1f85f38df0b1e641ff42cd36279162436e74fcb0
Author: Jiri BlueBear Dluhos <jiri.bluebear.dluhos(a)gmail.com>
Date: Sun Dec 9 17:28:27 2012 +0100
Slightly better handling of joints in GP_FillPolygon().
diff --git a/libs/gfx/GP_Polygon.c b/libs/gfx/GP_Polygon.c
index 3b7c2e7..2114006 100644
--- a/libs/gfx/GP_Polygon.c
+++ b/libs/gfx/GP_Polygon.c
@@ -66,17 +66,22 @@ static void GP_InitEdge(struct GP_PolygonEdge *edge, float x1, float y1,
edge->dx_by_dy = dx / dy;
}
+static int GP_IsEdgeHorizontal(struct GP_PolygonEdge *edge)
+{
+ return ((edge->ymax - edge->ymin) < GP_HORIZ_DY_THRESHOLD);
+}
+
/* Computes an intersection of the specified scanline with the given edge.
* If successful, returns 1 and stores the resulting X coordinate into result_x.
* If failed (the edge does not intersect), 0 is returned.
- * Horizontal edges are considered to never intersect.
+ * Horizontal edges are ignored at this point (result is always 0).
*/
static int GP_ComputeIntersection(float *result_x, struct GP_PolygonEdge *edge, float y)
{
if (y<edge->ymin || y>edge->ymax)
return 0; /* outside the edge Y range */
- if (edge->ymax - edge->ymin < GP_HORIZ_DY_THRESHOLD)
+ if (GP_IsEdgeHorizontal(edge))
return 0; /* ignore horizontal edges */
*result_x = edge->x1 + (y-edge->y1)*edge->dx_by_dy;
@@ -112,6 +117,18 @@ static int GP_ComputeScanline(float *results, struct GP_PolygonEdge *edges,
struct GP_PolygonEdge *edge = edges + edge_index;
float x;
+ /*
+ * Horizontal edges match either as a whole (yielding two
+ * intersections), or not at all.
+ */
+ if (GP_IsEdgeHorizontal(edge)) {
+ if (fabsf(edge->ymin - y) < 0.00001f) {
+ results[result_index++] = GP_MIN(edge->x1, edge->x2);
+ results[result_index++] = GP_MAX(edge->x1, edge->x2);
+ }
+ continue;
+ }
+
if (GP_ComputeIntersection(&x, edge, y)) {
results[result_index++] = x;
}
@@ -127,7 +144,7 @@ void GP_FillPolygon_Raw(GP_Context *context, unsigned int vertex_count,
{
float ymin = HUGE_VALF, ymax = -HUGE_VALF;
struct GP_PolygonEdge *edge;
- struct GP_PolygonEdge edges[vertex_count];
+ struct GP_PolygonEdge edges[2*vertex_count];
/* Build edge structures for each vertex-vertex connection.
http://repo.or.cz/w/gfxprim.git/commit/bee55d2f8ce82f2cae2ad16fa0f61af7aa98…
commit bee55d2f8ce82f2cae2ad16fa0f61af7aa9801da
Author: Jiri BlueBear Dluhos <jiri.bluebear.dluhos(a)gmail.com>
Date: Sun Dec 9 17:07:58 2012 +0100
Fixed an assertion crash in FillPolygon.
diff --git a/libs/gfx/GP_Polygon.c b/libs/gfx/GP_Polygon.c
index 0901922..3b7c2e7 100644
--- a/libs/gfx/GP_Polygon.c
+++ b/libs/gfx/GP_Polygon.c
@@ -28,6 +28,7 @@
#include <math.h>
#include "core/GP_Transform.h"
+#include "core/GP_GetPutPixel.h"
#include "GP_Line.h"
#include "GP_HLine.h"
@@ -157,10 +158,24 @@ void GP_FillPolygon_Raw(GP_Context *context, unsigned int vertex_count,
for (y = (int) ymin; y <= (int) ymax; y++) {
int inter_count = GP_ComputeScanline(intersections, edges, vertex_count, y + 0.5f);
- GP_ASSERT(inter_count % 2 == 0, "odd number of intersections!");
-
- for (i = 0; i < inter_count; i+=2) {
- GP_HLine_Raw(context, intersections[i], intersections[i + 1], y, pixel);
+ i = 0;
+ for (;;) {
+ if (i >= inter_count) break;
+ float start = intersections[i++];
+ if (i >= inter_count) {
+
+ /* a solo vertex or a single-point intersection */
+ GP_PutPixel_Raw(context, start, y, pixel);
+ break;
+ }
+ float end = intersections[i++];
+ if (start == end) {
+
+ /* two intersections - edge joint */
+ if (i >= inter_count) break;
+ end = intersections[i++];
+ }
+ GP_HLine_Raw(context, start, end, y, pixel);
}
}
}
-----------------------------------------------------------------------
Summary of changes:
libs/gfx/GP_Polygon.c | 46 +++++++++++++++++++++++++++++++++++++++-------
1 files changed, 39 insertions(+), 7 deletions(-)
repo.or.cz automatic notification. Contact project admin jiri.bluebear.dluhos(a)gmail.com
if you want to unsubscribe, or site admin admin(a)repo.or.cz if you receive
no reply.
--
gfxprim.git ("A simple 2D graphics library with emphasis on correctness and well-defined operation.")
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 d774f27f7337a04044850bc48f4253e2d5016d13 (commit)
from b9b02ed950aa9b8c45aa065ef1e5175b6e7ea2e8 (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/d774f27f7337a04044850bc48f4253e2d501…
commit d774f27f7337a04044850bc48f4253e2d5016d13
Author: Cyril Hrubis <metan(a)ucw.cz>
Date: Sun Dec 9 14:27:21 2012 +0100
gfx: GP_Line() the first special case is not needed now.
diff --git a/libs/gfx/algo/Line.algo.h b/libs/gfx/algo/Line.algo.h
index a69d053..952598c 100644
--- a/libs/gfx/algo/Line.algo.h
+++ b/libs/gfx/algo/Line.algo.h
@@ -42,10 +42,6 @@ void FN_NAME(CONTEXT_T context, int x0, int y0, int x1, int y1, PIXVAL_T pixval) { if (x0 == x1) { - if (y0 == y1) { - PUTPIXEL(context, x0, y0, pixval); - return; - } if (y0 > y1) GP_SWAP(y0, y1); int y;
-----------------------------------------------------------------------
Summary of changes:
libs/gfx/algo/Line.algo.h | 4 ----
1 files changed, 0 insertions(+), 4 deletions(-)
repo.or.cz automatic notification. Contact project admin jiri.bluebear.dluhos(a)gmail.com
if you want to unsubscribe, or site admin admin(a)repo.or.cz if you receive
no reply.
--
gfxprim.git ("A simple 2D graphics library with emphasis on correctness and well-defined operation.")
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 b9b02ed950aa9b8c45aa065ef1e5175b6e7ea2e8 (commit)
via 76e72cf5507bca2ec0e6da9aff3b82a566543f89 (commit)
from 23a61ce77d10e1f69552bca123878f3c7602d363 (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/b9b02ed950aa9b8c45aa065ef1e5175b6e7e…
commit b9b02ed950aa9b8c45aa065ef1e5175b6e7ea2e8
Author: Cyril Hrubis <metan(a)ucw.cz>
Date: Sun Dec 9 14:26:06 2012 +0100
gfx: Fix second special case of GP_Line().
diff --git a/libs/gfx/algo/Line.algo.h b/libs/gfx/algo/Line.algo.h
index c6ca4f8..a69d053 100644
--- a/libs/gfx/algo/Line.algo.h
+++ b/libs/gfx/algo/Line.algo.h
@@ -46,12 +46,11 @@ void FN_NAME(CONTEXT_T context, int x0, int y0, int x1, int y1, PUTPIXEL(context, x0, y0, pixval); return; } - int y = y0; - while (y != y1) { + if (y0 > y1) + GP_SWAP(y0, y1); + int y; + for (y = y0; y <= y1; y++) PUTPIXEL(context, x0, y, pixval); - if (y0 > y1) y--; - else y++; - } return; }
http://repo.or.cz/w/gfxprim.git/commit/76e72cf5507bca2ec0e6da9aff3b82a56654…
commit 76e72cf5507bca2ec0e6da9aff3b82a566543f89
Author: Cyril Hrubis <metan(a)ucw.cz>
Date: Sun Dec 9 14:23:08 2012 +0100
gfx: Fix one special case for GP_Line().
diff --git a/libs/gfx/algo/Line.algo.h b/libs/gfx/algo/Line.algo.h
index afc37dc..c6ca4f8 100644
--- a/libs/gfx/algo/Line.algo.h
+++ b/libs/gfx/algo/Line.algo.h
@@ -42,6 +42,10 @@ void FN_NAME(CONTEXT_T context, int x0, int y0, int x1, int y1, PIXVAL_T pixval) { if (x0 == x1) { + if (y0 == y1) { + PUTPIXEL(context, x0, y0, pixval); + return; + } int y = y0; while (y != y1) { PUTPIXEL(context, x0, y, pixval);
-----------------------------------------------------------------------
Summary of changes:
libs/gfx/algo/Line.algo.h | 13 ++++++++-----
1 files changed, 8 insertions(+), 5 deletions(-)
repo.or.cz automatic notification. Contact project admin jiri.bluebear.dluhos(a)gmail.com
if you want to unsubscribe, or site admin admin(a)repo.or.cz if you receive
no reply.
--
gfxprim.git ("A simple 2D graphics library with emphasis on correctness and well-defined operation.")
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/ce13a7e7695f7264c8fe0047a912bcc1b9cf…
commit ce13a7e7695f7264c8fe0047a912bcc1b9cf5126
Author: Jiri BlueBear Dluhos <jiri.bluebear.dluhos(a)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(a)gmail.com> *
- * *
- * Copyright (C) 2009-2010 Cyril Hrubis <metan(a)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(a)gmail.com
if you want to unsubscribe, or site admin admin(a)repo.or.cz if you receive
no reply.
--
gfxprim.git ("A simple 2D graphics library with emphasis on correctness and well-defined operation.")
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 6c3a610f5c62bbcfbdabd7a538d97bc455fae1b4 (commit)
via bcd7731a0e0dec5884309cf6b920f8df0b3a3ca3 (commit)
from 14c24da39e8d293f98aae1e4ba72be6c4069417f (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/6c3a610f5c62bbcfbdabd7a538d97bc455fa…
commit 6c3a610f5c62bbcfbdabd7a538d97bc455fae1b4
Merge: bcd7731 14c24da
Author: Jiri BlueBear Dluhos <jiri.bluebear.dluhos(a)gmail.com>
Date: Sat Dec 8 21:36:54 2012 +0100
Merge branch 'master' of ssh://repo.or.cz/srv/git/gfxprim
http://repo.or.cz/w/gfxprim.git/commit/bcd7731a0e0dec5884309cf6b920f8df0b3a…
commit bcd7731a0e0dec5884309cf6b920f8df0b3a3ca3
Author: Jiri BlueBear Dluhos <jiri.bluebear.dluhos(a)gmail.com>
Date: Sat Dec 8 21:36:34 2012 +0100
Added a special case for circle with r == 0.
diff --git a/libs/gfx/algo/FillCircle.algo.h b/libs/gfx/algo/FillCircle.algo.h
index c6a48d0..b3eeb6b 100644
--- a/libs/gfx/algo/FillCircle.algo.h
+++ b/libs/gfx/algo/FillCircle.algo.h
@@ -45,6 +45,12 @@
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) {
-----------------------------------------------------------------------
Summary of changes:
libs/gfx/algo/FillCircle.algo.h | 6 ++++++
1 files changed, 6 insertions(+), 0 deletions(-)
repo.or.cz automatic notification. Contact project admin jiri.bluebear.dluhos(a)gmail.com
if you want to unsubscribe, or site admin admin(a)repo.or.cz if you receive
no reply.
--
gfxprim.git ("A simple 2D graphics library with emphasis on correctness and well-defined operation.")
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 14c24da39e8d293f98aae1e4ba72be6c4069417f (commit)
from 8a0c954a8e79f88f06cfc99f7a29d3a1558b21d6 (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/14c24da39e8d293f98aae1e4ba72be6c4069…
commit 14c24da39e8d293f98aae1e4ba72be6c4069417f
Author: Cyril Hrubis <metan(a)ucw.cz>
Date: Sat Dec 8 20:44:30 2012 +0100
core: GP_Common.h: Remove the C++ part.
The C++ implementation of common gfxprim
macros is not needed at all because these
problems have different solutions in C++.
Hide them only, which is sufficient for
using GP.h from C++ code.
diff --git a/include/core/GP_Common.h b/include/core/GP_Common.h
index ee5907c..a1e8d14 100644
--- a/include/core/GP_Common.h
+++ b/include/core/GP_Common.h
@@ -16,10 +16,10 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, *
* Boston, MA 02110-1301 USA *
* *
- * Copyright (C) 2009-2010 Jiri "BlueBear" Dluhos *
+ * Copyright (C) 2009-2012 Jiri "BlueBear" Dluhos *
* <jiri.bluebear.dluhos(a)gmail.com> *
* *
- * Copyright (C) 2009-2011 Cyril Hrubis <metan(a)ucw.cz> *
+ * Copyright (C) 2009-2012 Cyril Hrubis <metan(a)ucw.cz> *
* *
*****************************************************************************/
@@ -31,33 +31,7 @@
#include <stdlib.h>
#include <unistd.h>
-#ifdef __cplusplus
-
-/*-------------------------------------------------------------------------*/
-/* C++-specific code */
-/*-------------------------------------------------------------------------*/
-
-#include <algorithm>
-#include <cmath>
-
-/* use STL algorithms when we already have them */
-#define GP_MIN(a, b) std::min(a, b)
-#define GP_MAX(a, b) std::max(a, b)
-#define GP_SWAP(a, b) std::swap(a, b)
-#define GP_ABS(a) std::abs(a)
-
-/* C++ uses templates instead of typeof */
-template <typename t>
-int GP_SIGN(t x)
-{
- return (x > 0) ? 1 : ((x < 0) ? -1 : 0);
-}
-
-#else /* __cplusplus */
-
-/*-------------------------------------------------------------------------*/
-/* plain C-specific code */
-/*-------------------------------------------------------------------------*/
+#ifndef __cplusplus
/*
* Returns a minimum of the two numbers.
@@ -102,10 +76,6 @@ int GP_SIGN(t x)
(_a > 0) ? 1 : ((_a < 0) ? -1 : 0); })
-/*-------------------------------------------------------------------------*/
-/* end of C/C++-specific code */
-/*-------------------------------------------------------------------------*/
-
#endif /* __cplusplus */
/*
@@ -194,4 +164,4 @@ void SWIG_exception(const char *msg);
#define GP_CHECK(check_cond_, ...) GP_GENERAL_CHECK(check_cond_, "check failed: ", ##__VA_ARGS__);
-#endif /* CORE_GP_COMMON_H */
No newline at end of file
+#endif /* CORE_GP_COMMON_H */
-----------------------------------------------------------------------
Summary of changes:
include/core/GP_Common.h | 38 ++++----------------------------------
1 files changed, 4 insertions(+), 34 deletions(-)
repo.or.cz automatic notification. Contact project admin jiri.bluebear.dluhos(a)gmail.com
if you want to unsubscribe, or site admin admin(a)repo.or.cz if you receive
no reply.
--
gfxprim.git ("A simple 2D graphics library with emphasis on correctness and well-defined operation.")
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 b77f76c2f45a7e07893d88d7edf9016d35411f95 (commit)
from 9e3d0f91aabd4b32abf770506e345424e39c4469 (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/b77f76c2f45a7e07893d88d7edf9016d3541…
commit b77f76c2f45a7e07893d88d7edf9016d35411f95
Author: Jiri BlueBear Dluhos <jiri.bluebear.dluhos(a)gmail.com>
Date: Sat Dec 8 15:47:22 2012 +0100
Suspicion of odd # of intersections; added assert.
diff --git a/libs/gfx/GP_Polygon.c b/libs/gfx/GP_Polygon.c
index fb4b03f..0901922 100644
--- a/libs/gfx/GP_Polygon.c
+++ b/libs/gfx/GP_Polygon.c
@@ -156,6 +156,9 @@ void GP_FillPolygon_Raw(GP_Context *context, unsigned int vertex_count,
int y;
for (y = (int) ymin; y <= (int) ymax; y++) {
int inter_count = GP_ComputeScanline(intersections, edges, vertex_count, y + 0.5f);
+
+ GP_ASSERT(inter_count % 2 == 0, "odd number of intersections!");
+
for (i = 0; i < inter_count; i+=2) {
GP_HLine_Raw(context, intersections[i], intersections[i + 1], y, pixel);
}
-----------------------------------------------------------------------
Summary of changes:
libs/gfx/GP_Polygon.c | 3 +++
1 files changed, 3 insertions(+), 0 deletions(-)
repo.or.cz automatic notification. Contact project admin jiri.bluebear.dluhos(a)gmail.com
if you want to unsubscribe, or site admin admin(a)repo.or.cz if you receive
no reply.
--
gfxprim.git ("A simple 2D graphics library with emphasis on correctness and well-defined operation.")