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 e659d64782d1f5d6c93fc1547c81d941b5ea45bc (commit)
from c9a9d19055f9add550845b8e3c9050e7e32467c2 (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/e659d64782d1f5d6c93fc1547c81d941b5ea…
commit e659d64782d1f5d6c93fc1547c81d941b5ea45bc
Author: Cyril Hrubis <metan(a)ucw.cz>
Date: Wed Feb 8 20:27:09 2012 +0100
tests: Add LineAA to linetest.
* The key 'a' now changes between anti aliased
and normal lines.
diff --git a/tests/SDL/linetest.c b/tests/SDL/linetest.c
index 1b01a3a..9e35f96 100644
--- a/tests/SDL/linetest.c
+++ b/tests/SDL/linetest.c
@@ -54,6 +54,8 @@ Uint32 timer_callback(__attribute__((unused)) Uint32 interval,
double start_angle = 0.0;
+static int aa_flag = 0;
+
void redraw_screen(void)
{
double angle;
@@ -74,17 +76,18 @@ void redraw_screen(void)
GP_Pixel pixel;
pixel = GP_RGBToPixel(r, 0, b, context.pixel_type);
- /*
- * Draw the line forth and back to detect any pixel change
- * between one direction and the other.
- */
- GP_Line(&context, xcenter, ycenter, xcenter + x, ycenter + y, pixel);
- GP_Line(&context, xcenter + x, ycenter + y, xcenter, ycenter, pixel);
+ if (aa_flag) {
+ GP_LineAA_Raw(&context, GP_FP_FROM_INT(xcenter), GP_FP_FROM_INT(ycenter),
+ GP_FP_FROM_INT(xcenter + x), GP_FP_FROM_INT(ycenter + y), pixel);
+ } else {
+ GP_Line(&context, xcenter + x, ycenter + y, xcenter, ycenter, pixel);
+ GP_Line(&context, xcenter, ycenter, xcenter + x, ycenter + y, pixel);
+ }
}
/* axes */
- GP_HLineXYW(&context, 0, ycenter, display->w, white);
- GP_VLineXYH(&context, xcenter, 0, display->h, white);
+// GP_HLineXYW(&context, 0, ycenter, display->w, white);
+// GP_VLineXYH(&context, xcenter, 0, display->h, white);
SDL_UnlockSurface(display);
}
@@ -95,17 +98,25 @@ void event_loop(void)
while (SDL_WaitEvent(&event) > 0) {
switch (event.type) {
- case SDL_USEREVENT:
- redraw_screen();
- SDL_Flip(display);
- start_angle += 0.01;
- if (start_angle > 2*M_PI) {
- start_angle = 0.0;
- }
+ case SDL_USEREVENT:
+ redraw_screen();
+ SDL_Flip(display);
+ start_angle += 0.01;
+ if (start_angle > 2*M_PI) {
+ start_angle = 0.0;
+ }
+ break;
+ case SDL_KEYDOWN:
+ switch (event.key.keysym.sym) {
+ case SDLK_a:
+ aa_flag = !aa_flag;
break;
- case SDL_KEYDOWN:
- case SDL_QUIT:
+ default:
return;
+ }
+ break;
+ case SDL_QUIT:
+ return;
}
}
}
-----------------------------------------------------------------------
Summary of changes:
tests/SDL/linetest.c | 45 ++++++++++++++++++++++++++++-----------------
1 files changed, 28 insertions(+), 17 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.")