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, generate has been updated via cfc6c022b5368c44e60c7f494865c651066fb117 (commit) from ecca5686f36c35b12f2bd72dd5ef16165da1ec8c (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/cfc6c022b5368c44e60c7f494865c651066fb...
commit cfc6c022b5368c44e60c7f494865c651066fb117 Author: Cyril Hrubis metan@ucw.cz Date: Sun Jul 17 14:13:32 2011 +0200
Made the gfx library work with the generated code.
diff --git a/include/core/GP_Context.h b/include/core/GP_Context.h index ce85f65..35b8ae7 100644 --- a/include/core/GP_Context.h +++ b/include/core/GP_Context.h @@ -30,13 +30,9 @@ #include <unistd.h>
#include "GP_Common.h" +#include "GP_Types.h" #include "GP_Pixel.h"
-/* Integer type for coordinates: x, y, width, height, ... - * Should be signed to hold negative values as well. */ -typedef int GP_Coord; -typedef unsigned int GP_Size; - /* This structure holds all information needed for drawing into an image. */ typedef struct GP_Context { uint8_t *pixels; /* pointer to image pixels */ diff --git a/include/gfx/GP_Gfx.h b/include/core/GP_DefFnPerBpp.h similarity index 54% copy from include/gfx/GP_Gfx.h copy to include/core/GP_DefFnPerBpp.h index aa578b4..6da6754 100644 --- a/include/gfx/GP_Gfx.h +++ b/include/core/GP_DefFnPerBpp.h @@ -16,41 +16,39 @@ * 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 * + * Copyright (C) 2009-2011 Cyril Hrubis metan@ucw.cz * * * *****************************************************************************/
/* - - This is a main header for gfx part. - + * Macros that gets MACRO template for drawing function and generates drawing + * functions for each BPP. + * + * This functions are later used by GP_FN_PER_BPP_CONTEXT() to generate one + * drawing function for all BPP Yay! */ +#ifndef GP_DEF_FN_PER_BPP_H +#define GP_DEF_FN_PER_BPP_H + +#define GP_DEF_DRAW_FN_PER_BPP(fname, MACRO_NAME) + GP_DEF_FN_PER_BPP(fname, MACRO_NAME, GP_PutPixel_Raw_)
-#ifndef GP_GFX_H -#define GP_GFX_H +#define GP_DEF_FILL_FN_PER_BPP(fname, MACRO_NAME) + GP_DEF_FN_PER_BPP(fname, MACRO_NAME, GP_HLine_)
-/* basic definitions and structures */ -#include "core/GP_Common.h" -#include "core/GP_Transform.h" -#include "core/GP_Context.h" -#include "core/GP_WritePixel.h" -#include "core/GP_GetPutPixel.h" -#include "core/GP_Color.h" +#define GP_DEF_FN_FOR_BPP(fname, MACRO_NAME, fdraw, bpp) + MACRO_NAME(fname##_##bpp, GP_Context *, GP_Pixel, fdraw##bpp)
-/* public drawing API */ -#include "GP_Fill.h" -#include "GP_HLine.h" -#include "GP_VLine.h" -#include "GP_Line.h" -#include "GP_Rect.h" -#include "GP_Triangle.h" -#include "GP_Tetragon.h" -#include "GP_Circle.h" -#include "GP_Ellipse.h" -#include "GP_Polygon.h" -#include "GP_Symbol.h" +#define GP_DEF_FN_PER_BPP(fname, MACRO_NAME, fdraw) + GP_DEF_FN_FOR_BPP(fname, MACRO_NAME, fdraw, 1BPP_LE) + GP_DEF_FN_FOR_BPP(fname, MACRO_NAME, fdraw, 1BPP_BE) + GP_DEF_FN_FOR_BPP(fname, MACRO_NAME, fdraw, 2BPP_LE) + GP_DEF_FN_FOR_BPP(fname, MACRO_NAME, fdraw, 2BPP_BE) + GP_DEF_FN_FOR_BPP(fname, MACRO_NAME, fdraw, 4BPP_LE) + GP_DEF_FN_FOR_BPP(fname, MACRO_NAME, fdraw, 4BPP_BE) + GP_DEF_FN_FOR_BPP(fname, MACRO_NAME, fdraw, 8BPP) + GP_DEF_FN_FOR_BPP(fname, MACRO_NAME, fdraw, 16BPP) + GP_DEF_FN_FOR_BPP(fname, MACRO_NAME, fdraw, 24BPP) + GP_DEF_FN_FOR_BPP(fname, MACRO_NAME, fdraw, 32BPP) -#endif /* GP_GFX_H */ +#endif /* GP_DEF_FN_PER_BPP_H */ diff --git a/include/gfx/GP_Polygon.h b/include/core/GP_Types.h similarity index 75% copy from include/gfx/GP_Polygon.h copy to include/core/GP_Types.h index dc4a6e1..e3d0f55 100644 --- a/include/gfx/GP_Polygon.h +++ b/include/core/GP_Types.h @@ -16,19 +16,20 @@ * 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 * + * Copyright (C) 2009-2011 Cyril Hrubis metan@ucw.cz * * * *****************************************************************************/
-#ifndef GP_FILL_POLYGON_H -#define GP_FILL_POLYGON_H +#ifndef GP_TYPES_H +#define GP_TYPES_H
-#include "core/GP_Context.h" +#include <stdint.h>
-void GP_FillPolygon(GP_Context *context, int vertex_count, const int *xy, - GP_Pixel pixel); +/* + * Integer type for coordinates: x, y, width, height, ... + * Should be signed to hold negative values as well. + */ +typedef int GP_Coord; +typedef unsigned int GP_Size;
-#endif /* GP_FILL_POLYGON_H */ +#endif /* GP_TYPES_H */ diff --git a/include/gfx/GP_Circle.h b/include/gfx/GP_Circle.h index 6360e72..aaab27a 100644 --- a/include/gfx/GP_Circle.h +++ b/include/gfx/GP_Circle.h @@ -28,16 +28,16 @@
#include "core/GP_Context.h"
-void GP_Circle(GP_Context *context, int xcenter, int ycenter, - unsigned int r, GP_Pixel pixel); +void GP_Circle(GP_Context *context, GP_Coord xcenter, GP_Coord ycenter, + GP_Size r, GP_Pixel pixel);
-void GP_TCircle(GP_Context *context, int xcenter, int ycenter, - unsigned int r, GP_Pixel pixel); +void GP_TCircle(GP_Context *context, GP_Coord xcenter, GP_Coord ycenter, + GP_Size r, GP_Pixel pixel);
-void GP_FillCircle(GP_Context *context, int xcenter, int ycenter, - unsigned int r, GP_Pixel pixel); +void GP_FillCircle(GP_Context *context, GP_Coord xcenter, GP_Coord ycenter, + GP_Size r, GP_Pixel pixel);
-void GP_TFillCircle(GP_Context *context, int xcenter, int ycenter, - unsigned int r, GP_Pixel pixel); +void GP_TFillCircle(GP_Context *context, GP_Coord xcenter, GP_Coord ycenter, + GP_Size r, GP_Pixel pixel);
#endif /* GP_CIRCLE_H */ diff --git a/include/gfx/GP_Ellipse.h b/include/gfx/GP_Ellipse.h index eeb6d5a..ef10808 100644 --- a/include/gfx/GP_Ellipse.h +++ b/include/gfx/GP_Ellipse.h @@ -28,17 +28,17 @@
#include "core/GP_Context.h"
-void GP_Ellipse(GP_Context *context, int xcenter, int ycenter, - unsigned int a, unsigned int b, GP_Pixel pixel); +void GP_Ellipse(GP_Context *context, GP_Coord xcenter, GP_Coord ycenter, + GP_Size a, GP_Size b, GP_Pixel pixel);
-void GP_TEllipse(GP_Context *context, int xcenter, int ycenter, - unsigned int a, unsigned int b, GP_Pixel pixel); +void GP_TEllipse(GP_Context *context, GP_Coord xcenter, GP_Coord ycenter, + GP_Size a, GP_Size b, GP_Pixel pixel);
-void GP_FillEllipse(GP_Context *context, int xcenter, int ycenter, - unsigned int a, unsigned int b, GP_Pixel pixel); +void GP_FillEllipse(GP_Context *context, GP_Coord xcenter, GP_Coord ycenter, + GP_Size a, GP_Size b, GP_Pixel pixel);
-void GP_TFillEllipse(GP_Context *context, int xcenter, int ycenter, - unsigned int a, unsigned int b, GP_Pixel pixel); +void GP_TFillEllipse(GP_Context *context, GP_Coord xcenter, GP_Coord ycenter, + GP_Size a, GP_Size b, GP_Pixel pixel);
#endif /* GP_ELLIPSE_H */ diff --git a/include/gfx/GP_Gfx.h b/include/gfx/GP_Gfx.h index aa578b4..4639b1f 100644 --- a/include/gfx/GP_Gfx.h +++ b/include/gfx/GP_Gfx.h @@ -34,6 +34,7 @@
/* basic definitions and structures */ #include "core/GP_Common.h" +#include "core/GP_Types.h" #include "core/GP_Transform.h" #include "core/GP_Context.h" #include "core/GP_WritePixel.h" diff --git a/include/gfx/GP_HLine.h b/include/gfx/GP_HLine.h index ee3c674..66e2b79 100644 --- a/include/gfx/GP_HLine.h +++ b/include/gfx/GP_HLine.h @@ -28,26 +28,59 @@
#include "core/GP_Context.h"
-void GP_HLine1bpp(GP_Context *context, int x0, int x1, int y, GP_Pixel pixel); -void GP_HLine2bpp(GP_Context *context, int x0, int x1, int y, GP_Pixel pixel); -void GP_HLine8bpp(GP_Context *context, int x0, int x1, int y, GP_Pixel pixel); -void GP_HLine4bpp(GP_Context *context, int x0, int x1, int y, GP_Pixel pixel); -void GP_HLine16bpp(GP_Context *context, int x0, int x1, int y, GP_Pixel pixel); -void GP_HLine24bpp(GP_Context *context, int x0, int x1, int y, GP_Pixel pixel); -void GP_HLine32bpp(GP_Context *context, int x0, int x1, int y, GP_Pixel pixel); +void GP_HLine_1BPP_LE(GP_Context *context, GP_Coord x0, GP_Coord x1, + GP_Coord y, GP_Pixel pixel);
-void GP_HLineXXY(GP_Context *context, int x0, int x1, int y, GP_Pixel pixel); +void GP_HLine_1BPP_BE(GP_Context *context, GP_Coord x0, GP_Coord x1, + GP_Coord y, GP_Pixel pixel);
-void GP_HLineXYW(GP_Context *context, int x, int y, unsigned int w, +void GP_HLine_2BPP_LE(GP_Context *context, GP_Coord x0, GP_Coord x1, + GP_Coord y, GP_Pixel pixel); + +void GP_HLine_2BPP_BE(GP_Context *context, GP_Coord x0, GP_Coord x1, + GP_Coord y, GP_Pixel pixel); + +void GP_HLine_4BPP_LE(GP_Context *context, GP_Coord x0, GP_Coord x1, + GP_Coord y, GP_Pixel pixel); + +void GP_HLine_4BPP_BE(GP_Context *context, GP_Coord x0, GP_Coord x1, + GP_Coord y, GP_Pixel pixel); + +void GP_HLine_8BPP(GP_Context *context, GP_Coord x0, GP_Coord x1, + GP_Coord y, GP_Pixel pixel); + +void GP_HLine_16BPP(GP_Context *context, GP_Coord x0, GP_Coord x1, + GP_Coord y, GP_Pixel pixel); + +void GP_HLine_24BPP(GP_Context *context, GP_Coord x0, GP_Coord x1, + GP_Coord y, GP_Pixel pixel); + +void GP_HLine_32BPP(GP_Context *context, GP_Coord x0, GP_Coord x1, + GP_Coord y, GP_Pixel pixel); + +void GP_HLineXXY(GP_Context *context, GP_Coord x0, GP_Coord x1, + GP_Coord y, GP_Pixel pixel); + +void GP_HLineXYW(GP_Context *context, GP_Coord x, GP_Coord y, GP_Size w, GP_Pixel pixel);
-void GP_THLineXXY(GP_Context *context, int x0, int x1, int y, GP_Pixel pixel); +void GP_THLineXXY(GP_Context *context, GP_Coord x0, GP_Coord x1, + GP_Coord y, GP_Pixel pixel);
-void GP_THLineXYW(GP_Context *context, int x, int y, unsigned int w, +void GP_THLineXYW(GP_Context *context, GP_Coord x, GP_Coord y, GP_Size w, GP_Pixel pixel);
/* default argument set is XXY */ -#define GP_HLine GP_HLineXXY -#define GP_THLine GP_THLineXXY +static inline void GP_HLine(GP_Context *context, GP_Coord x0, GP_Coord x1, + GP_Coord y, GP_Pixel p) +{ + GP_HLineXXY(context, x0, x1, y, p); +} + +static inline void GP_THLine(GP_Context *context, GP_Coord x0, GP_Coord x1, + GP_Coord y, GP_Pixel p) +{ + GP_THLineXXY(context, x0, x1, y, p); +}
#endif /* GP_HLINE_H */ diff --git a/include/gfx/GP_Line.h b/include/gfx/GP_Line.h index b5587bd..be0b67f 100644 --- a/include/gfx/GP_Line.h +++ b/include/gfx/GP_Line.h @@ -28,19 +28,22 @@
#include "core/GP_Context.h"
-void GP_Line8bpp(GP_Context *context, int x0, int y0, int x1, int y1, - GP_Pixel pixel); -void GP_Line16bpp(GP_Context *context, int x0, int y0, int x1, int y1, - GP_Pixel pixel); -void GP_Line24bpp(GP_Context *context, int x0, int y0, int x1, int y1, - GP_Pixel pixel); -void GP_Line32bpp(GP_Context *context, int x0, int y0, int x1, int y1, - GP_Pixel pixel); - -void GP_Line(GP_Context *context, int x0, int y0, int x1, int y1, - GP_Pixel pixel); - -void GP_TLine(GP_Context *context, int x0, int y0, int x1, int y1, - GP_Pixel pixel); +void GP_Line8bpp(GP_Context *context, GP_Coord x0, GP_Coord y0, + GP_Coord x1, GP_Coord y1, GP_Pixel pixel); + +void GP_Line16bpp(GP_Context *context, GP_Coord x0, GP_Coord y0, + GP_Coord x1, GP_Coord y1, GP_Pixel pixel); + +void GP_Line24bpp(GP_Context *context, GP_Coord x0, GP_Coord y0, + GP_Coord x1, GP_Coord y1, GP_Pixel pixel); + +void GP_Line32bpp(GP_Context *context, GP_Coord x0, GP_Coord y0, + GP_Coord x1, GP_Coord y1, GP_Pixel pixel); + +void GP_Line(GP_Context *context, GP_Coord x0, GP_Coord y0, + GP_Coord x1, GP_Coord y1, GP_Pixel pixel); + +void GP_TLine(GP_Context *context, GP_Coord x0, GP_Coord y0, + GP_Coord x1, GP_Coord y1, GP_Pixel pixel);
#endif /* GP_LINE_H */ diff --git a/include/gfx/GP_Polygon.h b/include/gfx/GP_Polygon.h index dc4a6e1..eee3bcc 100644 --- a/include/gfx/GP_Polygon.h +++ b/include/gfx/GP_Polygon.h @@ -23,12 +23,12 @@ * * *****************************************************************************/
-#ifndef GP_FILL_POLYGON_H -#define GP_FILL_POLYGON_H +#ifndef GP_POLYGON_H +#define GP_POLYGON_H
#include "core/GP_Context.h"
-void GP_FillPolygon(GP_Context *context, int vertex_count, const int *xy, - GP_Pixel pixel); +void GP_FillPolygon(GP_Context *context, int vertex_count, const GP_Coord *xy, + GP_Pixel pixel);
-#endif /* GP_FILL_POLYGON_H */ +#endif /* GP_POLYGON_H */ diff --git a/include/gfx/GP_Rect.h b/include/gfx/GP_Rect.h index a0085e8..984e0ee 100644 --- a/include/gfx/GP_Rect.h +++ b/include/gfx/GP_Rect.h @@ -28,33 +28,33 @@
#include "core/GP_Context.h"
-void GP_RectXYXY(GP_Context *context, int x0, int y0, int x1, int y1, - GP_Pixel pixel); +void GP_RectXYXY(GP_Context *context, GP_Coord x0, GP_Coord y0, + GP_Coord x1, GP_Coord y1, GP_Pixel pixel);
-void GP_RectXYWH(GP_Context *context, int x, int y, - unsigned int w, unsigned int h, GP_Pixel pixel); +void GP_RectXYWH(GP_Context *context, GP_Coord x, GP_Coord y, + GP_Size w, GP_Size h, GP_Pixel pixel);
-void GP_TRectXYXY(GP_Context *context, int x0, int y0, int x1, int y1, - GP_Pixel pixel); +void GP_TRectXYXY(GP_Context *context, GP_Coord x0, GP_Coord y0, + GP_Coord x1, GP_Coord y1, GP_Pixel pixel);
-void GP_TRectXYWH(GP_Context *context, int x, int y, - unsigned int w, unsigned int h, GP_Pixel pixel); +void GP_TRectXYWH(GP_Context *context, GP_Coord x, GP_Coord y, + GP_Size w, GP_Size h, GP_Pixel pixel);
/* The XYXY argument set is the default */ #define GP_Rect GP_RectXYXY #define GP_TRect GP_TRectXYXY
-void GP_FillRectXYXY(GP_Context *context, int x0, int y0, int x1, int y1, - GP_Pixel pixel); +void GP_FillRectXYXY(GP_Context *context, GP_Coord x0, GP_Coord y0, + GP_Coord x1, GP_Coord y1, GP_Pixel pixel);
-void GP_FillRectXYWH(GP_Context *context, int x, int y, - unsigned int w, unsigned int h, GP_Pixel pixel); +void GP_FillRectXYWH(GP_Context *context, GP_Coord x, GP_Coord y, + GP_Size w, GP_Size h, GP_Pixel pixel);
-void GP_TFillRectXYXY(GP_Context *context, int x0, int y0, int x1, int y1, - GP_Pixel pixel); +void GP_TFillRectXYXY(GP_Context *context, GP_Coord x0, GP_Coord y0, + GP_Coord x1, GP_Coord y1, GP_Pixel pixel);
-void GP_TFillRectXYWH(GP_Context *context, int x, int y, - unsigned int w, unsigned int h, GP_Pixel pixel); +void GP_TFillRectXYWH(GP_Context *context, GP_Coord x, GP_Coord y, + GP_Size w, GP_Size h, GP_Pixel pixel);
#define GP_FillRect GP_FillRectXYXY #define GP_TFillRect GP_TFillRectXYXY diff --git a/include/gfx/GP_Symbol.h b/include/gfx/GP_Symbol.h index 5aa3f2c..648a11e 100644 --- a/include/gfx/GP_Symbol.h +++ b/include/gfx/GP_Symbol.h @@ -30,7 +30,7 @@ #ifndef GP_SYMBOL_H #define GP_SYMBOL_H
-#include "core/GP_Context.h" +#include "core/GP_Types.h"
typedef enum GP_SymbolType { GP_SYM_TRIANGLE_UP, @@ -41,15 +41,19 @@ typedef enum GP_SymbolType { } GP_SymbolType;
void GP_Symbol(GP_Context *context, GP_SymbolType sym, - int x, int y, int w, int h, GP_Pixel pixel); + GP_Coord x, GP_Coord y, + GP_Size w, GP_Size h, GP_Pixel pixel);
void GP_TSymbol(GP_Context *context, GP_SymbolType sym, - int x, int y, int w, int h, GP_Pixel pixel); + GP_Coord x, GP_Coord y, + GP_Size w, GP_Size h, GP_Pixel pixel);
void GP_FillSymbol(GP_Context *context, GP_SymbolType sym, - int x, int y, int w, int h, GP_Pixel pixel); + GP_Coord x, GP_Coord y, + GP_Size w, GP_Size h, GP_Pixel pixel);
void GP_TFillSymbol(GP_Context *context, GP_SymbolType sym, - int x, int y, int w, int h, GP_Pixel pixel); + GP_Coord x, GP_Coord y, + GP_Size w, GP_Size h, GP_Pixel pixel);
#endif /* GP_SYMBOL_H */ diff --git a/include/gfx/GP_Tetragon.h b/include/gfx/GP_Tetragon.h index 3f9d027..687ed7e 100644 --- a/include/gfx/GP_Tetragon.h +++ b/include/gfx/GP_Tetragon.h @@ -28,16 +28,20 @@
#include "core/GP_Context.h"
-void GP_Tetragon(GP_Context *context, int x0, int y0, int x1, int y1, - int x2, int y2, int x3, int y3, GP_Pixel pixel); +void GP_Tetragon(GP_Context *context, GP_Coord x0, GP_Coord y0, + GP_Coord x1, GP_Coord y1, GP_Coord x2, GP_Coord y2, + GP_Coord x3, GP_Coord y3, GP_Pixel pixel);
-void GP_TTetragon(GP_Context *context, int x0, int y0, int x1, int y1, - int x2, int y2, int x3, int y3, GP_Pixel pixel); +void GP_TTetragon(GP_Context *context, GP_Coord x0, GP_Coord y0, + GP_Coord x1, GP_Coord y1, GP_Coord x2, GP_Coord y2, + GP_Coord x3, GP_Coord y3, GP_Pixel pixel);
-void GP_FillTetragon(GP_Context *context, int x0, int y0, int x1, int y1, - int x2, int y2, int x3, int y3, GP_Pixel pixel); +void GP_FillTetragon(GP_Context *context, GP_Coord x0, GP_Coord y0, + GP_Coord x1, GP_Coord y1, GP_Coord x2, GP_Coord y2, + GP_Coord x3, GP_Coord y3, GP_Pixel pixel);
-void GP_TFillTetragon(GP_Context *context, int x0, int y0, int x1, int y1, - int x2, int y2, int x3, int y3, GP_Pixel pixel); +void GP_TFillTetragon(GP_Context *context, GP_Coord x0, GP_Coord y0, + GP_Coord x1, GP_Coord y1, GP_Coord x2, GP_Coord y2, + GP_Coord x3, GP_Coord y3, GP_Pixel pixel);
#endif /* GP_TETRAGON_H */ diff --git a/include/gfx/GP_Triangle.h b/include/gfx/GP_Triangle.h index 128a721..7703a5f 100644 --- a/include/gfx/GP_Triangle.h +++ b/include/gfx/GP_Triangle.h @@ -28,16 +28,20 @@
#include "core/GP_Context.h"
-void GP_Triangle(GP_Context *context, int x0, int y0, int x1, int y1, - int x2, int y2, GP_Pixel pixel); +void GP_Triangle(GP_Context *context, GP_Coord x0, GP_Coord y0, + GP_Coord x1, GP_Coord y1, + GP_Coord x2, GP_Coord y2, GP_Pixel pixel);
-void GP_TTriangle(GP_Context *context, int x0, int y0, int x1, int y1, - int x2, int y2, GP_Pixel pixel); +void GP_TTriangle(GP_Context *context, GP_Coord x0, GP_Coord y0, + GP_Coord x1, GP_Coord y1, + GP_Coord x2, GP_Coord y2, GP_Pixel pixel);
-void GP_FillTriangle(GP_Context *context, int x0, int y0, int x1, int y1, - int x2, int y2, GP_Pixel pixel); +void GP_FillTriangle(GP_Context *context, GP_Coord x0, GP_Coord y0, + GP_Coord x1, GP_Coord y1, + GP_Coord x2, GP_Coord y2, GP_Pixel pixel);
-void GP_TFillTriangle(GP_Context *context, int x0, int y0, int x1, int y1, - int x2, int y2, GP_Pixel pixel); +void GP_TFillTriangle(GP_Context *context, GP_Coord x0, GP_Coord y0, + GP_Coord x1, GP_Coord y1, + GP_Coord x2, GP_Coord y2, GP_Pixel pixel);
#endif /* GP_TRIANGLE_H */ diff --git a/include/gfx/GP_VLine.h b/include/gfx/GP_VLine.h index 9e857b4..3cf6085 100644 --- a/include/gfx/GP_VLine.h +++ b/include/gfx/GP_VLine.h @@ -28,15 +28,17 @@
#include "core/GP_Context.h"
-void GP_VLineXYY(GP_Context *context, int x, int y0, int y1, GP_Pixel pixel); +void GP_VLineXYY(GP_Context *context, GP_Coord x, GP_Coord y0, + GP_Coord y1, GP_Pixel pixel);
-void GP_VLineXYH(GP_Context *context, int x, int y, - unsigned int height, GP_Pixel pixel); +void GP_VLineXYH(GP_Context *context, GP_Coord x, GP_Coord y, + GP_Size height, GP_Pixel pixel);
-void GP_TVLineXYY(GP_Context *context, int x, int y0, int y1, GP_Pixel pixel); +void GP_TVLineXYY(GP_Context *context, GP_Coord x, GP_Coord y0, + GP_Coord y1, GP_Pixel pixel);
-void GP_TVLineXYH(GP_Context *context, int x, int y, - unsigned int height, GP_Pixel pixel); +void GP_TVLineXYH(GP_Context *context, GP_Coord x, GP_Coord y, + GP_Size height, GP_Pixel pixel);
/* default argument set is XYY */ #define GP_VLine GP_VLineXYY diff --git a/libs/gfx/GP_Circle.c b/libs/gfx/GP_Circle.c index 4e92243..e92d8cc 100644 --- a/libs/gfx/GP_Circle.c +++ b/libs/gfx/GP_Circle.c @@ -24,32 +24,28 @@ *****************************************************************************/
#include "GP_Gfx.h" -#include "algo/Circle.algo.h" #include "core/GP_FnPerBpp.h" +#include "core/GP_DefFnPerBpp.h" + +#include "algo/Circle.algo.h"
/* Generate drawing functions for various bit depths. */ -DEF_CIRCLE_FN(GP_Circle1bpp, GP_Context *, GP_Pixel, GP_PutPixel1bpp) -DEF_CIRCLE_FN(GP_Circle2bpp, GP_Context *, GP_Pixel, GP_PutPixel2bpp) -DEF_CIRCLE_FN(GP_Circle4bpp, GP_Context *, GP_Pixel, GP_PutPixel4bpp) -DEF_CIRCLE_FN(GP_Circle8bpp, GP_Context *, GP_Pixel, GP_PutPixel8bpp) -DEF_CIRCLE_FN(GP_Circle16bpp, GP_Context *, GP_Pixel, GP_PutPixel16bpp) -DEF_CIRCLE_FN(GP_Circle24bpp, GP_Context *, GP_Pixel, GP_PutPixel24bpp) -DEF_CIRCLE_FN(GP_Circle32bpp, GP_Context *, GP_Pixel, GP_PutPixel32bpp) +GP_DEF_DRAW_FN_PER_BPP(GP_Circle, DEF_CIRCLE_FN)
-void GP_Circle(GP_Context *context, int xcenter, int ycenter, - unsigned int r, GP_Pixel pixel) +void GP_Circle(GP_Context *context, GP_Coord xcenter, GP_Coord ycenter, + GP_Size r, GP_Pixel pixel) { GP_CHECK_CONTEXT(context);
- GP_FN_PER_BPP(GP_Circle, context->bpp, context, - xcenter, ycenter, r, pixel); + GP_FN_PER_BPP_CONTEXT(GP_Circle, context, context, + xcenter, ycenter, r, pixel); }
-void GP_TCircle(GP_Context *context, int xcenter, int ycenter, - unsigned int r, GP_Pixel pixel) +void GP_TCircle(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_Circle(context, xcenter, ycenter, r, pixel); @@ -58,25 +54,19 @@ void GP_TCircle(GP_Context *context, int xcenter, int ycenter, #include "algo/FillCircle.algo.h"
/* Generate drawing functions for various bit depths. */ -DEF_FILLCIRCLE_FN(GP_FillCircle1bpp, GP_Context *, GP_Pixel, GP_HLine1bpp) -DEF_FILLCIRCLE_FN(GP_FillCircle2bpp, GP_Context *, GP_Pixel, GP_HLine2bpp) -DEF_FILLCIRCLE_FN(GP_FillCircle4bpp, GP_Context *, GP_Pixel, GP_HLine4bpp) -DEF_FILLCIRCLE_FN(GP_FillCircle8bpp, GP_Context *, GP_Pixel, GP_HLine8bpp) -DEF_FILLCIRCLE_FN(GP_FillCircle16bpp, GP_Context *, GP_Pixel, GP_HLine16bpp) -DEF_FILLCIRCLE_FN(GP_FillCircle24bpp, GP_Context *, GP_Pixel, GP_HLine24bpp) -DEF_FILLCIRCLE_FN(GP_FillCircle32bpp, GP_Context *, GP_Pixel, GP_HLine32bpp) +GP_DEF_FILL_FN_PER_BPP(GP_FillCircle, DEF_FILLCIRCLE_FN)
-void GP_FillCircle(GP_Context *context, int xcenter, int ycenter, - unsigned int r, GP_Pixel pixel) +void GP_FillCircle(GP_Context *context, GP_Coord xcenter, GP_Coord ycenter, + GP_Size r, GP_Pixel pixel) { GP_CHECK_CONTEXT(context);
- GP_FN_PER_BPP(GP_FillCircle, context->bpp, context, - xcenter, ycenter, r, pixel); + GP_FN_PER_BPP_CONTEXT(GP_FillCircle, context, context, + xcenter, ycenter, r, pixel); }
-void GP_TFillCircle(GP_Context *context, int xcenter, int ycenter, - unsigned int r, GP_Pixel pixel) +void GP_TFillCircle(GP_Context *context, GP_Coord xcenter, GP_Coord ycenter, + GP_Size r, GP_Pixel pixel) { GP_CHECK_CONTEXT(context); diff --git a/libs/gfx/GP_Ellipse.c b/libs/gfx/GP_Ellipse.c index 701f9bb..bbd3bdf 100644 --- a/libs/gfx/GP_Ellipse.c +++ b/libs/gfx/GP_Ellipse.c @@ -24,33 +24,29 @@ *****************************************************************************/
#include "GP_Gfx.h" -#include "algo/Ellipse.algo.h" #include "core/GP_FnPerBpp.h" +#include "core/GP_DefFnPerBpp.h" + +#include "algo/Ellipse.algo.h"
/* Generate drawing functions for various bit depths. */ -DEF_ELLIPSE_FN(GP_Ellipse1bpp, GP_Context *, GP_Pixel, GP_PutPixel1bpp); -DEF_ELLIPSE_FN(GP_Ellipse2bpp, GP_Context *, GP_Pixel, GP_PutPixel2bpp); -DEF_ELLIPSE_FN(GP_Ellipse4bpp, GP_Context *, GP_Pixel, GP_PutPixel4bpp); -DEF_ELLIPSE_FN(GP_Ellipse8bpp, GP_Context *, GP_Pixel, GP_PutPixel8bpp); -DEF_ELLIPSE_FN(GP_Ellipse16bpp, GP_Context *, GP_Pixel, GP_PutPixel16bpp); -DEF_ELLIPSE_FN(GP_Ellipse24bpp, GP_Context *, GP_Pixel, GP_PutPixel24bpp); -DEF_ELLIPSE_FN(GP_Ellipse32bpp, GP_Context *, GP_Pixel, GP_PutPixel32bpp); +GP_DEF_DRAW_FN_PER_BPP(GP_Ellipse, DEF_ELLIPSE_FN)
-void GP_Ellipse(GP_Context *context, int xcenter, int ycenter, - unsigned int a, unsigned int b, GP_Pixel pixel) +void GP_Ellipse(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(GP_Ellipse, context->bpp, context, - xcenter, ycenter, a, b, pixel); + GP_FN_PER_BPP_CONTEXT(GP_Ellipse, context, context, + xcenter, ycenter, a, b, pixel); }
-void GP_TEllipse(GP_Context *context, int xcenter, int ycenter, - unsigned int a, unsigned int b, GP_Pixel pixel) +void GP_TEllipse(GP_Context *context, GP_Coord xcenter, GP_Coord ycenter, + GP_Size a, GP_Size b, GP_Pixel pixel) { GP_CHECK_CONTEXT(context); - /* recalculate center point and swap a and b when axes are swapped */ + /* recalculate center poGP_Coord and swap a and b when axes are swapped */ GP_TRANSFORM_POINT(context, xcenter, ycenter); GP_TRANSFORM_SWAP(context, a, b); @@ -60,25 +56,19 @@ void GP_TEllipse(GP_Context *context, int xcenter, int ycenter, #include "algo/FillEllipse.algo.h"
/* Generate drawing functions for various bit depths. */ -DEF_FILLELLIPSE_FN(GP_FillEllipse1bpp, GP_Context *, GP_Pixel, GP_HLine1bpp) -DEF_FILLELLIPSE_FN(GP_FillEllipse2bpp, GP_Context *, GP_Pixel, GP_HLine2bpp) -DEF_FILLELLIPSE_FN(GP_FillEllipse4bpp, GP_Context *, GP_Pixel, GP_HLine4bpp) -DEF_FILLELLIPSE_FN(GP_FillEllipse8bpp, GP_Context *, GP_Pixel, GP_HLine8bpp) -DEF_FILLELLIPSE_FN(GP_FillEllipse16bpp, GP_Context *, GP_Pixel, GP_HLine16bpp) -DEF_FILLELLIPSE_FN(GP_FillEllipse24bpp, GP_Context *, GP_Pixel, GP_HLine24bpp) -DEF_FILLELLIPSE_FN(GP_FillEllipse32bpp, GP_Context *, GP_Pixel, GP_HLine32bpp) +GP_DEF_FILL_FN_PER_BPP(GP_FillEllipse, DEF_FILLELLIPSE_FN)
-void GP_FillEllipse(GP_Context *context, int xcenter, int ycenter, - unsigned int a, unsigned int b, GP_Pixel 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_FN_PER_BPP(GP_FillEllipse, context->bpp, context, - xcenter, ycenter, a, b, pixel); + GP_FN_PER_BPP_CONTEXT(GP_FillEllipse, context, context, + xcenter, ycenter, a, b, pixel); }
-void GP_TFillEllipse(GP_Context *context, int xcenter, int ycenter, - unsigned int a, unsigned int b, GP_Pixel pixel) +void GP_TFillEllipse(GP_Context *context, GP_Coord xcenter, GP_Coord ycenter, + GP_Size a, GP_Size b, GP_Pixel pixel) { GP_CHECK_CONTEXT(context); diff --git a/libs/gfx/GP_HLine.c b/libs/gfx/GP_HLine.c index ede37ef..3d51cc4 100644 --- a/libs/gfx/GP_HLine.c +++ b/libs/gfx/GP_HLine.c @@ -28,22 +28,29 @@ #include "core/GP_FnPerBpp.h"
/* Generate drawing functions for various bit depths. */ -DEF_HLINE_BU_FN(GP_HLine1bpp, GP_Context *, GP_Pixel, GP_PIXEL_ADDR, GP_WritePixels1bpp) -DEF_HLINE_BU_FN(GP_HLine2bpp, GP_Context *, GP_Pixel, GP_PIXEL_ADDR, GP_WritePixels2bpp) -DEF_HLINE_BU_FN(GP_HLine4bpp, GP_Context *, GP_Pixel, GP_PIXEL_ADDR, GP_WritePixels4bpp) -DEF_HLINE_FN(GP_HLine8bpp, GP_Context *, GP_Pixel, GP_PIXEL_ADDR, GP_WritePixels8bpp) -DEF_HLINE_FN(GP_HLine16bpp, GP_Context *, GP_Pixel, GP_PIXEL_ADDR, GP_WritePixels16bpp) -DEF_HLINE_FN(GP_HLine24bpp, GP_Context *, GP_Pixel, GP_PIXEL_ADDR, GP_WritePixels24bpp) -DEF_HLINE_FN(GP_HLine32bpp, GP_Context *, GP_Pixel, GP_PIXEL_ADDR, GP_WritePixels32bpp)
-void GP_HLineXXY(GP_Context *context, int x0, int x1, int y, GP_Pixel pixel) +//TODO: BIT ENDIANESS +DEF_HLINE_BU_FN(GP_HLine_1BPP_LE, GP_Context *, GP_Pixel, GP_PIXEL_ADDR, GP_WritePixels1bpp) +DEF_HLINE_BU_FN(GP_HLine_1BPP_BE, GP_Context *, GP_Pixel, GP_PIXEL_ADDR, GP_WritePixels1bpp) +DEF_HLINE_BU_FN(GP_HLine_2BPP_LE, GP_Context *, GP_Pixel, GP_PIXEL_ADDR, GP_WritePixels2bpp) +DEF_HLINE_BU_FN(GP_HLine_2BPP_BE, GP_Context *, GP_Pixel, GP_PIXEL_ADDR, GP_WritePixels2bpp) +DEF_HLINE_BU_FN(GP_HLine_4BPP_LE, GP_Context *, GP_Pixel, GP_PIXEL_ADDR, GP_WritePixels2bpp) +DEF_HLINE_BU_FN(GP_HLine_4BPP_BE, GP_Context *, GP_Pixel, GP_PIXEL_ADDR, GP_WritePixels2bpp) + +DEF_HLINE_FN(GP_HLine_8BPP, GP_Context *, GP_Pixel, GP_PIXEL_ADDR, GP_WritePixels8bpp) +DEF_HLINE_FN(GP_HLine_16BPP, GP_Context *, GP_Pixel, GP_PIXEL_ADDR, GP_WritePixels16bpp) +DEF_HLINE_FN(GP_HLine_24BPP, GP_Context *, GP_Pixel, GP_PIXEL_ADDR, GP_WritePixels24bpp) +DEF_HLINE_FN(GP_HLine_32BPP, GP_Context *, GP_Pixel, GP_PIXEL_ADDR, GP_WritePixels32bpp) + +void GP_HLineXXY(GP_Context *context, GP_Coord x0, GP_Coord x1, + GP_Coord y, GP_Pixel pixel) { GP_CHECK_CONTEXT(context); - GP_FN_PER_BPP(GP_HLine, context->bpp, context, x0, x1, y, pixel); + GP_FN_PER_BPP_CONTEXT(GP_HLine, context, context, x0, x1, y, pixel); }
-void GP_HLineXYW(GP_Context *context, int x, int y, unsigned int w, +void GP_HLineXYW(GP_Context *context, GP_Coord x, GP_Coord y, GP_Size w, GP_Pixel pixel) { /* zero width: do not draw anything */ @@ -53,7 +60,8 @@ void GP_HLineXYW(GP_Context *context, int x, int y, unsigned int w, GP_HLineXXY(context, x, x + w - 1, y, pixel); }
-void GP_THLineXXY(GP_Context *context, int x0, int x1, int y, GP_Pixel pixel) +void GP_THLineXXY(GP_Context *context, GP_Coord x0, GP_Coord x1, + GP_Coord y, GP_Pixel pixel) { GP_CHECK_CONTEXT(context); @@ -70,7 +78,7 @@ void GP_THLineXXY(GP_Context *context, int x0, int x1, int y, GP_Pixel pixel) } }
-void GP_THLineXYW(GP_Context *context, int x, int y, unsigned int w, +void GP_THLineXYW(GP_Context *context, GP_Coord x, GP_Coord y, GP_Size w, GP_Pixel pixel) { /* zero width: do not draw anything */ diff --git a/libs/gfx/GP_Line.c b/libs/gfx/GP_Line.c index 21066b1..d5dda97 100644 --- a/libs/gfx/GP_Line.c +++ b/libs/gfx/GP_Line.c @@ -24,31 +24,24 @@ *****************************************************************************/
#include "GP_Gfx.h" -#include "algo/Line.algo.h" #include "core/GP_FnPerBpp.h" +#include "core/GP_DefFnPerBpp.h" + +#include "algo/Line.algo.h"
/* Generate drawing functions for various bit depths. */ -DEF_LINE_FN(GP_Line1bpp_LE, GP_Context *, GP_Pixel, GP_PutPixel1bpp_LE) -DEF_LINE_FN(GP_Line2bpp_LE, GP_Context *, GP_Pixel, GP_PutPixel2bpp_LE) -DEF_LINE_FN(GP_Line4bpp_LE, GP_Context *, GP_Pixel, GP_PutPixel4bpp_LE) -DEF_LINE_FN(GP_Line1bpp_BE, GP_Context *, GP_Pixel, GP_PutPixel1bpp_BE) -DEF_LINE_FN(GP_Line2bpp_BE, GP_Context *, GP_Pixel, GP_PutPixel2bpp_BE) -DEF_LINE_FN(GP_Line4bpp_BE, GP_Context *, GP_Pixel, GP_PutPixel4bpp_BE) -DEF_LINE_FN(GP_Line8bpp, GP_Context *, GP_Pixel, GP_PutPixel8bpp) -DEF_LINE_FN(GP_Line16bpp, GP_Context *, GP_Pixel, GP_PutPixel16bpp) -DEF_LINE_FN(GP_Line24bpp, GP_Context *, GP_Pixel, GP_PutPixel24bpp) -DEF_LINE_FN(GP_Line32bpp, GP_Context *, GP_Pixel, GP_PutPixel32bpp) +GP_DEF_DRAW_FN_PER_BPP(GP_Line, DEF_LINE_FN)
-void GP_Line(GP_Context *context, int x0, int y0, int x1, int y1, - GP_Pixel pixel) +void GP_Line(GP_Context *context, GP_Coord x0, GP_Coord y0, + GP_Coord x1, GP_Coord y1, GP_Pixel pixel) { GP_CHECK_CONTEXT(context);
- GP_FN_PER_BPP(GP_Line, context->bpp, context, x0, y0, x1, y1, pixel); + GP_FN_PER_BPP_CONTEXT(GP_Line, context, context, x0, y0, x1, y1, pixel); }
-void GP_TLine(GP_Context *context, int x0, int y0, int x1, int y1, - GP_Pixel pixel) +void GP_TLine(GP_Context *context, GP_Coord x0, GP_Coord y0, + GP_Coord x1, GP_Coord y1, GP_Pixel pixel) { GP_CHECK_CONTEXT(context); diff --git a/libs/gfx/GP_Polygon.c b/libs/gfx/GP_Polygon.c index bf47baf..1bf5dc7 100644 --- a/libs/gfx/GP_Polygon.c +++ b/libs/gfx/GP_Polygon.c @@ -29,15 +29,15 @@ #include <stdlib.h>
struct GP_PolygonEdge { - int startx, starty; - int endx, endy; - int dx, dy; + GP_Coord startx, starty; + GP_Coord endx, endy; + GP_Coord dx, dy; };
struct GP_Polygon { struct GP_PolygonEdge *edges; - int edge_count; - int ymin, ymax; + GP_Coord edge_count; + GP_Coord ymin, ymax; };
#define GP_POLYGON_INITIALIZER { @@ -48,7 +48,7 @@ struct GP_Polygon { }
static void GP_InitEdge(struct GP_PolygonEdge *edge, - int x1, int y1, int x2, int y2) + GP_Coord x1, GP_Coord y1, GP_Coord x2, GP_Coord y2) { if (y1 < y2) { /* coords are top-down, correct */ edge->startx = x1; @@ -66,7 +66,8 @@ static void GP_InitEdge(struct GP_PolygonEdge *edge, edge->dy = edge->endy - edge->starty; }
-static void GP_AddEdge(struct GP_Polygon *poly, int x1, int y1, int x2, int y2) +static void GP_AddEdge(struct GP_Polygon *poly, GP_Coord x1, GP_Coord y1, + GP_Coord x2, GP_Coord y2) { struct GP_PolygonEdge *edge = poly->edges + poly->edge_count; @@ -78,7 +79,7 @@ static void GP_AddEdge(struct GP_Polygon *poly, int x1, int y1, int x2, int y2) poly->ymax = GP_MAX(poly->ymax, edge->endy); }
-static int GP_CompareEdges(const void *edge1, const void *edge2) +static GP_Coord GP_CompareEdges(const void *edge1, const void *edge2) { struct GP_PolygonEdge *e1 = (struct GP_PolygonEdge *) edge1; struct GP_PolygonEdge *e2 = (struct GP_PolygonEdge *) edge2; @@ -96,15 +97,15 @@ static int GP_CompareEdges(const void *edge1, const void *edge2) return 0; }
-static void GP_LoadPolygon(struct GP_Polygon *poly, int vertex_count, - const int *xy) +static void GP_LoadPolygon(struct GP_Polygon *poly, GP_Coord vertex_count, + const GP_Coord *xy) { poly->edge_count = 0; poly->edges = calloc(sizeof(struct GP_PolygonEdge), vertex_count);
- int i; - int coord_count = 2*vertex_count - 2; + GP_Coord i; + GP_Coord coord_count = 2*vertex_count - 2; for (i = 0; i < coord_count; i+=2) {
/* add the edge, unless it is horizontal */ @@ -133,13 +134,13 @@ static void GP_ResetPolygon(struct GP_Polygon *poly) }
/* - * Finds an X coordinate of an intersection of the edge + * Finds an X coordinate of an GP_Coordersection of the edge * with the given Y line. */ -static inline int GP_FindIntersection(int y, const struct GP_PolygonEdge *edge) +static inline GP_Coord GP_FindIntersection(GP_Coord y, const struct GP_PolygonEdge *edge) { - int edge_y = y - edge->starty; /* Y relative to the edge */ - int x = edge->startx; + GP_Coord edge_y = y - edge->starty; /* Y relative to the edge */ + GP_Coord x = edge->startx;
if (edge->dx > 0) { while (edge->startx*edge->dy + edge_y*edge->dx > x*edge->dy) @@ -152,37 +153,37 @@ static inline int GP_FindIntersection(int y, const struct GP_PolygonEdge *edge) return x; }
-void GP_FillPolygon(GP_Context *context, int vertex_count, const int *xy, +void GP_FillPolygon(GP_Context *context, GP_Coord vertex_count, const GP_Coord *xy, GP_Pixel pixel) { struct GP_Polygon poly = GP_POLYGON_INITIALIZER;
GP_LoadPolygon(&poly, vertex_count, xy);
- int y, startx, endx; - int startx_prev = -INT_MAX; - int endx_prev = INT_MAX; + GP_Coord y, startx, endx; + GP_Coord startx_prev = -INT_MAX; + GP_Coord endx_prev = INT_MAX;
for (y = poly.ymin; y <= poly.ymax; y++) { startx = INT_MAX; endx = 0;
- int i; + GP_Coord i; for (i = 0; i < poly.edge_count; i++) { struct GP_PolygonEdge *edge = poly.edges + i;
if (y < edge->starty || y > edge->endy) continue;
- int inter = GP_FindIntersection(y, edge); + GP_Coord GP_Coorder = GP_FindIntersection(y, edge);
- startx = GP_MIN(startx, inter); - endx = GP_MAX(endx, inter); + startx = GP_MIN(startx, GP_Coorder); + endx = GP_MAX(endx, GP_Coorder);
if (y != edge->endy) { - inter = GP_FindIntersection(y + 1, edge); - startx = GP_MIN(startx, inter); - endx = GP_MAX(endx, inter); + GP_Coorder = GP_FindIntersection(y + 1, edge); + startx = GP_MIN(startx, GP_Coorder); + endx = GP_MAX(endx, GP_Coorder); } }
diff --git a/libs/gfx/GP_Rect.c b/libs/gfx/GP_Rect.c index 52e3a36..9f1fabe 100644 --- a/libs/gfx/GP_Rect.c +++ b/libs/gfx/GP_Rect.c @@ -25,8 +25,8 @@
#include "GP_Gfx.h"
-void GP_RectXYXY(GP_Context *context, int x0, int y0, int x1, int y1, - GP_Pixel pixel) +void GP_RectXYXY(GP_Context *context, GP_Coord x0, GP_Coord y0, + GP_Coord x1, GP_Coord y1, GP_Pixel pixel) { GP_CHECK_CONTEXT(context);
@@ -36,8 +36,8 @@ void GP_RectXYXY(GP_Context *context, int x0, int y0, int x1, int y1, GP_VLine(context, x1, y0, y1, pixel); }
-void GP_RectXYWH(GP_Context *context, int x, int y, - unsigned int w, unsigned int h, GP_Pixel pixel) +void GP_RectXYWH(GP_Context *context, GP_Coord x, GP_Coord y, + GP_Size w, GP_Size h, GP_Pixel pixel) { GP_CHECK_CONTEXT(context);
@@ -47,8 +47,8 @@ void GP_RectXYWH(GP_Context *context, int x, int y, GP_VLine(context, x + w, y, y + h, pixel); }
-void GP_TRectXYXY(GP_Context *context, int x0, int y0, int x1, int y1, - GP_Pixel pixel) +void GP_TRectXYXY(GP_Context *context, GP_Coord x0, GP_Coord y0, + GP_Coord x1, GP_Coord y1, GP_Pixel pixel) { GP_CHECK_CONTEXT(context); @@ -58,27 +58,27 @@ void GP_TRectXYXY(GP_Context *context, int x0, int y0, int x1, int y1, GP_RectXYXY(context, x0, y0, x1, y1, pixel); }
-void GP_TRectXYWH(GP_Context *context, int x, int y, - unsigned int w, unsigned int h, GP_Pixel pixel) +void GP_TRectXYWH(GP_Context *context, GP_Coord x, GP_Coord y, + GP_Size w, GP_Size h, GP_Pixel pixel) { GP_TRectXYXY(context, x, y, x + w, y + h, pixel); }
-void GP_FillRectXYXY(GP_Context *context, int x0, int y0, int x1, int y1, - GP_Pixel pixel) +void GP_FillRectXYXY(GP_Context *context, GP_Coord x0, GP_Coord y0, + GP_Coord x1, GP_Coord y1, GP_Pixel pixel) { GP_CHECK_CONTEXT(context);
if (y0 > y1) GP_SWAP(y0, y1);
- int y; + GP_Coord y; for (y = y0; y <= y1; y++) GP_HLine(context, x0, x1, y, pixel); }
-void GP_FillRectXYWH(GP_Context *context, int x, int y, - unsigned int w, unsigned int h, GP_Pixel pixel) +void GP_FillRectXYWH(GP_Context *context, GP_Coord x, GP_Coord y, + GP_Size w, GP_Size h, GP_Pixel pixel) { /* zero width/height: draw nothing */ if (w == 0 || h == 0) @@ -87,8 +87,8 @@ void GP_FillRectXYWH(GP_Context *context, int x, int y, return GP_FillRectXYXY(context, x, y, x + w - 1, y + h - 1, pixel); }
-void GP_TFillRectXYXY(GP_Context *context, int x0, int y0, - int x1, int y1, GP_Pixel pixel) +void GP_TFillRectXYXY(GP_Context *context, GP_Coord x0, GP_Coord y0, + GP_Coord x1, GP_Coord y1, GP_Pixel pixel) { GP_CHECK_CONTEXT(context); @@ -98,8 +98,8 @@ void GP_TFillRectXYXY(GP_Context *context, int x0, int y0, GP_FillRect(context, x0, y0, x1, y1, pixel); }
-void GP_TFillRectXYWH(GP_Context *context, int x, int y, - unsigned int w, unsigned int h, GP_Pixel pixel) +void GP_TFillRectXYWH(GP_Context *context, GP_Coord x, GP_Coord y, + GP_Size w, GP_Size h, GP_Pixel pixel) { /* zero width/height: draw nothing */ if (w == 0 || h == 0) diff --git a/libs/gfx/GP_Symbol.c b/libs/gfx/GP_Symbol.c index 1103673..7a7b44e 100644 --- a/libs/gfx/GP_Symbol.c +++ b/libs/gfx/GP_Symbol.c @@ -69,7 +69,7 @@ } while (0)
void GP_Symbol(GP_Context *context, GP_SymbolType sym, - int x, int y, int w, int h, GP_Pixel pixel) + GP_Coord x, GP_Coord y, GP_Size w, GP_Size h, GP_Pixel pixel) { DO_DECREMENT(w); DO_DECREMENT(h); @@ -97,7 +97,7 @@ void GP_Symbol(GP_Context *context, GP_SymbolType sym, }
void GP_FillSymbol(GP_Context *context, GP_SymbolType sym, - int x, int y, int w, int h, GP_Pixel pixel) + GP_Coord x, GP_Coord y, GP_Size w, GP_Size h, GP_Pixel pixel) { DO_DECREMENT(w); DO_DECREMENT(h); @@ -125,7 +125,7 @@ void GP_FillSymbol(GP_Context *context, GP_SymbolType sym, }
void GP_TSymbol(GP_Context *context, GP_SymbolType sym, - int x, int y, int w, int h, GP_Pixel pixel) + GP_Coord x, GP_Coord y, GP_Size w, GP_Size h, GP_Pixel pixel) { DO_DECREMENT(w); DO_DECREMENT(h); @@ -153,7 +153,8 @@ void GP_TSymbol(GP_Context *context, GP_SymbolType sym, }
void GP_TFillSymbol(GP_Context *context, GP_SymbolType sym, - int x, int y, int w, int h, GP_Pixel pixel) + GP_Coord x, GP_Coord y, + GP_Size w, GP_Size h, GP_Pixel pixel) { DO_DECREMENT(w); DO_DECREMENT(h); diff --git a/libs/gfx/GP_Tetragon.c b/libs/gfx/GP_Tetragon.c index ff9100e..f5f924a 100644 --- a/libs/gfx/GP_Tetragon.c +++ b/libs/gfx/GP_Tetragon.c @@ -25,8 +25,9 @@
#include "GP_Gfx.h"
-void GP_Tetragon(GP_Context *context, int x0, int y0, int x1, int y1, - int x2, int y2, int x3, int y3, GP_Pixel pixel) +void GP_Tetragon(GP_Context *context, GP_Coord x0, GP_Coord y0, + GP_Coord x1, GP_Coord y1, GP_Coord x2, GP_Coord y2, + GP_Coord x3, GP_Coord y3, GP_Pixel pixel) { GP_CHECK_CONTEXT(context);
@@ -36,8 +37,9 @@ void GP_Tetragon(GP_Context *context, int x0, int y0, int x1, int y1, GP_Line(context, x3, y3, x0, y0, pixel); }
-void GP_TTetragon(GP_Context *context, int x0, int y0, int x1, int y1, - int x2, int y2, int x3, int y3, GP_Pixel pixel) +void GP_TTetragon(GP_Context *context, GP_Coord x0, GP_Coord y0, + GP_Coord x1, GP_Coord y1, GP_Coord x2, GP_Coord y2, + GP_Coord x3, GP_Coord y3, GP_Pixel pixel) { GP_CHECK_CONTEXT(context); @@ -49,17 +51,19 @@ void GP_TTetragon(GP_Context *context, int x0, int y0, int x1, int y1, GP_Tetragon(context, x0, y0, x1, y1, x2, y2, x3, y3, pixel); }
-void GP_FillTetragon(GP_Context *context, int x0, int y0, int x1, int y1, - int x2, int y2, int x3, int y3, GP_Pixel pixel) +void GP_FillTetragon(GP_Context *context, GP_Coord x0, GP_Coord y0, + GP_Coord x1, GP_Coord y1, GP_Coord x2, GP_Coord y2, + GP_Coord x3, GP_Coord y3, GP_Pixel pixel) { GP_CHECK_CONTEXT(context);
- int xy[8] = { x0, y0, x1, y1, x2, y2, x3, y3 }; - GP_FillPolygon(context, 4, (const int *) xy, pixel); + const GP_Coord xy[8] = { x0, y0, x1, y1, x2, y2, x3, y3 }; + GP_FillPolygon(context, 4, xy, pixel); }
-void GP_TFillTetragon(GP_Context* context, int x0, int y0, int x1, int y1, - int x2, int y2, int x3, int y3, GP_Pixel pixel) +void GP_TFillTetragon(GP_Context* context, GP_Coord x0, GP_Coord y0, + GP_Coord x1, GP_Coord y1, GP_Coord x2, GP_Coord y2, + GP_Coord x3, GP_Coord y3, GP_Pixel pixel) { GP_CHECK_CONTEXT(context); @@ -68,6 +72,6 @@ void GP_TFillTetragon(GP_Context* context, int x0, int y0, int x1, int y1, GP_TRANSFORM_POINT(context, x2, y2); GP_TRANSFORM_POINT(context, x3, y3);
- int xy[8] = { x0, y0, x1, y1, x2, y2, x3, y3 }; - GP_FillPolygon(context, 4, (const int *) xy, pixel); + const GP_Coord xy[8] = { x0, y0, x1, y1, x2, y2, x3, y3 }; + GP_FillPolygon(context, 4, xy, pixel); } diff --git a/libs/gfx/GP_Triangle.c b/libs/gfx/GP_Triangle.c index 46f6939..10725ec 100644 --- a/libs/gfx/GP_Triangle.c +++ b/libs/gfx/GP_Triangle.c @@ -25,8 +25,9 @@
#include "GP_Gfx.h"
-void GP_Triangle(GP_Context *context, int x0, int y0, int x1, int y1, - int x2, int y2, GP_Pixel pixel) +void GP_Triangle(GP_Context *context, GP_Coord x0, GP_Coord y0, + GP_Coord x1, GP_Coord y1, + GP_Coord x2, GP_Coord y2, GP_Pixel pixel) { GP_CHECK_CONTEXT(context);
@@ -35,8 +36,9 @@ void GP_Triangle(GP_Context *context, int x0, int y0, int x1, int y1, GP_Line(context, x1, y1, x2, y2, pixel); }
-void GP_TTriangle(GP_Context *context, int x0, int y0, int x1, int y1, - int x2, int y2, GP_Pixel pixel) +void GP_TTriangle(GP_Context *context, GP_Coord x0, GP_Coord y0, + GP_Coord x1, GP_Coord y1, + GP_Coord x2, GP_Coord y2, GP_Pixel pixel) { GP_CHECK_CONTEXT(context); @@ -47,17 +49,19 @@ void GP_TTriangle(GP_Context *context, int x0, int y0, int x1, int y1, GP_Triangle(context, x0, y0, x1, y1, x2, y2, pixel); }
-void GP_FillTriangle(GP_Context * context, int x0, int y0, int x1, int y1, - int x2, int y2, GP_Pixel pixel) +void GP_FillTriangle(GP_Context *context, GP_Coord x0, GP_Coord y0, + GP_Coord x1, GP_Coord y1, + GP_Coord x2, GP_Coord y2, GP_Pixel pixel) { GP_CHECK_CONTEXT(context);
- int coords[6] = { x0, y0, x1, y1, x2, y2 }; + const GP_Coord coords[6] = { x0, y0, x1, y1, x2, y2 }; GP_FillPolygon(context, 3, coords, pixel); }
-void GP_TFillTriangle(GP_Context* context, int x0, int y0, int x1, int y1, - int x2, int y2, GP_Pixel pixel) +void GP_TFillTriangle(GP_Context* context, GP_Coord x0, GP_Coord y0, + GP_Coord x1, GP_Coord y1, + GP_Coord x2, GP_Coord y2, GP_Pixel pixel) { GP_CHECK_CONTEXT(context); @@ -65,6 +69,6 @@ void GP_TFillTriangle(GP_Context* context, int x0, int y0, int x1, int y1, GP_TRANSFORM_POINT(context, x1, y1); GP_TRANSFORM_POINT(context, x2, y2); - int coords[6] = { x0, y0, x1, y1, x2, y2 }; + const GP_Coord coords[6] = { x0, y0, x1, y1, x2, y2 }; GP_FillPolygon(context, 3, coords, pixel); } diff --git a/libs/gfx/GP_VLine.c b/libs/gfx/GP_VLine.c index 7a27768..91d26da 100644 --- a/libs/gfx/GP_VLine.c +++ b/libs/gfx/GP_VLine.c @@ -24,27 +24,24 @@ *****************************************************************************/
#include "GP_Gfx.h" -#include "algo/VLine.algo.h" #include "core/GP_FnPerBpp.h" +#include "core/GP_DefFnPerBpp.h" + +#include "algo/VLine.algo.h"
/* Generate drawing functions for various bit depths. */ -DEF_VLINE_FN(GP_VLine1bpp, GP_Context *, GP_Pixel, GP_PutPixel1bpp) -DEF_VLINE_FN(GP_VLine2bpp, GP_Context *, GP_Pixel, GP_PutPixel2bpp) -DEF_VLINE_FN(GP_VLine4bpp, GP_Context *, GP_Pixel, GP_PutPixel4bpp) -DEF_VLINE_FN(GP_VLine8bpp, GP_Context *, GP_Pixel, GP_PutPixel8bpp) -DEF_VLINE_FN(GP_VLine16bpp, GP_Context *, GP_Pixel, GP_PutPixel16bpp) -DEF_VLINE_FN(GP_VLine24bpp, GP_Context *, GP_Pixel, GP_PutPixel24bpp) -DEF_VLINE_FN(GP_VLine32bpp, GP_Context *, GP_Pixel, GP_PutPixel32bpp) +GP_DEF_DRAW_FN_PER_BPP(GP_VLine, DEF_VLINE_FN)
-void GP_VLineXYY(GP_Context *context, int x, int y0, int y1, GP_Pixel pixel) +void GP_VLineXYY(GP_Context *context, GP_Coord x, GP_Coord y0, + GP_Coord y1, GP_Pixel pixel) { GP_CHECK_CONTEXT(context);
- GP_FN_PER_BPP(GP_VLine, context->bpp, context, x, y0, y1, pixel); + GP_FN_PER_BPP_CONTEXT(GP_VLine, context, context, x, y0, y1, pixel); }
-void GP_VLineXYH(GP_Context *context, int x, int y, unsigned int height, - GP_Pixel pixel) +void GP_VLineXYH(GP_Context *context, GP_Coord x, GP_Coord y, + GP_Size height, GP_Pixel pixel) { /* zero height: do not draw anything */ if (height == 0) @@ -53,7 +50,8 @@ void GP_VLineXYH(GP_Context *context, int x, int y, unsigned int height, GP_VLineXYY(context, x, y, y + height - 1, pixel); }
-void GP_TVLineXYY(GP_Context *context, int x, int y0, int y1, GP_Pixel pixel) +void GP_TVLineXYY(GP_Context *context, GP_Coord x, GP_Coord y0, + GP_Coord y1, GP_Pixel pixel) { GP_CHECK_CONTEXT(context); @@ -70,8 +68,8 @@ void GP_TVLineXYY(GP_Context *context, int x, int y0, int y1, GP_Pixel pixel) } }
-void GP_TVLineXYH(GP_Context *context, int x, int y, unsigned int height, - GP_Pixel pixel) +void GP_TVLineXYH(GP_Context *context, GP_Coord x, GP_Coord y, + GP_Size height, GP_Pixel pixel) { /* zero height: do not draw anything */ if (height == 0)
-----------------------------------------------------------------------
Summary of changes: include/core/GP_Context.h | 6 +-- .../core/GP_DefFnPerBpp.h | 62 ++++++++++---------- LICENSE => include/core/GP_Types.h | 19 +++++- include/gfx/GP_Circle.h | 16 +++--- include/gfx/GP_Ellipse.h | 16 +++--- include/gfx/GP_Gfx.h | 1 + include/gfx/GP_HLine.h | 59 +++++++++++++++---- include/gfx/GP_Line.h | 31 +++++----- include/gfx/GP_Polygon.h | 10 ++-- include/gfx/GP_Rect.h | 32 +++++----- include/gfx/GP_Symbol.h | 14 +++-- include/gfx/GP_Tetragon.h | 20 ++++--- include/gfx/GP_Triangle.h | 20 ++++--- include/gfx/GP_VLine.h | 14 +++-- libs/gfx/GP_Circle.c | 46 ++++++--------- libs/gfx/GP_Ellipse.c | 46 ++++++--------- libs/gfx/GP_HLine.c | 32 ++++++---- libs/gfx/GP_Line.c | 25 +++----- libs/gfx/GP_Polygon.c | 55 +++++++++--------- libs/gfx/GP_Rect.c | 34 +++++----- libs/gfx/GP_Symbol.c | 9 ++- libs/gfx/GP_Tetragon.c | 28 +++++---- libs/gfx/GP_Triangle.c | 24 +++++--- libs/gfx/GP_VLine.c | 28 ++++----- 24 files changed, 346 insertions(+), 301 deletions(-) copy libs/loaders/GP_PXMCommon.h => include/core/GP_DefFnPerBpp.h (55%) copy LICENSE => include/core/GP_Types.h (83%)
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.