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 fafd7bf50d69b47a22775fcbb166d9c3d48c565f (commit) via 26a5965f520f882cd33c837e582ac545058efbec (commit) via f8e9023cc4fa863d5a373c86c1f998ae7185d119 (commit) via b0c52fdb07844102bc97b887672b2bf9ff4d1d1f (commit) via a8071e4ec58be0465c9235ee50e0bf8f136aa5c9 (commit) via 92a84bb8701fb5d421bac2b277debdb8056d68e4 (commit) via 3b46f61b9b1698b2711c93e746464db13a486e62 (commit) from c7c32efcf6deac514ea58f8adef8185afc0a3788 (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/fafd7bf50d69b47a22775fcbb166d9c3d48c5...
commit fafd7bf50d69b47a22775fcbb166d9c3d48c565f Author: Cyril Hrubis metan@ucw.cz Date: Fri May 10 13:02:36 2013 +0200
gfx: Remove unused Line.algo.h, fix copyrights.
Signed-off-by: Cyril Hrubis metan@ucw.cz
diff --git a/libs/gfx/GP_Line.gen.c.t b/libs/gfx/GP_Line.gen.c.t index 668d89f..a2dbd9d 100644 --- a/libs/gfx/GP_Line.gen.c.t +++ b/libs/gfx/GP_Line.gen.c.t @@ -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@gmail.com * * * - * Copyright (C) 2009-2010 Cyril Hrubis metan@ucw.cz * + * Copyright (C) 2009-2013 Cyril Hrubis metan@ucw.cz * * * *****************************************************************************/
diff --git a/libs/gfx/algo/Line.algo.h b/libs/gfx/algo/Line.algo.h deleted file mode 100644 index 952598c..0000000 --- a/libs/gfx/algo/Line.algo.h +++ /dev/null @@ -1,81 +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 * - * * - *****************************************************************************/ - -/* - * The classical Bresenham line drawing algorithm. - * Please see http://en.wikipedia.org/wiki/Bresenham%27s_line_algorithm - * for a nice and understandable description. - */ - -/* - * This macro defines a line drawing function. - * Arguments: - * CONTEXT_T - user-defined type of drawing context (passed to PUTPIXEL) - * PIXVAL_T - user-defined pixel value type (passed to PUTPIXEL) - * PUTPIXEL - a pixel drawing function f(context, x, y, pixval) - * FN_NAME - name of the function to be defined - */ -#define DEF_LINE_FN(FN_NAME, CONTEXT_T, PIXVAL_T, PUTPIXEL) -void FN_NAME(CONTEXT_T context, int x0, int y0, int x1, int y1, - PIXVAL_T pixval) -{ - if (x0 == x1) { - if (y0 > y1) - GP_SWAP(y0, y1); - int y; - for (y = y0; y <= y1; y++) - PUTPIXEL(context, x0, y, pixval); - return; - } -- int steep = abs(y1 - y0) / abs(x1 - x0); - if (steep) { - GP_SWAP(x0, y0); - GP_SWAP(x1, y1); - } - if (x0 > x1) { - GP_SWAP(x0, x1); - GP_SWAP(y0, y1); - } -- int deltax = x1 - x0; - int deltay = abs(y1 - y0); - int error = deltax / 2; - int y = y0, x; - int ystep = (y0 < y1) ? 1 : -1; - for (x = x0; x <= x1; x++) { -- if (steep) - PUTPIXEL(context, y, x, pixval); - else - PUTPIXEL(context, x, y, pixval); -- error = error - deltay; - if (error < 0) { - y = y + ystep; - error = error + deltax; - } - } -}
http://repo.or.cz/w/gfxprim.git/commit/26a5965f520f882cd33c837e582ac545058ef...
commit 26a5965f520f882cd33c837e582ac545058efbec Author: Cyril Hrubis metan@ucw.cz Date: Fri May 10 13:00:05 2013 +0200
gfx: Remove commented out FillCircle from Circle.c
Signed-off-by: Cyril Hrubis metan@ucw.cz
diff --git a/libs/gfx/GP_Circle.c b/libs/gfx/GP_Circle.c index d8973e4..a19e98f 100644 --- a/libs/gfx/GP_Circle.c +++ b/libs/gfx/GP_Circle.c @@ -19,7 +19,7 @@ * Copyright (C) 2009-2011 Jiri "BlueBear" Dluhos * * jiri.bluebear.dluhos@gmail.com * * * - * Copyright (C) 2009-2012 Cyril Hrubis metan@ucw.cz * + * Copyright (C) 2009-2013 Cyril Hrubis metan@ucw.cz * * * *****************************************************************************/
@@ -53,11 +53,6 @@ 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" */ - -/* Generate drawing functions for various bit depths. */ -//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) {
http://repo.or.cz/w/gfxprim.git/commit/f8e9023cc4fa863d5a373c86c1f998ae7185d...
commit f8e9023cc4fa863d5a373c86c1f998ae7185d119 Author: Cyril Hrubis metan@ucw.cz Date: Fri May 10 12:56:37 2013 +0200
tests: PNG: Add testcase for Adam7 interlacing.
* Add test for Adam7 interlacing
* Edhance a few testcases to check context data pixel values.
Signed-off-by: Cyril Hrubis metan@ucw.cz
diff --git a/tests/loaders/PNG.c b/tests/loaders/PNG.c index d4901ca..540e492 100644 --- a/tests/loaders/PNG.c +++ b/tests/loaders/PNG.c @@ -16,7 +16,7 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, * * Boston, MA 02110-1301 USA * * * - * Copyright (C) 2009-2012 Cyril Hrubis metan@ucw.cz * + * Copyright (C) 2009-2013 Cyril Hrubis metan@ucw.cz * * * *****************************************************************************/
@@ -25,6 +25,7 @@ #include <sys/stat.h>
#include <core/GP_Context.h> +#include <core/GP_GetPutPixel.h> #include <loaders/GP_Loaders.h>
#include "tst_test.h" @@ -57,6 +58,71 @@ static int test_load_PNG(const char *path) return TST_SUCCESS; }
+struct check_color_test { + const char *path; + GP_Pixel pixel; +}; + +static int test_load_PNG_check_color(struct check_color_test *test) +{ + GP_Context *img; + + errno = 0; + + img = GP_LoadPNG(test->path, NULL); + + if (img == NULL) { + switch (errno) { + case ENOSYS: + tst_msg("Not Implemented"); + return TST_SKIPPED; + default: + tst_msg("Got %s", strerror(errno)); + return TST_FAILED; + } + } + + unsigned int x, y, fail = 0; + + for (x = 0; x < img->w; x++) { + for (y = 0; y < img->w; y++) { + GP_Pixel p = GP_GetPixel(img, x, y); + + if (p != test->pixel) { + if (!fail) + tst_msg("First failed at %u,%u %x %x", + x, y, p, test->pixel); + fail = 1; + } + } + } + + if (!fail) + tst_msg("Context pixels are correct"); + + GP_ContextFree(img); + + if (fail) + return TST_FAILED; + + return TST_SUCCESS; +} + +static struct check_color_test white_adam7 = { + .path = "100x100-white-adam7.png", + .pixel = 0xffffff, +}; + +static struct check_color_test black_grayscale = { + .path = "100x100-black-grayscale.png", + .pixel = 0x000000, +}; + +static struct check_color_test red = { + .path = "100x100-red.png", + .pixel = 0xff0000, +}; + static int test_save_PNG(GP_PixelType pixel_type) { GP_Context *ctx; @@ -96,9 +162,9 @@ const struct tst_suite tst_suite = { .tests = { /* PNG loader tests */ {.name = "PNG Load 100x100 RGB", - .tst_fn = test_load_PNG, + .tst_fn = test_load_PNG_check_color, .res_path = "data/png/valid/100x100-red.png", - .data = "100x100-red.png", + .data = &red, .flags = TST_TMPDIR | TST_CHECK_MALLOC}, {.name = "PNG Load 100x100 RGB 50% alpha", @@ -108,9 +174,9 @@ const struct tst_suite tst_suite = { .flags = TST_TMPDIR | TST_CHECK_MALLOC}, {.name = "PNG Load 100x100 8 bit Grayscale", - .tst_fn = test_load_PNG, + .tst_fn = test_load_PNG_check_color, .res_path = "data/png/valid/100x100-black-grayscale.png", - .data = "100x100-black-grayscale.png", + .data = &black_grayscale, .flags = TST_TMPDIR | TST_CHECK_MALLOC}, {.name = "PNG Load 100x100 8 bit Grayscale + alpha", @@ -131,6 +197,12 @@ const struct tst_suite tst_suite = { .data = "100x100-red-palette.png", .flags = TST_TMPDIR | TST_CHECK_MALLOC}, + {.name = "PNG Load 100x100 RGB Adam7", + .tst_fn = test_load_PNG_check_color, + .res_path = "data/png/valid/100x100-white-adam7.png", + .data = &white_adam7, + .flags = TST_TMPDIR | TST_CHECK_MALLOC}, + {.name = "PNG Save 100x100 G1", .tst_fn = test_save_PNG, .data = (void*)GP_PIXEL_G1, diff --git a/tests/loaders/data/png/valid/100x100-white-adam7.png b/tests/loaders/data/png/valid/100x100-white-adam7.png new file mode 100644 index 0000000..c08b015 Binary files /dev/null and b/tests/loaders/data/png/valid/100x100-white-adam7.png differ
http://repo.or.cz/w/gfxprim.git/commit/b0c52fdb07844102bc97b887672b2bf9ff4d1...
commit b0c52fdb07844102bc97b887672b2bf9ff4d1d1f Author: Cyril Hrubis metan@ucw.cz Date: Fri May 10 12:23:01 2013 +0200
tests: gfx: Fix Line testsuite.
Signed-off-by: Cyril Hrubis metan@ucw.cz
diff --git a/tests/gfx/Line.c b/tests/gfx/Line.c index 5314a90..5fcc4a3 100644 --- a/tests/gfx/Line.c +++ b/tests/gfx/Line.c @@ -163,10 +163,10 @@ static struct testcase testcase_line_15 = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, + 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, } };
http://repo.or.cz/w/gfxprim.git/commit/a8071e4ec58be0465c9235ee50e0bf8f136aa...
commit a8071e4ec58be0465c9235ee50e0bf8f136aa5c9 Author: Cyril Hrubis metan@ucw.cz Date: Fri May 10 12:18:16 2013 +0200
gfx: Move FillEllipse to template, fix special case.
Signed-off-by: Cyril Hrubis metan@ucw.cz
diff --git a/libs/gfx/GP_Ellipse.c b/libs/gfx/GP_Ellipse.c index a41ca5f..bd7d31b 100644 --- a/libs/gfx/GP_Ellipse.c +++ b/libs/gfx/GP_Ellipse.c @@ -54,28 +54,3 @@ void GP_Ellipse(GP_Context *context, GP_Coord xcenter, GP_Coord ycenter, GP_Ellipse_Raw(context, xcenter, ycenter, a, b, pixel); } - -#include "algo/FillEllipse.algo.h" - -/* Generate drawing functions for various bit depths. */ -GP_DEF_FILL_FN_PER_BPP(GP_FillEllipse_Raw, DEF_FILLELLIPSE_FN) - -void GP_FillEllipse_Raw(GP_Context *context, GP_Coord xcenter, GP_Coord ycenter, - GP_Size a, GP_Size b, GP_Pixel pixel) -{ - GP_CHECK_CONTEXT(context); - - GP_FN_PER_BPP_CONTEXT(GP_FillEllipse_Raw, context, context, - xcenter, ycenter, a, b, pixel); -} - -void GP_FillEllipse(GP_Context *context, GP_Coord xcenter, GP_Coord ycenter, - GP_Size a, GP_Size b, GP_Pixel pixel) -{ - GP_CHECK_CONTEXT(context); - - GP_TRANSFORM_POINT(context, xcenter, ycenter); - GP_TRANSFORM_SWAP(context, a, b); - - GP_FillEllipse_Raw(context, xcenter, ycenter, a, b, pixel); -} diff --git a/libs/gfx/algo/FillEllipse.algo.h b/libs/gfx/GP_FillEllipse.gen.c.t similarity index 56% rename from libs/gfx/algo/FillEllipse.algo.h rename to libs/gfx/GP_FillEllipse.gen.c.t index 76da4bd..aed7d1f 100644 --- a/libs/gfx/algo/FillEllipse.algo.h +++ b/libs/gfx/GP_FillEllipse.gen.c.t @@ -19,10 +19,22 @@ * Copyright (C) 2009-2010 Jiri "BlueBear" Dluhos * * jiri.bluebear.dluhos@gmail.com * * * - * Copyright (C) 2009-2012 Cyril Hrubis metan@ucw.cz * + * Copyright (C) 2009-2013 Cyril Hrubis metan@ucw.cz * * * *****************************************************************************/
+%% extends "base.c.t" + +{% block descr %}A filled ellipse drawing algorithm.{% endblock %} + +%% block body + +#include "core/GP_GetPutPixel.h" +#include "core/GP_FnPerBpp.h" +#include "gfx/GP_HLine.h" +#include "gfx/GP_VLine.h" +#include "gfx/GP_Ellipse.h" + /* * A filled ellipse drawing algorithm. * @@ -32,32 +44,55 @@ * we just iterate X until Y reaches next line, and then draw the full line. */
-/* - * This macro defines a filled ellipse 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_FILLELLIPSE_FN(FN_NAME, CONTEXT_T, PIXVAL_T, HLINE) -static void FN_NAME(CONTEXT_T context, int xcenter, int ycenter, - unsigned int a, unsigned int b, PIXVAL_T pixval) -{ - /* Precompute quadratic terms. */ - int a2 = a*a; - int b2 = b*b; -- int x, y, error; - for (x = 0, error = -b2*a, y = b; y >= 0; y--) { - while (error < 0) { - error += b2 * (2*x + 1); - x++; - } - error += a2 * (-2*y + 1); -- /* Draw two horizontal lines reflected across Y. */ - HLINE(context, xcenter-x+1, xcenter+x-1, ycenter-y, pixval); - HLINE(context, xcenter-x+1, xcenter+x-1, ycenter+y, pixval); - } +%% for ps in pixelsizes + +static void GP_FillEllipse_Raw_{{ ps.suffix }}(GP_Context *context, GP_Coord xcenter, + GP_Coord ycenter, GP_Size a, GP_Size b, GP_Pixel pixel) +{ + /* Precompute quadratic terms. */ + int a2 = a*a; + int b2 = b*b; + + /* Handle special case */ + if (a == 0) { + GP_VLine_Raw_{{ ps.suffix }}(context, xcenter, ycenter - b, ycenter + b, pixel); + return; + } + + int x, y, error; + for (x = 0, error = -b2*a, y = b; y >= 0; y--) { + while (error < 0) { + error += b2 * (2*x + 1); + x++; + } + error += a2 * (-2*y + 1); + + /* Draw two horizontal lines reflected across Y. */ + 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_FillEllipse_Raw(GP_Context *context, GP_Coord xcenter, GP_Coord ycenter, + GP_Size a, GP_Size b, GP_Pixel pixel) +{ + GP_CHECK_CONTEXT(context); + + GP_FN_PER_BPP_CONTEXT(GP_FillEllipse_Raw, context, context, + xcenter, ycenter, a, b, pixel); +} + +void GP_FillEllipse(GP_Context *context, GP_Coord xcenter, GP_Coord ycenter, + GP_Size a, GP_Size b, GP_Pixel pixel) +{ + GP_CHECK_CONTEXT(context); + + GP_TRANSFORM_POINT(context, xcenter, ycenter); + GP_TRANSFORM_SWAP(context, a, b); + + GP_FillEllipse_Raw(context, xcenter, ycenter, a, b, pixel); +} + +%% endblock body diff --git a/libs/gfx/Makefile b/libs/gfx/Makefile index 4511495..8ffe38a 100644 --- a/libs/gfx/Makefile +++ b/libs/gfx/Makefile @@ -3,7 +3,8 @@ include $(TOPDIR)/pre.mk
CSOURCES=$(filter-out $(wildcard *.gen.c),$(wildcard *.c)) GENSOURCES=GP_Line.gen.c GP_HLine.gen.c GP_LineAA.gen.c GP_PutPixelAA.gen.c - GP_HLineAA.gen.c GP_VLineAA.gen.c GP_FillCircle.gen.c GP_VLine.gen.c + GP_HLineAA.gen.c GP_VLineAA.gen.c GP_FillCircle.gen.c GP_VLine.gen.c + GP_FillEllipse.gen.c LIBNAME=gfx
include $(TOPDIR)/gen.mk
http://repo.or.cz/w/gfxprim.git/commit/92a84bb8701fb5d421bac2b277debdb8056d6...
commit 92a84bb8701fb5d421bac2b277debdb8056d68e4 Author: Cyril Hrubis metan@ucw.cz Date: Fri May 10 12:13:18 2013 +0200
gfx: FillCircle: Add GPL header, sort out includes.
Signed-off-by: Cyril Hrubis metan@ucw.cz
diff --git a/libs/gfx/GP_FillCircle.gen.c.t b/libs/gfx/GP_FillCircle.gen.c.t index 90c18c7..ac4c6ce 100644 --- a/libs/gfx/GP_FillCircle.gen.c.t +++ b/libs/gfx/GP_FillCircle.gen.c.t @@ -1,13 +1,39 @@ +/***************************************************************************** + * 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-2012 Jiri "BlueBear" Dluhos * + * jiri.bluebear.dluhos@gmail.com * + * * + * Copyright (C) 2009-2013 Cyril Hrubis metan@ucw.cz * + * * + *****************************************************************************/ + %% extends "base.c.t"
-{% block descr %}Circle filling algorithm{% endblock %} +{% block descr %}A filled circle drawing algorithm.{% endblock %}
%% block body
#include "core/GP_GetPutPixel.h" +#include "core/GP_Transform.h" #include "core/GP_FnPerBpp.h" -#include "gfx/GP_Circle.h" #include "gfx/GP_HLine.h" +#include "gfx/GP_Circle.h"
/* * A filled circle drawing algorithm.
http://repo.or.cz/w/gfxprim.git/commit/3b46f61b9b1698b2711c93e746464db13a486...
commit 3b46f61b9b1698b2711c93e746464db13a486e62 Author: Cyril Hrubis metan@ucw.cz Date: Fri May 10 11:45:17 2013 +0200
tests: gfx: Add FillEllipse testsuite.
Signed-off-by: Cyril Hrubis metan@ucw.cz
diff --git a/tests/gfx/FillEllipse.c b/tests/gfx/FillEllipse.c new file mode 100644 index 0000000..84bb7d7 --- /dev/null +++ b/tests/gfx/FillEllipse.c @@ -0,0 +1,367 @@ +/***************************************************************************** + * 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-2013 Cyril Hrubis metan@ucw.cz * + * * + *****************************************************************************/ + +#include <string.h> +#include <errno.h> +#include <sys/stat.h> + +#include <core/GP_Context.h> +#include <gfx/GP_Ellipse.h> + +#include "tst_test.h" + +#include "common.h" + +struct testcase { + /* cicle description */ + GP_Coord x; + GP_Coord y; + GP_Size a; + GP_Size b; + + /* expected result */ + GP_Size w, h; + const char pixmap[]; +}; + +static int test_ellipse(const struct testcase *t) +{ + GP_Context *c; + int err; + + c = GP_ContextAlloc(t->w, t->h, GP_PIXEL_G8); + + if (c == NULL) { + tst_err("Failed to allocate context"); + return TST_UNTESTED; + } + + /* zero the pixels buffer */ + memset(c->pixels, 0, c->w * c->h); + + GP_FillEllipse(c, t->x, t->y, t->a, t->b, 1); + + err = compare_buffers(t->pixmap, c); + + if (err) + return TST_FAILED; + + return TST_SUCCESS; +} + +static struct testcase testcase_ellipse_a0_b0 = { + .x = 2, + .y = 2, + .a = 0, + .b = 0, + + .w = 5, + .h = 5, + + .pixmap = { + 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, + 0, 0, 1, 0, 0, + 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, + } +}; + +static struct testcase testcase_ellipse_a1_b0 = { + .x = 2, + .y = 2, + .a = 1, + .b = 0, + + .w = 5, + .h = 5, + + .pixmap = { + 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, + 0, 1, 1, 1, 0, + 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, + } +}; + +static struct testcase testcase_ellipse_a0_b1 = { + .x = 2, + .y = 2, + .a = 0, + .b = 1, + + .w = 5, + .h = 5, + + .pixmap = { + 0, 0, 0, 0, 0, + 0, 0, 1, 0, 0, + 0, 0, 1, 0, 0, + 0, 0, 1, 0, 0, + 0, 0, 0, 0, 0, + } +}; + +static struct testcase testcase_ellipse_a1_b1 = { + .x = 2, + .y = 2, + .a = 1, + .b = 1, + + .w = 5, + .h = 5, + + .pixmap = { + 0, 0, 0, 0, 0, + 0, 0, 1, 0, 0, + 0, 1, 1, 1, 0, + 0, 0, 1, 0, 0, + 0, 0, 0, 0, 0, + } +}; + +static struct testcase testcase_ellipse_a2_b1 = { + .x = 3, + .y = 3, + .a = 2, + .b = 1, + + .w = 7, + .h = 7, + + .pixmap = { + 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, + 0, 0, 1, 1, 1, 0, 0, + 0, 1, 1, 1, 1, 1, 0, + 0, 0, 1, 1, 1, 0, 0, + 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, + } +}; + +static struct testcase testcase_ellipse_a1_b2 = { + .x = 3, + .y = 3, + .a = 1, + .b = 2, + + .w = 7, + .h = 7, + + .pixmap = { + 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 1, 0, 0, 0, + 0, 0, 1, 1, 1, 0, 0, + 0, 0, 1, 1, 1, 0, 0, + 0, 0, 1, 1, 1, 0, 0, + 0, 0, 0, 1, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, + } +}; + +static struct testcase testcase_ellipse_a2_b2 = { + .x = 3, + .y = 3, + .a = 2, + .b = 2, + + .w = 7, + .h = 7, + + .pixmap = { + 0, 0, 0, 0, 0, 0, 0, + 0, 0, 1, 1, 1, 0, 0, + 0, 1, 1, 1, 1, 1, 0, + 0, 1, 1, 1, 1, 1, 0, + 0, 1, 1, 1, 1, 1, 0, + 0, 0, 1, 1, 1, 0, 0, + 0, 0, 0, 0, 0, 0, 0, + } +}; + +static struct testcase testcase_ellipse_a1_b3 = { + .x = 4, + .y = 4, + .a = 1, + .b = 3, + + .w = 9, + .h = 9, + + .pixmap = { + 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 1, 0, 0, 0, 0, + 0, 0, 0, 1, 1, 1, 0, 0, 0, + 0, 0, 0, 1, 1, 1, 0, 0, 0, + 0, 0, 0, 1, 1, 1, 0, 0, 0, + 0, 0, 0, 1, 1, 1, 0, 0, 0, + 0, 0, 0, 1, 1, 1, 0, 0, 0, + 0, 0, 0, 0, 1, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, + } +}; + +static struct testcase testcase_ellipse_a3_b2 = { + .x = 4, + .y = 4, + .a = 3, + .b = 2, + + .w = 9, + .h = 9, + + .pixmap = { + 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 1, 1, 1, 0, 0, 0, + 0, 1, 1, 1, 1, 1, 1, 1, 0, + 0, 1, 1, 1, 1, 1, 1, 1, 0, + 0, 1, 1, 1, 1, 1, 1, 1, 0, + 0, 0, 0, 1, 1, 1, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, + } +}; + +static struct testcase testcase_ellipse_a3_b3 = { + .x = 4, + .y = 4, + .a = 3, + .b = 3, + + .w = 9, + .h = 9, + + .pixmap = { + 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 1, 1, 1, 0, 0, 0, + 0, 0, 1, 1, 1, 1, 1, 0, 0, + 0, 1, 1, 1, 1, 1, 1, 1, 0, + 0, 1, 1, 1, 1, 1, 1, 1, 0, + 0, 1, 1, 1, 1, 1, 1, 1, 0, + 0, 0, 1, 1, 1, 1, 1, 0, 0, + 0, 0, 0, 1, 1, 1, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, + } +}; + +static struct testcase testcase_ellipse_a6_b6_clip = { + .x = 0, + .y = 0, + .a = 6, + .b = 6, + + .w = 8, + .h = 8, + + .pixmap = { + 1, 1, 1, 1, 1, 1, 1, 0, + 1, 1, 1, 1, 1, 1, 1, 0, + 1, 1, 1, 1, 1, 1, 1, 0, + 1, 1, 1, 1, 1, 1, 0, 0, + 1, 1, 1, 1, 1, 1, 0, 0, + 1, 1, 1, 1, 1, 0, 0, 0, + 1, 1, 1, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + } +}; + +static struct testcase testcase_ellipse_a5_b5_clip = { + .x = 0, + .y = 5, + .a = 5, + .b = 5, + + .w = 11, + .h = 11, + + .pixmap = { + 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, + 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, + 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, + 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, + 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, + 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, + 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, + 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, + 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, + 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, + 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, + } +}; + +const struct tst_suite tst_suite = { + .suite_name = "FillEllipse Testsuite", + .tests = { + {.name = "FillEllipse a=0 b=0", + .tst_fn = test_ellipse, + .data = &testcase_ellipse_a0_b0}, + + {.name = "FillEllipse a=1 b=0", + .tst_fn = test_ellipse, + .data = &testcase_ellipse_a1_b0}, + + {.name = "FillEllipse a=0 b=1", + .tst_fn = test_ellipse, + .data = &testcase_ellipse_a0_b1}, + + {.name = "FillEllipse a=1 b=1", + .tst_fn = test_ellipse, + .data = &testcase_ellipse_a1_b1}, + + {.name = "FillEllipse a=2 b=1", + .tst_fn = test_ellipse, + .data = &testcase_ellipse_a2_b1}, + + {.name = "FillEllipse a=1 b=2", + .tst_fn = test_ellipse, + .data = &testcase_ellipse_a1_b2}, + + {.name = "FillEllipse a=2 b=2", + .tst_fn = test_ellipse, + .data = &testcase_ellipse_a2_b2}, + + {.name = "FillEllipse a=1 b=3", + .tst_fn = test_ellipse, + .data = &testcase_ellipse_a1_b3}, + + {.name = "FillEllipse a=3 b=2", + .tst_fn = test_ellipse, + .data = &testcase_ellipse_a3_b2}, + + {.name = "FillEllipse a=3 b=3", + .tst_fn = test_ellipse, + .data = &testcase_ellipse_a3_b3}, + + {.name = "FillEllipse a=5 b=5 clipped", + .tst_fn = test_ellipse, + .data = &testcase_ellipse_a5_b5_clip}, + + {.name = "FillEllipse a=6 b=6 clipped", + .tst_fn = test_ellipse, + .data = &testcase_ellipse_a6_b6_clip}, + + {.name = NULL} + } +}; diff --git a/tests/gfx/Makefile b/tests/gfx/Makefile index cf845f6..2094107 100644 --- a/tests/gfx/Makefile +++ b/tests/gfx/Makefile @@ -5,11 +5,12 @@ CSOURCES=$(filter-out $(wildcard *.gen.c),$(wildcard *.c)) GENSOURCES=APICoverage.gen.c
APPS=gfx_benchmark Circle FillCircle Line CircleSeg Polygon Ellipse HLine- VLine PutPixelAA HLineAA LineAA APICoverage.gen + VLine PutPixelAA HLineAA LineAA APICoverage.gen FillEllipse
Circle: common.o FillCircle: common.o Ellipse: common.o +FillEllipse: common.o Line: common.o CircleSeg: common.o Polygon: common.o diff --git a/tests/gfx/test_list.txt b/tests/gfx/test_list.txt index 8070210..ff64600 100644 --- a/tests/gfx/test_list.txt +++ b/tests/gfx/test_list.txt @@ -8,6 +8,7 @@ Line Circle FillCircle Ellipse +FillEllipse CircleSeg Polygon
-----------------------------------------------------------------------
Summary of changes: libs/gfx/GP_Circle.c | 7 +- libs/gfx/GP_Ellipse.c | 25 ----- libs/gfx/GP_FillCircle.gen.c.t | 30 ++++++- .../FillEllipse.algo.h => GP_FillEllipse.gen.c.t} | 93 ++++++++++++------ libs/gfx/GP_Line.gen.c.t | 4 +- libs/gfx/Makefile | 3 +- libs/gfx/algo/Line.algo.h | 81 ---------------- tests/gfx/{Ellipse.c => FillEllipse.c} | 102 ++++++++++---------- tests/gfx/Line.c | 8 +- tests/gfx/Makefile | 3 +- tests/gfx/test_list.txt | 1 + tests/loaders/PNG.c | 82 +++++++++++++++- .../loaders/data/png/valid/100x100-white-adam7.png | Bin 0 -> 346 bytes 13 files changed, 232 insertions(+), 207 deletions(-) rename libs/gfx/{algo/FillEllipse.algo.h => GP_FillEllipse.gen.c.t} (56%) delete mode 100644 libs/gfx/algo/Line.algo.h copy tests/gfx/{Ellipse.c => FillEllipse.c} (78%) create mode 100644 tests/loaders/data/png/valid/100x100-white-adam7.png
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.