Gfxprim
Threads by month
- ----- 2026 -----
- January
- ----- 2025 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
July 2011
- 3 participants
- 17 discussions
[repo.or.cz] gfxprim.git branch generate updated: 1cd5016b247b64d2d0b7b7c6791d5f730248ec64
by metan 30 Jul '11
by metan 30 Jul '11
30 Jul '11
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 1cd5016b247b64d2d0b7b7c6791d5f730248ec64 (commit)
via ff97808f33bff1007d84a1d4899363b62d2ac2f3 (commit)
from 24db76060a41a8d3abb75c57e552d9a784bf5948 (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/1cd5016b247b64d2d0b7b7c6791d5f730248…
commit 1cd5016b247b64d2d0b7b7c6791d5f730248ec64
Author: Cyril Hrubis <metan(a)ucw.cz>
Date: Fri Jul 29 21:24:06 2011 +0000
Updated docs to match the code.
diff --git a/doc/Makefile b/doc/Makefile
index 4307a8c..fd95a7b 100644
--- a/doc/Makefile
+++ b/doc/Makefile
@@ -1,6 +1,7 @@
all: api.html
-api.html: general.txt api.txt context.txt loaders.txt filters.txt
+api.html: general.txt api.txt context.txt loaders.txt filters.txt + basic_types.txt drawing_api.txt
asciidoc -a toc api.txt
api.pdf: api.txt
diff --git a/doc/basic_types.txt b/doc/basic_types.txt
index 9bcba9e..efc9c7b 100644
--- a/doc/basic_types.txt
+++ b/doc/basic_types.txt
@@ -3,7 +3,8 @@ Basic types
Return Code
~~~~~~~~~~~
-Basically each gfxprim function returns one of following return codes:
+Some gfxprim function returns one of following return codes (may be removed in
+future):
[source,c]
--------------------------------------------------------------------------------
@@ -29,74 +30,51 @@ Return codes could be translated into an error messages.
const char *GP_RetCodeName(GP_RetCode code);
--------------------------------------------------------------------------------
+Coord and Size
+~~~~~~~~~~~~~~
+For drawing API there are two integer types defined the 'GP_Coord' for
+coordinates and 'GP_Size' for size, length or so.
+
+
Color and pixel types
~~~~~~~~~~~~~~~~~~~~~
-The color, in gfxprim is abstract value that represents color in some format,
-while pixel is color in format of the target bitmap.
-
-Color and pixel types could be converted between each other but certain
-conversions lose information.
+The color, in gfxprim is enumeration of symbolic color names while pixel is
+integer value or you may say color in format of the target bitmap.
-Color types are defined in 'core/GP_Color.h' and pixels in 'core/GP_Pixel.h'.
-The color is union of structures so that is easy to manipulate with each color
-types, the pixel is basically sequence of bytes stored in long enough integer
-number.
+Color could be converted into given pixel type which will result in integer
+value suitable for usage with drawing functions. The color could be also
+converted to color name (C string in English language) and C string may be
+matched against table of color names.
-Before drawing a shape into a bitmap, color must be converted into pixel as
-all drawing functions takes pixel rather than color.
+As all drawing functions works with pixel rather than color the color must be
+converted before using function to draw a shape into a bitmap.
-The color types:
+The color is defined as follows:
[source,c]
--------------------------------------------------------------------------------
-typedef enum GP_ColorType {
- GP_NOCOLOR = 0,
- GP_COLNAME,
- GP_PALETTE,
- GP_PAL4,
- GP_PAL8,
- GP_G1,
- GP_G2,
- GP_G4,
- GP_G8,
- GP_RGB555,
- GP_RGB565,
- GP_RGB666,
- GP_RGB888,
- GP_RGBA8888,
- GP_COLMAX,
-} GP_ColorType;
+typedef enum GP_Color {
+ GP_COL_INVALID = -1,
+ GP_COL_BLACK,
+ ...
+} GP_Color;
--------------------------------------------------------------------------------
-Predefined names are provided for the most basic colors:
+Color and Pixel conversion functions, the last one returns 'true' in case of
+successful match and conversion and false otherwise.
[source,c]
--------------------------------------------------------------------------------
-typedef enum GP_ColorName {
- GP_COL_BLACK,
- GP_COL_RED,
- GP_COL_GREEN,
- GP_COL_BLUE,
- GP_COL_YELLOW,
- GP_COL_BROWN,
- GP_COL_ORANGE,
- GP_COL_GRAY_DARK,
- GP_COL_GRAY_LIGHT,
- GP_COL_PURPLE,
- GP_COL_WHITE,
- GP_COL_MAX,
-} GP_ColorName;
---------------------------------------------------------------------------------
+#include <core/GP_Color.h>
-To convert color to context pixel type use:
+GP_Pixel GP_ColorToPixel(GP_Context *context, GP_Color color);
-[source,c]
---------------------------------------------------------------------------------
-GP_RetCode GP_ColorToPixel(struct GP_Context *context, GP_Color color,
- GP_Pixel *pixel);
+GP_Color GP_ColorNameToColor(const char *color_name);
+
+const char *GP_ColorToColorName(GP_Color color);
-GP_RetCode GP_ColorNameToPixel(struct GP_Context *context, GP_ColorName name,
- GP_Pixel *pixel);
+bool GP_ColorNameToPixel(GP_Context *context, const char *color_name,
+ GP_Pixel *pixel);
--------------------------------------------------------------------------------
diff --git a/doc/context.txt b/doc/context.txt
index b3156a0..42c9f8c 100644
--- a/doc/context.txt
+++ b/doc/context.txt
@@ -20,25 +20,21 @@ typedef struct GP_Context {
int axes_swap:1; /* Context rotation and mirroring */
int x_swap:1;
int y_swap:1;
-
- uint32_t clip_w_min; /* Clipping rectanle */
- uint32_t clip_w_max;
- uint32_t clip_h_min;
- uint32_t clip_h_max;
} GP_Context;
-------------------------------------------------------------------------------
-The 'GP_Context' holds metadata needed for bitmaps. The values of pixels
+The 'GP_Context' holds meta-data needed for bitmaps. The values of pixels
are stored as bitmap lines (aligned to bytes) in one dimensional array.
-The addres of pixel could be determined by GP_PIXEL_ADDRESS(context, x, y)
-which returns byte aligned addres for the pixel.
+The address of pixel could be determined by GP_PIXEL_ADDRESS(context, x, y)
+which returns byte aligned address for the pixel.
Rotation
^^^^^^^^
+All gfx functions does honor rotation and mirroring. If you really need drawing
+primitives without it use variants with _Raw suffix.
-Rotation and mirroring is honored only by functions starting with extra T.
-So GP_TLine() is equal to GP_Line(), when all axes_sawp, x_swap and y_swap are
-set to zero.
+So GP_Line() is equal to GP_Line_Raw(), when all axes_swap, x_swap and y_swap
+are set to zero.
There are various macros for transforming coordinates and sizes in
'core/GP_Transform.h'.
@@ -47,13 +43,6 @@ There are various macros for transforming coordinates and sizes in
* *GP_TRANSFORM_RECT(x, y, w, h)*
* *GP_RETRANSFORM_POINT(x, y)*
-Clipping rectangle
-^^^^^^^^^^^^^^^^^^
-
-All drawing functions honor the clipping rectangle, eg. no pixels are put,
-even when the coordinates are inside the bitmap, if they are outside of
-clipping rectangle.
-
Functions
~~~~~~~~~
@@ -63,12 +52,10 @@ Functions
uint32_t GP_ContextW(struct GP_Context *context);
uint32_t GP_ContextH(struct GP_Context *context);
-uint32_t GP_TContextW(struct GP_Context *context);
-uint32_t GP_TContextH(struct GP_Context *context);
-------------------------------------------------------------------------------
-Functions to get context width and height. Functions with 'T' prefix do honour
-rotation flags (swaps W and H if axes_swap is set).
+Functions to get context width and height that do honor rotation flags (swaps
+W and H if axes_swap is set).
[source,c]
-------------------------------------------------------------------------------
@@ -88,7 +75,7 @@ counter clock wise.
GP_Context *GP_ContextAlloc(uint32_t w, uint32_t h, GP_PixelType type);
-------------------------------------------------------------------------------
-Allocates and initalizes the 'GP_Context' structure. The size for pixels is
+Allocates and initializes the 'GP_Context' structure. The size for pixels is
computed from width, height and pixel type. Moreover the rotation flags are
set to zero and clipping rectangle is set to whole bitmap.
@@ -110,9 +97,9 @@ Free the context allocated memory.
GP_Context *GP_ContextCopy(GP_Context *context, int flag);
-------------------------------------------------------------------------------
-Copy a context. Allocates and initalizes a 'GP_Context'. If flag is set to
-GP_CONTEXT_WITH_PIXELS, the actuall bitmap is copied from contex to newly
-allocated context, otherwise only context metadata are copied.
+Copy a context. Allocates and initializes a 'GP_Context'. If flag is set to
+GP_CONTEXT_WITH_PIXELS, the actual bitmap is copied from context to newly
+allocated context, otherwise only context meta-data are copied.
The newly created context should be later freed with 'GP_ContextFree()'.
diff --git a/doc/drawing_api.txt b/doc/drawing_api.txt
index 707ad71..6cfd7e8 100644
--- a/doc/drawing_api.txt
+++ b/doc/drawing_api.txt
@@ -9,42 +9,46 @@ Fill
void GP_Fill(GP_Context *context, GP_Pixel pixel);
--------------------------------------------------------------------------------
-Fills the context bitmap, respecting the clipping rect. This has the same effect
-as calling 'GP_FillRect(context, 0, 0, context->w, context->h, pixel)'.
-
-This functions doesn't have rotate friendly variant.
+Fills the context bitmap. This has the same effect as calling
+'GP_FillRect(context, 0, 0, context->w, context->h, pixel)'.
Lines
~~~~~
[source,c]
--------------------------------------------------------------------------------
-void GP_HLineXXY(GP_Context *context, int x0, int x1, int 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, 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);
-void GP_HLine(GP_Context *context, int x0, int x1, int y, GP_Pixel pixel);
+void GP_HLine(GP_Context *context, GP_Coord x0, GP_Coord x1, GP_Coord y,
+ GP_Pixel pixel);
--------------------------------------------------------------------------------
-Draws a horizontal line. The 'GP_HLine()' function is an alias for 'GP_HLineXXY()'.
+Draws a horizontal line. The 'GP_HLine()' function is an alias for
+'GP_HLineXXY()'.
[source,c]
--------------------------------------------------------------------------------
-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 h,
+ GP_Pixel pixel);
-void GP_VLine(GP_Context *context, int x, int y0, int y1, GP_Pixel pixel);
+void GP_VLine(GP_Context *context, GP_Coord x, GP_Coord y0, GP_Coord y1,
+ GP_Pixel pixel);
--------------------------------------------------------------------------------
-Draws a vertical line. The 'GP_VLine()' function is an alias for 'GP_VLineXYY()'.
+Draws a vertical line. The 'GP_VLine()' function is an alias for
+'GP_VLineXYY()'.
[source,c]
--------------------------------------------------------------------------------
-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);
--------------------------------------------------------------------------------
Draws a line from (x0, y0) to (x1, y1), inclusive.
@@ -54,35 +58,56 @@ Circles
[source,c]
--------------------------------------------------------------------------------
-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);
--------------------------------------------------------------------------------
Draws a circle.
[source,c]
--------------------------------------------------------------------------------
-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);
--------------------------------------------------------------------------------
Draws a filled circle.
+Rings
+~~~~~
+[source,c]
+--------------------------------------------------------------------------------
+void GP_Ring(GP_Context *context, GP_Coord xcenter, GP_Coord ycenter,
+ GP_Size r1, GP_Size r2, GP_Pixel pixel);
+--------------------------------------------------------------------------------
+
+Draws a ring.
+
+[source,c]
+--------------------------------------------------------------------------------
+void GP_FillRing(GP_Context *context, GP_Coord xcenter, GP_Coord ycenter,
+ GP_Size r1, GP_Size r2, GP_Pixel pixel);
+--------------------------------------------------------------------------------
+
+Draws a filled ring.
+
+The smaller of r1 and r2 is used for inner radius and bigger one for outer
+radius.
+
Ellipses
~~~~~~~~
[source,c]
--------------------------------------------------------------------------------
-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);
--------------------------------------------------------------------------------
Draws an ellipse.
[source,c]
--------------------------------------------------------------------------------
-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);
--------------------------------------------------------------------------------
Draws a filled ellipse.
@@ -92,16 +117,18 @@ Triangles
[source,c]
--------------------------------------------------------------------------------
-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);
--------------------------------------------------------------------------------
Draws a triangle.
[source,c]
--------------------------------------------------------------------------------
-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);
--------------------------------------------------------------------------------
Draws a filled triangle.
@@ -111,34 +138,36 @@ Rects
[source,c]
--------------------------------------------------------------------------------
-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_Rect(GP_Context *context, int x0, int y0, int x1, int y1,
- GP_Pixel pixel);
+void GP_Rect(GP_Context *context, GP_Coord x0, GP_Coord y0,
+ GP_Coord x1, GP_Coord y1, GP_Pixel pixel);
--------------------------------------------------------------------------------
Draws a rectangle.
+
The 'GP_RectXYXY()' expects two corner points (x0, y0), and (x1, y1).
The 'GP_RectXYWH()' expects a corner point (x0, y0), width and height.
The 'GP_Rect()' function is an alias for 'GP_RectXYXY()'.
[source,c]
--------------------------------------------------------------------------------
-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_FillRect(GP_Context *context, int x0, int y0, int x1, int y1,
- GP_Pixel pixel);
+void GP_FillRect(GP_Context *context, GP_Coord x0, GP_Coord y0,
+ GP_Coord x1, GP_Coord y1, GP_Pixel pixel);
--------------------------------------------------------------------------------
Draws a filled rectangle.
+
The 'GP_RectXYXY' fills an area between corner points (x0, y0) and (x1, y1),
inclusive.
The 'GP_RectXYWH' fills an area starting from (x0, y0) with specified width
@@ -150,16 +179,18 @@ Tetragons
[source,c]
--------------------------------------------------------------------------------
-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);
--------------------------------------------------------------------------------
Draws a tetragon.
[source,c]
--------------------------------------------------------------------------------
-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);
--------------------------------------------------------------------------------
Draws a filled tetragon.
diff --git a/doc/filters.txt b/doc/filters.txt
index 707a621..d741abb 100644
--- a/doc/filters.txt
+++ b/doc/filters.txt
@@ -1,7 +1,7 @@
Context filters
---------------
-Pixel filters for 'GP_Context'.
+Pixel filters for 'GP_Context'. The context filter is basially an function that modifies context somehow (may even allocate new context to store result).
Rotation
~~~~~~~~
@@ -13,8 +13,7 @@ Rotation
GP_RetCode GP_MirrorH(GP_Context *context);
-------------------------------------------------------------------------------
-Mirrors context pixels horizontaly and updates the context metadata (mirrors
-cliping rectangle too).
+Mirrors context pixels horizontaly and updates the context metadata.
[source,c]
-------------------------------------------------------------------------------
@@ -23,8 +22,7 @@ cliping rectangle too).
GP_RetCode GP_MirrorV(GP_Context *context);
-------------------------------------------------------------------------------
-Mirrors context pixels verticaly and updates the context metadata (mirrors
-cliping rectangle too).
+Mirrors context pixels verticaly and updates the context metadata.
[source,c]
-------------------------------------------------------------------------------
@@ -33,8 +31,7 @@ cliping rectangle too).
GP_RetCode GP_RotateCW(GP_Context *context);
-------------------------------------------------------------------------------
-Rotates context clock wise and updates the context metadata (rotates cliping
-rectangle too).
+Rotates context clock wise and updates the context metadata.
[source,c]
-------------------------------------------------------------------------------
@@ -43,6 +40,5 @@ rectangle too).
GP_RetCode GP_RotateCCW(GP_Context *context);
-------------------------------------------------------------------------------
-Rotates context counter clock wise and updates the context metadata (rotates
-cliping rectangle too).
+Rotates context counter clock wise and updates the context metadata.
http://repo.or.cz/w/gfxprim.git/commit/ff97808f33bff1007d84a1d4899363b62d2a…
commit ff97808f33bff1007d84a1d4899363b62d2ac2f3
Author: Cyril Hrubis <metan(a)ucw.cz>
Date: Fri Jul 29 19:18:57 2011 +0000
Minor core and gfx cleanup.
diff --git a/include/core/GP_Color.h b/include/core/GP_Color.h
index 8bda861..a636cd0 100644
--- a/include/core/GP_Color.h
+++ b/include/core/GP_Color.h
@@ -25,7 +25,8 @@
/*
- Color.
+ Color is enumeration of color names which may be converted into pixel values
+ in desired pixel format.
*/
@@ -54,18 +55,19 @@ typedef enum GP_Color {
/*
* Converts Color to Pixel
*/
-GP_Pixel GP_ColorToPixel(GP_Context *context, GP_Color col);
+GP_Pixel GP_ColorToPixel(GP_Context *context, GP_Color color);
/*
* Converts Color name to Color.
*/
GP_Color GP_ColorNameToColor(const char *color_name);
-const char *GP_ColorToColorName(GP_Color col);
+const char *GP_ColorToColorName(GP_Color color);
/*
* Converts Color name to Pixel.
*/
-GP_Pixel GP_ColorNameToPixel(GP_Context *context, const char *color_name);
+bool GP_ColorNameToPixel(GP_Context *context, const char *color_name,
+ GP_Pixel *pixel);
#endif /* GP_COLOR_H */
diff --git a/include/core/GP_Context.h b/include/core/GP_Context.h
index 4bffd66..cf65432 100644
--- a/include/core/GP_Context.h
+++ b/include/core/GP_Context.h
@@ -46,10 +46,10 @@ typedef struct GP_Context {
/* image orientation. Most common is landscape (0, 0, 0),
* portrait with normal topleft corner is (1, 0, 0).
*/
- uint8_t axes_swap:1; /* swap axes so that x is y and y is x */
- uint8_t x_swap:1; /* swap direction on x */
- uint8_t y_swap:1; /* swap direction on y */
- uint8_t bit_endian:1; /* GP_BIT_ENDIAN */
+ uint8_t axes_swap:1; /* swap axes so that x is y and y is x */
+ uint8_t x_swap:1; /* swap direction on x */
+ uint8_t y_swap:1; /* swap direction on y */
+ uint8_t bit_endian:1; /* GP_BIT_ENDIAN */
} GP_Context;
/* Returns the pixel type used by the context. */
diff --git a/include/gfx/GP_VLine.h b/include/gfx/GP_VLine.h
index ea5a576..f4c5d1e 100644
--- a/include/gfx/GP_VLine.h
+++ b/include/gfx/GP_VLine.h
@@ -34,11 +34,11 @@ void GP_VLineXYY(GP_Context *context, GP_Coord x, GP_Coord y0,
void GP_VLineXYY_Raw(GP_Context *context, GP_Coord x, GP_Coord y0,
GP_Coord y1, GP_Pixel pixel);
-void GP_VLineXYH(GP_Context *context, GP_Coord x, GP_Coord y,
- GP_Size height, GP_Pixel pixel);
+void GP_VLineXYH(GP_Context *context, GP_Coord x, GP_Coord y, GP_Size h,
+ GP_Pixel pixel);
-void GP_VLineXYH_Raw(GP_Context *context, GP_Coord x, GP_Coord y,
- GP_Size height, GP_Pixel pixel);
+void GP_VLineXYH_Raw(GP_Context *context, GP_Coord x, GP_Coord y, GP_Size h,
+ GP_Pixel pixel);
/* default argument set is XYY */
static inline void GP_VLine(GP_Context *context, GP_Coord x,
diff --git a/libs/core/GP_Color.c b/libs/core/GP_Color.c
index b6981d9..06a2791 100644
--- a/libs/core/GP_Color.c
+++ b/libs/core/GP_Color.c
@@ -87,12 +87,15 @@ const char *GP_ColorToColorName(GP_Color col)
return color_names[col];
}
-GP_Pixel GP_ColorNameToPixel(GP_Context *context, const char *color_name)
+bool GP_ColorNameToPixel(GP_Context *context, const char *color_name,
+ GP_Pixel *pixel)
{
GP_Color col = GP_ColorNameToColor(color_name);
- if (col < 0)
- return 0;
+ if (col == GP_COL_INVALID)
+ return false;
- return GP_ColorToPixel(context, col);
+ *pixel = GP_ColorToPixel(context, col);
+
+ return true;
}
diff --git a/libs/gfx/GP_VLine.c b/libs/gfx/GP_VLine.c
index 4fdb319..e6d7f01 100644
--- a/libs/gfx/GP_VLine.c
+++ b/libs/gfx/GP_VLine.c
@@ -40,14 +40,14 @@ void GP_VLineXYY_Raw(GP_Context *context, GP_Coord x, GP_Coord y0,
GP_FN_PER_BPP_CONTEXT(GP_VLine, context, context, x, y0, y1, pixel);
}
-void GP_VLineXYH_Raw(GP_Context *context, GP_Coord x, GP_Coord y,
- GP_Size height, GP_Pixel pixel)
+void GP_VLineXYH_Raw(GP_Context *context, GP_Coord x, GP_Coord y, GP_Size h,
+ GP_Pixel pixel)
{
/* zero height: do not draw anything */
- if (height == 0)
+ if (h == 0)
return;
- GP_VLineXYY(context, x, y, y + height - 1, pixel);
+ GP_VLineXYY(context, x, y, y + h - 1, pixel);
}
void GP_VLineXYY(GP_Context *context, GP_Coord x, GP_Coord y0,
@@ -68,12 +68,12 @@ void GP_VLineXYY(GP_Context *context, GP_Coord x, GP_Coord y0,
}
}
-void GP_VLineXYH(GP_Context *context, GP_Coord x, GP_Coord y,
- GP_Size height, GP_Pixel pixel)
+void GP_VLineXYH(GP_Context *context, GP_Coord x, GP_Coord y, GP_Size h,
+ GP_Pixel pixel)
{
/* zero height: do not draw anything */
- if (height == 0)
+ if (h == 0)
return;
- GP_VLineXYY(context, x, y, y + height - 1, pixel);
+ GP_VLineXYY(context, x, y, y + h - 1, pixel);
}
-----------------------------------------------------------------------
Summary of changes:
doc/Makefile | 3 +-
doc/basic_types.txt | 84 ++++++++++++--------------------
doc/context.txt | 39 +++++----------
doc/drawing_api.txt | 117 ++++++++++++++++++++++++++++----------------
doc/filters.txt | 14 ++----
include/core/GP_Color.h | 10 ++--
include/core/GP_Context.h | 8 ++--
include/gfx/GP_VLine.h | 8 ++--
libs/core/GP_Color.c | 11 +++--
libs/gfx/GP_VLine.c | 16 +++---
10 files changed, 154 insertions(+), 156 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.")
1
0
[repo.or.cz] gfxprim.git branch generate updated: 24db76060a41a8d3abb75c57e552d9a784bf5948
by metan 25 Jul '11
by metan 25 Jul '11
25 Jul '11
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 24db76060a41a8d3abb75c57e552d9a784bf5948 (commit)
from 8a21bc6f957aa940853da65d443afdb21be9b891 (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/24db76060a41a8d3abb75c57e552d9a784bf…
commit 24db76060a41a8d3abb75c57e552d9a784bf5948
Author: Cyril Hrubis <metan(a)ucw.cz>
Date: Mon Jul 25 14:47:44 2011 +0200
Removed clipping rectangle in preparation for subcontext.
diff --git a/include/core/GP_Clip.h b/include/core/GP_Clip.h
deleted file mode 100644
index a6e5261..0000000
--- a/include/core/GP_Clip.h
+++ /dev/null
@@ -1,51 +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> *
- * *
- *****************************************************************************/
-
-#ifndef GP_CLIP_H
-#define GP_CLIP_H
-
-/*
- * Clipping rectanle mirroring and rotations.
- */
-#define GP_MIRROR_V_CLIP(context) do { - typeof(context->clip_w_min) _clip_w_min = context->clip_w_min; - - context->clip_w_min = context->w - context->clip_w_max; - context->clip_w_max = context->w - _clip_w_min; -} while (0)
-
-#define GP_MIRROR_H_CLIP(context) do { - typeof(context->clip_h_min) _clip_h_min = context->clip_h_min; - - context->clip_h_min = context->h - context->clip_h_max; - context->clip_h_max = context->h - _clip_h_min; -} while (0)
-
-#define GP_SWAP_CLIPS(context) do { - GP_SWAP(context->clip_w_min, context->clip_h_min); - GP_SWAP(context->clip_w_max, context->clip_h_max); -} while (0)
-
-#endif /* GP_CLIP_H */
diff --git a/include/core/GP_Context.h b/include/core/GP_Context.h
index 2e640da..4bffd66 100644
--- a/include/core/GP_Context.h
+++ b/include/core/GP_Context.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-2011 Jiri "BlueBear" Dluhos *
* <jiri.bluebear.dluhos(a)gmail.com> *
* *
- * Copyright (C) 2009-2010 Cyril Hrubis <metan(a)ucw.cz> *
+ * Copyright (C) 2009-2011 Cyril Hrubis <metan(a)ucw.cz> *
* *
*****************************************************************************/
@@ -38,8 +38,8 @@ typedef struct GP_Context {
uint8_t *pixels; /* pointer to image pixels */
uint8_t bpp; /* values: 1, 2, 4, 8, 16, 24, 32 */
uint32_t bytes_per_row;
- uint32_t w; /* width */
- uint32_t h; /* height */
+ uint32_t w; /* width in pixels */
+ uint32_t h; /* height in pixels */
GP_PixelType pixel_type; /* hardware pixel format */
@@ -50,12 +50,6 @@ typedef struct GP_Context {
uint8_t x_swap:1; /* swap direction on x */
uint8_t y_swap:1; /* swap direction on y */
uint8_t bit_endian:1; /* GP_BIT_ENDIAN */
-
- /* clipping rectangle; drawing functions only affect the inside */
- uint32_t clip_w_min;
- uint32_t clip_w_max;
- uint32_t clip_h_min;
- uint32_t clip_h_max;
} GP_Context;
/* Returns the pixel type used by the context. */
@@ -82,22 +76,14 @@ static inline GP_PixelType GP_GetContextPixelType(const GP_Context *context)
GP_CHECK(context->pixels, "invalid context: NULL image pointer"); GP_CHECK(context->bpp <= 32, "invalid context: unsupported bits-per-pixel count"); GP_CHECK(context->w > 0 && context->h > 0, "invalid context: invalid image size"); - GP_CHECK(context->clip_w_min <= context->clip_w_max - && context->clip_h_min <= context->clip_h_max, - "invalid context: invalid clipping rectangle"); - GP_CHECK(context->clip_w_max < context->w - && context->clip_h_max < context->h, - "invalid context: clipping rectangle larger than image"); } while (0)
/*
- * Is true, when pixel is clipped.
+ * Is true, when pixel is clipped out of context.
*/
#define GP_PIXEL_IS_CLIPPED(context, x, y) - (x < (int) context->clip_w_min - || x > (int) context->clip_w_max - || y < (int) context->clip_h_min - || y > (int) context->clip_h_max) + ((x) < 0 || x >= (int) context->w + || (y) < 0 || y >= (int) context->h)
/*
* Allocate context.
diff --git a/libs/SDL/GP_SDL_Context.c b/libs/SDL/GP_SDL_Context.c
index e8b7500..3378d3b 100644
--- a/libs/SDL/GP_SDL_Context.c
+++ b/libs/SDL/GP_SDL_Context.c
@@ -57,11 +57,5 @@ GP_RetCode GP_SDL_ContextFromSurface(GP_Context *context, SDL_Surface *surf)
context->x_swap = 0;
context->y_swap = 0;
- /* clipping */
- context->clip_h_min = surf->clip_rect.y;
- context->clip_h_max = surf->clip_rect.y + surf->clip_rect.h - 1;
- context->clip_w_min = surf->clip_rect.x;
- context->clip_w_max = surf->clip_rect.x + surf->clip_rect.w - 1;
-
return GP_ESUCCESS;
}
diff --git a/libs/backends/GP_Backend_SDL.c b/libs/backends/GP_Backend_SDL.c
index c3fd9ac..a0a40e6 100644
--- a/libs/backends/GP_Backend_SDL.c
+++ b/libs/backends/GP_Backend_SDL.c
@@ -77,12 +77,6 @@ inline GP_RetCode GP_SDL_ContextFromSurface(
context->x_swap = 0;
context->y_swap = 0;
- /* clipping */
- context->clip_h_min = surf->clip_rect.y;
- context->clip_h_max = surf->clip_rect.y + surf->clip_rect.h - 1;
- context->clip_w_min = surf->clip_rect.x;
- context->clip_w_max = surf->clip_rect.x + surf->clip_rect.w - 1;
-
return GP_ESUCCESS;
}
diff --git a/libs/core/GP_Context.c b/libs/core/GP_Context.c
index 1660d25..58c6a0b 100644
--- a/libs/core/GP_Context.c
+++ b/libs/core/GP_Context.c
@@ -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-2011 Jiri "BlueBear" Dluhos *
* <jiri.bluebear.dluhos(a)gmail.com> *
* *
- * Copyright (C) 2009-2010 Cyril Hrubis <metan(a)ucw.cz> *
+ * Copyright (C) 2009-2011 Cyril Hrubis <metan(a)ucw.cz> *
* *
*****************************************************************************/
@@ -63,12 +63,6 @@ GP_Context *GP_ContextCopy(GP_Context *context, int flag)
new->y_swap = context->y_swap;
new->x_swap = context->x_swap;
- /* clipping */
- new->clip_w_min = context->clip_w_min;
- new->clip_w_max = context->clip_w_max;
- new->clip_h_min = context->clip_h_min;
- new->clip_h_max = context->clip_h_max;
-
return new;
}
@@ -102,12 +96,6 @@ GP_Context *GP_ContextAlloc(uint32_t w, uint32_t h, GP_PixelType type)
context->y_swap = 0;
context->x_swap = 0;
- /* clipping */
- context->clip_w_min = 0;
- context->clip_w_max = w - 1;
- context->clip_h_min = 0;
- context->clip_h_max = h - 1;
-
return context;
}
diff --git a/libs/core/GP_GetPutPixel.c b/libs/core/GP_GetPutPixel.c
index 9cac910..774be54 100644
--- a/libs/core/GP_GetPutPixel.c
+++ b/libs/core/GP_GetPutPixel.c
@@ -34,6 +34,6 @@ GP_Pixel GP_GetPixel(const GP_Context *context, int x, int y)
void GP_PutPixel(GP_Context *context, int x, int y, GP_Pixel p)
{
GP_TRANSFORM_POINT(context, x, y);
- if (! GP_PIXEL_IS_CLIPPED(context, x, y))
+ if (!GP_PIXEL_IS_CLIPPED(context, x, y))
GP_PutPixel_Raw(context, x, y, p);
}
diff --git a/libs/filters/GP_Rotate.c b/libs/filters/GP_Rotate.c
index adb0ce2..6967514 100644
--- a/libs/filters/GP_Rotate.c
+++ b/libs/filters/GP_Rotate.c
@@ -51,8 +51,6 @@ GP_RetCode GP_MirrorH(GP_Context *context)
memcpy(l2, buf, bpr);
}
- GP_MIRROR_H_CLIP(context);
-
return GP_ESUCCESS;
}
diff --git a/libs/filters/algo/GP_MirrorV.algo.h b/libs/filters/algo/GP_MirrorV.algo.h
index 3ea1438..6555700 100644
--- a/libs/filters/algo/GP_MirrorV.algo.h
+++ b/libs/filters/algo/GP_MirrorV.algo.h
@@ -16,16 +16,14 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, *
* Boston, MA 02110-1301 USA *
* *
- * Copyright (C) 2009-2010 Jiri "BlueBear" Dluhos *
+ * Copyright (C) 2009-2011 Jiri "BlueBear" Dluhos *
* <jiri.bluebear.dluhos(a)gmail.com> *
* *
- * Copyright (C) 2009-2010 Cyril Hrubis <metan(a)ucw.cz> *
+ * Copyright (C) 2009-2011 Cyril Hrubis <metan(a)ucw.cz> *
* *
*****************************************************************************/
-#include "core/GP_Clip.h"
-
#define DEF_MIRRORV_FN(FN_NAME, CONTEXT_T, PIXEL_T, PUTPIXEL, GETPIXEL) void FN_NAME(CONTEXT_T context) { @@ -41,6 +39,4 @@ void FN_NAME(CONTEXT_T context) PUTPIXEL(context, xm, y, tmp); } } -- GP_MIRROR_V_CLIP(context); }
diff --git a/libs/filters/algo/GP_Rotate.algo.h b/libs/filters/algo/GP_Rotate.algo.h
index e6ea14d..bc7528d 100644
--- a/libs/filters/algo/GP_Rotate.algo.h
+++ b/libs/filters/algo/GP_Rotate.algo.h
@@ -16,14 +16,13 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, *
* Boston, MA 02110-1301 USA *
* *
- * Copyright (C) 2009-2010 Jiri "BlueBear" Dluhos *
+ * Copyright (C) 2009-2011 Jiri "BlueBear" Dluhos *
* <jiri.bluebear.dluhos(a)gmail.com> *
* *
- * Copyright (C) 2009-2010 Cyril Hrubis <metan(a)ucw.cz> *
+ * Copyright (C) 2009-2011 Cyril Hrubis <metan(a)ucw.cz> *
* *
*****************************************************************************/
-#include "core/GP_Clip.h"
#include "core/GP_Common.h"
#include "core/GP_Context.h"
@@ -52,9 +51,6 @@ GP_RetCode FN_NAME(CONTEXT_T context) GP_ContextFree(tmp); - GP_SWAP_CLIPS(context); - GP_MIRROR_H_CLIP(context); - return GP_ESUCCESS; }
@@ -83,8 +79,5 @@ GP_RetCode FN_NAME(CONTEXT_T context) GP_ContextFree(tmp); - GP_SWAP_CLIPS(context); - GP_MIRROR_V_CLIP(context); - return GP_ESUCCESS; }
diff --git a/libs/gfx/algo/Circle.algo.h b/libs/gfx/algo/Circle.algo.h
index 96eb3b4..f5f5acc 100644
--- a/libs/gfx/algo/Circle.algo.h
+++ b/libs/gfx/algo/Circle.algo.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-2011 Jiri "BlueBear" Dluhos *
* <jiri.bluebear.dluhos(a)gmail.com> *
* *
- * Copyright (C) 2009-2010 Cyril Hrubis <metan(a)ucw.cz> *
+ * Copyright (C) 2009-2011 Cyril Hrubis <metan(a)ucw.cz> *
* *
*****************************************************************************/
diff --git a/libs/gfx/algo/HLine.algo.h b/libs/gfx/algo/HLine.algo.h
index a62ae50..91dd35f 100644
--- a/libs/gfx/algo/HLine.algo.h
+++ b/libs/gfx/algo/HLine.algo.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-2011 Jiri "BlueBear" Dluhos *
* <jiri.bluebear.dluhos(a)gmail.com> *
* *
- * Copyright (C) 2009-2010 Cyril Hrubis <metan(a)ucw.cz> *
+ * Copyright (C) 2009-2011 Cyril Hrubis <metan(a)ucw.cz> *
* *
*****************************************************************************/
@@ -28,16 +28,14 @@
/* 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 (x0 > x1) GP_SWAP(x0, x1); - if (y < (int) context->clip_h_min - || y > (int) context->clip_h_max - || x0 > (int) context->clip_w_max - || x1 < (int) context->clip_w_min) { - return; - } - x0 = GP_MAX(x0, (int) context->clip_w_min); - x1 = GP_MIN(x1, (int) context->clip_w_max); +#define ORDER_AND_CLIP_COORDS do { + if (x0 > x1) + GP_SWAP(x0, x1); + if (y < 0 || y >= (int) context->h || + x1 < 0 || x0 >= (int) context->w) + return; + x0 = GP_MAX(x0, 0); + x1 = GP_MIN(x1, (int) context->w - 1); } while (0)
/*
diff --git a/libs/gfx/algo/VLine.algo.h b/libs/gfx/algo/VLine.algo.h
index daa6f9d..b33a448 100644
--- a/libs/gfx/algo/VLine.algo.h
+++ b/libs/gfx/algo/VLine.algo.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-2011 Jiri "BlueBear" Dluhos *
* <jiri.bluebear.dluhos(a)gmail.com> *
* *
- * Copyright (C) 2009-2010 Cyril Hrubis <metan(a)ucw.cz> *
+ * Copyright (C) 2009-2011 Cyril Hrubis <metan(a)ucw.cz> *
* *
*****************************************************************************/
@@ -28,16 +28,14 @@
/* 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 < (int) context->clip_w_min - || x > (int) context->clip_w_max - || y1 < (int) context->clip_h_min - || y0 > (int) context->clip_h_max) { - return; - } - y0 = GP_MAX(y0, (int) context->clip_h_min); - y1 = GP_MIN(y1, (int) context->clip_h_max); +#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)
/*
-----------------------------------------------------------------------
Summary of changes:
include/core/GP_Clip.h | 51 -----------------------------------
include/core/GP_Context.h | 28 +++++--------------
libs/SDL/GP_SDL_Context.c | 6 ----
libs/backends/GP_Backend_SDL.c | 6 ----
libs/core/GP_Context.c | 16 +---------
libs/core/GP_GetPutPixel.c | 2 +-
libs/filters/GP_Rotate.c | 2 -
libs/filters/algo/GP_MirrorV.algo.h | 8 +----
libs/filters/algo/GP_Rotate.algo.h | 11 +------
libs/gfx/algo/Circle.algo.h | 4 +-
libs/gfx/algo/HLine.algo.h | 22 +++++++--------
libs/gfx/algo/VLine.algo.h | 22 +++++++--------
12 files changed, 36 insertions(+), 142 deletions(-)
delete mode 100644 include/core/GP_Clip.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.")
1
0
[repo.or.cz] gfxprim.git branch generate updated: 8a21bc6f957aa940853da65d443afdb21be9b891
by metan 24 Jul '11
by metan 24 Jul '11
24 Jul '11
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 8a21bc6f957aa940853da65d443afdb21be9b891 (commit)
via a6b989fc9c386a6e7422277784cd13140af7e286 (commit)
from 9af82e35bed6a38c5599afcd4d0e0ac3450299a5 (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/8a21bc6f957aa940853da65d443afdb21be9…
commit 8a21bc6f957aa940853da65d443afdb21be9b891
Author: Cyril Hrubis <metan(a)ucw.cz>
Date: Sun Jul 24 19:00:23 2011 +0200
API change for gfx library.
Make the default functions honour transformations. The functions that
doesn't honour transformations are now with _Raw suffix.
diff --git a/include/core/GP_DefFnPerBpp.h b/include/core/GP_DefFnPerBpp.h
index 534a451..bedc3b0 100644
--- a/include/core/GP_DefFnPerBpp.h
+++ b/include/core/GP_DefFnPerBpp.h
@@ -34,7 +34,7 @@
GP_DEF_FN_PER_BPP(fname, MACRO_NAME, GP_PutPixel_Raw_)
#define GP_DEF_FILL_FN_PER_BPP(fname, MACRO_NAME) - GP_DEF_FN_PER_BPP(fname, MACRO_NAME, GP_HLine_)
+ GP_DEF_FN_PER_BPP(fname, MACRO_NAME, GP_HLine_Raw_)
#define GP_DEF_FN_FOR_BPP(fname, MACRO_NAME, fdraw, bpp) MACRO_NAME(fname##_##bpp, GP_Context *, GP_Pixel, fdraw##bpp)
diff --git a/include/gfx/GP_Circle.h b/include/gfx/GP_Circle.h
index 482cd51..8f9f4de 100644
--- a/include/gfx/GP_Circle.h
+++ b/include/gfx/GP_Circle.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-2011 Jiri "BlueBear" Dluhos *
* <jiri.bluebear.dluhos(a)gmail.com> *
* *
- * Copyright (C) 2009-2010 Cyril Hrubis <metan(a)ucw.cz> *
+ * Copyright (C) 2009-2011 Cyril Hrubis <metan(a)ucw.cz> *
* *
*****************************************************************************/
@@ -28,22 +28,36 @@
#include "core/GP_Context.h"
+/* Circle */
+
void GP_Circle(GP_Context *context, GP_Coord xcenter, GP_Coord ycenter,
GP_Size r, GP_Pixel pixel);
-void GP_TCircle(GP_Context *context, GP_Coord xcenter, GP_Coord ycenter,
- GP_Size r, GP_Pixel pixel);
+void GP_Circle_Raw(GP_Context *context, GP_Coord xcenter, GP_Coord ycenter,
+ GP_Size r, GP_Pixel pixel);
+
+/* Filled Circle */
void GP_FillCircle(GP_Context *context, GP_Coord xcenter, GP_Coord ycenter,
GP_Size r, GP_Pixel pixel);
-void GP_TFillCircle(GP_Context *context, GP_Coord xcenter, GP_Coord ycenter,
- GP_Size r, GP_Pixel pixel);
+void GP_FillCircle_Raw(GP_Context *context, GP_Coord xcenter, GP_Coord ycenter,
+ GP_Size r, GP_Pixel pixel);
+
+/* Ring */
+
+void GP_Ring(GP_Context *context, GP_Coord xcenter, GP_Coord ycenter,
+ GP_Size r1, GP_Size r2, GP_Pixel pixel);
+
+void GP_Ring_Raw(GP_Context *context, GP_Coord xcenter, GP_Coord ycenter,
+ GP_Size r1, GP_Size r2, GP_Pixel pixel);
+
+/* Filled Ring */
void GP_FillRing(GP_Context *context, GP_Coord xcenter, GP_Coord ycenter,
- GP_Size r1, GP_Size r2, GP_Pixel pixel);
+ GP_Size r1, GP_Size r2, GP_Pixel pixel);
-void GP_TFillRing(GP_Context *context, GP_Coord xcenter, GP_Coord ycenter,
- GP_Size r1, GP_Size r2, GP_Pixel pixel);
+void GP_FillRing_Raw(GP_Context *context, GP_Coord xcenter, GP_Coord ycenter,
+ GP_Size r1, GP_Size r2, GP_Pixel pixel);
#endif /* GP_CIRCLE_H */
diff --git a/include/gfx/GP_Ellipse.h b/include/gfx/GP_Ellipse.h
index ef10808..6a86a47 100644
--- a/include/gfx/GP_Ellipse.h
+++ b/include/gfx/GP_Ellipse.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-2011 Jiri "BlueBear" Dluhos *
* <jiri.bluebear.dluhos(a)gmail.com> *
* *
- * Copyright (C) 2009-2010 Cyril Hrubis <metan(a)ucw.cz> *
+ * Copyright (C) 2009-2011 Cyril Hrubis <metan(a)ucw.cz> *
* *
*****************************************************************************/
@@ -28,17 +28,20 @@
#include "core/GP_Context.h"
+/* Ellipse */
+
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, GP_Coord xcenter, GP_Coord ycenter,
- GP_Size a, GP_Size b, GP_Pixel pixel);
+void GP_Ellipse_Raw(GP_Context *context, GP_Coord xcenter, GP_Coord ycenter,
+ GP_Size a, GP_Size b, GP_Pixel pixel);
+
+/* Filled Ellipse */
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, GP_Coord xcenter, GP_Coord ycenter,
- GP_Size a, GP_Size b, GP_Pixel pixel);
-
+void GP_FillEllipse_Raw(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_Fill.h b/include/gfx/GP_Fill.h
index 6b6139d..2a8ba8b 100644
--- a/include/gfx/GP_Fill.h
+++ b/include/gfx/GP_Fill.h
@@ -16,18 +16,21 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, *
* Boston, MA 02110-1301 USA *
* *
- * Copyright (C) 2009-2010 Jiri "BlueBear" Dluhos *
+ * Copyright (C) 2009-2011 Jiri "BlueBear" Dluhos *
* <jiri.bluebear.dluhos(a)gmail.com> *
* *
- * Copyright (C) 2009-2010 Cyril Hrubis <metan(a)ucw.cz> *
+ * Copyright (C) 2009-2011 Cyril Hrubis <metan(a)ucw.cz> *
* *
*****************************************************************************/
#ifndef GP_FILL_H
#define GP_FILL_H
-#include "core/GP_Context.h"
+#include "GP_Rect.h"
-void GP_Fill(GP_Context *context, GP_Pixel pixel);
+static inline void GP_Fill(GP_Context *context, GP_Pixel pixel)
+{
+ GP_FillRect_Raw(context, 0, 0, context->w, context->h, pixel);
+}
#endif /* GP_FILL_H */
diff --git a/include/gfx/GP_HLine.h b/include/gfx/GP_HLine.h
index 66e2b79..96b66de 100644
--- a/include/gfx/GP_HLine.h
+++ b/include/gfx/GP_HLine.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-2011 Jiri "BlueBear" Dluhos *
* <jiri.bluebear.dluhos(a)gmail.com> *
* *
- * Copyright (C) 2009-2010 Cyril Hrubis <metan(a)ucw.cz> *
+ * Copyright (C) 2009-2011 Cyril Hrubis <metan(a)ucw.cz> *
* *
*****************************************************************************/
@@ -28,59 +28,63 @@
#include "core/GP_Context.h"
-void GP_HLine_1BPP_LE(GP_Context *context, GP_Coord x0, GP_Coord x1,
- GP_Coord y, GP_Pixel pixel);
+/* Raw per BPP HLines */
-void GP_HLine_1BPP_BE(GP_Context *context, GP_Coord x0, GP_Coord x1,
- GP_Coord y, GP_Pixel pixel);
+void GP_HLine_Raw_1BPP_LE(GP_Context *context, GP_Coord x0, GP_Coord x1,
+ GP_Coord y, GP_Pixel pixel);
-void GP_HLine_2BPP_LE(GP_Context *context, GP_Coord x0, GP_Coord x1,
- GP_Coord y, GP_Pixel pixel);
+void GP_HLine_Raw_1BPP_BE(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_Raw_2BPP_LE(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_Raw_2BPP_BE(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_Raw_4BPP_LE(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_Raw_4BPP_BE(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_Raw_8BPP(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_Raw_16BPP(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_HLine_Raw_24BPP(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_HLine_Raw_32BPP(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,
+/* Generic HLines */
+
+void GP_HLineXXY(GP_Context *context, GP_Coord x0, GP_Coord x1, GP_Coord y,
GP_Pixel pixel);
-void GP_THLineXXY(GP_Context *context, GP_Coord x0, GP_Coord x1,
- GP_Coord y, GP_Pixel pixel);
+void GP_HLineXXY_Raw(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_THLineXYW(GP_Context *context, GP_Coord x, GP_Coord y, GP_Size w,
- GP_Pixel pixel);
+void GP_HLineXYW_Raw(GP_Context *context, GP_Coord x, GP_Coord y, GP_Size w,
+ GP_Pixel pixel);
/* default argument set is XXY */
-static inline void GP_HLine(GP_Context *context, GP_Coord x0, GP_Coord x1,
- GP_Coord y, GP_Pixel p)
+static inline void GP_HLine_Raw(GP_Context *context, GP_Coord x0, GP_Coord x1,
+ GP_Coord y, GP_Pixel p)
{
- GP_HLineXXY(context, x0, x1, y, p);
+ GP_HLineXXY_Raw(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)
+static inline void GP_HLine(GP_Context *context, GP_Coord x0, GP_Coord x1,
+ GP_Coord y, GP_Pixel p)
{
- GP_THLineXXY(context, x0, x1, y, p);
+ GP_HLineXXY(context, x0, x1, y, p);
}
#endif /* GP_HLINE_H */
diff --git a/include/gfx/GP_Line.h b/include/gfx/GP_Line.h
index be0b67f..c131c7a 100644
--- a/include/gfx/GP_Line.h
+++ b/include/gfx/GP_Line.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-2011 Jiri "BlueBear" Dluhos *
* <jiri.bluebear.dluhos(a)gmail.com> *
* *
- * Copyright (C) 2009-2010 Cyril Hrubis <metan(a)ucw.cz> *
+ * Copyright (C) 2009-2011 Cyril Hrubis <metan(a)ucw.cz> *
* *
*****************************************************************************/
@@ -28,22 +28,10 @@
#include "core/GP_Context.h"
-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);
+void GP_Line_Raw(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 eee3bcc..8874a53 100644
--- a/include/gfx/GP_Polygon.h
+++ b/include/gfx/GP_Polygon.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-2011 Jiri "BlueBear" Dluhos *
* <jiri.bluebear.dluhos(a)gmail.com> *
* *
- * Copyright (C) 2009-2010 Cyril Hrubis <metan(a)ucw.cz> *
+ * Copyright (C) 2009-2011 Cyril Hrubis <metan(a)ucw.cz> *
* *
*****************************************************************************/
@@ -28,7 +28,7 @@
#include "core/GP_Context.h"
-void GP_FillPolygon(GP_Context *context, int vertex_count, const GP_Coord *xy,
- GP_Pixel pixel);
+void GP_FillPolygon_Raw(GP_Context *context, int vertex_count,
+ const GP_Coord *xy, GP_Pixel pixel);
#endif /* GP_POLYGON_H */
diff --git a/include/gfx/GP_Rect.h b/include/gfx/GP_Rect.h
index 984e0ee..5a3d57f 100644
--- a/include/gfx/GP_Rect.h
+++ b/include/gfx/GP_Rect.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-2011 Jiri "BlueBear" Dluhos *
* <jiri.bluebear.dluhos(a)gmail.com> *
* *
- * Copyright (C) 2009-2010 Cyril Hrubis <metan(a)ucw.cz> *
+ * Copyright (C) 2009-2011 Cyril Hrubis <metan(a)ucw.cz> *
* *
*****************************************************************************/
@@ -28,35 +28,59 @@
#include "core/GP_Context.h"
+/* Rectangle */
+
void GP_RectXYXY(GP_Context *context, GP_Coord x0, GP_Coord y0,
GP_Coord x1, GP_Coord y1, GP_Pixel pixel);
+void GP_RectXYXY_Raw(GP_Context *context, GP_Coord x0, GP_Coord y0,
+ GP_Coord x1, GP_Coord y1, 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, GP_Coord x0, GP_Coord y0,
- GP_Coord x1, GP_Coord y1, GP_Pixel pixel);
-
-void GP_TRectXYWH(GP_Context *context, GP_Coord x, GP_Coord y,
- GP_Size w, GP_Size h, GP_Pixel pixel);
+void GP_RectXYWH_Raw(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
+static inline void GP_Rect(GP_Context *context, GP_Coord x0, GP_Coord y0,
+ GP_Coord x1, GP_Coord y1, GP_Pixel pixel)
+{
+ GP_RectXYXY(context, x0, y0, x1, y1, pixel);
+}
+
+static inline void GP_Rect_Raw(GP_Context *context, GP_Coord x0, GP_Coord y0,
+ GP_Coord x1, GP_Coord y1, GP_Pixel pixel)
+{
+ GP_RectXYXY_Raw(context, x0, y0, x1, y1, pixel);
+}
+
+/* Filled Rectangle */
void GP_FillRectXYXY(GP_Context *context, GP_Coord x0, GP_Coord y0,
GP_Coord x1, GP_Coord y1, GP_Pixel pixel);
+void GP_FillRectXYXY_Raw(GP_Context *context, GP_Coord x0, GP_Coord y0,
+ GP_Coord x1, GP_Coord y1, GP_Pixel pixel);
+
void GP_FillRectXYWH(GP_Context *context, GP_Coord x, GP_Coord y,
- GP_Size w, GP_Size h, GP_Pixel pixel);
+ GP_Size w, GP_Size h, 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_FillRectXYWH_Raw(GP_Context *context, GP_Coord x, GP_Coord y,
+ GP_Size w, GP_Size 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);
+/* The XYXY argument set is the default */
+static inline void GP_FillRect(GP_Context *context, GP_Coord x0, GP_Coord y0,
+ GP_Coord x1, GP_Coord y1, GP_Pixel pixel)
+{
+ GP_FillRectXYXY(context, x0, y0, x1, y1, pixel);
+}
-#define GP_FillRect GP_FillRectXYXY
-#define GP_TFillRect GP_TFillRectXYXY
+static inline void GP_FillRect_Raw(GP_Context *context,
+ GP_Coord x0, GP_Coord y0,
+ GP_Coord x1, GP_Coord y1, GP_Pixel pixel)
+{
+ GP_FillRectXYXY_Raw(context, x0, y0, x1, y1, pixel);
+}
#endif /* GP_RECT_H */
diff --git a/include/gfx/GP_Symbol.h b/include/gfx/GP_Symbol.h
index 648a11e..8a9f2df 100644
--- a/include/gfx/GP_Symbol.h
+++ b/include/gfx/GP_Symbol.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-2011 Jiri "BlueBear" Dluhos *
* <jiri.bluebear.dluhos(a)gmail.com> *
* *
- * Copyright (C) 2009-2010 Cyril Hrubis <metan(a)ucw.cz> *
+ * Copyright (C) 2009-2011 Cyril Hrubis <metan(a)ucw.cz> *
* *
*****************************************************************************/
@@ -40,20 +40,24 @@ typedef enum GP_SymbolType {
GP_SYM_MAX,
} GP_SymbolType;
+/* Symbol */
+
void GP_Symbol(GP_Context *context, GP_SymbolType sym,
GP_Coord x, GP_Coord y,
- GP_Size w, GP_Size h, GP_Pixel pixel);
+ GP_Size w, GP_Size h, GP_Pixel pixel);
+
+void GP_Symbol_Raw(GP_Context *context, GP_SymbolType sym,
+ GP_Coord x, GP_Coord y,
+ GP_Size w, GP_Size h, GP_Pixel pixel);
-void GP_TSymbol(GP_Context *context, GP_SymbolType sym,
- GP_Coord x, GP_Coord y,
- GP_Size w, GP_Size h, GP_Pixel pixel);
+/* Filled Symbol */
void GP_FillSymbol(GP_Context *context, GP_SymbolType sym,
GP_Coord x, GP_Coord y,
GP_Size w, GP_Size h, GP_Pixel pixel);
-void GP_TFillSymbol(GP_Context *context, GP_SymbolType sym,
- GP_Coord x, GP_Coord y,
- GP_Size w, GP_Size h, GP_Pixel pixel);
+void GP_FillSymbol_Raw(GP_Context *context, GP_SymbolType sym,
+ 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 687ed7e..c6307c3 100644
--- a/include/gfx/GP_Tetragon.h
+++ b/include/gfx/GP_Tetragon.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-2011 Jiri "BlueBear" Dluhos *
* <jiri.bluebear.dluhos(a)gmail.com> *
* *
- * Copyright (C) 2009-2010 Cyril Hrubis <metan(a)ucw.cz> *
+ * Copyright (C) 2009-2011 Cyril Hrubis <metan(a)ucw.cz> *
* *
*****************************************************************************/
@@ -28,20 +28,24 @@
#include "core/GP_Context.h"
+/* Tetragon */
+
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_Coord x3, GP_Coord y3, GP_Pixel pixel);
+
+void GP_Tetragon_Raw(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, 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);
+/* Filled Tetragon */
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, 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_Raw(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 7703a5f..2496d89 100644
--- a/include/gfx/GP_Triangle.h
+++ b/include/gfx/GP_Triangle.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-2011 Jiri "BlueBear" Dluhos *
* <jiri.bluebear.dluhos(a)gmail.com> *
* *
- * Copyright (C) 2009-2010 Cyril Hrubis <metan(a)ucw.cz> *
+ * Copyright (C) 2009-2011 Cyril Hrubis <metan(a)ucw.cz> *
* *
*****************************************************************************/
@@ -28,20 +28,24 @@
#include "core/GP_Context.h"
+/* Triangle */
+
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_Coord x2, GP_Coord y2, GP_Pixel pixel);
+
+void GP_Triangle_Raw(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, GP_Coord x0, GP_Coord y0,
- GP_Coord x1, GP_Coord y1,
- GP_Coord x2, GP_Coord y2, GP_Pixel pixel);
+/* Filled Triangle */
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, GP_Coord x0, GP_Coord y0,
- GP_Coord x1, GP_Coord y1,
- GP_Coord x2, GP_Coord y2, GP_Pixel pixel);
+void GP_FillTriangle_Raw(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 3cf6085..ea5a576 100644
--- a/include/gfx/GP_VLine.h
+++ b/include/gfx/GP_VLine.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-2011 Jiri "BlueBear" Dluhos *
* <jiri.bluebear.dluhos(a)gmail.com> *
* *
- * Copyright (C) 2009-2010 Cyril Hrubis <metan(a)ucw.cz> *
+ * Copyright (C) 2009-2011 Cyril Hrubis <metan(a)ucw.cz> *
* *
*****************************************************************************/
@@ -31,17 +31,26 @@
void GP_VLineXYY(GP_Context *context, GP_Coord x, GP_Coord y0,
GP_Coord y1, GP_Pixel pixel);
+void GP_VLineXYY_Raw(GP_Context *context, GP_Coord x, GP_Coord y0,
+ GP_Coord y1, 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, GP_Coord x, GP_Coord y0,
- GP_Coord y1, GP_Pixel pixel);
-
-void GP_TVLineXYH(GP_Context *context, GP_Coord x, GP_Coord y,
- GP_Size height, GP_Pixel pixel);
+void GP_VLineXYH_Raw(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
-#define GP_TVLine GP_TVLineXYY
+static inline void GP_VLine(GP_Context *context, GP_Coord x,
+ GP_Coord y0, GP_Coord y1, GP_Pixel pixel)
+{
+ GP_VLineXYY(context, x, y0, y1, pixel);
+}
+
+static inline void GP_VLine_Raw(GP_Context *context, GP_Coord x,
+ GP_Coord y0, GP_Coord y1, GP_Pixel pixel)
+{
+ GP_VLineXYY_Raw(context, x, y0, y1, pixel);
+}
#endif /* GP_VLINE_H */
diff --git a/include/text/GP_Text.h b/include/text/GP_Text.h
index e1144fa..2c0177e 100644
--- a/include/text/GP_Text.h
+++ b/include/text/GP_Text.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-2011 Jiri "BlueBear" Dluhos *
* <jiri.bluebear.dluhos(a)gmail.com> *
* *
- * Copyright (C) 2009-2010 Cyril Hrubis <metan(a)ucw.cz> *
+ * Copyright (C) 2009-2011 Cyril Hrubis <metan(a)ucw.cz> *
* *
*****************************************************************************/
@@ -54,18 +54,20 @@ typedef enum GP_TextAlign {
GP_VALIGN_BOTTOM = GP_VALIGN_BELOW,
} GP_TextAlign;
+GP_RetCode GP_Text_Raw(GP_Context *context, const GP_TextStyle *style,
+ GP_Coord x, GP_Coord y, int align,
+ const char *str, GP_Pixel pixel);
+
GP_RetCode GP_Text(GP_Context *context, const GP_TextStyle *style,
- int x, int y, int align, const char *str, GP_Pixel pixel);
+ GP_Coord x, GP_Coord y, int align,
+ const char *str, GP_Pixel pixel);
-GP_RetCode GP_TText(GP_Context *context, const GP_TextStyle *style,
- int x, int y, int align, const char *str, GP_Pixel pixel);
+GP_RetCode GP_BoxCenteredText_Raw(GP_Context *context, const GP_TextStyle *style,
+ GP_Coord x, GP_Coord y, GP_Size w, GP_Size h,
+ const char *str, GP_Pixel pixel);
GP_RetCode GP_BoxCenteredText(GP_Context *context, const GP_TextStyle *style,
- int x, int y, int w, int h, const char *str,
- GP_Pixel pixel);
-
-GP_RetCode GP_TBoxCenteredText(GP_Context *context, const GP_TextStyle *style,
- int x, int y, int w, int h, const char *str,
- GP_Pixel pixel);
+ GP_Coord x, GP_Coord y, GP_Size w, GP_Size h,
+ const char *str, GP_Pixel pixel);
#endif /* GP_TEXT_H */
diff --git a/libs/gfx/GP_Circle.c b/libs/gfx/GP_Circle.c
index 9af9f43..95e685f 100644
--- a/libs/gfx/GP_Circle.c
+++ b/libs/gfx/GP_Circle.c
@@ -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-2011 Jiri "BlueBear" Dluhos *
* <jiri.bluebear.dluhos(a)gmail.com> *
* *
- * Copyright (C) 2009-2010 Cyril Hrubis <metan(a)ucw.cz> *
+ * Copyright (C) 2009-2011 Cyril Hrubis <metan(a)ucw.cz> *
* *
*****************************************************************************/
@@ -30,71 +30,88 @@
#include "algo/Circle.algo.h"
/* Generate drawing functions for various bit depths. */
-GP_DEF_DRAW_FN_PER_BPP(GP_Circle, DEF_CIRCLE_FN)
+GP_DEF_DRAW_FN_PER_BPP(GP_Circle_Raw, DEF_CIRCLE_FN)
-void GP_Circle(GP_Context *context, GP_Coord xcenter, GP_Coord ycenter,
- GP_Size r, GP_Pixel pixel)
+void GP_Circle_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_Circle, context, context,
+ GP_FN_PER_BPP_CONTEXT(GP_Circle_Raw, context, context,
xcenter, ycenter, r, pixel);
}
-void GP_TCircle(GP_Context *context, GP_Coord xcenter, GP_Coord ycenter,
- GP_Size 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_TRANSFORM_POINT(context, xcenter, ycenter);
- GP_Circle(context, xcenter, ycenter, r, pixel);
+ 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, DEF_FILLCIRCLE_FN)
+GP_DEF_FILL_FN_PER_BPP(GP_FillCircle_Raw, DEF_FILLCIRCLE_FN)
-void GP_FillCircle(GP_Context *context, GP_Coord xcenter, GP_Coord ycenter,
- GP_Size r, GP_Pixel pixel)
+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, context, context,
+ GP_FN_PER_BPP_CONTEXT(GP_FillCircle_Raw, context, context,
xcenter, ycenter, r, pixel);
}
-void GP_TFillCircle(GP_Context *context, GP_Coord xcenter, GP_Coord ycenter,
- GP_Size 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_TRANSFORM_POINT(context, xcenter, ycenter);
- GP_FillCircle(context, xcenter, ycenter, r, pixel);
+ GP_FillCircle_Raw(context, xcenter, ycenter, r, pixel);
+}
+
+void GP_Ring_Raw(GP_Context *context, GP_Coord xcenter, GP_Coord ycenter,
+ GP_Size r1, GP_Size r2, GP_Pixel pixel)
+{
+ GP_Circle_Raw(context, xcenter, ycenter, r1, pixel);
+ GP_Circle_Raw(context, xcenter, ycenter, r2, pixel);
+}
+
+void GP_Ring(GP_Context *context, GP_Coord xcenter, GP_Coord ycenter,
+ GP_Size r1, GP_Size r2, GP_Pixel pixel)
+{
+ GP_CHECK_CONTEXT(context);
+
+ GP_TRANSFORM_POINT(context, xcenter, ycenter);
+
+ GP_Ring_Raw(context, xcenter, ycenter, r1, r2, pixel);
}
#include "algo/FillRing.algo.h"
/* Generate drawing functions for various bit depths. */
-GP_DEF_FILL_FN_PER_BPP(GP_FillRing, DEF_FILLRING_FN)
+GP_DEF_FILL_FN_PER_BPP(GP_FillRing_Raw, DEF_FILLRING_FN)
-void GP_FillRing(GP_Context *context, GP_Coord xcenter, GP_Coord ycenter,
- GP_Size r1, GP_Size r2, GP_Pixel pixel)
+void GP_FillRing_Raw(GP_Context *context, GP_Coord xcenter, GP_Coord ycenter,
+ GP_Size r1, GP_Size r2, GP_Pixel pixel)
{
GP_CHECK_CONTEXT(context);
- GP_FN_PER_BPP_CONTEXT(GP_FillRing, context, context,
+ GP_FN_PER_BPP_CONTEXT(GP_FillRing_Raw, context, context,
xcenter, ycenter, r1, r2, pixel);
}
-void GP_TFillRing(GP_Context *context, GP_Coord xcenter, GP_Coord ycenter,
- GP_Size r1, GP_Size r2, GP_Pixel pixel)
+void GP_FillRing(GP_Context *context, GP_Coord xcenter, GP_Coord ycenter,
+ GP_Size r1, GP_Size r2, GP_Pixel pixel)
{
GP_CHECK_CONTEXT(context);
GP_TRANSFORM_POINT(context, xcenter, ycenter);
- GP_FillRing(context, xcenter, ycenter, r1, r2, pixel);
+ GP_FillRing_Raw(context, xcenter, ycenter, r1, r2, pixel);
}
diff --git a/libs/gfx/GP_Ellipse.c b/libs/gfx/GP_Ellipse.c
index bbd3bdf..66f33e0 100644
--- a/libs/gfx/GP_Ellipse.c
+++ b/libs/gfx/GP_Ellipse.c
@@ -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-2011 Jiri "BlueBear" Dluhos *
* <jiri.bluebear.dluhos(a)gmail.com> *
* *
- * Copyright (C) 2009-2010 Cyril Hrubis <metan(a)ucw.cz> *
+ * Copyright (C) 2009-2011 Cyril Hrubis <metan(a)ucw.cz> *
* *
*****************************************************************************/
@@ -30,50 +30,50 @@
#include "algo/Ellipse.algo.h"
/* Generate drawing functions for various bit depths. */
-GP_DEF_DRAW_FN_PER_BPP(GP_Ellipse, DEF_ELLIPSE_FN)
+GP_DEF_DRAW_FN_PER_BPP(GP_Ellipse_Raw, DEF_ELLIPSE_FN)
-void GP_Ellipse(GP_Context *context, GP_Coord xcenter, GP_Coord ycenter,
- GP_Size a, GP_Size b, GP_Pixel pixel)
+void GP_Ellipse_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_Ellipse, context, context,
+ GP_FN_PER_BPP_CONTEXT(GP_Ellipse_Raw, context, context,
xcenter, ycenter, a, b, pixel);
}
-void GP_TEllipse(GP_Context *context, GP_Coord xcenter, GP_Coord ycenter,
- GP_Size a, GP_Size 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);
- /* recalculate center poGP_Coord and swap a and b when axes are swapped */
+ /* recalculate center point and swap a and b when axes are swapped */
GP_TRANSFORM_POINT(context, xcenter, ycenter);
GP_TRANSFORM_SWAP(context, a, b);
- GP_Ellipse(context, xcenter, ycenter, a, b, pixel);
+ 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, DEF_FILLELLIPSE_FN)
+GP_DEF_FILL_FN_PER_BPP(GP_FillEllipse_Raw, DEF_FILLELLIPSE_FN)
-void GP_FillEllipse(GP_Context *context, GP_Coord xcenter, GP_Coord ycenter,
- GP_Size a, GP_Size b, GP_Pixel pixel)
+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, context, context,
+ GP_FN_PER_BPP_CONTEXT(GP_FillEllipse_Raw, context, context,
xcenter, ycenter, a, b, pixel);
}
-void GP_TFillEllipse(GP_Context *context, GP_Coord xcenter, GP_Coord ycenter,
- GP_Size a, GP_Size 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_TRANSFORM_POINT(context, xcenter, ycenter);
GP_TRANSFORM_SWAP(context, a, b);
- GP_FillEllipse(context, xcenter, ycenter, a, b, pixel);
+ GP_FillEllipse_Raw(context, xcenter, ycenter, a, b, pixel);
}
diff --git a/libs/gfx/GP_Fill.c b/libs/gfx/GP_Fill.c
deleted file mode 100644
index c99df23..0000000
--- a/libs/gfx/GP_Fill.c
+++ /dev/null
@@ -1,38 +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> *
- * *
- *****************************************************************************/
-
-#ifndef GP_FILL_H
-#define GP_FILL_H
-
-#include "GP_Gfx.h"
-
-void GP_Fill(GP_Context *context, GP_Pixel pixel)
-{
- GP_CHECK_CONTEXT(context);
-
- GP_FillRect(context, 0, 0, context->w, context->h, pixel);
-}
-
-#endif /* GP_FILL_H */
diff --git a/libs/gfx/GP_HLine.c b/libs/gfx/GP_HLine.c
index 3d51cc4..9154b45 100644
--- a/libs/gfx/GP_HLine.c
+++ b/libs/gfx/GP_HLine.c
@@ -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-2011 Jiri "BlueBear" Dluhos *
* <jiri.bluebear.dluhos(a)gmail.com> *
* *
- * Copyright (C) 2009-2010 Cyril Hrubis <metan(a)ucw.cz> *
+ * Copyright (C) 2009-2011 Cyril Hrubis <metan(a)ucw.cz> *
* *
*****************************************************************************/
@@ -30,38 +30,39 @@
/* Generate drawing functions for various bit depths. */
//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_BU_FN(GP_HLine_Raw_1BPP_LE, GP_Context*, GP_Pixel, GP_PIXEL_ADDR, GP_WritePixels1bpp)
+DEF_HLINE_BU_FN(GP_HLine_Raw_1BPP_BE, GP_Context*, GP_Pixel, GP_PIXEL_ADDR, GP_WritePixels1bpp)
+DEF_HLINE_BU_FN(GP_HLine_Raw_2BPP_LE, GP_Context*, GP_Pixel, GP_PIXEL_ADDR, GP_WritePixels2bpp)
+DEF_HLINE_BU_FN(GP_HLine_Raw_2BPP_BE, GP_Context*, GP_Pixel, GP_PIXEL_ADDR, GP_WritePixels2bpp)
+DEF_HLINE_BU_FN(GP_HLine_Raw_4BPP_LE, GP_Context*, GP_Pixel, GP_PIXEL_ADDR, GP_WritePixels2bpp)
+DEF_HLINE_BU_FN(GP_HLine_Raw_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)
+DEF_HLINE_FN(GP_HLine_Raw_8BPP, GP_Context *, GP_Pixel, GP_PIXEL_ADDR, GP_WritePixels8bpp)
+DEF_HLINE_FN(GP_HLine_Raw_16BPP, GP_Context *, GP_Pixel, GP_PIXEL_ADDR, GP_WritePixels16bpp)
+DEF_HLINE_FN(GP_HLine_Raw_24BPP, GP_Context *, GP_Pixel, GP_PIXEL_ADDR, GP_WritePixels24bpp)
+DEF_HLINE_FN(GP_HLine_Raw_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)
+void GP_HLineXXY_Raw(GP_Context *context, GP_Coord x0, GP_Coord x1,
+ GP_Coord y, GP_Pixel pixel)
{
GP_CHECK_CONTEXT(context);
- GP_FN_PER_BPP_CONTEXT(GP_HLine, context, context, x0, x1, y, pixel);
+ GP_FN_PER_BPP_CONTEXT(GP_HLine_Raw, context, context, x0, x1, y,
+ pixel);
}
-void GP_HLineXYW(GP_Context *context, GP_Coord x, GP_Coord y, GP_Size w,
- GP_Pixel pixel)
+void GP_HLineXYW_Raw(GP_Context *context, GP_Coord x, GP_Coord y, GP_Size w,
+ GP_Pixel pixel)
{
/* zero width: do not draw anything */
if (w == 0)
return;
- GP_HLineXXY(context, x, x + w - 1, y, pixel);
+ GP_HLineXXY_Raw(context, x, x + w - 1, y, pixel);
}
-void GP_THLineXXY(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)
{
GP_CHECK_CONTEXT(context);
@@ -69,21 +70,21 @@ void GP_THLineXXY(GP_Context *context, GP_Coord x0, GP_Coord x1,
GP_TRANSFORM_Y(context, x0);
GP_TRANSFORM_Y(context, x1);
GP_TRANSFORM_X(context, y);
- GP_VLine(context, y, x0, x1, pixel);
+ GP_VLine_Raw(context, y, x0, x1, pixel);
} else {
GP_TRANSFORM_X(context, x0);
GP_TRANSFORM_X(context, x1);
GP_TRANSFORM_Y(context, y);
- GP_HLine(context, x0, x1, y, pixel);
+ GP_HLine_Raw(context, x0, x1, y, pixel);
}
}
-void GP_THLineXYW(GP_Context *context, GP_Coord x, GP_Coord y, GP_Size w,
- GP_Pixel pixel)
+void GP_HLineXYW(GP_Context *context, GP_Coord x, GP_Coord y, GP_Size w,
+ GP_Pixel pixel)
{
/* zero width: do not draw anything */
if (w == 0)
return;
- GP_THLineXXY(context, x, x + w - 1, y, pixel);
+ GP_HLineXXY(context, x, x + w - 1, y, pixel);
}
diff --git a/libs/gfx/GP_Line.c b/libs/gfx/GP_Line.c
index d5dda97..4236ee8 100644
--- a/libs/gfx/GP_Line.c
+++ b/libs/gfx/GP_Line.c
@@ -30,23 +30,24 @@
#include "algo/Line.algo.h"
/* Generate drawing functions for various bit depths. */
-GP_DEF_DRAW_FN_PER_BPP(GP_Line, DEF_LINE_FN)
+GP_DEF_DRAW_FN_PER_BPP(GP_Line_Raw, DEF_LINE_FN)
-void GP_Line(GP_Context *context, GP_Coord x0, GP_Coord y0,
- GP_Coord x1, GP_Coord y1, GP_Pixel pixel)
+void GP_Line_Raw(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_CONTEXT(GP_Line, context, context, x0, y0, x1, y1, pixel);
+ GP_FN_PER_BPP_CONTEXT(GP_Line_Raw, context, context, x0, y0, x1, y1,
+ pixel);
}
-void GP_TLine(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)
{
GP_CHECK_CONTEXT(context);
GP_TRANSFORM_POINT(context, x0, y0);
GP_TRANSFORM_POINT(context, x1, y1);
- GP_Line(context, x0, y0, x1, y1, pixel);
+ GP_Line_Raw(context, x0, y0, x1, y1, pixel);
}
diff --git a/libs/gfx/GP_Polygon.c b/libs/gfx/GP_Polygon.c
index 1bf5dc7..cef18c0 100644
--- a/libs/gfx/GP_Polygon.c
+++ b/libs/gfx/GP_Polygon.c
@@ -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-2011 Jiri "BlueBear" Dluhos *
* <jiri.bluebear.dluhos(a)gmail.com> *
* *
- * Copyright (C) 2009-2010 Cyril Hrubis <metan(a)ucw.cz> *
+ * Copyright (C) 2009-2011 Cyril Hrubis <metan(a)ucw.cz> *
* *
*****************************************************************************/
@@ -79,7 +79,7 @@ static void GP_AddEdge(struct GP_Polygon *poly, GP_Coord x1, GP_Coord y1,
poly->ymax = GP_MAX(poly->ymax, edge->endy);
}
-static GP_Coord GP_CompareEdges(const void *edge1, const void *edge2)
+static int GP_CompareEdges(const void *edge1, const void *edge2)
{
struct GP_PolygonEdge *e1 = (struct GP_PolygonEdge *) edge1;
struct GP_PolygonEdge *e2 = (struct GP_PolygonEdge *) edge2;
@@ -153,8 +153,8 @@ static inline GP_Coord GP_FindIntersection(GP_Coord y, const struct GP_PolygonEd
return x;
}
-void GP_FillPolygon(GP_Context *context, GP_Coord vertex_count, const GP_Coord *xy,
- GP_Pixel pixel)
+void GP_FillPolygon_Raw(GP_Context *context, GP_Coord vertex_count,
+ const GP_Coord *xy, GP_Pixel pixel)
{
struct GP_Polygon poly = GP_POLYGON_INITIALIZER;
@@ -187,7 +187,7 @@ void GP_FillPolygon(GP_Context *context, GP_Coord vertex_count, const GP_Coord *
}
}
- GP_HLine(context, startx, endx, y, pixel);
+ GP_HLine_Raw(context, startx, endx, y, pixel);
startx_prev = startx;
endx_prev = endx;
diff --git a/libs/gfx/GP_Rect.c b/libs/gfx/GP_Rect.c
index 9f1fabe..eee96f5 100644
--- a/libs/gfx/GP_Rect.c
+++ b/libs/gfx/GP_Rect.c
@@ -16,56 +16,52 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, *
* Boston, MA 02110-1301 USA *
* *
- * Copyright (C) 2009-2010 Jiri "BlueBear" Dluhos *
+ * Copyright (C) 2009-2011 Jiri "BlueBear" Dluhos *
* <jiri.bluebear.dluhos(a)gmail.com> *
* *
- * Copyright (C) 2009-2010 Cyril Hrubis <metan(a)ucw.cz> *
+ * Copyright (C) 2009-2011 Cyril Hrubis <metan(a)ucw.cz> *
* *
*****************************************************************************/
#include "GP_Gfx.h"
-void GP_RectXYXY(GP_Context *context, GP_Coord x0, GP_Coord y0,
- GP_Coord x1, GP_Coord y1, GP_Pixel pixel)
+void GP_RectXYXY_Raw(GP_Context *context, GP_Coord x0, GP_Coord y0,
+ GP_Coord x1, GP_Coord y1, GP_Pixel pixel)
{
- GP_CHECK_CONTEXT(context);
-
- GP_HLine(context, x0, x1, y0, pixel);
- GP_HLine(context, x0, x1, y1, pixel);
- GP_VLine(context, x0, y0, y1, pixel);
- GP_VLine(context, x1, y0, y1, pixel);
+ GP_HLine_Raw(context, x0, x1, y0, pixel);
+ GP_HLine_Raw(context, x0, x1, y1, pixel);
+ GP_VLine_Raw(context, x0, y0, y1, pixel);
+ GP_VLine_Raw(context, x1, y0, y1, pixel);
}
-void GP_RectXYWH(GP_Context *context, GP_Coord x, GP_Coord y,
- GP_Size w, GP_Size h, GP_Pixel pixel)
+void GP_RectXYWH_Raw(GP_Context *context, GP_Coord x, GP_Coord y,
+ GP_Size w, GP_Size h, GP_Pixel pixel)
{
- GP_CHECK_CONTEXT(context);
-
- GP_HLine(context, x, x + w, y, pixel);
- GP_HLine(context, x, x + w, y + h, pixel);
- GP_VLine(context, x, y, y + h, pixel);
- GP_VLine(context, x + w, y, y + h, pixel);
+ GP_HLine_Raw(context, x, x + w, y, pixel);
+ GP_HLine_Raw(context, x, x + w, y + h, pixel);
+ GP_VLine_Raw(context, x, y, y + h, pixel);
+ GP_VLine_Raw(context, x + w, y, y + h, pixel);
}
-void GP_TRectXYXY(GP_Context *context, GP_Coord x0, GP_Coord y0,
- GP_Coord x1, GP_Coord 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);
GP_TRANSFORM_POINT(context, x0, y0);
GP_TRANSFORM_POINT(context, x1, y1);
- GP_RectXYXY(context, x0, y0, x1, y1, pixel);
+ GP_RectXYXY_Raw(context, x0, y0, x1, y1, pixel);
}
-void GP_TRectXYWH(GP_Context *context, GP_Coord x, GP_Coord y,
- GP_Size w, GP_Size 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_TRectXYXY(context, x, y, x + w, y + h, pixel);
+ GP_RectXYXY(context, x, y, x + w, y + h, pixel);
}
-void GP_FillRectXYXY(GP_Context *context, GP_Coord x0, GP_Coord y0,
- GP_Coord x1, GP_Coord y1, GP_Pixel pixel)
+void GP_FillRectXYXY_Raw(GP_Context *context, GP_Coord x0, GP_Coord y0,
+ GP_Coord x1, GP_Coord y1, GP_Pixel pixel)
{
GP_CHECK_CONTEXT(context);
@@ -74,36 +70,36 @@ void GP_FillRectXYXY(GP_Context *context, GP_Coord x0, GP_Coord y0,
GP_Coord y;
for (y = y0; y <= y1; y++)
- GP_HLine(context, x0, x1, y, pixel);
+ GP_HLine_Raw(context, x0, x1, y, pixel);
}
-void GP_FillRectXYWH(GP_Context *context, GP_Coord x, GP_Coord y,
- GP_Size w, GP_Size h, GP_Pixel pixel)
+void GP_FillRectXYWH_Raw(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)
return;
- return GP_FillRectXYXY(context, x, y, x + w - 1, y + h - 1, pixel);
+ GP_FillRectXYXY_Raw(context, x, y, x + w - 1, y + h - 1, pixel);
}
-void GP_TFillRectXYXY(GP_Context *context, GP_Coord x0, GP_Coord y0,
- GP_Coord x1, GP_Coord 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);
GP_TRANSFORM_POINT(context, x0, y0);
GP_TRANSFORM_POINT(context, x1, y1);
- GP_FillRect(context, x0, y0, x1, y1, pixel);
+ GP_FillRect_Raw(context, x0, y0, x1, y1, pixel);
}
-void GP_TFillRectXYWH(GP_Context *context, GP_Coord x, GP_Coord y,
- GP_Size w, GP_Size 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)
return;
- GP_TFillRectXYXY(context, x, y, x + w - 1, y + h - 1, pixel);
+ GP_FillRectXYXY(context, x, y, x + w - 1, y + h - 1, pixel);
}
diff --git a/libs/gfx/GP_Symbol.c b/libs/gfx/GP_Symbol.c
index 7a7b44e..fcf61c7 100644
--- a/libs/gfx/GP_Symbol.c
+++ b/libs/gfx/GP_Symbol.c
@@ -68,83 +68,94 @@
fn_pref##Triangle(context, TRIANGLE_PARAMS(x, y, w, h), pixel); } while (0)
-void GP_Symbol(GP_Context *context, GP_SymbolType sym,
- GP_Coord x, GP_Coord y, GP_Size w, GP_Size h, GP_Pixel pixel)
+#define TRIANGLE_RAW(context, base, x, y, w, h, fn_pref, + TRIANGLE_PARAMS, TETRAGON_PARAMS, pixel) do { + if (base % 2) + fn_pref##Tetragon_Raw(context, TETRAGON_PARAMS(x, y, w, h), pixel);+ else + fn_pref##Triangle_Raw(context, TRIANGLE_PARAMS(x, y, w, h), pixel);+} while (0)
+
+void GP_Symbol_Raw(GP_Context *context, GP_SymbolType sym,
+ GP_Coord x, GP_Coord y, GP_Size w, GP_Size h,
+ GP_Pixel pixel)
{
DO_DECREMENT(w);
DO_DECREMENT(h);
switch (sym) {
case GP_SYM_TRIANGLE_UP:
- TRIANGLE(context, w, x, y, w, h, GP_,
- DO_TRIANGLE_UP, DO_TETRAGON_UP, pixel);
+ TRIANGLE_RAW(context, w, x, y, w, h, GP_,
+ DO_TRIANGLE_UP, DO_TETRAGON_UP, pixel);
break;
case GP_SYM_TRIANGLE_DOWN:
- TRIANGLE(context, w, x, y, w, h, GP_,
- DO_TRIANGLE_DOWN, DO_TETRAGON_DOWN, pixel);
+ TRIANGLE_RAW(context, w, x, y, w, h, GP_,
+ DO_TRIANGLE_DOWN, DO_TETRAGON_DOWN, pixel);
break;
case GP_SYM_TRIANGLE_LEFT:
- TRIANGLE(context, h, x, y, w, h, GP_,
- DO_TRIANGLE_LEFT, DO_TETRAGON_LEFT, pixel);
+ TRIANGLE_RAW(context, h, x, y, w, h, GP_,
+ DO_TRIANGLE_LEFT, DO_TETRAGON_LEFT, pixel);
break;
case GP_SYM_TRIANGLE_RIGHT:
- TRIANGLE(context, h, x, y, w, h, GP_,
- DO_TRIANGLE_RIGHT, DO_TETRAGON_RIGHT, pixel);
+ TRIANGLE_RAW(context, h, x, y, w, h, GP_,
+ DO_TRIANGLE_RIGHT, DO_TETRAGON_RIGHT, pixel);
break;
default:
break;
}
}
-void GP_FillSymbol(GP_Context *context, GP_SymbolType sym,
- GP_Coord x, GP_Coord y, GP_Size w, GP_Size h, GP_Pixel pixel)
+void GP_FillSymbol_Raw(GP_Context *context, GP_SymbolType sym,
+ GP_Coord x, GP_Coord y, GP_Size w, GP_Size h,
+ GP_Pixel pixel)
{
DO_DECREMENT(w);
DO_DECREMENT(h);
switch (sym) {
case GP_SYM_TRIANGLE_UP:
- TRIANGLE(context, w, x, y, w, h, GP_Fill,
- DO_TRIANGLE_UP, DO_TETRAGON_UP, pixel);
+ TRIANGLE_RAW(context, w, x, y, w, h, GP_Fill,
+ DO_TRIANGLE_UP, DO_TETRAGON_UP, pixel);
break;
case GP_SYM_TRIANGLE_DOWN:
- TRIANGLE(context, w, x, y, w, h, GP_Fill,
- DO_TRIANGLE_DOWN, DO_TETRAGON_DOWN, pixel);
+ TRIANGLE_RAW(context, w, x, y, w, h, GP_Fill,
+ DO_TRIANGLE_DOWN, DO_TETRAGON_DOWN, pixel);
break;
case GP_SYM_TRIANGLE_LEFT:
- TRIANGLE(context, h, x, y, w, h, GP_Fill,
- DO_TRIANGLE_LEFT, DO_TETRAGON_LEFT, pixel);
+ TRIANGLE_RAW(context, h, x, y, w, h, GP_Fill,
+ DO_TRIANGLE_LEFT, DO_TETRAGON_LEFT, pixel);
break;
case GP_SYM_TRIANGLE_RIGHT:
- TRIANGLE(context, h, x, y, w, h, GP_Fill,
- DO_TRIANGLE_RIGHT, DO_TETRAGON_RIGHT, pixel);
+ TRIANGLE_RAW(context, h, x, y, w, h, GP_Fill,
+ DO_TRIANGLE_RIGHT, DO_TETRAGON_RIGHT, pixel);
break;
default:
break;
}
}
-void GP_TSymbol(GP_Context *context, GP_SymbolType sym,
- GP_Coord x, GP_Coord y, GP_Size w, GP_Size h, GP_Pixel pixel)
+void GP_Symbol(GP_Context *context, GP_SymbolType sym,
+ GP_Coord x, GP_Coord y, GP_Size w, GP_Size h,
+ GP_Pixel pixel)
{
DO_DECREMENT(w);
DO_DECREMENT(h);
switch (sym) {
case GP_SYM_TRIANGLE_UP:
- TRIANGLE(context, w, x, y, w, h, GP_T,
+ TRIANGLE(context, w, x, y, w, h, GP_,
DO_TRIANGLE_UP, DO_TETRAGON_UP, pixel);
break;
case GP_SYM_TRIANGLE_DOWN:
- TRIANGLE(context, w, x, y, w, h, GP_T,
+ TRIANGLE(context, w, x, y, w, h, GP_,
DO_TRIANGLE_DOWN, DO_TETRAGON_DOWN, pixel);
break;
case GP_SYM_TRIANGLE_LEFT:
- TRIANGLE(context, h, x, y, w, h, GP_T,
+ TRIANGLE(context, h, x, y, w, h, GP_,
DO_TRIANGLE_LEFT, DO_TETRAGON_LEFT, pixel);
break;
case GP_SYM_TRIANGLE_RIGHT:
- TRIANGLE(context, h, x, y, w, h, GP_T,
+ TRIANGLE(context, h, x, y, w, h, GP_,
DO_TRIANGLE_RIGHT, DO_TETRAGON_RIGHT, pixel);
break;
default:
@@ -152,28 +163,28 @@ void GP_TSymbol(GP_Context *context, GP_SymbolType sym,
}
}
-void GP_TFillSymbol(GP_Context *context, GP_SymbolType sym,
- GP_Coord x, GP_Coord y,
- GP_Size w, GP_Size h, GP_Pixel pixel)
+void GP_FillSymbol(GP_Context *context, GP_SymbolType sym,
+ GP_Coord x, GP_Coord y,
+ GP_Size w, GP_Size h, GP_Pixel pixel)
{
DO_DECREMENT(w);
DO_DECREMENT(h);
switch (sym) {
case GP_SYM_TRIANGLE_UP:
- TRIANGLE(context, w, x, y, w, h, GP_TFill,
+ TRIANGLE(context, w, x, y, w, h, GP_Fill,
DO_TRIANGLE_UP, DO_TETRAGON_UP, pixel);
break;
case GP_SYM_TRIANGLE_DOWN:
- TRIANGLE(context, w, x, y, w, h, GP_TFill,
+ TRIANGLE(context, w, x, y, w, h, GP_Fill,
DO_TRIANGLE_DOWN, DO_TETRAGON_DOWN, pixel);
break;
case GP_SYM_TRIANGLE_LEFT:
- TRIANGLE(context, h, x, y, w, h, GP_TFill,
+ TRIANGLE(context, h, x, y, w, h, GP_Fill,
DO_TRIANGLE_LEFT, DO_TETRAGON_LEFT, pixel);
break;
case GP_SYM_TRIANGLE_RIGHT:
- TRIANGLE(context, h, x, y, w, h, GP_TFill,
+ TRIANGLE(context, h, x, y, w, h, GP_Fill,
DO_TRIANGLE_RIGHT, DO_TETRAGON_RIGHT, pixel);
break;
default:
diff --git a/libs/gfx/GP_Tetragon.c b/libs/gfx/GP_Tetragon.c
index f5f924a..8e31801 100644
--- a/libs/gfx/GP_Tetragon.c
+++ b/libs/gfx/GP_Tetragon.c
@@ -16,30 +16,30 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, *
* Boston, MA 02110-1301 USA *
* *
- * Copyright (C) 2009-2010 Jiri "BlueBear" Dluhos *
+ * Copyright (C) 2009-2011 Jiri "BlueBear" Dluhos *
* <jiri.bluebear.dluhos(a)gmail.com> *
* *
- * Copyright (C) 2009-2010 Cyril Hrubis <metan(a)ucw.cz> *
+ * Copyright (C) 2009-2011 Cyril Hrubis <metan(a)ucw.cz> *
* *
*****************************************************************************/
#include "GP_Gfx.h"
-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_Tetragon_Raw(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);
- GP_Line(context, x0, y0, x1, y1, pixel);
- GP_Line(context, x1, y1, x2, y2, pixel);
- GP_Line(context, x2, y2, x3, y3, pixel);
- GP_Line(context, x3, y3, x0, y0, pixel);
+ GP_Line_Raw(context, x0, y0, x1, y1, pixel);
+ GP_Line_Raw(context, x1, y1, x2, y2, pixel);
+ GP_Line_Raw(context, x2, y2, x3, y3, pixel);
+ GP_Line_Raw(context, x3, y3, x0, y0, 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_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);
@@ -48,22 +48,21 @@ void GP_TTetragon(GP_Context *context, GP_Coord x0, GP_Coord y0,
GP_TRANSFORM_POINT(context, x2, y2);
GP_TRANSFORM_POINT(context, x3, y3);
- GP_Tetragon(context, x0, y0, x1, y1, x2, y2, x3, y3, pixel);
+ GP_Tetragon_Raw(context, x0, y0, x1, y1, x2, y2, x3, y3, 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_FillTetragon_Raw(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);
-
- const GP_Coord xy[8] = { x0, y0, x1, y1, x2, y2, x3, y3 };
- GP_FillPolygon(context, 4, xy, pixel);
+ const GP_Coord xy[8] = {x0, y0, x1, y1, x2, y2, x3, y3};
+
+ GP_FillPolygon_Raw(context, 4, xy, 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)
+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);
@@ -72,6 +71,7 @@ void GP_TFillTetragon(GP_Context* context, GP_Coord x0, GP_Coord y0,
GP_TRANSFORM_POINT(context, x2, y2);
GP_TRANSFORM_POINT(context, x3, y3);
- const GP_Coord xy[8] = { x0, y0, x1, y1, x2, y2, x3, y3 };
- GP_FillPolygon(context, 4, xy, pixel);
+ const GP_Coord xy[8] = {x0, y0, x1, y1, x2, y2, x3, y3};
+
+ GP_FillPolygon_Raw(context, 4, xy, pixel);
}
diff --git a/libs/gfx/GP_Triangle.c b/libs/gfx/GP_Triangle.c
index 10725ec..863c9b0 100644
--- a/libs/gfx/GP_Triangle.c
+++ b/libs/gfx/GP_Triangle.c
@@ -16,29 +16,27 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, *
* Boston, MA 02110-1301 USA *
* *
- * Copyright (C) 2009-2010 Jiri "BlueBear" Dluhos *
+ * Copyright (C) 2009-2011 Jiri "BlueBear" Dluhos *
* <jiri.bluebear.dluhos(a)gmail.com> *
* *
- * Copyright (C) 2009-2010 Cyril Hrubis <metan(a)ucw.cz> *
+ * Copyright (C) 2009-2011 Cyril Hrubis <metan(a)ucw.cz> *
* *
*****************************************************************************/
#include "GP_Gfx.h"
-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_Triangle_Raw(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);
-
- GP_Line(context, x0, y0, x1, y1, pixel);
- GP_Line(context, x0, y0, x2, y2, pixel);
- GP_Line(context, x1, y1, x2, y2, pixel);
+ GP_Line_Raw(context, x0, y0, x1, y1, pixel);
+ GP_Line_Raw(context, x0, y0, x2, y2, pixel);
+ GP_Line_Raw(context, x1, y1, x2, y2, 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_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);
@@ -46,29 +44,27 @@ void GP_TTriangle(GP_Context *context, GP_Coord x0, GP_Coord y0,
GP_TRANSFORM_POINT(context, x1, y1);
GP_TRANSFORM_POINT(context, x2, y2);
- GP_Triangle(context, x0, y0, x1, y1, x2, y2, pixel);
+ GP_Triangle_Raw(context, x0, y0, x1, y1, x2, y2, 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_FillTriangle_Raw(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);
+ const GP_Coord 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);
+ GP_FillPolygon_Raw(context, 3, coords, 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)
+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);
-
+
GP_TRANSFORM_POINT(context, x0, y0);
GP_TRANSFORM_POINT(context, x1, y1);
GP_TRANSFORM_POINT(context, x2, y2);
-
- const GP_Coord coords[6] = { x0, y0, x1, y1, x2, y2 };
- GP_FillPolygon(context, 3, coords, pixel);
+
+ GP_FillTriangle_Raw(context, x0, y0, x1, y1, x2, y2, pixel);
}
diff --git a/libs/gfx/GP_VLine.c b/libs/gfx/GP_VLine.c
index 91d26da..4fdb319 100644
--- a/libs/gfx/GP_VLine.c
+++ b/libs/gfx/GP_VLine.c
@@ -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-2011 Jiri "BlueBear" Dluhos *
* <jiri.bluebear.dluhos(a)gmail.com> *
* *
- * Copyright (C) 2009-2010 Cyril Hrubis <metan(a)ucw.cz> *
+ * Copyright (C) 2009-2011 Cyril Hrubis <metan(a)ucw.cz> *
* *
*****************************************************************************/
@@ -32,16 +32,16 @@
/* Generate drawing functions for various bit depths. */
GP_DEF_DRAW_FN_PER_BPP(GP_VLine, DEF_VLINE_FN)
-void GP_VLineXYY(GP_Context *context, GP_Coord x, GP_Coord y0,
- GP_Coord y1, GP_Pixel pixel)
+void GP_VLineXYY_Raw(GP_Context *context, GP_Coord x, GP_Coord y0,
+ GP_Coord y1, GP_Pixel pixel)
{
GP_CHECK_CONTEXT(context);
GP_FN_PER_BPP_CONTEXT(GP_VLine, context, context, x, y0, y1, pixel);
}
-void GP_VLineXYH(GP_Context *context, GP_Coord x, GP_Coord y,
- GP_Size height, GP_Pixel pixel)
+void GP_VLineXYH_Raw(GP_Context *context, GP_Coord x, GP_Coord y,
+ GP_Size height, GP_Pixel pixel)
{
/* zero height: do not draw anything */
if (height == 0)
@@ -50,7 +50,7 @@ void GP_VLineXYH(GP_Context *context, GP_Coord x, GP_Coord y,
GP_VLineXYY(context, x, y, y + height - 1, pixel);
}
-void GP_TVLineXYY(GP_Context *context, GP_Coord x, GP_Coord y0,
+void GP_VLineXYY(GP_Context *context, GP_Coord x, GP_Coord y0,
GP_Coord y1, GP_Pixel pixel)
{
GP_CHECK_CONTEXT(context);
@@ -59,21 +59,21 @@ void GP_TVLineXYY(GP_Context *context, GP_Coord x, GP_Coord y0,
GP_TRANSFORM_Y(context, x);
GP_TRANSFORM_X(context, y0);
GP_TRANSFORM_X(context, y1);
- GP_HLine(context, y0, y1, x, pixel);
+ GP_HLine_Raw(context, y0, y1, x, pixel);
} else {
GP_TRANSFORM_X(context, x);
GP_TRANSFORM_Y(context, y0);
GP_TRANSFORM_Y(context, y1);
- GP_VLine(context, x, y0, y1, pixel);
+ GP_VLine_Raw(context, x, y0, y1, pixel);
}
}
-void GP_TVLineXYH(GP_Context *context, GP_Coord x, GP_Coord y,
+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)
return;
- GP_TVLineXYY(context, x, y, y + height - 1, pixel);
+ GP_VLineXYY(context, x, y, y + height - 1, pixel);
}
diff --git a/libs/text/GP_Text.c b/libs/text/GP_Text.c
index 4ffae23..43bf6ed 100644
--- a/libs/text/GP_Text.c
+++ b/libs/text/GP_Text.c
@@ -16,7 +16,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, *
* Boston, MA 02110-1301 USA *
* *
- * Copyright (C) 2009-2010 Jiri "BlueBear" Dluhos *
+ * Copyright (C) 2009-2011 Jiri "BlueBear" Dluhos *
* <jiri.bluebear.dluhos(a)gmail.com> *
* *
* Copyright (C) 2009-2011 Cyril Hrubis <metan(a)ucw.cz> *
@@ -32,12 +32,11 @@
static GP_TextStyle DefaultStyle = GP_DEFAULT_TEXT_STYLE;
/* Generate drawing functions for various bit depths. */
-GP_DEF_FILL_FN_PER_BPP(GP_Text, DEF_TEXT_FN)
+GP_DEF_FILL_FN_PER_BPP(GP_Text_Raw, DEF_TEXT_FN)
-DEF_TEXT_FN(GP_TText_internal, GP_Context *, GP_Pixel, GP_THLine)
-
-GP_RetCode GP_Text(GP_Context *context, const GP_TextStyle *style,
- int x, int y, int align, const char *str, GP_Pixel pixel)
+GP_RetCode GP_Text_Raw(GP_Context *context, const GP_TextStyle *style,
+ GP_Coord x, GP_Coord y, int align,
+ const char *str, GP_Pixel pixel)
{
GP_CHECK_CONTEXT(context);
GP_CHECK_TEXT_STYLE(style);
@@ -45,7 +44,6 @@ GP_RetCode GP_Text(GP_Context *context, const GP_TextStyle *style,
if (str == NULL)
return GP_ENULLPTR;
-
if (style == NULL)
style = &DefaultStyle;
@@ -83,14 +81,17 @@ GP_RetCode GP_Text(GP_Context *context, const GP_TextStyle *style,
return GP_EINVAL;
}
- GP_FN_PER_BPP_CONTEXT(GP_Text, context, context,
- style, topleft_x, topleft_y, str, pixel);
+ GP_FN_PER_BPP_CONTEXT(GP_Text_Raw, context, context, style,
+ topleft_x, topleft_y, str, pixel);
return GP_ESUCCESS;
}
-GP_RetCode GP_TText(GP_Context *context, const GP_TextStyle *style,
- int x, int y, int align, const char *str, GP_Pixel pixel)
+DEF_TEXT_FN(GP_Text_internal, GP_Context *, GP_Pixel, GP_HLine)
+
+GP_RetCode GP_Text(GP_Context *context, const GP_TextStyle *style,
+ GP_Coord x, GP_Coord y, int align,
+ const char *str, GP_Pixel pixel)
{
GP_CHECK_CONTEXT(context);
GP_CHECK_TEXT_STYLE(style);
@@ -135,12 +136,13 @@ GP_RetCode GP_TText(GP_Context *context, const GP_TextStyle *style,
return GP_EINVAL;
}
- GP_TText_internal(context, style, topleft_x, topleft_y, str, pixel);
+ GP_Text_internal(context, style, topleft_x, topleft_y, str, pixel);
return GP_ESUCCESS;
}
-GP_RetCode GP_BoxCenteredText(GP_Context *context, const GP_TextStyle *style,
- int x, int y, int w, int h, const char *str, GP_Pixel pixel)
+GP_RetCode GP_BoxCenteredText_Raw(GP_Context *context, const GP_TextStyle *style,
+ GP_Coord x, GP_Coord y, GP_Size w, GP_Size h,
+ const char *str, GP_Pixel pixel)
{
GP_CHECK_CONTEXT(context);
GP_CHECK_TEXT_STYLE(style);
@@ -155,14 +157,15 @@ GP_RetCode GP_BoxCenteredText(GP_Context *context, const GP_TextStyle *style,
const int mid_y = y + h/2;
const int font_ascent = GP_TextAscent(style);
- return GP_Text(context, style, mid_x,
+ return GP_Text_Raw(context, style, mid_x,
mid_y + font_ascent/2,
GP_ALIGN_CENTER | GP_VALIGN_BASELINE,
str, pixel);
}
-GP_RetCode GP_TBoxCenteredText(GP_Context *context, const GP_TextStyle *style,
- int x, int y, int w, int h, const char *str, GP_Pixel pixel)
+GP_RetCode GP_BoxCenteredText(GP_Context *context, const GP_TextStyle *style,
+ GP_Coord x, GP_Coord y, GP_Size w, GP_Size h,
+ const char *str, GP_Pixel pixel)
{
GP_CHECK_CONTEXT(context);
GP_CHECK_TEXT_STYLE(style);
@@ -177,7 +180,7 @@ GP_RetCode GP_TBoxCenteredText(GP_Context *context, const GP_TextStyle *style,
const int mid_y = y + h/2;
const int font_ascent = GP_TextAscent(style);
- return GP_TText(context, style, mid_x,
+ return GP_Text(context, style, mid_x,
mid_y + font_ascent/2,
GP_ALIGN_CENTER | GP_VALIGN_BASELINE,
str, pixel);
diff --git a/tests/SDL/fileview.c b/tests/SDL/fileview.c
index 4bbe940..d4ceeda 100644
--- a/tests/SDL/fileview.c
+++ b/tests/SDL/fileview.c
@@ -180,12 +180,13 @@ void event_loop(void)
static int read_file_head(const char *filename)
{
FILE *f = fopen(filename, "r");
+ char buf[512];
+
if (f == NULL) {
fprintf(stderr, "Could not open file: %sn", filename);
return 0;
}
- char buf[512];
for (;;) {
if (fgets(buf, 511, f) == NULL)
diff --git a/tests/SDL/pixeltest.c b/tests/SDL/pixeltest.c
index 467a17b..7102074 100644
--- a/tests/SDL/pixeltest.c
+++ b/tests/SDL/pixeltest.c
@@ -89,9 +89,8 @@ void draw_pixels(void)
/* Draw some pixels (exact number is not important). */
int i;
- for (i = 0; i < 30; i++) {
+ for (i = 0; i < 30; i++)
draw_pixel();
- }
SDL_UnlockSurface(display);
}
@@ -101,15 +100,14 @@ void event_loop(void)
SDL_Event event;
while (SDL_WaitEvent(&event) > 0) {
-
switch (event.type) {
- case SDL_USEREVENT:
- draw_pixels();
- SDL_Flip(display);
- break;
- case SDL_KEYDOWN:
- case SDL_QUIT:
- return;
+ case SDL_USEREVENT:
+ draw_pixels();
+ SDL_Flip(display);
+ break;
+ case SDL_KEYDOWN:
+ case SDL_QUIT:
+ return;
}
}
}
@@ -122,8 +120,7 @@ int main(int argc, char **argv)
for (i = 1; i < argc; i++) {
if (strcmp(argv[i], "-16") == 0) {
display_bpp = 16;
- }
- else if (strcmp(argv[i], "-24") == 0) {
+ } else if (strcmp(argv[i], "-24") == 0) {
display_bpp = 24;
}
}
diff --git a/tests/SDL/shapetest.c b/tests/SDL/shapetest.c
index 1f6e44a..57cca2d 100644
--- a/tests/SDL/shapetest.c
+++ b/tests/SDL/shapetest.c
@@ -49,7 +49,7 @@ Uint32 timer_callback(__attribute__((unused)) Uint32 interval,
}
/* Basic colors in display-specific format. */
-GP_Pixel black, white, yellow, green, red, gray, darkgray;
+static GP_Pixel black, white, yellow, green, red, gray, darkgray;
/* Radius of the shape being drawn */
static int xradius = 5;
@@ -71,7 +71,8 @@ static int show_axes = 1;
#define SHAPE_RING 3
#define SHAPE_ELLIPSE 4
#define SHAPE_RECTANGLE 5
-#define SHAPE_LAST 5
+#define SHAPE_TETRAGON 6
+#define SHAPE_LAST 6
static int shape = SHAPE_FIRST;
/* Variants in coordinates, if applicable */
@@ -81,12 +82,15 @@ static int variant = 1;
static int xradius_add = 0;
static int yradius_add = 0;
-/* center of drawing */
-static int center_x = 320;
-static int center_y = 240;
+#define DISPLAY_W 640
+#define DISPLAY_H 480
+
+static int display_w = DISPLAY_W;
+static int display_h = DISPLAY_H;
-static int display_w = 640;
-static int display_h = 480;
+/* center of drawing */
+static int center_x = DISPLAY_W/2;
+static int center_y = DISPLAY_H/2;
void draw_testing_triangle(int x, int y, int xradius, int yradius)
{
@@ -130,68 +134,88 @@ void draw_testing_triangle(int x, int y, int xradius, int yradius)
/* draw the three vertices green; they should never be visible
* because the red triangle should cover them; if they are visible,
* it means we don't draw to the end */
- GP_TPutPixel(&context, x0, y0, green);
- GP_TPutPixel(&context, x1, y1, green);
- GP_TPutPixel(&context, x2, y2, green);
+ GP_PutPixel(&context, x0, y0, green);
+ GP_PutPixel(&context, x1, y1, green);
+ GP_PutPixel(&context, x2, y2, green);
if (outline == 1)
- GP_TTriangle(&context, x0, y0, x1, y1, x2, y2, yellow);
+ GP_Triangle(&context, x0, y0, x1, y1, x2, y2, yellow);
if (fill)
- GP_TFillTriangle(&context, x0, y0, x1, y1, x2, y2, red);
+ GP_FillTriangle(&context, x0, y0, x1, y1, x2, y2, red);
if (outline == 2)
- GP_TTriangle(&context, x0, y0, x1, y1, x2, y2, white);
+ GP_Triangle(&context, x0, y0, x1, y1, x2, y2, white);
}
void draw_testing_circle(int x, int y, int xradius,
__attribute__((unused)) int yradius)
{
if (outline == 1)
- GP_TCircle(&context, x, y, xradius, yellow);
+ GP_Circle(&context, x, y, xradius, yellow);
if (fill)
- GP_TFillCircle(&context, x, y, xradius, red);
+ GP_FillCircle(&context, x, y, xradius, red);
if (outline == 2)
- GP_TCircle(&context, x, y, xradius, white);
+ GP_Circle(&context, x, y, xradius, white);
}
void draw_testing_ring(int x, int y, int xradius,
__attribute__((unused)) int yradius)
{
if (outline == 1)
- GP_TCircle(&context, x, y, xradius, yellow);
+ GP_Ring(&context, x, y, xradius, yradius, yellow);
if (fill)
- GP_TFillRing(&context, x, y, xradius, yradius, red);
+ GP_FillRing(&context, x, y, xradius, yradius, red);
if (outline == 2)
- GP_TCircle(&context, x, y, xradius, white);
+ GP_Ring(&context, x, y, xradius, yradius, white);
}
void draw_testing_ellipse(int x, int y, int xradius, int yradius)
{
if (outline == 1)
- GP_TEllipse(&context, x, y, xradius, yradius, yellow);
+ GP_Ellipse(&context, x, y, xradius, yradius, yellow);
if (fill)
- GP_TFillEllipse(&context, x, y, xradius, yradius, red);
+ GP_FillEllipse(&context, x, y, xradius, yradius, red);
if (outline == 2)
- GP_TEllipse(&context, x, y, xradius, yradius, white);
+ GP_Ellipse(&context, x, y, xradius, yradius, white);
}
void draw_testing_rectangle(int x, int y, int xradius, int yradius)
{
+ int x0 = x - xradius, y0 = y - yradius;
+ int x1 = x + xradius, y1 = y + yradius;
+
if (outline == 1)
- GP_TRect(&context, x - xradius, y - yradius, x + xradius, y + yradius, yellow);
+ GP_Rect(&context, x0, y0, x1, y1, yellow);
+
+ if (fill)
+ GP_FillRect(&context, x0, y0, x1, y1, red);
+
+ if (outline == 2)
+ GP_Rect(&context, x0, y0, x1, y1, white);
+}
+void draw_testing_tetragon(int x, int y, int xradius, int yradius)
+{
+ int x0 = x - xradius, y0 = y - yradius;
+ int x1 = x + xradius, y1 = y;
+ int x2 = x + xradius, y2 = y + yradius/2;
+ int x3 = x, y3 = y + yradius;
+
+ if (outline == 1)
+ GP_Tetragon(&context, x0, y0, x1, y1, x2, y2, x3, y3, yellow);
+
if (fill)
- GP_TFillRect(&context, x - xradius, y - yradius, x + xradius, y + yradius, red);
+ GP_FillTetragon(&context, x0, y0, x1, y1, x2, y2, x3, y3, red);
if (outline == 2)
- GP_TRect(&context, x - xradius, y - yradius, x + xradius, y + yradius, white);
+ GP_Tetragon(&context, x0, y0, x1, y1, x2, y2, x3, y3, white);
}
void redraw_screen(void)
@@ -211,12 +235,12 @@ void redraw_screen(void)
/* axes */
if (show_axes) {
- GP_THLine(&context, 0, display_w, center_y, gray);
- GP_THLine(&context, 0, display_w, center_y-yradius, darkgray);
- GP_THLine(&context, 0, display_w, center_y+yradius, darkgray);
- GP_TVLine(&context, center_x, 0, display_h, gray);
- GP_TVLine(&context, center_x-xradius, 0, display_h, darkgray);
- GP_TVLine(&context, center_x+xradius, 0, display_h, darkgray);
+ GP_HLine(&context, 0, display_w, center_y, gray);
+ GP_HLine(&context, 0, display_w, center_y-yradius, darkgray);
+ GP_HLine(&context, 0, display_w, center_y+yradius, darkgray);
+ GP_VLine(&context, center_x, 0, display_h, gray);
+ GP_VLine(&context, center_x-xradius, 0, display_h, darkgray);
+ GP_VLine(&context, center_x+xradius, 0, display_h, darkgray);
}
/* the shape */
@@ -242,8 +266,14 @@ void redraw_screen(void)
draw_testing_rectangle(center_x, center_y, xradius, yradius);
title = "RECTANGLE";
break;
+ case SHAPE_TETRAGON:
+ draw_testing_tetragon(center_x, center_y, xradius, yradius);
+ title = "TETRAGON";
+ break;
}
- GP_TText(&context, &style, 16, 16, GP_ALIGN_RIGHT|GP_VALIGN_BELOW, title, white);
+
+ GP_Text(&context, &style, 16, 16, GP_ALIGN_RIGHT|GP_VALIGN_BELOW,
+ title, white);
SDL_UnlockSurface(display);
}
@@ -260,16 +290,20 @@ void event_loop(void)
switch (event.type) {
case SDL_USEREVENT:
- if (xradius + xradius_add > 1 && xradius + xradius_add < 400)
+ if (xradius + xradius_add > 1 &&
+ xradius + xradius_add < display_w)
xradius += xradius_add;
- if (yradius + yradius_add > 1 && yradius + yradius_add < 400)
+ if (yradius + yradius_add > 1 &&
+ yradius + yradius_add < display_h)
yradius += yradius_add;
- if (center_x + xcenter_add > 1 && center_x + xcenter_add < 320)
+ if (center_x + xcenter_add > 1 &&
+ center_x + xcenter_add < display_w/2)
center_x += xcenter_add;
- if (center_y + ycenter_add > 1 && center_y + ycenter_add < 240)
+ if (center_y + ycenter_add > 1 &&
+ center_y + ycenter_add < display_h/2)
center_y += ycenter_add;
redraw_screen();
@@ -290,14 +324,7 @@ void event_loop(void)
break;
case SDLK_r:
context.axes_swap = !context.axes_swap;
-
- if (context.axes_swap) {
- display_w = 480;
- display_h = 640;
- } else {
- display_w = 640;
- display_h = 480;
- }
+ GP_SWAP(display_w, display_h);
break;
case SDLK_f:
fill = !fill;
@@ -453,8 +480,7 @@ int main(int argc, char ** argv)
for (i = 1; i < argc; i++) {
if (strcmp(argv[i], "-16") == 0) {
display_bpp = 16;
- }
- else if (strcmp(argv[i], "-24") == 0) {
+ } else if (strcmp(argv[i], "-24") == 0) {
display_bpp = 24;
}
}
@@ -466,14 +492,14 @@ int main(int argc, char ** argv)
}
/* Create a window with a software back surface */
- display = SDL_SetVideoMode(640, 480, display_bpp, SDL_SWSURFACE);
+ display = SDL_SetVideoMode(display_w, display_h, display_bpp, SDL_SWSURFACE);
if (display == NULL) {
fprintf(stderr, "Could not open display: %sn", SDL_GetError());
goto fail;
}
/* Set up a clipping rectangle to exercise clipping */
- SDL_Rect clip_rect = {10, 10, 620, 460};
+ SDL_Rect clip_rect = {10, 10, display_w - 10, display_h - 10};
SDL_SetClipRect(display, &clip_rect);
GP_SDL_ContextFromSurface(&context, display);
@@ -494,13 +520,9 @@ int main(int argc, char ** argv)
goto fail;
}
- /* Print a short info how to use this test. */
print_instructions();
- /* Enter the event loop */
event_loop();
-
- /* We're done */
SDL_Quit();
return 0;
diff --git a/tests/SDL/textaligntest.c b/tests/SDL/textaligntest.c
index 66f97ed..0ecad33 100644
--- a/tests/SDL/textaligntest.c
+++ b/tests/SDL/textaligntest.c
@@ -42,8 +42,8 @@ static GP_Pixel black_pixel, red_pixel, yellow_pixel, green_pixel, blue_pixel,
static int flag_proportional = 0;
/* center of the screen */
-static int xcenter = 320;
-static int ycenter = 240;
+static int X = 640;
+static int Y = 480;
void redraw_screen(void)
{
@@ -52,8 +52,8 @@ void redraw_screen(void)
GP_Fill(&context, black_pixel);
/* draw axes intersecting in the middle, where text should be shown */
- GP_HLine(&context, 0, 640, 240, darkgray_pixel);
- GP_VLine(&context, 320, 0, 480, darkgray_pixel);
+ GP_HLine(&context, 0, X, Y/2, darkgray_pixel);
+ GP_VLine(&context, X/2, 0, Y, darkgray_pixel);
GP_TextStyle style = GP_DEFAULT_TEXT_STYLE;
@@ -65,20 +65,20 @@ void redraw_screen(void)
style.pixel_xspace = 4;
style.pixel_yspace = 4;
- GP_TBoxCenteredText(&context, &style, 0, 0, 640, 480,
- "Hello world!", darkgray_pixel);
+ GP_BoxCenteredText(&context, &style, 0, 0, X, Y,
+ "Hello world!", darkgray_pixel);
style.pixel_xspace = 0;
style.pixel_yspace = 0;
- GP_TText(&context, &style, xcenter, ycenter, GP_ALIGN_LEFT|GP_VALIGN_BELOW,
- "bottom left", yellow_pixel);
- GP_TText(&context, &style, xcenter, ycenter, GP_ALIGN_RIGHT|GP_VALIGN_BELOW,
- "bottom right", red_pixel);
- GP_TText(&context, &style, xcenter, ycenter, GP_ALIGN_RIGHT|GP_VALIGN_ABOVE,
- "top right", blue_pixel);
- GP_TText(&context, &style, xcenter, ycenter, GP_ALIGN_LEFT|GP_VALIGN_ABOVE,
- "top left", green_pixel);
+ GP_Text(&context, &style, X/2, Y/2, GP_ALIGN_LEFT|GP_VALIGN_BELOW,
+ "bottom left", yellow_pixel);
+ GP_Text(&context, &style, X/2, Y/2, GP_ALIGN_RIGHT|GP_VALIGN_BELOW,
+ "bottom right", red_pixel);
+ GP_Text(&context, &style, X/2, Y/2, GP_ALIGN_RIGHT|GP_VALIGN_ABOVE,
+ "top right", blue_pixel);
+ GP_Text(&context, &style, X/2, Y/2, GP_ALIGN_LEFT|GP_VALIGN_ABOVE,
+ "top left", green_pixel);
SDL_UnlockSurface(display);
}
@@ -108,7 +108,7 @@ void event_loop(void)
break;
case SDLK_r:
context.axes_swap = !context.axes_swap;
- GP_SWAP(xcenter, ycenter);
+ GP_SWAP(X, Y);
break;
default:
break;
@@ -143,7 +143,7 @@ int main(void)
}
/* Create a window with a software back surface */
- display = SDL_SetVideoMode(640, 480, 0, SDL_SWSURFACE);
+ display = SDL_SetVideoMode(X, Y, 0, SDL_SWSURFACE);
if (display == NULL) {
fprintf(stderr, "Could not open display: %sn", SDL_GetError());
goto fail;
@@ -152,7 +152,7 @@ int main(void)
print_instructions();
/* Set up a clipping rectangle to test proper clipping of pixels */
- SDL_Rect clip_rect = {10, 10, 620, 460};
+ SDL_Rect clip_rect = {10, 10, X-10, Y-10};
SDL_SetClipRect(display, &clip_rect);
/* Initialize a GP context from the SDL display */
http://repo.or.cz/w/gfxprim.git/commit/a6b989fc9c386a6e7422277784cd13140af7…
commit a6b989fc9c386a6e7422277784cd13140af7e286
Author: Cyril Hrubis <metan(a)ucw.cz>
Date: Sun Jul 24 14:51:09 2011 +0200
Fix some overly long lines.
diff --git a/include/core/GP_Common.h b/include/core/GP_Common.h
index 3bae989..39b9ea9 100644
--- a/include/core/GP_Common.h
+++ b/include/core/GP_Common.h
@@ -65,31 +65,31 @@
/*
* Internal macros with common code for GP_ABORT, GP_ASSERT and GP_CHECK.
* GP_INTERNAL_ABORT takes a message that may contain % (e.g. assert condition)
- * and prints:
- * "*** gfxprim: __FILE__:__LINE__: in __FUNCTION__: str_abort_msg_" format(__VA_ARGS__) "n"
- *
- * GP_GENERAL_CHECK is a check with specified message prefix (for assert and check)
+ * and prints message and calls abort().
+ * GP_GENERAL_CHECK is a check with specified message prefix
+ * (for assert and check)
*/
#define GP_INTERNAL_ABORT(str_abort_msg_, ...) do { - fprintf(stderr, "*** gfxprim: %s:%d: in %s: %s", - __FILE__, __LINE__, __FUNCTION__, str_abort_msg_); - if (! (#__VA_ARGS__ [0])) - fprintf(stderr, "abort()"); - else - fprintf(stderr, " " __VA_ARGS__); - fprintf(stderr, "n"); - abort(); - } while (0)
+ fprintf(stderr, "*** gfxprim: %s:%d: in %s: %s", + __FILE__, __LINE__, __FUNCTION__, str_abort_msg_); + if (! (#__VA_ARGS__ [0])) + fprintf(stderr, "abort()"); + else + fprintf(stderr, " " __VA_ARGS__); + fprintf(stderr, "n"); + abort(); +} while (0)
#define GP_GENERAL_CHECK(check_cond_, check_message_, ...) do { - if (unlikely(!(check_cond_))) { - if (#__VA_ARGS__ [0]) - GP_INTERNAL_ABORT(check_message_ #check_cond_, "n" __VA_ARGS__); - else - GP_INTERNAL_ABORT(check_message_ #check_cond_, " "); - } - } while (0)
+ if (unlikely(!(check_cond_))) { + if (#__VA_ARGS__ [0]) + GP_INTERNAL_ABORT(check_message_ #check_cond_, + "n" __VA_ARGS__); + else + GP_INTERNAL_ABORT(check_message_ #check_cond_, " "); + } +} while (0)
/*
* Aborts and prints the message along with the location in code
@@ -138,12 +138,14 @@
* Return (shifted) count bits at offset of value
* Note: operates with value types same as val
*/
-#define GP_GET_BITS(offset, count, val) ( ( (val)>>(offset) ) & ( ((((typeof(val))1)<<(count)) - 1) ) )
+#define GP_GET_BITS(offset, count, val) + ( ( (val)>>(offset) ) & ( ((((typeof(val))1)<<(count)) - 1) ) )
/*
* Debugging version, evaluates args twice.
*/
-#define GP_GET_BITS_DBG(offset, count, val) ( printf("GET_BITS(%d, %d, 0x%x)=%d", offset, count, val, +#define GP_GET_BITS_DBG(offset, count, val) + ( printf("GET_BITS(%d, %d, 0x%x)=%d", offset, count, val, GP_GET_BITS(offset, count, val)), GP_GET_BITS(offset, count, val))
/*
@@ -157,7 +159,8 @@
* GP_CLEAR_BITS sets the target bits to zero
* GP_SET_BITS does both
*/
-#define GP_CLEAR_BITS(offset, count, dest) ( (dest) &= ~(((((typeof(dest))1) << (count)) - 1) << (offset)) )
+#define GP_CLEAR_BITS(offset, count, dest) + ( (dest) &= ~(((((typeof(dest))1) << (count)) - 1) << (offset)) )
#define GP_SET_BITS_OR(offset, dest, val) ( (dest) |= ((val)<<(offset)) )
@@ -170,8 +173,8 @@
* Debugging version, evaluates args twice.
*/
#define GP_SET_BITS_DBG(offset, count, dest, val) do { - GP_SET_BITS(offset, count, dest, val); - printf("SET_BITS(%d, %d, p, %d)n", offset, count, val); + GP_SET_BITS(offset, count, dest, val); + printf("SET_BITS(%d, %d, p, %d)n", offset, count, val); } while (0)
diff --git a/include/core/GP_Context.h b/include/core/GP_Context.h
index 35b8ae7..2e640da 100644
--- a/include/core/GP_Context.h
+++ b/include/core/GP_Context.h
@@ -78,21 +78,17 @@ static inline GP_PixelType GP_GetContextPixelType(const GP_Context *context)
/* Performs a series of sanity checks on context, aborting if any fails. */
#define GP_CHECK_CONTEXT(context) do { - GP_CHECK(context, - "NULL passed as context"); - GP_CHECK(context->pixels, - "invalid context: NULL image pointer"); - GP_CHECK(context->bpp <= 32, - "invalid context: unsupported bits-per-pixel count"); - GP_CHECK(context->w > 0 && context->h > 0, - "invalid context: invalid image size"); - GP_CHECK(context->clip_w_min <= context->clip_w_max - && context->clip_h_min <= context->clip_h_max, - "invalid context: invalid clipping rectangle"); - GP_CHECK(context->clip_w_max < context->w - && context->clip_h_max < context->h, - "invalid context: clipping rectangle larger than image"); - } while (0)
+ GP_CHECK(context, "NULL passed as context"); + GP_CHECK(context->pixels, "invalid context: NULL image pointer"); + GP_CHECK(context->bpp <= 32, "invalid context: unsupported bits-per-pixel count"); + GP_CHECK(context->w > 0 && context->h > 0, "invalid context: invalid image size"); + GP_CHECK(context->clip_w_min <= context->clip_w_max + && context->clip_h_min <= context->clip_h_max, + "invalid context: invalid clipping rectangle"); + GP_CHECK(context->clip_w_max < context->w + && context->clip_h_max < context->h, + "invalid context: clipping rectangle larger than image"); +} while (0)
/*
* Is true, when pixel is clipped.
diff --git a/include/core/GP_Convert.h b/include/core/GP_Convert.h
index 6dd9d61..d33d417 100644
--- a/include/core/GP_Convert.h
+++ b/include/core/GP_Convert.h
@@ -58,7 +58,8 @@ GP_Pixel GP_PixelToRGBA8888(GP_Pixel pixel, GP_PixelType type);
/*
* Converts a color specified by its R, G, B components to a specified type.
*/
-static inline GP_Pixel GP_RGBToPixel(uint8_t r, uint8_t g, uint8_t b, GP_PixelType type)
+static inline GP_Pixel GP_RGBToPixel(uint8_t r, uint8_t g, uint8_t b,
+ GP_PixelType type)
{
GP_Pixel p = GP_Pixel_CREATE_RGB888(r, g, b);
return GP_RGB888ToPixel(p, type);
@@ -67,7 +68,8 @@ static inline GP_Pixel GP_RGBToPixel(uint8_t r, uint8_t g, uint8_t b, GP_PixelTy
/*
* Converts a color specified by its R, G, B, A components to a specified type.
*/
-static inline GP_Pixel GP_RGBAToPixel(uint8_t r, uint8_t g, uint8_t b, uint8_t a, GP_PixelType type)
+static inline GP_Pixel GP_RGBAToPixel(uint8_t r, uint8_t g, uint8_t b,
+ uint8_t a, GP_PixelType type)
{
GP_Pixel p = GP_Pixel_CREATE_RGBA8888(r, g, b, a);
return GP_RGBA8888ToPixel(p, type);
@@ -87,7 +89,9 @@ static inline GP_Pixel GP_RGBToContextPixel(uint8_t r, uint8_t g, uint8_t b,
* Converts a color specified by its R, G, B, A components to a pixel value
* compatible with the specified context.
*/
-static inline GP_Pixel GP_RGBAToContextPixel(uint8_t r, uint8_t g, uint8_t b, uint8_t a, const GP_Context *context)
+static inline GP_Pixel GP_RGBAToContextPixel(uint8_t r, uint8_t g,
+ uint8_t b, uint8_t a,
+ const GP_Context *context)
{
return GP_RGBAToPixel(r, g, b, a, context->pixel_type);
}
@@ -95,18 +99,22 @@ static inline GP_Pixel GP_RGBAToContextPixel(uint8_t r, uint8_t g, uint8_t b, ui
/*
* Convert between any pixel types (excl. palette types) via RGBA8888
*/
-static inline GP_Pixel GP_ConvertPixel(GP_Pixel pixel, GP_PixelType from, GP_PixelType to)
+static inline GP_Pixel GP_ConvertPixel(GP_Pixel pixel, GP_PixelType from,
+ GP_PixelType to)
{
return GP_RGBA8888ToPixel(GP_PixelToRGBA8888(pixel, from), to);
}
/*
- * Convert between pixel types of given contexts (excl. palette types) via RGBA8888.
- *
+ * Convert between pixel types of given contexts (excl. palette types) via
+ * RGBA8888.
*/
-static inline GP_Pixel GP_ConvertContextPixel(GP_Pixel pixel, const GP_Context *from, const GP_Context *to)
+static inline GP_Pixel GP_ConvertContextPixel(GP_Pixel pixel,
+ const GP_Context *from,
+ const GP_Context *to)
{
- return GP_RGBA8888ToPixel(GP_PixelToRGBA8888(from->pixel_type, pixel), to->pixel_type);
+ return GP_RGBA8888ToPixel(GP_PixelToRGBA8888(from->pixel_type, pixel),
+ to->pixel_type);
}
#endif /* CORE_GP_CONVERT_H */
-----------------------------------------------------------------------
Summary of changes:
include/core/GP_Common.h | 53 +++++++++--------
include/core/GP_Context.h | 26 ++++-----
include/core/GP_Convert.h | 24 +++++---
include/core/GP_DefFnPerBpp.h | 2 +-
include/gfx/GP_Circle.h | 32 ++++++++---
include/gfx/GP_Ellipse.h | 17 +++--
include/gfx/GP_Fill.h | 11 ++-
include/gfx/GP_HLine.h | 74 +++++++++++++-----------
include/gfx/GP_Line.h | 22 ++------
include/gfx/GP_Polygon.h | 8 +-
include/gfx/GP_Rect.h | 56 +++++++++++++-----
include/gfx/GP_Symbol.h | 22 ++++---
include/gfx/GP_Tetragon.h | 22 ++++---
include/gfx/GP_Triangle.h | 22 ++++---
include/gfx/GP_VLine.h | 27 ++++++---
include/text/GP_Text.h | 24 ++++----
libs/gfx/GP_Circle.c | 63 +++++++++++++--------
libs/gfx/GP_Ellipse.c | 34 ++++++------
libs/gfx/GP_Fill.c | 38 ------------
libs/gfx/GP_HLine.c | 51 +++++++++--------
libs/gfx/GP_Line.c | 15 +++--
libs/gfx/GP_Polygon.c | 12 ++--
libs/gfx/GP_Rect.c | 68 ++++++++++------------
libs/gfx/GP_Symbol.c | 77 ++++++++++++++-----------
libs/gfx/GP_Tetragon.c | 50 ++++++++--------
libs/gfx/GP_Triangle.c | 50 ++++++++---------
libs/gfx/GP_VLine.c | 22 ++++----
libs/text/GP_Text.c | 39 +++++++------
tests/SDL/fileview.c | 3 +-
tests/SDL/pixeltest.c | 21 +++----
tests/SDL/shapetest.c | 126 ++++++++++++++++++++++++-----------------
tests/SDL/textaligntest.c | 34 ++++++------
32 files changed, 609 insertions(+), 536 deletions(-)
delete mode 100644 libs/gfx/GP_Fill.c
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.")
1
0
Hi!
As you may see I've fixed the generate branch to compile (that is good).
But still there are some problems that arised and needs to be fixed:
* The GP_SET_BITS() used in GP_PutPixel_Raw doesn't work correctly
unless you explicitly cast the result from GP_PIXEL_ADDR_32BPP()
to (uint32_t*) (and same for each pixel > 8BPP).
* The gfx part for now uses GP_PutPixel_Raw() (which is wrong because
we need to clip every pixel (at least for the more complicated shapes).
So variant without transformation but with clipping is needed too.
* The HLine for 1, 2 and 4 BPP for different bit endians is not written
at all.
* The GP_PutPixel and GP_GetPixel now uses transformation flags for default
but the rest of the library doesn't (eg. gfx part). Should we simply rename
GP_TLine to GP_Line and GP_Line to GP_Line_Raw and so?
And that's it for now, I guess.
--
metan
2
13
[repo.or.cz] gfxprim.git branch generate updated: 9af82e35bed6a38c5599afcd4d0e0ac3450299a5
by metan 18 Jul '11
by metan 18 Jul '11
18 Jul '11
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 9af82e35bed6a38c5599afcd4d0e0ac3450299a5 (commit)
via ad753048dfe4082af1e4573c2c5d19c4cd4c6026 (commit)
from e5540ad2e0e262ef503332e7aa03168ef6ac072e (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/9af82e35bed6a38c5599afcd4d0e0ac34502…
commit 9af82e35bed6a38c5599afcd4d0e0ac3450299a5
Author: Cyril Hrubis <metan(a)ucw.cz>
Date: Mon Jul 18 11:08:24 2011 +0200
Fix off by one bug causing segfaults.
diff --git a/libs/gfx/algo/Line.algo.h b/libs/gfx/algo/Line.algo.h
index c1c2c2d..3eccb3a 100644
--- a/libs/gfx/algo/Line.algo.h
+++ b/libs/gfx/algo/Line.algo.h
@@ -66,10 +66,12 @@ void FN_NAME(CONTEXT_T context, int x0, int y0, int x1, int y1, int error = deltax / 2; int y = y0, x; int ystep = (y0 < y1) ? 1 : -1; - for (x = x0; x <= x1; x++) { + for (x = x0; x < x1; x++) { - if (steep) PUTPIXEL(context, y, x, pixval); - else PUTPIXEL(context, x, y, pixval); + if (steep) + PUTPIXEL(context, y, x, pixval); + else + PUTPIXEL(context, x, y, pixval); error = error - deltay; if (error < 0) {
http://repo.or.cz/w/gfxprim.git/commit/ad753048dfe4082af1e4573c2c5d19c4cd4c…
commit ad753048dfe4082af1e4573c2c5d19c4cd4c6026
Author: Cyril Hrubis <metan(a)ucw.cz>
Date: Mon Jul 18 10:59:03 2011 +0200
Coding style, typos.
diff --git a/include/core/GP_Common.h b/include/core/GP_Common.h
index cda1967..3bae989 100644
--- a/include/core/GP_Common.h
+++ b/include/core/GP_Common.h
@@ -164,7 +164,7 @@
#define GP_SET_BITS(offset, count, dest, val) do { GP_CLEAR_BITS(offset, count, dest); GP_SET_BITS_OR(offset, dest, val); - } while (0)
+} while (0)
/*
* Debugging version, evaluates args twice.
@@ -172,7 +172,7 @@
#define GP_SET_BITS_DBG(offset, count, dest, val) do { GP_SET_BITS(offset, count, dest, val); printf("SET_BITS(%d, %d, p, %d)n", offset, count, val); - } while (0)
+} while (0)
/* Determines the sign of the integer value; it is +1 if value is positive,
diff --git a/include/core/GP_GetPutPixel.h b/include/core/GP_GetPutPixel.h
index 12e9af4..9d9b7be 100644
--- a/include/core/GP_GetPutPixel.h
+++ b/include/core/GP_GetPutPixel.h
@@ -57,11 +57,10 @@ static inline GP_Pixel GP_GetPixel_Raw(const GP_Context *context, int x, int y)
*/
void GP_PutPixel(GP_Context *context, int x, int y, GP_Pixel p);
+//TODO: This is the same as GP_PutPixel
static inline void GP_TPutPixel(GP_Context *context, GP_Coord x, GP_Coord y,
GP_Pixel p)
{
- GP_TRANSFORM_POINT(context, x, y);
-
GP_PutPixel(context, x, y, p);
}
diff --git a/include/core/GP_Pixel.h b/include/core/GP_Pixel.h
index de2b4a5..99793f1 100644
--- a/include/core/GP_Pixel.h
+++ b/include/core/GP_Pixel.h
@@ -19,7 +19,7 @@
* Copyright (C) 2009-2010 Jiri "BlueBear" Dluhos *
* <jiri.bluebear.dluhos(a)gmail.com> *
* *
- * Copyright (C) 2009-2010 Cyril Hrubis <metan(a)ucw.cz> *
+ * Copyright (C) 2009-2011 Cyril Hrubis <metan(a)ucw.cz> *
* *
* Copyright (C) 2011 Tomas Gavenciak <gavento(a)ucw.cz> *
* *
@@ -52,7 +52,7 @@ struct GP_Context;
* GP_Pixel is just uint32_t
*/
typedef uint32_t GP_Pixel;
-#define GP_PIXEL_BITS 32
+#define GP_PIXEL_BITS (sizeof(GP_Pixel) * 8)
/* Generated header */
#include "GP_Pixel.gen.h"
@@ -81,9 +81,9 @@ typedef enum {
*/
typedef struct {
- char name[8]; /* Channel name */
- uint8_t offset; /* Offset in bits */
- uint8_t size; /* Bit-size */
+ char name[8]; /* Channel name */
+ uint8_t offset; /* Offset in bits */
+ uint8_t size; /* Bit-size */
} GP_PixelTypeChannel;
/*
@@ -99,15 +99,15 @@ typedef struct {
*/
typedef struct {
- GP_PixelType type; /* Number of the type */
- const char name[16]; /* Name */
- uint8_t size; /* Size in bits */
- GP_BIT_ENDIAN bit_endian; /* Order of pixels in a byte */
- uint8_t numchannels; /* Number of channels */
- /* String describing the bit-representaton (as in "RRRRRGGGGGGBBBBB")*/
- const char bitmap[sizeof(GP_Pixel) * 8 + 1];
- /* Individual channels */
- const GP_PixelTypeChannel channels[GP_PIXELTYPE_MAX_CHANNELS];
+ GP_PixelType type; /* Number of the type */
+ const char name[16]; /* Name */
+ uint8_t size; /* Size in bits */
+ GP_BIT_ENDIAN bit_endian; /* Order of pixels in a byte */
+ uint8_t numchannels; /* Number of channels */
+ /* String describing the bit-representaton (as in "RRRRRGGGGGGBBBBB")*/
+ const char bitmap[sizeof(GP_Pixel) * 8 + 1];
+ /* Individual channels */
+ const GP_PixelTypeChannel channels[GP_PIXELTYPE_MAX_CHANNELS];
} GP_PixelTypeDescription;
/*
-----------------------------------------------------------------------
Summary of changes:
include/core/GP_Common.h | 4 ++--
include/core/GP_GetPutPixel.h | 3 +--
include/core/GP_Pixel.h | 28 ++++++++++++++--------------
libs/gfx/algo/Line.algo.h | 8 +++++---
4 files changed, 22 insertions(+), 21 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.")
1
0
[repo.or.cz] gfxprim.git branch generate updated: e5540ad2e0e262ef503332e7aa03168ef6ac072e
by metan 17 Jul '11
by metan 17 Jul '11
17 Jul '11
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 e5540ad2e0e262ef503332e7aa03168ef6ac072e (commit)
from 7175cdaf66ca013f4ec1fd25e175adbeabd6501a (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/e5540ad2e0e262ef503332e7aa03168ef6ac…
commit e5540ad2e0e262ef503332e7aa03168ef6ac072e
Author: Cyril Hrubis <metan(a)ucw.cz>
Date: Sun Jul 17 22:32:00 2011 +0200
Fix previously forgotten color initializaiton.
diff --git a/tests/SDL/textaligntest.c b/tests/SDL/textaligntest.c
index f7872ac..66f97ed 100644
--- a/tests/SDL/textaligntest.c
+++ b/tests/SDL/textaligntest.c
@@ -162,6 +162,9 @@ int main(void)
black_pixel = GP_ColorToPixel(&context, GP_COL_BLACK);
red_pixel = GP_ColorToPixel(&context, GP_COL_RED);
blue_pixel = GP_ColorToPixel(&context, GP_COL_BLUE);
+ green_pixel = GP_ColorToPixel(&context, GP_COL_GREEN);
+ yellow_pixel = GP_ColorToPixel(&context, GP_COL_YELLOW);
+ darkgray_pixel = GP_ColorToPixel(&context, GP_COL_GRAY_DARK);
redraw_screen();
SDL_Flip(display);
-----------------------------------------------------------------------
Summary of changes:
tests/SDL/textaligntest.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.")
1
0
[repo.or.cz] gfxprim.git branch generate updated: 7175cdaf66ca013f4ec1fd25e175adbeabd6501a
by metan 17 Jul '11
by metan 17 Jul '11
17 Jul '11
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 7175cdaf66ca013f4ec1fd25e175adbeabd6501a (commit)
via 5ddc1f67228f0ce6195d0b52f67516f02511006d (commit)
via 37cb764fee13f5de90edebad64c54d22870590ea (commit)
from 7e70914d42f31e963a39ed92efe54f31cfce0782 (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/7175cdaf66ca013f4ec1fd25e175adbeabd6…
commit 7175cdaf66ca013f4ec1fd25e175adbeabd6501a
Merge: 5ddc1f6 37cb764
Author: Cyril Hrubis <metan(a)ucw.cz>
Date: Sun Jul 17 22:17:46 2011 +0200
Merge branch 'master' into generate
Conflicts:
include/gfx/GP_Circle.h
libs/gfx/GP_Circle.c
tests/SDL/shapetest.c
diff --cc include/gfx/GP_Circle.h
index c82c346,e743abd..482cd51
--- a/include/gfx/GP_Circle.h
+++ b/include/gfx/GP_Circle.h
@@@ -28,22 -28,22 +28,22 @@@
#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);
-void GP_FillRing(GP_Context *context, int xcenter, int ycenter,
- unsigned int r1, unsigned int r2, GP_Pixel pixel);
+void GP_FillRing(GP_Context *context, GP_Coord xcenter, GP_Coord ycenter,
- GP_Size outer_r, GP_Size inner_r, GP_Pixel pixel);
++ GP_Size r1, GP_Size r2, GP_Pixel pixel);
-void GP_TFillRing(GP_Context *context, int xcenter, int ycenter,
- unsigned int r1, unsigned int r2, GP_Pixel pixel);
+void GP_TFillRing(GP_Context *context, GP_Coord xcenter, GP_Coord ycenter,
- GP_Size outer_r, GP_Size inner_r, GP_Pixel pixel);
++ GP_Size r1, GP_Size r2, GP_Pixel pixel);
#endif /* GP_CIRCLE_H */
diff --cc libs/gfx/GP_Circle.c
index 07b3955,b63fc98..9af9f43
--- a/libs/gfx/GP_Circle.c
+++ b/libs/gfx/GP_Circle.c
@@@ -78,19 -88,25 +78,19 @@@ void GP_TFillCircle(GP_Context *context
#include "algo/FillRing.algo.h"
/* Generate drawing functions for various bit depths. */
-DEF_FILLRING_FN(GP_FillRing1bpp, GP_Context *, GP_Pixel, GP_HLine1bpp)
-DEF_FILLRING_FN(GP_FillRing2bpp, GP_Context *, GP_Pixel, GP_HLine2bpp)
-DEF_FILLRING_FN(GP_FillRing4bpp, GP_Context *, GP_Pixel, GP_HLine4bpp)
-DEF_FILLRING_FN(GP_FillRing8bpp, GP_Context *, GP_Pixel, GP_HLine8bpp)
-DEF_FILLRING_FN(GP_FillRing16bpp, GP_Context *, GP_Pixel, GP_HLine16bpp)
-DEF_FILLRING_FN(GP_FillRing24bpp, GP_Context *, GP_Pixel, GP_HLine24bpp)
-DEF_FILLRING_FN(GP_FillRing32bpp, GP_Context *, GP_Pixel, GP_HLine32bpp)
-
-void GP_FillRing(GP_Context *context, int xcenter, int ycenter,
- unsigned int r1, unsigned int r2, GP_Pixel pixel)
+GP_DEF_FILL_FN_PER_BPP(GP_FillRing, DEF_FILLRING_FN)
+
+void GP_FillRing(GP_Context *context, GP_Coord xcenter, GP_Coord ycenter,
- GP_Size outer_r, GP_Size inner_r, GP_Pixel pixel)
++ GP_Size r1, GP_Size r2, GP_Pixel pixel)
{
GP_CHECK_CONTEXT(context);
- GP_FN_PER_BPP(GP_FillRing, context->bpp, context,
- xcenter, ycenter, r1, r2, pixel);
+ GP_FN_PER_BPP_CONTEXT(GP_FillRing, context, context,
- xcenter, ycenter, outer_r, inner_r, pixel);
++ xcenter, ycenter, r1, r2, pixel);
}
-void GP_TFillRing(GP_Context *context, int xcenter, int ycenter,
- unsigned int r1, unsigned int r2, GP_Pixel pixel)
+void GP_TFillRing(GP_Context *context, GP_Coord xcenter, GP_Coord ycenter,
- GP_Size outer_r, GP_Size inner_r, GP_Pixel pixel)
++ GP_Size r1, GP_Size r2, GP_Pixel pixel)
{
GP_CHECK_CONTEXT(context);
http://repo.or.cz/w/gfxprim.git/commit/5ddc1f67228f0ce6195d0b52f67516f02511…
commit 5ddc1f67228f0ce6195d0b52f67516f02511006d
Author: Cyril Hrubis <metan(a)ucw.cz>
Date: Sun Jul 17 22:02:15 2011 +0200
Fix nasty Make system bug.
diff --git a/build/Makefile b/build/Makefile
index 5c24ac7..709dd08 100644
--- a/build/Makefile
+++ b/build/Makefile
@@ -10,7 +10,7 @@ else
@rm -f libGP.a libGP.so libGP.so.0
endif
-libGP.a: $(LIB_OBJECTS)
+libGP.a:
@. ./liblock.sh; spinlock .
ifdef VERBOSE
$(AR) rcs libGP.a $(LIB_OBJECTS)
@@ -20,7 +20,7 @@ else
endif
@. ./liblock.sh; spinunlock .
-libGP.so: $(LIB_OBJECTS)
+libGP.so:
@. ./liblock.sh; spinlock .
ifdef VERBOSE
$(CC) -fPIC -dPIC --shared -Wl,-soname -Wl,libGP.so.0 $(LIB_OBJECTS) -o libGP.so
-----------------------------------------------------------------------
Summary of changes:
build/Makefile | 4 ++--
include/gfx/GP_Circle.h | 4 ++--
libs/gfx/GP_Circle.c | 8 ++++----
libs/gfx/algo/FillRing.algo.h | 16 ++++++++--------
tests/SDL/shapetest.c | 9 ++-------
5 files changed, 18 insertions(+), 23 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.")
1
0
[repo.or.cz] gfxprim.git branch master updated: 37cb764fee13f5de90edebad64c54d22870590ea
by bluebear 17 Jul '11
by bluebear 17 Jul '11
17 Jul '11
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project gfxprim.git.
The branch, master has been updated
via 37cb764fee13f5de90edebad64c54d22870590ea (commit)
from b3779d6def780f74dc0dbaed7ed5f5172a9faa7c (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
http://repo.or.cz/w/gfxprim.git/commit/37cb764fee13f5de90edebad64c54d228705…
commit 37cb764fee13f5de90edebad64c54d22870590ea
Author: BlueBear <jiri.bluebear.dluhos(a)gmail.com>
Date: Sun Jul 17 21:59:51 2011 +0200
Fixed some +/-1 errors in Ring and improved API.
diff --git a/include/gfx/GP_Circle.h b/include/gfx/GP_Circle.h
index 57b5a0a..e743abd 100644
--- a/include/gfx/GP_Circle.h
+++ b/include/gfx/GP_Circle.h
@@ -41,9 +41,9 @@ void GP_TFillCircle(GP_Context *context, int xcenter, int ycenter,
unsigned int r, GP_Pixel pixel);
void GP_FillRing(GP_Context *context, int xcenter, int ycenter,
- unsigned int outer_r, unsigned int inner_r, GP_Pixel pixel);
+ unsigned int r1, unsigned int r2, GP_Pixel pixel);
void GP_TFillRing(GP_Context *context, int xcenter, int ycenter,
- unsigned int outer_r, unsigned int inner_r, GP_Pixel pixel);
+ unsigned int r1, unsigned int r2, GP_Pixel pixel);
#endif /* GP_CIRCLE_H */
diff --git a/libs/gfx/GP_Circle.c b/libs/gfx/GP_Circle.c
index 427a9ad..b63fc98 100644
--- a/libs/gfx/GP_Circle.c
+++ b/libs/gfx/GP_Circle.c
@@ -97,20 +97,20 @@ DEF_FILLRING_FN(GP_FillRing24bpp, GP_Context *, GP_Pixel, GP_HLine24bpp)
DEF_FILLRING_FN(GP_FillRing32bpp, GP_Context *, GP_Pixel, GP_HLine32bpp)
void GP_FillRing(GP_Context *context, int xcenter, int ycenter,
- unsigned int outer_r, unsigned int inner_r, GP_Pixel pixel)
+ unsigned int r1, unsigned int r2, GP_Pixel pixel)
{
GP_CHECK_CONTEXT(context);
GP_FN_PER_BPP(GP_FillRing, context->bpp, context,
- xcenter, ycenter, outer_r, inner_r, pixel);
+ xcenter, ycenter, r1, r2, pixel);
}
void GP_TFillRing(GP_Context *context, int xcenter, int ycenter,
- unsigned int outer_r, unsigned int inner_r, GP_Pixel pixel)
+ unsigned int r1, unsigned int r2, GP_Pixel pixel)
{
GP_CHECK_CONTEXT(context);
GP_TRANSFORM_POINT(context, xcenter, ycenter);
- GP_FillRing(context, xcenter, ycenter, outer_r, inner_r, pixel);
+ GP_FillRing(context, xcenter, ycenter, r1, r2, pixel);
}
diff --git a/libs/gfx/algo/FillRing.algo.h b/libs/gfx/algo/FillRing.algo.h
index 4458bec..96dfa79 100644
--- a/libs/gfx/algo/FillRing.algo.h
+++ b/libs/gfx/algo/FillRing.algo.h
@@ -37,10 +37,10 @@
*/
#define DEF_FILLRING_FN(FN_NAME, CONTEXT_T, PIXVAL_T, HLINE) void FN_NAME(CONTEXT_T context, int xcenter, int ycenter, - unsigned int outer_r, unsigned int inner_r, PIXVAL_T pixval) + unsigned int r1, unsigned int r2, PIXVAL_T pixval) { - if (inner_r >= outer_r) return; -+ int outer_r = (int) GP_MAX(r1, r2); + int inner_r = (int) GP_MIN(r1, r2); int outer_x = 0; int inner_x = 0; int y; @@ -54,17 +54,17 @@ void FN_NAME(CONTEXT_T context, int xcenter, int ycenter, } outer_error += -2*y + 1; - if (y < (int) inner_r && y > -((int) inner_r)) { + if (y <= (int) inner_r && y >= -((int) inner_r)) { while (inner_error < 0) { inner_error += 2*inner_x + 1; inner_x++; } inner_error += -2*y + 1; - HLINE(context, xcenter - outer_x + 1, xcenter - inner_x - 1, ycenter - y, pixval); - HLINE(context, xcenter + inner_x + 1, xcenter + outer_x - 1, ycenter - y, pixval); - HLINE(context, xcenter - outer_x + 1, xcenter - inner_x - 1, ycenter + y, pixva
l); - HLINE(context, xcenter + inner_x + 1, xcenter + outer_x - 1, ycenter + y, pixval); + HLINE(context, xcenter - outer_x + 1, xcenter - inner_x + 1, ycenter - y, pixval); + HLINE(context, xcenter + inner_x - 1, xcenter + outer_x - 1, ycenter - y, pixval); + HLINE(context, xcenter - outer_x + 1, xcenter - inner_x + 1, ycenter + y, pixval); + HLINE(context, xcenter + inner_x - 1, xcenter + outer_x - 1, ycenter + y, pixval); } else { HLINE(context, xcenter - outer_x + 1, xcenter + outer_x - 1, ycenter-y, pixval); HLINE(context, xcenter - outer_x + 1, xcenter + outer_x - 1, ycenter+y, pixval); diff --git a/tests/SDL/shapetest.c b/tests/SDL/shapetest.c
index d1009d9..0587c55 100644
--- a/tests/SDL/shapetest.c
+++ b/tests/SDL/shapetest.c
@@ -164,14 +164,8 @@ void draw_testing_ring(int x, int y, int xradius,
if (outline == 1)
GP_TCircle(&context, x, y, xradius, yellow);
- if (fill) {
- if (xradius == yradius) {
- GP_TFillRing(&context, x, y, xradius, xradius/2, red);
- } else {
- GP_TFillRing(&context, x, y, GP_MAX(xradius, yradius),
- GP_MIN(xradius, yradius), red);
- }
- }
+ if (fill)
+ GP_TFillRing(&context, x, y, xradius, yradius, red);
if (outline == 2)
GP_TCircle(&context, x, y, xradius, white);
-----------------------------------------------------------------------
Summary of changes:
include/gfx/GP_Circle.h | 4 ++--
libs/gfx/GP_Circle.c | 8 ++++----
libs/gfx/algo/FillRing.algo.h | 16 ++++++++--------
tests/SDL/shapetest.c | 10 ++--------
4 files changed, 16 insertions(+), 22 deletions(-)
repo.or.cz automatic notification. Contact project admin jiri.bluebear.dluhos(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.")
1
0
[repo.or.cz] gfxprim.git branch generate updated: 7e70914d42f31e963a39ed92efe54f31cfce0782
by metan 17 Jul '11
by metan 17 Jul '11
17 Jul '11
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 7e70914d42f31e963a39ed92efe54f31cfce0782 (commit)
via 740b7028f534fbd12a22257f701f28c1df603cbc (commit)
via b3779d6def780f74dc0dbaed7ed5f5172a9faa7c (commit)
from 2d34007fde18efe7a66079b899a16eae0bfd2dbc (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/7e70914d42f31e963a39ed92efe54f31cfce…
commit 7e70914d42f31e963a39ed92efe54f31cfce0782
Author: Cyril Hrubis <metan(a)ucw.cz>
Date: Sun Jul 17 20:53:34 2011 +0200
Fix merge.
diff --git a/include/gfx/GP_Circle.h b/include/gfx/GP_Circle.h
index 2ff4dac..c82c346 100644
--- a/include/gfx/GP_Circle.h
+++ b/include/gfx/GP_Circle.h
@@ -40,10 +40,10 @@ void GP_FillCircle(GP_Context *context, GP_Coord xcenter, GP_Coord ycenter,
void GP_TFillCircle(GP_Context *context, GP_Coord xcenter, GP_Coord ycenter,
GP_Size r, GP_Pixel pixel);
-void GP_FillRing(GP_Context *context, int xcenter, int ycenter,
- unsigned int outer_r, unsigned int inner_r, GP_Pixel pixel);
+void GP_FillRing(GP_Context *context, GP_Coord xcenter, GP_Coord ycenter,
+ GP_Size outer_r, GP_Size inner_r, GP_Pixel pixel);
-void GP_TFillRing(GP_Context *context, int xcenter, int ycenter,
- unsigned int outer_r, unsigned int inner_r, GP_Pixel pixel);
+void GP_TFillRing(GP_Context *context, GP_Coord xcenter, GP_Coord ycenter,
+ GP_Size outer_r, GP_Size inner_r, GP_Pixel pixel);
#endif /* GP_CIRCLE_H */
diff --git a/libs/gfx/GP_Circle.c b/libs/gfx/GP_Circle.c
index ade89f7..07b3955 100644
--- a/libs/gfx/GP_Circle.c
+++ b/libs/gfx/GP_Circle.c
@@ -78,25 +78,19 @@ void GP_TFillCircle(GP_Context *context, GP_Coord xcenter, GP_Coord ycenter,
#include "algo/FillRing.algo.h"
/* Generate drawing functions for various bit depths. */
-DEF_FILLRING_FN(GP_FillRing1bpp, GP_Context *, GP_Pixel, GP_HLine1bpp)
-DEF_FILLRING_FN(GP_FillRing2bpp, GP_Context *, GP_Pixel, GP_HLine2bpp)
-DEF_FILLRING_FN(GP_FillRing4bpp, GP_Context *, GP_Pixel, GP_HLine4bpp)
-DEF_FILLRING_FN(GP_FillRing8bpp, GP_Context *, GP_Pixel, GP_HLine8bpp)
-DEF_FILLRING_FN(GP_FillRing16bpp, GP_Context *, GP_Pixel, GP_HLine16bpp)
-DEF_FILLRING_FN(GP_FillRing24bpp, GP_Context *, GP_Pixel, GP_HLine24bpp)
-DEF_FILLRING_FN(GP_FillRing32bpp, GP_Context *, GP_Pixel, GP_HLine32bpp)
-
-void GP_FillRing(GP_Context *context, int xcenter, int ycenter,
- unsigned int outer_r, unsigned int inner_r, GP_Pixel pixel)
+GP_DEF_FILL_FN_PER_BPP(GP_FillRing, DEF_FILLRING_FN)
+
+void GP_FillRing(GP_Context *context, GP_Coord xcenter, GP_Coord ycenter,
+ GP_Size outer_r, GP_Size inner_r, GP_Pixel pixel)
{
GP_CHECK_CONTEXT(context);
- GP_FN_PER_BPP(GP_FillRing, context->bpp, context,
- xcenter, ycenter, outer_r, inner_r, pixel);
+ GP_FN_PER_BPP_CONTEXT(GP_FillRing, context, context,
+ xcenter, ycenter, outer_r, inner_r, pixel);
}
-void GP_TFillRing(GP_Context *context, int xcenter, int ycenter,
- unsigned int outer_r, unsigned int inner_r, GP_Pixel pixel)
+void GP_TFillRing(GP_Context *context, GP_Coord xcenter, GP_Coord ycenter,
+ GP_Size outer_r, GP_Size inner_r, GP_Pixel pixel)
{
GP_CHECK_CONTEXT(context);
diff --git a/tests/SDL/shapetest.c b/tests/SDL/shapetest.c
index 4af2152..7f420c2 100644
--- a/tests/SDL/shapetest.c
+++ b/tests/SDL/shapetest.c
@@ -164,12 +164,11 @@ void draw_testing_ring(int x, int y, int xradius,
GP_TCircle(&context, x, y, xradius, yellow);
if (fill) {
- if (xradius == yradius) {
+ if (xradius == yradius)
GP_TFillRing(&context, x, y, xradius, xradius/2, red);
- } else {
+ else
GP_TFillRing(&context, x, y, GP_MAX(xradius, yradius),
GP_MIN(xradius, yradius), red);
- }
}
if (outline == 2)
http://repo.or.cz/w/gfxprim.git/commit/740b7028f534fbd12a22257f701f28c1df60…
commit 740b7028f534fbd12a22257f701f28c1df603cbc
Merge: 2d34007 b3779d6
Author: Cyril Hrubis <metan(a)ucw.cz>
Date: Sun Jul 17 20:43:10 2011 +0200
Merge branch 'master' into generate
diff --cc include/gfx/GP_Circle.h
index aaab27a,57b5a0a..2ff4dac
--- a/include/gfx/GP_Circle.h
+++ b/include/gfx/GP_Circle.h
@@@ -28,16 -28,22 +28,22 @@@
#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);
+ void GP_FillRing(GP_Context *context, int xcenter, int ycenter,
+ unsigned int outer_r, unsigned int inner_r, GP_Pixel pixel);
+
+ void GP_TFillRing(GP_Context *context, int xcenter, int ycenter,
+ unsigned int outer_r, unsigned int inner_r, GP_Pixel pixel);
+
#endif /* GP_CIRCLE_H */
-----------------------------------------------------------------------
Summary of changes:
include/gfx/GP_Circle.h | 6 ++
libs/gfx/GP_Circle.c | 24 ++++++++++
.../algo/{FillCircle.algo.h => FillRing.algo.h} | 49 +++++++++++++-------
tests/SDL/shapetest.c | 29 ++++++++++-
4 files changed, 88 insertions(+), 20 deletions(-)
copy libs/gfx/algo/{FillCircle.algo.h => FillRing.algo.h} (66%)
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.")
1
0
[repo.or.cz] gfxprim.git branch generate updated: 2d34007fde18efe7a66079b899a16eae0bfd2dbc
by metan 17 Jul '11
by metan 17 Jul '11
17 Jul '11
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 2d34007fde18efe7a66079b899a16eae0bfd2dbc (commit)
from f7289bd299e2a2414ab8b69f692f6e36f701a2e3 (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/2d34007fde18efe7a66079b899a16eae0bfd…
commit 2d34007fde18efe7a66079b899a16eae0bfd2dbc
Author: Cyril Hrubis <metan(a)ucw.cz>
Date: Sun Jul 17 20:25:45 2011 +0200
Changed GP_Color api.
* GP_Color is now enum
* Color Name is string
diff --git a/include/core/GP_Color.h b/include/core/GP_Color.h
index 1fddae9..8bda861 100644
--- a/include/core/GP_Color.h
+++ b/include/core/GP_Color.h
@@ -23,13 +23,20 @@
* *
*****************************************************************************/
+ /*
+
+ Color.
+
+ */
+
#ifndef GP_COLOR_H
#define GP_COLOR_H
#include "GP_Context.h"
#include "GP_Pixel.h"
-typedef enum GP_ColorName {
+typedef enum GP_Color {
+ GP_COL_INVALID = -1,
GP_COL_BLACK,
GP_COL_RED,
GP_COL_GREEN,
@@ -42,8 +49,23 @@ typedef enum GP_ColorName {
GP_COL_PURPLE,
GP_COL_WHITE,
GP_COL_MAX,
-} GP_ColorName;
+} GP_Color;
+
+/*
+ * Converts Color to Pixel
+ */
+GP_Pixel GP_ColorToPixel(GP_Context *context, GP_Color col);
+
+/*
+ * Converts Color name to Color.
+ */
+GP_Color GP_ColorNameToColor(const char *color_name);
+
+const char *GP_ColorToColorName(GP_Color col);
-GP_Pixel GP_ColorNameToPixel(GP_Context *context, GP_ColorName name);
+/*
+ * Converts Color name to Pixel.
+ */
+GP_Pixel GP_ColorNameToPixel(GP_Context *context, const char *color_name);
#endif /* GP_COLOR_H */
diff --git a/libs/core/GP_Color.c b/libs/core/GP_Color.c
index 19906e3..b6981d9 100644
--- a/libs/core/GP_Color.c
+++ b/libs/core/GP_Color.c
@@ -28,40 +28,71 @@
#include "GP_Color.h"
#include <stdint.h>
+#include <string.h>
static char *color_names[] = {
- "black ",
- "red ",
- "green ",
- "blue ",
- "yellow ",
- "brown ",
- "orange ",
- "gray dark ",
- "gray light",
- "purple ",
- "white "
+ "Black",
+ "Red",
+ "Green",
+ "Blue",
+ "Yellow",
+ "Brown",
+ "Orange",
+ "DarkGray",
+ "LightGray",
+ "Purple",
+ "White"
};
static uint8_t rgb888_colors[][3] = {
- {0x00, 0x00, 0x00}, /* black */
- {0xff, 0x00, 0x00}, /* red */
- {0x00, 0xff, 0x00}, /* green */
- {0x00, 0x00, 0xff}, /* blue */
- {0xff, 0xff, 0x00}, /* yellow */
- {0xa5, 0x2a, 0x2a}, /* brown */
- {0xff, 0xa5, 0x00}, /* orange */
- {0x7f, 0x7f, 0x7f}, /* gray dark */
- {0xbe, 0xbe, 0xbe}, /* gray light */
- {0xa0, 0x20, 0xf0}, /* purple */
- {0xff, 0xff, 0xff}, /* white */
+ {0x00, 0x00, 0x00}, /* Black */
+ {0xff, 0x00, 0x00}, /* Red */
+ {0x00, 0xff, 0x00}, /* Green */
+ {0x00, 0x00, 0xff}, /* Blue */
+ {0xff, 0xff, 0x00}, /* Yellow */
+ {0xa5, 0x2a, 0x2a}, /* Brown */
+ {0xff, 0xa5, 0x00}, /* Orange */
+ {0x7f, 0x7f, 0x7f}, /* DarkGray */
+ {0xbe, 0xbe, 0xbe}, /* LigthGray */
+ {0xa0, 0x20, 0xf0}, /* Purple */
+ {0xff, 0xff, 0xff}, /* White */
};
-GP_Pixel GP_ColorNameToPixel(GP_Context *context, GP_ColorName name)
+GP_Pixel GP_ColorToPixel(GP_Context *context, GP_Color col)
{
- GP_ASSERT(name < GP_COL_MAX);
+ GP_ASSERT(col < GP_COL_MAX);
+ GP_ASSERT(col >= 0);
- return GP_RGBToPixel(rgb888_colors[name][0],
- rgb888_colors[name][1],
- rgb888_colors[name][2], context->pixel_type);
+ return GP_RGBToPixel(rgb888_colors[col][0],
+ rgb888_colors[col][1],
+ rgb888_colors[col][2], context->pixel_type);
+}
+
+GP_Color GP_ColorNameToColor(const char *color_name)
+{
+ unsigned int i;
+
+ for (i = 0; i < GP_COL_MAX; i++)
+ if (!strcasecmp(color_name, color_names[i]))
+ return i;
+
+ return -1;
+}
+
+const char *GP_ColorToColorName(GP_Color col)
+{
+ if (col < 0 || col >= GP_COL_MAX)
+ return NULL;
+
+ return color_names[col];
+}
+
+GP_Pixel GP_ColorNameToPixel(GP_Context *context, const char *color_name)
+{
+ GP_Color col = GP_ColorNameToColor(color_name);
+
+ if (col < 0)
+ return 0;
+
+ return GP_ColorToPixel(context, col);
}
diff --git a/tests/SDL/fileview.c b/tests/SDL/fileview.c
index d7eead9..4bbe940 100644
--- a/tests/SDL/fileview.c
+++ b/tests/SDL/fileview.c
@@ -237,12 +237,12 @@ int main(int argc, char *argv[])
GP_SDL_ContextFromSurface(&context, display);
/* Load colors suitable for the display */
- white_pixel = GP_ColorNameToPixel(&context, GP_COL_WHITE);
- gray_pixel = GP_ColorNameToPixel(&context, GP_COL_GRAY_LIGHT);
- dark_gray_pixel = GP_ColorNameToPixel(&context, GP_COL_GRAY_DARK);
- black_pixel = GP_ColorNameToPixel(&context, GP_COL_BLACK);
- red_pixel = GP_ColorNameToPixel(&context, GP_COL_RED);
- blue_pixel = GP_ColorNameToPixel(&context, GP_COL_BLUE);
+ white_pixel = GP_ColorToPixel(&context, GP_COL_WHITE);
+ gray_pixel = GP_ColorToPixel(&context, GP_COL_GRAY_LIGHT);
+ dark_gray_pixel = GP_ColorToPixel(&context, GP_COL_GRAY_DARK);
+ black_pixel = GP_ColorToPixel(&context, GP_COL_BLACK);
+ red_pixel = GP_ColorToPixel(&context, GP_COL_RED);
+ blue_pixel = GP_ColorToPixel(&context, GP_COL_BLUE);
redraw_screen();
SDL_Flip(display);
diff --git a/tests/SDL/fonttest.c b/tests/SDL/fonttest.c
index 788f652..91f42fc 100644
--- a/tests/SDL/fonttest.c
+++ b/tests/SDL/fonttest.c
@@ -231,12 +231,12 @@ int main(int argc, char *argv[])
GP_SDL_ContextFromSurface(&context, display);
/* Load colors suitable for the display */
- white_pixel = GP_ColorNameToPixel(&context, GP_COL_WHITE);
- gray_pixel = GP_ColorNameToPixel(&context, GP_COL_GRAY_LIGHT);
- dark_gray_pixel = GP_ColorNameToPixel(&context, GP_COL_GRAY_DARK);
- black_pixel = GP_ColorNameToPixel(&context, GP_COL_BLACK);
- red_pixel = GP_ColorNameToPixel(&context, GP_COL_RED);
- blue_pixel = GP_ColorNameToPixel(&context, GP_COL_BLUE);
+ white_pixel = GP_ColorToPixel(&context, GP_COL_WHITE);
+ gray_pixel = GP_ColorToPixel(&context, GP_COL_GRAY_LIGHT);
+ dark_gray_pixel = GP_ColorToPixel(&context, GP_COL_GRAY_DARK);
+ black_pixel = GP_ColorToPixel(&context, GP_COL_BLACK);
+ red_pixel = GP_ColorToPixel(&context, GP_COL_RED);
+ blue_pixel = GP_ColorToPixel(&context, GP_COL_BLUE);
redraw_screen();
SDL_Flip(display);
diff --git a/tests/SDL/linetest.c b/tests/SDL/linetest.c
index 7012804..245b1ce 100644
--- a/tests/SDL/linetest.c
+++ b/tests/SDL/linetest.c
@@ -124,8 +124,8 @@ int main(int argc, char **argv)
GP_SDL_ContextFromSurface(&context, display);
/* Load colors in display format */
- black = GP_ColorNameToPixel(&context, GP_COL_BLACK);
- white = GP_ColorNameToPixel(&context, GP_COL_WHITE);
+ black = GP_ColorToPixel(&context, GP_COL_BLACK);
+ white = GP_ColorToPixel(&context, GP_COL_WHITE);
/* Set up the refresh timer */
timer = SDL_AddTimer(30, timer_callback, NULL);
diff --git a/tests/SDL/pixeltest.c b/tests/SDL/pixeltest.c
index 5ea47a1..467a17b 100644
--- a/tests/SDL/pixeltest.c
+++ b/tests/SDL/pixeltest.c
@@ -156,10 +156,10 @@ int main(int argc, char **argv)
GP_SDL_ContextFromSurface(&context, display);
/* Load pixel values compatible with the display. */
- red_pixel = GP_ColorNameToPixel(&context, GP_COL_RED);
- green_pixel = GP_ColorNameToPixel(&context, GP_COL_GREEN);
- blue_pixel = GP_ColorNameToPixel(&context, GP_COL_BLUE);
- white_pixel = GP_ColorNameToPixel(&context, GP_COL_WHITE);
+ red_pixel = GP_ColorToPixel(&context, GP_COL_RED);
+ green_pixel = GP_ColorToPixel(&context, GP_COL_GREEN);
+ blue_pixel = GP_ColorToPixel(&context, GP_COL_BLUE);
+ white_pixel = GP_ColorToPixel(&context, GP_COL_WHITE);
/* Set up the refresh timer */
timer = SDL_AddTimer(30, timer_callback, NULL);
diff --git a/tests/SDL/randomshapetest.c b/tests/SDL/randomshapetest.c
index 61c9f6f..592d466 100644
--- a/tests/SDL/randomshapetest.c
+++ b/tests/SDL/randomshapetest.c
@@ -89,13 +89,11 @@ void draw_random_circle(GP_Pixel pixel)
random_point(display, &x, &y);
int r = random() % 50;
- if (fill_flag) {
+ if (fill_flag)
GP_FillCircle(&context, x, y, r, pixel);
- }
- if (outline_flag) {
+ if (outline_flag)
GP_Circle(&context, x, y, r, white);
- }
}
void draw_random_ellipse(GP_Pixel pixel)
@@ -105,13 +103,11 @@ void draw_random_ellipse(GP_Pixel pixel)
int rx = random() % 50;
int ry = random() % 50;
- if (fill_flag) {
+ if (fill_flag)
GP_FillEllipse(&context, x, y, rx, ry, pixel);
- }
- if (outline_flag) {
+ if (outline_flag)
GP_Ellipse(&context, x, y, rx, ry, white);
- }
}
void draw_random_triangle(GP_Pixel pixel)
@@ -121,13 +117,11 @@ void draw_random_triangle(GP_Pixel pixel)
random_point(display, &x1, &y1);
random_point(display, &x2, &y2);
- if (fill_flag) {
+ if (fill_flag)
GP_FillTriangle(&context, x0, y0, x1, y1, x2, y2, pixel);
- }
- if (outline_flag) {
+ if (outline_flag)
GP_Triangle(&context, x0, y0, x1, y1, x2, y2, white);
- }
}
void draw_random_rectangle(GP_Pixel pixel)
@@ -136,13 +130,11 @@ void draw_random_rectangle(GP_Pixel pixel)
random_point(display, &x0, &y0);
random_point(display, &x1, &y1);
- if (fill_flag) {
+ if (fill_flag)
GP_FillRect(&context, x0, y0, x1, y1, pixel);
- }
- if (outline_flag) {
+ if (outline_flag)
GP_Rect(&context, x0, y0, x1, y1, white);
- }
}
void draw_random_tetragon(GP_Pixel pixel)
@@ -153,13 +145,11 @@ void draw_random_tetragon(GP_Pixel pixel)
random_point(display, &x2, &y2);
random_point(display, &x3, &y3);
- if (fill_flag) {
+ if (fill_flag)
GP_FillTetragon(&context, x0, y0, x1, y1, x2, y2, x3, y3, pixel);
- }
- if (outline_flag) {
+ if (outline_flag)
GP_Tetragon(&context, x0, y0, x1, y1, x2, y2, x3, y3, pixel);
- }
}
void clear_screen(void)
@@ -178,7 +168,8 @@ void redraw_screen(void)
/* Pick a random color for drawing. */
GP_Pixel pixel;
- pixel = GP_RGBToPixel(&context, random() % 256, random() % 256, random() % 256);
+ pixel = GP_RGBToPixel(random() % 256, random() % 256,
+ random() % 256, context.pixel_type);
switch (shape) {
case SHAPE_CIRCLE:
@@ -309,8 +300,8 @@ int main(int argc, char *argv[])
GP_SDL_ContextFromSurface(&context, display);
- white = GP_ColorNameToPixel(&context, GP_COL_WHITE);
- black = GP_ColorNameToPixel(&context, GP_COL_BLACK);
+ white = GP_ColorToPixel(&context, GP_COL_WHITE);
+ black = GP_ColorToPixel(&context, GP_COL_BLACK);
/* Set up the refresh timer */
timer = SDL_AddTimer(60, timer_callback, NULL);
diff --git a/tests/SDL/shapetest.c b/tests/SDL/shapetest.c
index 44f04cf..f91d94e 100644
--- a/tests/SDL/shapetest.c
+++ b/tests/SDL/shapetest.c
@@ -136,9 +136,8 @@ void draw_testing_triangle(int x, int y, int xradius, int yradius)
if (outline == 1)
GP_TTriangle(&context, x0, y0, x1, y1, x2, y2, yellow);
- if (fill) {
+ if (fill)
GP_TFillTriangle(&context, x0, y0, x1, y1, x2, y2, red);
- }
if (outline == 2)
GP_TTriangle(&context, x0, y0, x1, y1, x2, y2, white);
@@ -284,17 +283,16 @@ void event_loop(void)
break;
case SDLK_f:
fill = !fill;
- if (!fill && !outline) {
+ if (!fill && !outline)
outline = 1;
- }
break;
case SDLK_o:
outline++;
- if (outline == 3) { outline = 0; }
- if (!fill && outline == 0) {
+ if (outline == 3)
+ outline = 0;
+ if (!fill && outline == 0)
fill = 1;
- }
break;
case SDLK_a:
@@ -463,13 +461,13 @@ int main(int argc, char ** argv)
GP_SDL_ContextFromSurface(&context, display);
/* Load colors compatible with the display */
- black = GP_ColorNameToPixel(&context, GP_COL_BLACK);
- white = GP_ColorNameToPixel(&context, GP_COL_WHITE);
- yellow = GP_ColorNameToPixel(&context, GP_COL_YELLOW);
- green = GP_ColorNameToPixel(&context, GP_COL_GREEN);
- red = GP_ColorNameToPixel(&context, GP_COL_RED);
- gray = GP_ColorNameToPixel(&context, GP_COL_GRAY_LIGHT);
- darkgray = GP_ColorNameToPixel(&context, GP_COL_GRAY_DARK);
+ black = GP_ColorToPixel(&context, GP_COL_BLACK);
+ white = GP_ColorToPixel(&context, GP_COL_WHITE);
+ yellow = GP_ColorToPixel(&context, GP_COL_YELLOW);
+ green = GP_ColorToPixel(&context, GP_COL_GREEN);
+ red = GP_ColorToPixel(&context, GP_COL_RED);
+ gray = GP_ColorToPixel(&context, GP_COL_GRAY_LIGHT);
+ darkgray = GP_ColorToPixel(&context, GP_COL_GRAY_DARK);
/* Set up the refresh timer */
timer = SDL_AddTimer(60, timer_callback, NULL);
diff --git a/tests/SDL/sierpinsky.c b/tests/SDL/sierpinsky.c
index 333107f..b2e6dd8 100644
--- a/tests/SDL/sierpinsky.c
+++ b/tests/SDL/sierpinsky.c
@@ -55,7 +55,7 @@ static void sierpinsky(double x1, double y1, double x4, double y4, int iter)
{
double x2, y2, x3, y3, x5, y5;
GP_Pixel pixel;
- pixel = GP_RGBToPixel(context, 0, 0, 255-16*iter);
+ pixel = GP_RGBToPixel(0, 0, 255-16*iter, context->pixel_type);
if (iter <= 0) {
if (draw_edge)
@@ -162,10 +162,10 @@ int main(void)
display = SDL_GetVideoSurface();
context = GP_GetBackendVideoContext();
- black = GP_ColorNameToPixel(context, GP_COL_BLACK);
- blue = GP_ColorNameToPixel(context, GP_COL_BLUE);
- gray = GP_ColorNameToPixel(context, GP_COL_GRAY_LIGHT);
- red = GP_ColorNameToPixel(context, GP_COL_RED);
+ black = GP_ColorToPixel(context, GP_COL_BLACK);
+ blue = GP_ColorToPixel(context, GP_COL_BLUE);
+ gray = GP_ColorToPixel(context, GP_COL_GRAY_LIGHT);
+ red = GP_ColorToPixel(context, GP_COL_RED);
iter = 0;
draw(display->w/2, display->h/2, l, iter);
diff --git a/tests/SDL/symbolstest.c b/tests/SDL/symbolstest.c
index 532c13a..e7fd0a3 100644
--- a/tests/SDL/symbolstest.c
+++ b/tests/SDL/symbolstest.c
@@ -172,7 +172,7 @@ int main(int argc, char *argv[])
GP_SDL_ContextFromSurface(&context, display);
- black = GP_ColorNameToPixel(&context, GP_COL_BLACK);
+ black = GP_ColorToPixel(&context, GP_COL_BLACK);
/* Set up the refresh timer */
timer = SDL_AddTimer(60, timer_callback, NULL);
diff --git a/tests/SDL/textaligntest.c b/tests/SDL/textaligntest.c
index 348eab7..f7872ac 100644
--- a/tests/SDL/textaligntest.c
+++ b/tests/SDL/textaligntest.c
@@ -159,9 +159,9 @@ int main(void)
GP_SDL_ContextFromSurface(&context, display);
/* Load colors suitable for the display */
- black_pixel = GP_ColorNameToPixel(&context, GP_COL_BLACK);
- red_pixel = GP_ColorNameToPixel(&context, GP_COL_RED);
- blue_pixel = GP_ColorNameToPixel(&context, GP_COL_BLUE);
+ black_pixel = GP_ColorToPixel(&context, GP_COL_BLACK);
+ red_pixel = GP_ColorToPixel(&context, GP_COL_RED);
+ blue_pixel = GP_ColorToPixel(&context, GP_COL_BLUE);
redraw_screen();
SDL_Flip(display);
diff --git a/tests/SDL/trianglefps.c b/tests/SDL/trianglefps.c
index 17c0604..cf163bf 100644
--- a/tests/SDL/trianglefps.c
+++ b/tests/SDL/trianglefps.c
@@ -159,8 +159,8 @@ int main(int argc, char ** argv)
GP_SDL_ContextFromSurface(&context, display);
- white = GP_ColorNameToPixel(&context, GP_COL_WHITE);
- black = GP_ColorNameToPixel(&context, GP_COL_BLACK);
+ white = GP_ColorToPixel(&context, GP_COL_WHITE);
+ black = GP_ColorToPixel(&context, GP_COL_BLACK);
/* Set up the timer */
timer = SDL_AddTimer(1000, timer_callback, NULL);
-----------------------------------------------------------------------
Summary of changes:
include/core/GP_Color.h | 28 +++++++++++++--
libs/core/GP_Color.c | 85 +++++++++++++++++++++++++++++--------------
tests/SDL/fileview.c | 12 +++---
tests/SDL/fonttest.c | 12 +++---
tests/SDL/linetest.c | 4 +-
tests/SDL/pixeltest.c | 8 ++--
tests/SDL/randomshapetest.c | 37 +++++++------------
tests/SDL/shapetest.c | 26 ++++++-------
tests/SDL/sierpinsky.c | 10 +++---
tests/SDL/symbolstest.c | 2 +-
tests/SDL/textaligntest.c | 6 ++--
tests/SDL/trianglefps.c | 4 +-
12 files changed, 138 insertions(+), 96 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.")
1
0