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 8c91f2055c2d8a0f47593811e9ddb7261234d7b2 (commit) from 8dafb4ba1c30fc36d48f86e166212af3b7cf329c (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/8c91f2055c2d8a0f47593811e9ddb7261234d...
commit 8c91f2055c2d8a0f47593811e9ddb7261234d7b2 Author: Cyril Hrubis metan@ucw.cz Date: Sun Feb 12 12:08:48 2012 +0100
tests: blittest now tests rotated blits too.
diff --git a/tests/SDL/blittest.c b/tests/SDL/blittest.c index 2198e04..5136200 100644 --- a/tests/SDL/blittest.c +++ b/tests/SDL/blittest.c @@ -19,7 +19,7 @@ * Copyright (C) 2009-2010 Jiri "BlueBear" Dluhos * * jiri.bluebear.dluhos@gmail.com * * * - * Copyright (C) 2009-2011 Cyril Hrubis metan@ucw.cz * + * Copyright (C) 2009-2012 Cyril Hrubis metan@ucw.cz * * * *****************************************************************************/
@@ -63,7 +63,7 @@ void redraw_screen(void) bitmap_x += bitmap_vx; bitmap_y += bitmap_vy;
- if (bitmap_x + bitmap->w > context.w) { + if (bitmap_x + GP_ContextW(bitmap) > context.w) { bitmap_vx = -bitmap_vx; bitmap_x += bitmap_vx; } @@ -73,7 +73,7 @@ void redraw_screen(void) bitmap_x += bitmap_vx; }
- if (bitmap_y + bitmap->h > context.h) { + if (bitmap_y + GP_ContextH(bitmap) > context.h) { bitmap_vy = -bitmap_vy; bitmap_y += bitmap_vy; } @@ -85,12 +85,21 @@ void redraw_screen(void)
SDL_LockSurface(display);
+ GP_FillRectXYWH(&context, 20, 20, 300, 50, black); + GP_Text(&context, NULL, 20, 20, GP_ALIGN_RIGHT|GP_VALIGN_BOTTOM, white, black, text_buf); - GP_Blit(bitmap, 0, 0, bitmap->w, bitmap->h, &context, bitmap_x, bitmap_y);
- SDL_UpdateRect(display, bitmap_x, bitmap_y, bitmap->w, bitmap->h); - SDL_UpdateRect(display, 20, 20, 300, 50); + GP_Print(&context, NULL, 250, 20, GP_ALIGN_RIGHT|GP_VALIGN_BOTTOM, + white, black, "%c|%c|%c", bitmap->x_swap ? 'x' : ' ', + bitmap->y_swap ? 'y' : ' ', bitmap->axes_swap ? 'a' : ' '); + + GP_Blit(bitmap, 0, 0, GP_ContextW(bitmap), GP_ContextH(bitmap), + &context, bitmap_x, bitmap_y); + + SDL_UpdateRect(display, bitmap_x, bitmap_y, + GP_ContextW(bitmap), GP_ContextH(bitmap)); + SDL_UpdateRect(display, 20, 20, 400, 50);
SDL_UnlockSurface(display); } @@ -102,11 +111,9 @@ static void change_bitmap(void) else bitmap = bitmap_raw; - snprintf(text_buf, sizeof(text_buf), "Blitting '%s' -> '%s'", + snprintf(text_buf, sizeof(text_buf), "'%s' -> '%s'", GP_PixelTypes[bitmap->pixel_type].name, GP_PixelTypes[context.pixel_type].name); - - GP_FillRectXYWH(&context, 20, 20, 300, 50, black); }
void event_loop(void) @@ -125,12 +132,20 @@ void event_loop(void) case SDLK_p: pause_flag = !pause_flag; break; + case SDLK_x: + bitmap->x_swap = !bitmap->x_swap; + break; + case SDLK_y: + bitmap->y_swap = !bitmap->y_swap; + break; + case SDLK_a: + bitmap->axes_swap = !bitmap->axes_swap; + break; case SDLK_SPACE: change_bitmap(); break; case SDLK_ESCAPE: return; - default: break; } @@ -143,21 +158,34 @@ void event_loop(void) } }
+void print_instructions(void) +{ + printf("Use the following keys to control the test:n"); + printf(" Esc ................. exitn"); + printf(" Space ............... converts bitmap to screen pixel formatn"); + printf(" A ................... swap sprite axesn"); + printf(" X ................... mirror sprite Xn"); + printf(" Y ................... mirror sprite Yn"); + printf(" P ................... pausen"); +} + int main(int argc, char *argv[]) { - /* Bits per pixel to be set for the display surface. */ int display_bpp = 0; + const char *sprite = "ball.ppm"; + + print_instructions();
int i; 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; - } - else if (strcmp(argv[i], "-32") == 0) { + } else if (strcmp(argv[i], "-32") == 0) { display_bpp = 32; + } else { + sprite = argv[i]; } }
@@ -165,7 +193,7 @@ int main(int argc, char *argv[])
GP_RetCode ret;
- if ((ret = GP_LoadPPM("ball.ppm", &bitmap_raw))) { + if ((ret = GP_LoadImage(sprite, &bitmap_raw, NULL))) { fprintf(stderr, "Failed to load bitmap: %sn", GP_RetCodeName(ret)); return 1; }
-----------------------------------------------------------------------
Summary of changes: tests/SDL/blittest.c | 60 ++++++++++++++++++++++++++++++++++++------------- 1 files changed, 44 insertions(+), 16 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.