From 2e8876f8998a783e5c5b299a601b92e9ef17d27f Mon Sep 17 00:00:00 2001 From: Crayon2000 Date: Fri, 6 Nov 2009 22:55:01 +0000 Subject: [PATCH] [CHG] GRRLIB_Rectangle is calling directly GX_Begin/GX_End [CHG] Documentation improvement --- GRRLIB/GRRLIB/grrlib/GRRLIB_cExtn.h | 4 +-- GRRLIB/GRRLIB/grrlib/GRRLIB_fbGX.h | 4 +++ GRRLIB/GRRLIB/grrlib/GRRLIB_fbSimple.h | 35 ++++++++++++++++++++------ 3 files changed, 33 insertions(+), 10 deletions(-) diff --git a/GRRLIB/GRRLIB/grrlib/GRRLIB_cExtn.h b/GRRLIB/GRRLIB/grrlib/GRRLIB_cExtn.h index ed088fd..6e0c267 100644 --- a/GRRLIB/GRRLIB/grrlib/GRRLIB_cExtn.h +++ b/GRRLIB/GRRLIB/grrlib/GRRLIB_cExtn.h @@ -30,13 +30,11 @@ THE SOFTWARE. /** * A helper function for the YCbCr -> RGB conversion. * Clamps the given value into a range of 0 - 255 and thus preventing an overflow. - * @param Value The value to clamp. + * @param Value The value to clamp. Using float to increase the precision. This makes a full spectrum (0 - 255) possible. * @return Returns a clean, clamped unsigned char. */ INLINE u8 GRRLIB_ClampVar8 (f32 Value) { - /* Using float to increase the precision. - This makes a full spectrum (0 - 255) possible. */ Value = roundf(Value); if (Value < 0) Value = 0 ; else if (Value > 255) Value = 255 ; diff --git a/GRRLIB/GRRLIB/grrlib/GRRLIB_fbGX.h b/GRRLIB/GRRLIB/grrlib/GRRLIB_fbGX.h index 156b98c..c30a36b 100644 --- a/GRRLIB/GRRLIB/grrlib/GRRLIB_fbGX.h +++ b/GRRLIB/GRRLIB/grrlib/GRRLIB_fbGX.h @@ -27,6 +27,10 @@ THE SOFTWARE. /** * Draws a vector. + * @param v The vector to draw. + * @param color The color of the vector in RGBA format. + * @param n Number of points in the vector. + * @param fmt Type of primitive. */ INLINE void GRRLIB_GXEngine (const guVector v[], const u32 color[], const long n, diff --git a/GRRLIB/GRRLIB/grrlib/GRRLIB_fbSimple.h b/GRRLIB/GRRLIB/grrlib/GRRLIB_fbSimple.h index 45947a5..126cdd7 100644 --- a/GRRLIB/GRRLIB/grrlib/GRRLIB_fbSimple.h +++ b/GRRLIB/GRRLIB/grrlib/GRRLIB_fbSimple.h @@ -84,12 +84,33 @@ INLINE void GRRLIB_Rectangle (const f32 x, const f32 y, const f32 width, const f32 height, const u32 color, const u8 filled) { - f32 x2 = x+width; - f32 y2 = y+height; - guVector v[] = { {x,y,0.0f}, {x2,y,0.0f}, {x2,y2,0.0f}, {x,y2,0.0f}, - {x,y,0.0f} }; - u32 ncolor[] = {color,color,color,color,color}; + f32 x2 = x + width; + f32 y2 = y + height; - if (!filled) GRRLIB_NGone (v, ncolor, 5) ; - else GRRLIB_NGoneFilled(v, ncolor, 4) ; + if (filled) { + GX_Begin(GX_QUADS, GX_VTXFMT0, 4); + GX_Position3f32(x,y,0.0f); + GX_Color1u32(color); + GX_Position3f32(x2,y,0.0f); + GX_Color1u32(color); + GX_Position3f32(x2,y2,0.0f); + GX_Color1u32(color); + GX_Position3f32(x,y2,0.0f); + GX_Color1u32(color); + GX_End(); + } + else { + GX_Begin(GX_LINESTRIP, GX_VTXFMT0, 5); + GX_Position3f32(x,y,0.0f); + GX_Color1u32(color); + GX_Position3f32(x2,y,0.0f); + GX_Color1u32(color); + GX_Position3f32(x2,y2,0.0f); + GX_Color1u32(color); + GX_Position3f32(x,y2,0.0f); + GX_Color1u32(color); + GX_Position3f32(x,y,0.0f); + GX_Color1u32(color); + GX_End(); + } }