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 77ca5e065797236b928b1ee5a3e869c564620191 (commit) via e8c9a59408d797c9f58085f0656450d4993005cc (commit) from 33b95fd86ead735cd54f3b0f7cf87c779a4370ad (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/77ca5e065797236b928b1ee5a3e869c564620...
commit 77ca5e065797236b928b1ee5a3e869c564620191 Author: Cyril Hrubis metan@ucw.cz Date: Tue Dec 25 02:17:09 2012 +0100
gfx: VLine: Fix the VLine implementation.
diff --git a/build/syms/GFX_symbols.txt b/build/syms/GFX_symbols.txt index c8482d3..d6ed889 100644 --- a/build/syms/GFX_symbols.txt +++ b/build/syms/GFX_symbols.txt @@ -5,37 +5,21 @@ GP_HLine_Raw_32BPP GP_LineAA GP_Line_Raw_32BPP GP_HLineXYW_Raw -GP_VLine_18BPP_LE -GP_VLine_8BPP -GP_VLine_1BPP_LE GP_HLine_Raw_8BPP -GP_VLineAA GP_HLineAA -GP_VLine_4BPP_BE GP_HLineXYW -GP_VLineAA_Raw -GP_VLine_16BPP GP_HLine_Raw_1BPP_LE -GP_VLine_2BPP_LE -GP_VLine_24BPP GP_HLine_Raw_4BPP_BE GP_HLine_Raw_2BPP_BE GP_HLine_Raw_24BPP GP_Line_Raw_24BPP GP_Line_Raw_1BPP_BE -GP_VLineXYH_Raw -GP_VLine_4BPP_LE -GP_VLine_32BPP GP_HLineXXY GP_HLine_Raw_4BPP_LE GP_Line_Raw_18BPP_LE GP_Line_Raw_1BPP_LE -GP_VLineXYY_Raw GP_Line_Raw_4BPP_BE -GP_VLineXYY -GP_VLineXYH GP_HLineXXY_Raw -GP_VLine_2BPP_BE GP_HLine_Raw_1BPP_BE GP_Line GP_Line_Raw_8BPP @@ -46,7 +30,24 @@ GP_Line_Raw_16BPP GP_HLine_Raw_2BPP_LE GP_HLine_Raw_16BPP GP_LineAA_Raw -GP_VLine_1BPP_BE + +GP_VLineXYY_Raw +GP_VLineAA +GP_VLineAA_Raw +GP_VLineXYH_Raw +GP_VLineXYY +GP_VLineXYH +GP_VLine_Raw_16BPP +GP_VLine_Raw_1BPP_LE +GP_VLine_Raw_18BPP_LE +GP_VLine_Raw_2BPP_BE +GP_VLine_Raw_4BPP_BE +GP_VLine_Raw_8BPP +GP_VLine_Raw_2BPP_LE +GP_VLine_Raw_32BPP +GP_VLine_Raw_4BPP_LE +GP_VLine_Raw_24BPP +GP_VLine_Raw_1BPP_BE
GP_Circle GP_Circle_Raw @@ -112,3 +113,4 @@ GP_FillRectXYWH_AA_Raw
GP_AngleInRange GP_NormalizeAngle + diff --git a/include/Makefile b/include/Makefile index f098ae0..f41af14 100644 --- a/include/Makefile +++ b/include/Makefile @@ -1,3 +1,3 @@ TOPDIR=.. -SUBDIRS=core +SUBDIRS=core gfx include $(TOPDIR)/post.mk diff --git a/include/gfx/GP_VLine.gen.h.t b/include/gfx/GP_VLine.gen.h.t new file mode 100644 index 0000000..296e69a --- /dev/null +++ b/include/gfx/GP_VLine.gen.h.t @@ -0,0 +1,35 @@ +/***************************************************************************** + * 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 Cyril Hrubis metan@ucw.cz * + * * + *****************************************************************************/ + +%% extends 'base.h.t' + +{% block description %}VLine generated header{% endblock %} + +{% block body %} + +%% for ps in pixelsizes +void GP_VLine_Raw_{{ ps.suffix }}(GP_Context *context, GP_Coord x, + GP_Coord y0, GP_Coord y1, GP_Pixel pixel); + +%% endfor + +{% endblock body %} diff --git a/include/gfx/GP_VLine.h b/include/gfx/GP_VLine.h index a070f53..269d57a 100644 --- a/include/gfx/GP_VLine.h +++ b/include/gfx/GP_VLine.h @@ -19,49 +19,17 @@ * Copyright (C) 2009-2011 Jiri "BlueBear" Dluhos * * jiri.bluebear.dluhos@gmail.com * * * - * Copyright (C) 2009-2011 Cyril Hrubis metan@ucw.cz * + * Copyright (C) 2009-2012 Cyril Hrubis metan@ucw.cz * * * *****************************************************************************/
-#ifndef GP_VLINE_H -#define GP_VLINE_H +#ifndef GFX_GP_VLINE_H +#define GFX_GP_VLINE_H
#include "core/GP_Context.h"
/* Raw per BPP HLines */ - -void GP_VLine_Raw_1BPP_LE(GP_Context *context, GP_Coord x0, GP_Coord x1, - GP_Coord y, GP_Pixel pixel); - -void GP_VLine_Raw_1BPP_BE(GP_Context *context, GP_Coord x0, GP_Coord x1, - GP_Coord y, GP_Pixel pixel); - -void GP_VLine_Raw_2BPP_LE(GP_Context *context, GP_Coord x0, GP_Coord x1, - GP_Coord y, GP_Pixel pixel); - -void GP_VLine_Raw_2BPP_BE(GP_Context *context, GP_Coord x0, GP_Coord x1, - GP_Coord y, GP_Pixel pixel); - -void GP_VLine_Raw_4BPP_LE(GP_Context *context, GP_Coord x0, GP_Coord x1, - GP_Coord y, GP_Pixel pixel); - -void GP_VLine_Raw_4BPP_BE(GP_Context *context, GP_Coord x0, GP_Coord x1, - GP_Coord y, GP_Pixel pixel); - -void GP_VLine_Raw_8BPP(GP_Context *context, GP_Coord x0, GP_Coord x1, - GP_Coord y, GP_Pixel pixel); - -void GP_VLine_Raw_18BPP_LE(GP_Context *context, GP_Coord x0, GP_Coord x1, - GP_Coord y, GP_Pixel pixel); - -void GP_VLine_Raw_16BPP(GP_Context *context, GP_Coord x0, GP_Coord x1, - GP_Coord y, GP_Pixel pixel); - -void GP_VLine_Raw_24BPP(GP_Context *context, GP_Coord x0, GP_Coord x1, - GP_Coord y, GP_Pixel pixel); - -void GP_VLine_Raw_32BPP(GP_Context *context, GP_Coord x0, GP_Coord x1, - GP_Coord y, GP_Pixel pixel); +#include "gfx/GP_VLine.gen.h"
void GP_VLineXYY(GP_Context *context, GP_Coord x, GP_Coord y0, GP_Coord y1, GP_Pixel pixel); @@ -88,4 +56,4 @@ static inline void GP_VLine_Raw(GP_Context *context, GP_Coord x, GP_VLineXYY_Raw(context, x, y0, y1, pixel); }
-#endif /* GP_VLINE_H */ +#endif /* GFX_GP_VLINE_H */ diff --git a/include/gfx/Makefile b/include/gfx/Makefile new file mode 100644 index 0000000..7548d55 --- /dev/null +++ b/include/gfx/Makefile @@ -0,0 +1,8 @@ +TOPDIR=../.. + +include $(TOPDIR)/pre.mk + +GENHEADERS=GP_VLine.gen.h + +include $(TOPDIR)/gen.mk +include $(TOPDIR)/post.mk diff --git a/libs/gfx/GP_VLine.c b/libs/gfx/GP_VLine.c index 910033d..08d075c 100644 --- a/libs/gfx/GP_VLine.c +++ b/libs/gfx/GP_VLine.c @@ -23,23 +23,35 @@ * * *****************************************************************************/
+#include "core/GP_Common.h" #include "core/GP_GetPutPixel.h" #include "core/GP_FnPerBpp.h"
#include "gfx/GP_VLine.h" #include "gfx/GP_HLine.h"
-#include "algo/VLine.algo.h" - -/* Generate drawing functions for various bit depths. */ -GP_DEF_DRAW_FN_PER_BPP(GP_VLine, DEF_VLINE_FN) +/* + * Ensures that coordinates are in correct order, and clips them. + * Exits immediately if the line is completely clipped out. + */ +#define ORDER_AND_CLIP_COORDS do { + if (y0 > y1) + GP_SWAP(y0, y1); + if (x < 0 || x >= (int) context->w || + y1 < 0 || y0 >= (int) context->h) + return; + y0 = GP_MAX(y0, 0); + y1 = GP_MIN(y1, (int) context->h - 1); +} while (0)
void GP_VLineXYY_Raw(GP_Context *context, GP_Coord x, GP_Coord y0, GP_Coord y1, GP_Pixel pixel) { GP_CHECK_CONTEXT(context); + + ORDER_AND_CLIP_COORDS;
- GP_FN_PER_BPP_CONTEXT(GP_VLine, context, context, x, y0, y1, pixel); + GP_FN_PER_BPP_CONTEXT(GP_VLine_Raw, context, context, x, y0, y1, pixel); }
void GP_VLineXYH_Raw(GP_Context *context, GP_Coord x, GP_Coord y, GP_Size h, diff --git a/libs/gfx/GP_VLine.gen.c.t b/libs/gfx/GP_VLine.gen.c.t new file mode 100644 index 0000000..8700d8f --- /dev/null +++ b/libs/gfx/GP_VLine.gen.c.t @@ -0,0 +1,44 @@ +/***************************************************************************** + * 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 Cyril Hrubis metan@ucw.cz * + * * + *****************************************************************************/ + +%% extends 'base.h.t' + +{% block description %}Vertical Line{% endblock %} + +{% block body %} + +#include "core/GP_GetPutPixel.h" +#include "gfx/GP_VLine.gen.h" + +%% for ps in pixelsizes +void GP_VLine_Raw_{{ ps.suffix }}(GP_Context *context, GP_Coord x, + GP_Coord y0, GP_Coord y1, GP_Pixel pixel) +{ + int y; + + for (y = y0; y <= y1; y++) + GP_PutPixel_Raw_{{ ps.suffix }}(context, x, y, pixel); +} + +%% endfor + +{% endblock body %} diff --git a/libs/gfx/Makefile b/libs/gfx/Makefile index d80e49a..e46a8ef 100644 --- a/libs/gfx/Makefile +++ b/libs/gfx/Makefile @@ -1,7 +1,7 @@ TOPDIR=../.. 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_HLineAA.gen.c GP_VLineAA.gen.c GP_FillCircle.gen.c GP_VLine.gen.c LIBNAME=gfx
include $(TOPDIR)/pre.mk diff --git a/libs/gfx/algo/VLine.algo.h b/libs/gfx/algo/VLine.algo.h deleted file mode 100644 index b33a448..0000000 --- a/libs/gfx/algo/VLine.algo.h +++ /dev/null @@ -1,60 +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-2011 Jiri "BlueBear" Dluhos * - * jiri.bluebear.dluhos@gmail.com * - * * - * Copyright (C) 2009-2011 Cyril Hrubis metan@ucw.cz * - * * - *****************************************************************************/ - -/* A vertical line drawing algorithm. */ - -/* Ensures that coordinates are in correct order, and clips them. - * Exits immediately if the line is completely clipped out. - */ -#define ORDER_AND_CLIP_COORDS do { - if (y0 > y1) - GP_SWAP(y0, y1); - if (x < 0 || x >= (int) context->w || - y1 < 0 || y0 >= (int) context->h) - return; - y0 = GP_MAX(y0, 0); - y1 = GP_MIN(y1, (int) context->h - 1); -} while (0) - -/* - * This macro defines a horizontal 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) - * PIXEL_ADDRESS - a function that returns a pointer to a pixel in memory, - * in form f(context, y, x) - * WRITE_PIXELS - a function that fills a linear block with pixel value, - * in form f(start, length, pixel) - * FN_NAME - name of the function to be defined - */ -#define DEF_VLINE_FN(FN_NAME, CONTEXT_T, PIXEL_T, PUT_PIXEL) -void FN_NAME(CONTEXT_T context, int x, int y0, int y1, PIXEL_T pixel) -{ - ORDER_AND_CLIP_COORDS; - int y; -- for (y = y0; y <= y1; y++) - PUT_PIXEL(context, x, y, pixel); -}
http://repo.or.cz/w/gfxprim.git/commit/e8c9a59408d797c9f58085f0656450d499300...
commit e8c9a59408d797c9f58085f0656450d4993005cc Author: Cyril Hrubis metan@ucw.cz Date: Tue Dec 25 01:23:10 2012 +0100
core: WritePixel: Small cleanup first.
diff --git a/include/core/GP_Pixel.h b/include/core/GP_Pixel.h index f40c8a6..3b9d254 100644 --- a/include/core/GP_Pixel.h +++ b/include/core/GP_Pixel.h @@ -61,7 +61,6 @@ typedef uint32_t GP_Pixel; * Information about ordering of pixels in byte for 1, 2 and 4 bpp * used in a one bit variable in GP_Context */ - typedef enum { /* less significant bits contain pixels with lower indices */ /* also used for irrelevant bit-endian */ @@ -80,7 +79,6 @@ typedef enum { * A - opacity (0=transparent) * P - palette (index) */ - typedef struct { char name[8]; /* Channel name */ uint8_t offset; /* Offset in bits */ @@ -90,7 +88,6 @@ typedef struct { /* * Maximum number of channels in a PixelType */ - #define GP_PIXELTYPE_MAX_CHANNELS 8
/* @@ -98,7 +95,6 @@ typedef struct { * Assumes name with at most 15 chars * Assumes at most 8 channels */ - typedef struct { GP_PixelType type; /* Number of the type */ const char name[16]; /* Name */ diff --git a/include/core/GP_WritePixel.h b/include/core/GP_WritePixel.h index d9530f9..bb79b1f 100644 --- a/include/core/GP_WritePixel.h +++ b/include/core/GP_WritePixel.h @@ -16,15 +16,15 @@ * 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-2012 Cyril Hrubis metan@ucw.cz * * * *****************************************************************************/
-#ifndef GP_WRITEPIXEL_H -#define GP_WRITEPIXEL_H +#ifndef CORE_GP_WRITEPIXEL_H +#define CORE_GP_WRITEPIXEL_H
#include <stdint.h> #include <unistd.h> @@ -52,10 +52,20 @@ void GP_WritePixels_4BPP_LE(uint8_t *start, uint8_t off, /* * These calls are not byte aligned, thus need start offset. */ -void GP_WritePixels_1BPP_BE(uint8_t *start, uint8_t off, size_t cnt, uint8_t val); -void GP_WritePixels_2BPP_BE(uint8_t *start, uint8_t off, size_t cnt, uint8_t val); -void GP_WritePixels_4BPP_BE(uint8_t *start, uint8_t off, size_t cnt, uint8_t val); -void GP_WritePixels_18BPP_BE(void *start, uint8_t off, size_t count, uint32_t value); +void GP_WritePixels_1BPP_BE(uint8_t *start, uint8_t off, + size_t cnt, uint8_t val); + +void GP_WritePixels_2BPP_BE(uint8_t *start, uint8_t off, + size_t cnt, uint8_t val); + +void GP_WritePixels_4BPP_BE(uint8_t *start, uint8_t off, + size_t cnt, uint8_t val); + +void GP_WritePixels_18BPP_BE(void *start, uint8_t off, + size_t count, uint32_t value); + +void GP_WritePixels_18BPP_LE(void *start, uint8_t off, + size_t count, uint32_t value);
/* Byte-aligned calls. */ void GP_WritePixels_8BPP(void *start, size_t count, uint8_t value); @@ -63,14 +73,4 @@ void GP_WritePixels_16BPP(void *start, size_t count, uint16_t value); void GP_WritePixels_24BPP(void *start, size_t count, uint32_t value); void GP_WritePixels_32BPP(void *start, size_t count, uint32_t value);
-/* aliases for older names */ -#define GP_WritePixels1bpp GP_WritePixels_1BPP_BE -#define GP_WritePixels2bpp GP_WritePixels_2BPP_BE -#define GP_WritePixels4bpp GP_WritePixels_4BPP_BE -#define GP_WritePixels18bpp GP_WritePixels_18BPP_BE -#define GP_WritePixels8bpp GP_WritePixels_8BPP -#define GP_WritePixels16bpp GP_WritePixels_16BPP -#define GP_WritePixels24bpp GP_WritePixels_24BPP -#define GP_WritePixels32bpp GP_WritePixels_32BPP - -#endif /* GP_WRITEPIXEL_H */ +#endif /* CORE_GP_WRITEPIXEL_H */ diff --git a/tests/core/WritePixel_testsuite.gen.c.t b/tests/core/WritePixel_testsuite.gen.c.t index df49d2d..0807e0f 100644 --- a/tests/core/WritePixel_testsuite.gen.c.t +++ b/tests/core/WritePixel_testsuite.gen.c.t @@ -93,7 +93,7 @@ static int WritePixel{{ "_%i_%i_%i_%i"|format(pixelsize, offset, len, aligment) %% endfor %% endfor
- GP_WritePixels{{ pixelsize }}bpp(write_buf + {{aligment + offset * pixelsize//8}}, {{ len }}, 0xffffffff>>{{32 - pixelsize}}); + GP_WritePixels_{{ pixelsize }}BPP(write_buf + {{aligment + offset * pixelsize//8}}, {{ len }}, 0xffffffff>>{{32 - pixelsize}});
COMPARE_BUFFERS({{""p=%i o=%i l=%i a=%i""|format(pixelsize, offset, len, aligment)}}, write_buf, gen_buf); }
-----------------------------------------------------------------------
Summary of changes: build/syms/GFX_symbols.txt | 36 ++++++------ include/Makefile | 2 +- include/core/GP_Pixel.h | 4 - include/core/GP_WritePixel.h | 36 ++++++------ .../GP_InputDriverX11.h => gfx/GP_VLine.gen.h.t} | 20 +++---- include/gfx/GP_VLine.h | 42 ++------------ include/gfx/Makefile | 8 +++ libs/gfx/GP_VLine.c | 22 ++++++-- .../gfx/GP_VLine.gen.c.t | 24 +++++--- libs/gfx/Makefile | 2 +- libs/gfx/algo/VLine.algo.h | 60 -------------------- tests/core/WritePixel_testsuite.gen.c.t | 2 +- 12 files changed, 94 insertions(+), 164 deletions(-) copy include/{input/GP_InputDriverX11.h => gfx/GP_VLine.gen.h.t} (86%) create mode 100644 include/gfx/Makefile copy include/filters/GP_LinearThreads.h => libs/gfx/GP_VLine.gen.c.t (79%) delete mode 100644 libs/gfx/algo/VLine.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.