From: <Sie...@us...> - 2009-02-15 20:04:16
|
Revision: 11615 http://alleg.svn.sourceforge.net/alleg/?rev=11615&view=rev Author: SiegeLord Date: 2009-02-15 20:04:10 +0000 (Sun, 15 Feb 2009) Log Message: ----------- Fixed negative delta theta arc drawing. Added some more ASSERTS to catch some other potentially bad parameters Modified Paths: -------------- allegro/branches/4.9/addons/primitives/high_primitives.c Modified: allegro/branches/4.9/addons/primitives/high_primitives.c =================================================================== --- allegro/branches/4.9/addons/primitives/high_primitives.c 2009-02-15 17:38:36 UTC (rev 11614) +++ allegro/branches/4.9/addons/primitives/high_primitives.c 2009-02-15 20:04:10 UTC (rev 11615) @@ -294,6 +294,9 @@ int ii; ASSERT(vbuff); + ASSERT(num_segments > 1); + ASSERT(rx >= 0); + ASSERT(ry >= 0); if (thickness > 0.0f) { theta = delta_theta / ((float)(num_segments) - 1); @@ -395,6 +398,9 @@ ALLEGRO_COLOR color, float thickness) { verify_cache(); + ASSERT(rx > 0); + ASSERT(ry > 0); + if (thickness > 0) { int num_segments = ALLEGRO_PRIM_QUALITY * sqrtf((rx + ry) / 2.0f); int ii; @@ -431,6 +437,8 @@ { int num_segments, ii; verify_cache(); + ASSERT(rx > 0); + ASSERT(ry > 0); num_segments = ALLEGRO_PRIM_QUALITY * sqrtf((rx + ry) / 2.0f); @@ -473,8 +481,9 @@ float delta_theta, ALLEGRO_COLOR color, float thickness) { verify_cache(); + ASSERT(r >= 0); if (thickness > 0) { - int num_segments = delta_theta / (2 * AL_PI) * ALLEGRO_PRIM_QUALITY * sqrtf(r); + int num_segments = fabs(delta_theta / (2 * AL_PI) * ALLEGRO_PRIM_QUALITY * sqrtf(r)); int ii; if (2 * num_segments >= ALLEGRO_VBUFF_CACHE_SIZE) { @@ -489,7 +498,7 @@ al_draw_prim(cache_buffer, 0, 0, 2 * num_segments, ALLEGRO_PRIM_TRIANGLE_STRIP); } else { - int num_segments = delta_theta / (2 * AL_PI) * ALLEGRO_PRIM_QUALITY * sqrtf(r); + int num_segments = fabs(delta_theta / (2 * AL_PI) * ALLEGRO_PRIM_QUALITY * sqrtf(r)); int ii; if (num_segments >= ALLEGRO_VBUFF_CACHE_SIZE) { @@ -521,6 +530,7 @@ float xdt2_term, xdt3_term; float ydt2_term, ydt3_term; + ASSERT(num_segments > 1); ASSERT(vbuff); ASSERT(points); update_point_cache(num_segments); @@ -582,7 +592,7 @@ 1.2 * ALLEGRO_PRIM_QUALITY / 10); verify_cache(); - + if (thickness > 0) { if (2 * num_segments >= ALLEGRO_VBUFF_CACHE_SIZE) { num_segments = (ALLEGRO_VBUFF_CACHE_SIZE - 1) / 2; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |