[CHG] ScrShot using rmode->fbWidth, rmode->efbHeight instead of harcoded values.

This commit is contained in:
Crayon2000 2009-03-07 23:29:24 +00:00
parent f979db4aa4
commit e27b278a05
2 changed files with 14 additions and 16 deletions

View file

@ -14,7 +14,7 @@
#include "../lib/libjpeg/jpeglib.h" #include "../lib/libjpeg/jpeglib.h"
#include "GRRLIB.h" #include "GRRLIB.h"
#include <ogc/conf.h> #include <ogc/conf.h>
#include <fat.h> #include <fat.h>
#define DEFAULT_FIFO_SIZE (256 * 1024) /**< GX fifo buffer size. */ #define DEFAULT_FIFO_SIZE (256 * 1024) /**< GX fifo buffer size. */
@ -32,7 +32,7 @@ static GRRLIB_drawSettings GRRLIB_Settings;
* @param aa Set to true to enable AntiAliasing. (Default: Enabled) * @param aa Set to true to enable AntiAliasing. (Default: Enabled)
*/ */
void GRRLIB_SetAntiAliasing( bool aa ) { void GRRLIB_SetAntiAliasing( bool aa ) {
GRRLIB_Settings.antialias = aa; GRRLIB_Settings.antialias = aa;
} }
/** /**
@ -115,7 +115,7 @@ inline void GRRLIB_Circle(f32 x, f32 y, f32 radius, u32 color, u8 filled) {
u32 a; u32 a;
f32 ra; f32 ra;
f32 G_DTOR = M_DTOR * 10; f32 G_DTOR = M_DTOR * 10;
for (a = 0; a < 36; a++) { for (a = 0; a < 36; a++) {
ra = a * G_DTOR; ra = a * G_DTOR;
@ -333,7 +333,7 @@ void GRRLIB_PrintBMF(f32 xpos, f32 ypos, GRRLIB_bytemapFont bmf, f32 zoom, const
} }
} }
} }
GRRLIB_FlushTex(tex_BMfont); GRRLIB_FlushTex(tex_BMfont);
GRRLIB_DrawImg(0, 0, tex_BMfont, 0, 1, 1, 0xFFFFFFFF); GRRLIB_DrawImg(0, 0, tex_BMfont, 0, 1, 1, 0xFFFFFFFF);
free(tex_BMfont.data); free(tex_BMfont.data);
@ -643,9 +643,8 @@ bool GRRLIB_RectOnRect(int rect1x, int rect1y, int rect1w, int rect1h, int rect2
GRRLIB_PtInRect(rect1x, rect1y, rect1w, rect1h, rect2x, rect2y+rect2h)); GRRLIB_PtInRect(rect1x, rect1y, rect1w, rect1h, rect2x, rect2y+rect2h));
} }
/** /**
* Clip the drawing area to an rectangle * Clip the drawing area to an rectangle.
* @param x The x-coordinate of the rectangle. * @param x The x-coordinate of the rectangle.
* @param y The y-coordinate of the rectangle. * @param y The y-coordinate of the rectangle.
* @param width The width of the rectangle. * @param width The width of the rectangle.
@ -657,7 +656,7 @@ void GRRLIB_ClipDrawing( int x, int y, int width, int height ) {
} }
/** /**
* Reset the clipping to normal * Reset the clipping to normal.
*/ */
void GRRLIB_ClipReset() { void GRRLIB_ClipReset() {
GX_SetClipMode( GX_CLIP_DISABLE ); GX_SetClipMode( GX_CLIP_DISABLE );
@ -667,8 +666,8 @@ void GRRLIB_ClipReset() {
/** /**
* Set a texture's X and Y handles. (e.g. for rotation) * Set a texture's X and Y handles. (e.g. for rotation)
* @param tex The texture to set the handle on. * @param tex The texture to set the handle on.
* @param x The handle's x-coordinate * @param x The handle's x-coordinate.
* @param y The handle's y-coordinate * @param y The handle's y-coordinate.
*/ */
void GRRLIB_SetHandle( GRRLIB_texImg * tex, int x, int y ) { void GRRLIB_SetHandle( GRRLIB_texImg * tex, int x, int y ) {
if (tex->tilew) { if (tex->tilew) {
@ -693,7 +692,6 @@ void GRRLIB_SetMidHandle( GRRLIB_texImg * tex ) {
tex->offsety = 0; tex->offsety = 0;
} }
/** /**
* 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.
@ -1095,7 +1093,7 @@ bool GRRLIB_ScrShot(const char* File)
IMGCTX pngContext; IMGCTX pngContext;
if(fatInitDefault() && (pngContext = PNGU_SelectImageFromDevice(File))) { if(fatInitDefault() && (pngContext = PNGU_SelectImageFromDevice(File))) {
ErrorCode = PNGU_EncodeFromYCbYCr(pngContext, 640, 480, xfb[fb], 0); ErrorCode = PNGU_EncodeFromYCbYCr(pngContext, rmode->fbWidth, rmode->efbHeight, xfb[fb], 0);
PNGU_ReleaseImageContext(pngContext); PNGU_ReleaseImageContext(pngContext);
} }
return !ErrorCode; return !ErrorCode;

View file

@ -24,7 +24,7 @@
* Structure to hold the current drawing settings. * Structure to hold the current drawing settings.
*/ */
typedef struct GRRLIB_drawSettings { typedef struct GRRLIB_drawSettings {
bool antialias; /**< Flag for AntiAlias On/Off */ bool antialias; /**< Flag for AntiAlias On/Off. */
} GRRLIB_drawSettings; } GRRLIB_drawSettings;
/** /**
@ -33,10 +33,10 @@ typedef struct GRRLIB_drawSettings {
typedef struct GRRLIB_texImg { typedef struct GRRLIB_texImg {
unsigned int w; /**< Width of the texture. */ unsigned int w; /**< Width of the texture. */
unsigned int h; /**< Height of the texture. */ unsigned int h; /**< Height of the texture. */
int handlex; /**< handle x of the texture */ int handlex; /**< handle x of the texture. */
int handley; /**< handle y of the texture */ int handley; /**< handle y of the texture. */
int offsetx; /**< offset x of the texture */ int offsetx; /**< offset x of the texture. */
int offsety; /**< offset y of the texture */ int offsety; /**< offset y of the texture. */
unsigned int tilew; /**< Widht of a tile. */ unsigned int tilew; /**< Widht of a tile. */
unsigned int tileh; /**< Height of a tile. */ unsigned int tileh; /**< Height of a tile. */
unsigned int nbtilew; /**< Number of tiles for the x axis. */ unsigned int nbtilew; /**< Number of tiles for the x axis. */