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 b8038ff42052c3ff217d4739e5501279936d0303 (commit) via 831f6b2be47a611581e47f7616516bc70c9d91c7 (commit) from f6c5774e42d209fcc3bff4acb515739172dfdb97 (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/b8038ff42052c3ff217d4739e5501279936d0...
commit b8038ff42052c3ff217d4739e5501279936d0303 Author: Cyril Hrubis metan@ucw.cz Date: Sat Oct 15 15:55:41 2011 +0200
Make the GP_Color API match the GP_Pixel API.
diff --git a/include/core/GP_Color.h b/include/core/GP_Color.h index a636cd0..4e39e07 100644 --- a/include/core/GP_Color.h +++ b/include/core/GP_Color.h @@ -36,6 +36,9 @@ #include "GP_Context.h" #include "GP_Pixel.h"
+/* + * Enumeration of color constants. + */ typedef enum GP_Color { GP_COL_INVALID = -1, GP_COL_BLACK, @@ -53,21 +56,67 @@ typedef enum GP_Color { } GP_Color;
/* - * Converts Color to Pixel + * Converts GP_Color to GP_Pixel. + */ +GP_Pixel GP_ColorToPixel(GP_Color color, GP_PixelType pixel_type); + +/* + * Converts GP_Color to GP_Pixel. */ -GP_Pixel GP_ColorToPixel(GP_Context *context, GP_Color color); +static inline GP_Pixel GP_ColorToContextPixel(GP_Color color, + GP_Context *context) +{ + return GP_ColorToPixel(color, context->pixel_type); +}
/* - * Converts Color name to Color. + * Converts Color name (eg. string) to GP_Color. */ GP_Color GP_ColorNameToColor(const char *color_name);
+/* + * Converts GP_Color to color name. + * + * If color is not valid NULL is returned. + */ const char *GP_ColorToColorName(GP_Color color);
/* * Converts Color name to Pixel. + * + * Returns true if conversion was successful false otherwise. */ -bool GP_ColorNameToPixel(GP_Context *context, const char *color_name, +bool GP_ColorNameToPixel(const char *color_name, GP_PixelType pixel_type, GP_Pixel *pixel);
+/* + * Converts Color name to Pixel. + * + * Returns true if conversion was successful false otherwise. + */ +static inline bool GP_ColorNameContextToPixel(const char *color_name, + GP_PixelType pixel_type, + GP_Pixel *pixel) +{ + return GP_ColorNameToPixel(color_name, pixel_type, pixel); +} + +/* + * Loads all colors into array of GP_Pixel of size GP_COL_MAX. + * + * The colors are then used as pixels[GP_COL_XXX]; + */ +void GP_ColorLoadPixels(GP_Pixel pixels[], GP_PixelType pixel_type); + +/* + * Loads all colors into array of GP_Pixel of size GP_COL_MAX. + * + * The colors are then used as pixels[GP_COL_XXX]; + */ +static inline void GP_ColorLoadContextPixels(GP_Pixel pixels[], + GP_Context *context) +{ + GP_ColorLoadPixels(pixels, context->pixel_type); +} + #endif /* GP_COLOR_H */ diff --git a/libs/core/GP_Color.c b/libs/core/GP_Color.c index 672089e..bf055b2 100644 --- a/libs/core/GP_Color.c +++ b/libs/core/GP_Color.c @@ -19,16 +19,17 @@ * Copyright (C) 2009-2010 Jiri "BlueBear" Dluhos * * jiri.bluebear.dluhos@gmail.com * * * - * Copyright (C) 2009-2010 Cyril Hrubis metan@ucw.cz * + * Copyright (C) 2009-2011 Cyril Hrubis metan@ucw.cz * * * *****************************************************************************/
+#include <stdint.h> +#include <string.h> + #include "GP_Convert.h"
#include "GP_Color.h"
-#include <stdint.h> -#include <string.h>
static char *color_names[] = { "Black", @@ -73,17 +74,18 @@ static uint8_t p8_colors[] = { 0xff, /* White */ };
-GP_Pixel GP_ColorToPixel(GP_Context *context, GP_Color col) +GP_Pixel GP_ColorToPixel(GP_Color color, GP_PixelType pixel_type) { - GP_ASSERT(col < GP_COL_MAX); - GP_ASSERT(col >= 0); + GP_ASSERT(color < GP_COL_MAX); + GP_ASSERT(color >= 0);
- if (context->pixel_type == GP_PIXEL_P8) - return p8_colors[col]; + if (pixel_type == GP_PIXEL_P8) + return p8_colors[color];
- return GP_RGBToPixel(rgb888_colors[col][0], - rgb888_colors[col][1], - rgb888_colors[col][2], context->pixel_type); + return GP_RGBToPixel(rgb888_colors[color][0], + rgb888_colors[color][1], + rgb888_colors[color][2], + pixel_type); }
GP_Color GP_ColorNameToColor(const char *color_name) @@ -97,23 +99,31 @@ GP_Color GP_ColorNameToColor(const char *color_name) return -1; }
-const char *GP_ColorToColorName(GP_Color col) +const char *GP_ColorToColorName(GP_Color color) { - if (col < 0 || col >= GP_COL_MAX) + if (color < 0 || color >= GP_COL_MAX) return NULL;
- return color_names[col]; + return color_names[color]; }
-bool GP_ColorNameToPixel(GP_Context *context, const char *color_name, +bool GP_ColorNameToPixel(const char *color_name, GP_PixelType pixel_type, GP_Pixel *pixel) { - GP_Color col = GP_ColorNameToColor(color_name); + GP_Color color = GP_ColorNameToColor(color_name);
- if (col == GP_COL_INVALID) + if (color == GP_COL_INVALID) return false;
- *pixel = GP_ColorToPixel(context, col); + *pixel = GP_ColorToPixel(pixel_type, color);
return true; } + +void GP_ColorLoadPixels(GP_Pixel pixels[], GP_PixelType pixel_type) +{ + unsigned int i; + + for (i = 0; i < GP_COL_MAX; i++) + pixels[i] = GP_ColorToPixel(i, pixel_type); +} diff --git a/tests/SDL/blittest.c b/tests/SDL/blittest.c index a62d381..be39c83 100644 --- a/tests/SDL/blittest.c +++ b/tests/SDL/blittest.c @@ -187,8 +187,8 @@ int main(int argc, char *argv[]) bitmap_conv = GP_ContextConvert(bitmap_raw, context.pixel_type); change_bitmap();
- black = GP_ColorToPixel(&context, GP_COL_BLACK); - white = GP_ColorToPixel(&context, GP_COL_WHITE); + black = GP_ColorToContextPixel(GP_COL_BLACK, &context); + white = GP_ColorToContextPixel(GP_COL_WHITE, &context);
/* Set up the refresh timer */ timer = SDL_AddTimer(60, timer_callback, NULL); diff --git a/tests/SDL/fileview.c b/tests/SDL/fileview.c index d4ceeda..c01a7fc 100644 --- a/tests/SDL/fileview.c +++ b/tests/SDL/fileview.c @@ -19,7 +19,7 @@ * Copyright (C) 2009-2010 Jiri "BlueBear" Dluhos * * jiri.bluebear.dluhos@gmail.com * * * - * Copyright (C) 2009-2010 Cyril Hrubis metan@ucw.cz * + * Copyright (C) 2009-2011 Cyril Hrubis metan@ucw.cz * * * *****************************************************************************/
@@ -238,12 +238,12 @@ int main(int argc, char *argv[]) GP_SDL_ContextFromSurface(&context, display);
/* Load colors suitable for the display */ - 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); + white_pixel = GP_ColorToContextPixel(GP_COL_WHITE, &context); + gray_pixel = GP_ColorToContextPixel(GP_COL_GRAY_LIGHT, &context); + dark_gray_pixel = GP_ColorToContextPixel(GP_COL_GRAY_DARK, &context); + black_pixel = GP_ColorToContextPixel(GP_COL_BLACK, &context); + red_pixel = GP_ColorToContextPixel(GP_COL_RED, &context); + blue_pixel = GP_ColorToContextPixel(GP_COL_BLUE, &context);
redraw_screen(); SDL_Flip(display); diff --git a/tests/SDL/fonttest.c b/tests/SDL/fonttest.c index 91f42fc..602c526 100644 --- a/tests/SDL/fonttest.c +++ b/tests/SDL/fonttest.c @@ -19,7 +19,7 @@ * Copyright (C) 2009-2010 Jiri "BlueBear" Dluhos * * jiri.bluebear.dluhos@gmail.com * * * - * Copyright (C) 2009-2010 Cyril Hrubis metan@ucw.cz * + * Copyright (C) 2009-2011 Cyril Hrubis metan@ucw.cz * * * *****************************************************************************/
@@ -231,12 +231,12 @@ int main(int argc, char *argv[]) GP_SDL_ContextFromSurface(&context, display);
/* Load colors suitable for the display */ - 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); + white_pixel = GP_ColorToContextPixel(GP_COL_WHITE, &context); + gray_pixel = GP_ColorToContextPixel(GP_COL_GRAY_LIGHT, &context); + dark_gray_pixel = GP_ColorToContextPixel(GP_COL_GRAY_DARK, &context); + black_pixel = GP_ColorToContextPixel(GP_COL_BLACK, &context); + red_pixel = GP_ColorToContextPixel(GP_COL_RED, &context); + blue_pixel = GP_ColorToContextPixel(GP_COL_BLUE, &context);
redraw_screen(); SDL_Flip(display); diff --git a/tests/SDL/input.c b/tests/SDL/input.c index ebc7820..c420b09 100644 --- a/tests/SDL/input.c +++ b/tests/SDL/input.c @@ -19,7 +19,7 @@ * Copyright (C) 2009-2010 Jiri "BlueBear" Dluhos * * jiri.bluebear.dluhos@gmail.com * * * - * Copyright (C) 2009-2010 Cyril Hrubis metan@ucw.cz * + * Copyright (C) 2009-2011 Cyril Hrubis metan@ucw.cz * * * *****************************************************************************/
@@ -30,18 +30,13 @@ #include "GP.h" #include "GP_SDL.h"
-/* The surface used as a display (in fact it is a software surface). */ SDL_Surface *display = NULL; GP_Context context;
-/* Timer used for refreshing the display */ SDL_TimerID timer; - -/* An event used for signaling that the timer was triggered. */ SDL_UserEvent timer_event;
-/* Values for color pixels in display format. */ -GP_Pixel black_pixel, red_pixel, green_pixel, blue_pixel, white_pixel; +GP_Pixel black_pixel, red_pixel, green_pixel, white_pixel;
Uint32 timer_callback(__attribute__((unused)) Uint32 interval, __attribute__((unused)) void *param) @@ -51,17 +46,7 @@ Uint32 timer_callback(__attribute__((unused)) Uint32 interval, return 30; }
-void draw_pixel(void) -{ -// GP_Color pixel, conv; - int x = random() % 320; - int y = random() % 240; - - - GP_PutPixel(&context, x, y, green_pixel); -} - -void draw_event(GP_Event *ev) +static void draw_event(GP_Event *ev) { if (ev->type != GP_EV_KEY) return; @@ -72,19 +57,7 @@ void draw_event(GP_Event *ev) SDL_Flip(display); }
-void draw_pixels(void) -{ - SDL_LockSurface(display); - - /* Draw some pixels (exact number is not important). */ - int i; - for (i = 0; i < 30; i++) - draw_pixel(); - - SDL_UnlockSurface(display); -} - -void event_loop(void) +static void event_loop(void) { SDL_Event event;
@@ -107,8 +80,12 @@ void event_loop(void) exit(0); break; case GP_BTN_LEFT: - GP_PutPixel(&context, ev.cursor_x, - ev.cursor_y, red_pixel); + GP_HLineXXY(&context, ev.cursor_x - 3, + ev.cursor_x + 3, + ev.cursor_y, red_pixel); + GP_VLineXYY(&context, ev.cursor_x, + ev.cursor_y - 3, + ev.cursor_y + 3, red_pixel); SDL_Flip(display); break; default: @@ -131,7 +108,7 @@ void event_loop(void) } }
-int main(int argc, char **argv) +int main(int argc, char *argv[]) { int display_bpp = 0;
@@ -150,7 +127,6 @@ int main(int argc, char **argv) return 1; }
- /* Create a window with a software back surface */ display = SDL_SetVideoMode(480, 640, display_bpp, SDL_SWSURFACE); if (display == NULL) { fprintf(stderr, "Could not open display: %sn", SDL_GetError()); @@ -159,37 +135,20 @@ int main(int argc, char **argv)
GP_EventSetScreenSize(480, 640);
- /* Print basic information about the surface */ - printf("Display surface properties:n"); - printf(" width: %4d, height: %4d, pitch: %4dn", - display->w, display->h, display->pitch); - printf(" bits per pixel: %2d, bytes per pixel: %2dn", - display->format->BitsPerPixel, display->format->BytesPerPixel); - - /* Set up a clipping rectangle to test proper clipping of pixels */ - SDL_Rect clip_rect = {10, 10, 300, 220}; - SDL_SetClipRect(display, &clip_rect); - GP_SDL_ContextFromSurface(&context, display);
- /* Load pixel values compatible with the display. */ - 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); - black_pixel = GP_ColorToPixel(&context, GP_COL_BLACK); + red_pixel = GP_ColorToContextPixel(GP_COL_RED, &context); + green_pixel = GP_ColorToContextPixel(GP_COL_GREEN, &context); + white_pixel = GP_ColorToContextPixel(GP_COL_WHITE, &context); + black_pixel = GP_ColorToContextPixel(GP_COL_BLACK, &context);
- /* Set up the refresh timer */ timer = SDL_AddTimer(30, timer_callback, NULL); if (timer == 0) { fprintf(stderr, "Could not set up timer: %sn", SDL_GetError()); goto fail; }
- /* Enter the event loop */ event_loop(); - - /* We're done */ SDL_Quit(); return 0;
diff --git a/tests/SDL/linetest.c b/tests/SDL/linetest.c index 245b1ce..1b01a3a 100644 --- a/tests/SDL/linetest.c +++ b/tests/SDL/linetest.c @@ -19,7 +19,7 @@ * Copyright (C) 2009-2010 Jiri "BlueBear" Dluhos * * jiri.bluebear.dluhos@gmail.com * * * - * Copyright (C) 2009-2010 Cyril Hrubis metan@ucw.cz * + * Copyright (C) 2009-2011 Cyril Hrubis metan@ucw.cz * * * *****************************************************************************/
@@ -124,8 +124,8 @@ int main(int argc, char **argv) GP_SDL_ContextFromSurface(&context, display);
/* Load colors in display format */ - black = GP_ColorToPixel(&context, GP_COL_BLACK); - white = GP_ColorToPixel(&context, GP_COL_WHITE); + black = GP_ColorToContextPixel(GP_COL_BLACK, &context); + white = GP_ColorToContextPixel(GP_COL_WHITE, &context);
/* 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 7102074..6d7ccf0 100644 --- a/tests/SDL/pixeltest.c +++ b/tests/SDL/pixeltest.c @@ -19,7 +19,7 @@ * Copyright (C) 2009-2010 Jiri "BlueBear" Dluhos * * jiri.bluebear.dluhos@gmail.com * * * - * Copyright (C) 2009-2010 Cyril Hrubis metan@ucw.cz * + * Copyright (C) 2009-2011 Cyril Hrubis metan@ucw.cz * * * *****************************************************************************/
@@ -53,34 +53,25 @@ Uint32 timer_callback(__attribute__((unused)) Uint32 interval,
void draw_pixel(void) { -// GP_Color pixel, conv; + GP_Pixel pixel; int x = random() % 320; int y = random() % 240;
-// pixel = GP_GetPixel(&context, x, y); + pixel = GP_GetPixel(&context, x, y);
- GP_PutPixel(&context, x, y, green_pixel); - - /* TODO: we cannot switch like this - we need either to convert blue - and others into Context format - at the very beginning, or make - a copy to convert it and match - agains what we get from GP_GetPixel - - if (pixel == blue) { - GP_PutPixel(&context, x, y, green); + if (pixel == blue_pixel) { + GP_PutPixel(&context, x, y, green_pixel); } - else if (pixel == red) { - GP_PutPixel(&context, x, y, white); + else if (pixel == red_pixel) { + GP_PutPixel(&context, x, y, white_pixel); } else { if (x < 160) { - GP_PutPixel(&context, x, y, blue); + GP_PutPixel(&context, x, y, blue_pixel); } else { - GP_PutPixel(&context, x, y, red); + GP_PutPixel(&context, x, y, red_pixel); } - } */ + } }
void draw_pixels(void) @@ -153,10 +144,10 @@ int main(int argc, char **argv) GP_SDL_ContextFromSurface(&context, display);
/* Load pixel values compatible with the display. */ - 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); + red_pixel = GP_ColorToContextPixel(GP_COL_RED, &context); + green_pixel = GP_ColorToContextPixel(GP_COL_GREEN, &context); + blue_pixel = GP_ColorToContextPixel(GP_COL_BLUE, &context); + white_pixel = GP_ColorToContextPixel(GP_COL_WHITE, &context);
/* 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 592d466..edc8554 100644 --- a/tests/SDL/randomshapetest.c +++ b/tests/SDL/randomshapetest.c @@ -19,7 +19,7 @@ * Copyright (C) 2009-2010 Jiri "BlueBear" Dluhos * * jiri.bluebear.dluhos@gmail.com * * * - * Copyright (C) 2009-2010 Cyril Hrubis metan@ucw.cz * + * Copyright (C) 2009-2011 Cyril Hrubis metan@ucw.cz * * * *****************************************************************************/
@@ -300,8 +300,8 @@ int main(int argc, char *argv[])
GP_SDL_ContextFromSurface(&context, display);
- white = GP_ColorToPixel(&context, GP_COL_WHITE); - black = GP_ColorToPixel(&context, GP_COL_BLACK); + white = GP_ColorToContextPixel(GP_COL_WHITE, &context); + black = GP_ColorToContextPixel(GP_COL_BLACK, &context);
/* 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 3c61629..d270528 100644 --- a/tests/SDL/shapetest.c +++ b/tests/SDL/shapetest.c @@ -19,7 +19,7 @@ * Copyright (C) 2009-2010 Jiri "BlueBear" Dluhos * * jiri.bluebear.dluhos@gmail.com * * * - * Copyright (C) 2009-2010 Cyril Hrubis metan@ucw.cz * + * Copyright (C) 2009-2011 Cyril Hrubis metan@ucw.cz * * * *****************************************************************************/
@@ -507,13 +507,13 @@ int main(int argc, char ** argv) GP_SDL_ContextFromSurface(&context, display);
/* Load colors compatible with the display */ - 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); + black = GP_ColorToContextPixel(GP_COL_BLACK, &context); + white = GP_ColorToContextPixel(GP_COL_WHITE, &context); + yellow = GP_ColorToContextPixel(GP_COL_YELLOW, &context); + green = GP_ColorToContextPixel(GP_COL_GREEN, &context); + red = GP_ColorToContextPixel(GP_COL_RED, &context); + gray = GP_ColorToContextPixel(GP_COL_GRAY_LIGHT, &context); + darkgray = GP_ColorToContextPixel(GP_COL_GRAY_DARK, &context);
/* 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 b2e6dd8..04ad559 100644 --- a/tests/SDL/sierpinsky.c +++ b/tests/SDL/sierpinsky.c @@ -19,7 +19,7 @@ * Copyright (C) 2009-2010 Jiri "BlueBear" Dluhos * * jiri.bluebear.dluhos@gmail.com * * * - * Copyright (C) 2009-2010 Cyril Hrubis metan@ucw.cz * + * Copyright (C) 2009-2011 Cyril Hrubis metan@ucw.cz * * * *****************************************************************************/
@@ -114,7 +114,8 @@ static void draw(int x, int y, int l, int iter)
int paused = 0;
-Uint32 timer_callback(Uint32 interval __attribute__ ((unused)), void *ptr __attribute__ ((unused))) +Uint32 timer_callback(Uint32 interval __attribute__ ((unused)), + void *ptr __attribute__ ((unused))) { if (paused) return TIMER_TICK; @@ -162,10 +163,10 @@ int main(void) display = SDL_GetVideoSurface(); context = GP_GetBackendVideoContext();
- 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); + black = GP_ColorToContextPixel(GP_COL_BLACK, context); + blue = GP_ColorToContextPixel(GP_COL_BLUE, context); + gray = GP_ColorToContextPixel(GP_COL_GRAY_LIGHT, context); + red = GP_ColorToContextPixel(GP_COL_RED, context);
iter = 0; draw(display->w/2, display->h/2, l, iter); diff --git a/tests/SDL/subcontext.c b/tests/SDL/subcontext.c index b8f68c4..bbdfeae 100644 --- a/tests/SDL/subcontext.c +++ b/tests/SDL/subcontext.c @@ -31,7 +31,7 @@ #include "GP.h" #include "GP_SDL.h"
-static GP_Pixel black, white, gray, red, green; +static GP_Pixel black, white, gray;
SDL_Surface *display = NULL; GP_Context context, *sub_context; @@ -256,11 +256,9 @@ int main(int argc, char *argv[])
GP_SDL_ContextFromSurface(&context, display); - black = GP_ColorToPixel(&context, GP_COL_BLACK); - white = GP_ColorToPixel(&context, GP_COL_WHITE); - gray = GP_ColorToPixel(&context, GP_COL_GRAY_DARK); - red = GP_ColorToPixel(&context, GP_COL_RED); - green = GP_ColorToPixel(&context, GP_COL_GREEN); + black = GP_ColorToContextPixel(GP_COL_BLACK, &context); + white = GP_ColorToContextPixel(GP_COL_WHITE, &context); + gray = GP_ColorToContextPixel(GP_COL_GRAY_DARK, &context);
sub_context = GP_ContextSubContext(&context, 100, 100, 440, 280); GP_Fill(sub_context, gray); diff --git a/tests/SDL/symbolstest.c b/tests/SDL/symbolstest.c index e7fd0a3..be96422 100644 --- a/tests/SDL/symbolstest.c +++ b/tests/SDL/symbolstest.c @@ -19,7 +19,7 @@ * Copyright (C) 2009-2010 Jiri "BlueBear" Dluhos * * jiri.bluebear.dluhos@gmail.com * * * - * Copyright (C) 2009-2010 Cyril Hrubis metan@ucw.cz * + * Copyright (C) 2009-2011 Cyril Hrubis metan@ucw.cz * * * *****************************************************************************/
@@ -172,7 +172,7 @@ int main(int argc, char *argv[])
GP_SDL_ContextFromSurface(&context, display);
- black = GP_ColorToPixel(&context, GP_COL_BLACK); + black = GP_ColorToContextPixel(GP_COL_BLACK, &context); /* 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 0ecad33..507b560 100644 --- a/tests/SDL/textaligntest.c +++ b/tests/SDL/textaligntest.c @@ -19,7 +19,7 @@ * Copyright (C) 2009-2010 Jiri "BlueBear" Dluhos * * jiri.bluebear.dluhos@gmail.com * * * - * Copyright (C) 2009-2010 Cyril Hrubis metan@ucw.cz * + * Copyright (C) 2009-2011 Cyril Hrubis metan@ucw.cz * * * *****************************************************************************/
@@ -159,12 +159,12 @@ int main(void) GP_SDL_ContextFromSurface(&context, display);
/* Load colors suitable for the display */ - 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); + black_pixel = GP_ColorToContextPixel(GP_COL_BLACK, &context); + red_pixel = GP_ColorToContextPixel(GP_COL_RED, &context); + blue_pixel = GP_ColorToContextPixel(GP_COL_BLUE, &context); + green_pixel = GP_ColorToContextPixel(GP_COL_GREEN, &context); + yellow_pixel = GP_ColorToContextPixel(GP_COL_YELLOW, &context); + darkgray_pixel = GP_ColorToContextPixel(GP_COL_GRAY_DARK, &context);
redraw_screen(); SDL_Flip(display); diff --git a/tests/SDL/trianglefps.c b/tests/SDL/trianglefps.c index cf163bf..5eda430 100644 --- a/tests/SDL/trianglefps.c +++ b/tests/SDL/trianglefps.c @@ -19,7 +19,7 @@ * Copyright (C) 2009-2010 Jiri "BlueBear" Dluhos * * jiri.bluebear.dluhos@gmail.com * * * - * Copyright (C) 2009-2010 Cyril Hrubis metan@ucw.cz * + * Copyright (C) 2009-2011 Cyril Hrubis metan@ucw.cz * * * *****************************************************************************/
@@ -159,8 +159,8 @@ int main(int argc, char ** argv)
GP_SDL_ContextFromSurface(&context, display);
- white = GP_ColorToPixel(&context, GP_COL_WHITE); - black = GP_ColorToPixel(&context, GP_COL_BLACK); + white = GP_ColorToContextPixel(GP_COL_WHITE, &context); + black = GP_ColorToContextPixel(GP_COL_BLACK, &context);
/* Set up the timer */ timer = SDL_AddTimer(1000, timer_callback, NULL);
http://repo.or.cz/w/gfxprim.git/commit/831f6b2be47a611581e47f7616516bc70c9d9...
commit 831f6b2be47a611581e47f7616516bc70c9d91c7 Author: Cyril Hrubis metan@ucw.cz Date: Sat Oct 15 15:46:36 2011 +0200
Remove unneeded header dependencies.
diff --git a/include/core/GP_Core.h b/include/core/GP_Core.h index b080db7..9bd927f 100644 --- a/include/core/GP_Core.h +++ b/include/core/GP_Core.h @@ -56,4 +56,7 @@ /* Debug and debug level */ #include "core/GP_Debug.h"
+/* Color */ +#include "core/GP_Color.h" + #endif /* GP_CORE_H */ diff --git a/include/gfx/GP_Gfx.h b/include/gfx/GP_Gfx.h index 4639b1f..5ab2f03 100644 --- a/include/gfx/GP_Gfx.h +++ b/include/gfx/GP_Gfx.h @@ -19,7 +19,7 @@ * Copyright (C) 2009-2010 Jiri "BlueBear" Dluhos * * jiri.bluebear.dluhos@gmail.com * * * - * Copyright (C) 2009-2010 Cyril Hrubis metan@ucw.cz * + * Copyright (C) 2009-2011 Cyril Hrubis metan@ucw.cz * * * *****************************************************************************/
@@ -33,13 +33,9 @@ #define GP_GFX_H
/* basic definitions and structures */ -#include "core/GP_Common.h" -#include "core/GP_Types.h" -#include "core/GP_Transform.h" #include "core/GP_Context.h" -#include "core/GP_WritePixel.h" #include "core/GP_GetPutPixel.h" -#include "core/GP_Color.h" +#include "core/GP_WritePixel.h"
/* public drawing API */ #include "GP_Fill.h"
-----------------------------------------------------------------------
Summary of changes: include/core/GP_Color.h | 57 ++++++++++++++++++++++++++++++++-- include/core/GP_Core.h | 3 ++ include/gfx/GP_Gfx.h | 8 +---- libs/core/GP_Color.c | 46 +++++++++++++++++----------- tests/SDL/blittest.c | 4 +- tests/SDL/fileview.c | 14 ++++---- tests/SDL/fonttest.c | 14 ++++---- tests/SDL/input.c | 71 +++++++++---------------------------------- tests/SDL/linetest.c | 6 ++-- tests/SDL/pixeltest.c | 37 ++++++++-------------- tests/SDL/randomshapetest.c | 6 ++-- tests/SDL/shapetest.c | 16 +++++----- tests/SDL/sierpinsky.c | 13 ++++---- tests/SDL/subcontext.c | 10 ++---- tests/SDL/symbolstest.c | 4 +- tests/SDL/textaligntest.c | 14 ++++---- tests/SDL/trianglefps.c | 6 ++-- 17 files changed, 168 insertions(+), 161 deletions(-)
repo.or.cz automatic notification. Contact project admin jiri.bluebear.dluhos@gmail.com if you want to unsubscribe, or site admin admin@repo.or.cz if you receive no reply.