[CHG] Modded Screen2Texture to be able to specify parameters

with this change you can make real GX compositing now ;)
This commit is contained in:
N0NameN0 2009-11-08 16:54:14 +00:00
parent 167bc0b7e3
commit 54a20ad5ca
2 changed files with 9 additions and 7 deletions

View file

@ -24,13 +24,16 @@ THE SOFTWARE.
/** /**
* Make a snapshot of the screen in a texture. * Make a snapshot of the screen in a texture.
* @param posx top left corner of the grabbed part
* @param posy top left corner of the grabbed part
* @param tex A pointer to a texture representing the screen or NULL if an error occurs. * @param tex A pointer to a texture representing the screen or NULL if an error occurs.
* @param clear, want that GX clear the grabbed part ?
*/ */
void GRRLIB_Screen2Texture (GRRLIB_texImg *tex) { void GRRLIB_Screen2Texture (int posx, int posy, GRRLIB_texImg *tex, bool clear) {
if(tex->data != NULL) { if(tex->data != NULL) {
GX_SetTexCopySrc(0, 0, rmode->fbWidth, rmode->efbHeight); GX_SetTexCopySrc(posx, posy, tex->w, tex->h);
GX_SetTexCopyDst(rmode->fbWidth, rmode->efbHeight, GX_TF_RGBA8, GX_FALSE); GX_SetTexCopyDst(tex->w, tex->h, GX_TF_RGBA8, GX_FALSE);
GX_CopyTex(tex->data, GX_FALSE); GX_CopyTex(tex->data, clear);
GX_PixModeSync(); GX_PixModeSync();
GRRLIB_FlushTex(tex); GRRLIB_FlushTex(tex);
} }

View file

@ -121,9 +121,8 @@ void GRRLIB_DrawTileQuad (const guVector pos[4], GRRLIB_texImg *tex,
void GRRLIB_Render (void) ; void GRRLIB_Render (void) ;
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
// GRRLIB_snapshot.c - Create a texture containing a snapshot of the framebuffer // GRRLIB_snapshot.c - Create a texture containing a snapshot of a part of the framebuffer
void GRRLIB_Screen2Texture (GRRLIB_texImg *tex) ; void GRRLIB_Screen2Texture (int posx, int posy, GRRLIB_texImg *tex, bool clear) ;
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
// GRRLIB_texEdit.c - Modifying the content of a texture // GRRLIB_texEdit.c - Modifying the content of a texture