[CHG] Code formatting

This commit is contained in:
Crayon2000 2010-04-29 19:36:03 +00:00
parent 04cec42e7c
commit f9e3976fd5
3 changed files with 97 additions and 95 deletions

View file

@ -199,7 +199,6 @@ Mtx mv, mvi;
GX_LoadNrmMtxImm(mv, GX_PNMTX0); GX_LoadNrmMtxImm(mv, GX_PNMTX0);
} }
/** /**
* Set the view matrix to draw object (in this order scale, trans AND rotate). * Set the view matrix to draw object (in this order scale, trans AND rotate).
* @param posx x position of the object. * @param posx x position of the object.
@ -244,7 +243,6 @@ Mtx mv, mvi;
guMtxConcat(m, ObjTransformationMtx, ObjTransformationMtx); guMtxConcat(m, ObjTransformationMtx, ObjTransformationMtx);
} }
guMtxConcat(_GRR_view, ObjTransformationMtx, mv); guMtxConcat(_GRR_view, ObjTransformationMtx, mv);
GX_LoadPosMtxImm(mv, GX_PNMTX0); GX_LoadPosMtxImm(mv, GX_PNMTX0);

View file

@ -25,6 +25,11 @@ THE SOFTWARE.
* Inline functions for manipulating pixels in textures. * Inline functions for manipulating pixels in textures.
*/ */
#define _SHIFTL(v, s, w) \
((u32) (((u32)(v) & ((0x01 << (w)) - 1)) << (s)))
#define _SHIFTR(v, s, w) \
((u32)(((u32)(v) >> (s)) & ((0x01 << (w)) - 1)))
/** /**
* Return the color value of a pixel from a GRRLIB_texImg. * Return the color value of a pixel from a GRRLIB_texImg.
* @param x Specifies the x-coordinate of the pixel in the texture. * @param x Specifies the x-coordinate of the pixel in the texture.
@ -69,31 +74,30 @@ void GRRLIB_SetPixelTotexImg (const int x, const int y,
* Reads a pixel directly from the FrontBuffer. * Reads a pixel directly from the FrontBuffer.
* @param x The x-coordinate within the FB. * @param x The x-coordinate within the FB.
* @param y The y-coordinate within the FB. * @param y The y-coordinate within the FB.
* @return The color of a pixel in RGBA format.
*/ */
INLINE INLINE
u32 GRRLIB_GetPixelFromFB (int x, int y) { u32 GRRLIB_GetPixelFromFB (int x, int y) {
GXColor peekColor; u32 regval,val;
u32 MyColor;
GX_PeekARGB(x, y, &peekColor); regval = 0xc8000000|(_SHIFTL(x,2,10));
MyColor = RGBA(peekColor.r,peekColor.g,peekColor.b,peekColor.a); regval = (regval&~0x3FF000)|(_SHIFTL(y,12,10));
val = *(u32*)regval;
return (MyColor); return RGBA(_SHIFTR(val,16,8), _SHIFTR(val,8,8), val&0xff, _SHIFTR(val,24,8));
} }
/** /**
* Writes a pixel directly from the FrontBuffer. * Writes a pixel directly from the FrontBuffer.
* @param x The x-coordinate within the FB. * @param x The x-coordinate within the FB.
* @param y The y-coordinate within the FB. * @param y The y-coordinate within the FB.
* @param pokeColor The color of the pixel in RGBA format.
*/ */
INLINE INLINE
void GRRLIB_SetPixelToFB (int x, int y, u32 pokeColor) { void GRRLIB_SetPixelToFB (int x, int y, u32 pokeColor) {
GXColor MyColor; u32 regval;
MyColor.r=R(pokeColor); regval = 0xc8000000|(_SHIFTL(x,2,10));
MyColor.g=G(pokeColor); regval = (regval&~0x3FF000)|(_SHIFTL(y,12,10));
MyColor.b=B(pokeColor); *(u32*)regval = _SHIFTL(A(pokeColor),24,8) | _SHIFTL(R(pokeColor),16,8) | _SHIFTL(G(pokeColor),8,8) | (B(pokeColor)&0xff);
MyColor.a=A(pokeColor);
GX_PokeARGB(x, y, MyColor);
} }