zoomSurface -> RageSurfaceUtils::Zoom
Zoom() handles its own format limitations
This commit is contained in:
@@ -159,9 +159,9 @@ struct BannerTexture: public RageTexture
|
|||||||
img->h > DISPLAY->GetMaxTextureSize() )
|
img->h > DISPLAY->GetMaxTextureSize() )
|
||||||
{
|
{
|
||||||
LOG->Warn("Converted %s at runtime", GetID().filename.c_str() );
|
LOG->Warn("Converted %s at runtime", GetID().filename.c_str() );
|
||||||
RageSurfaceUtils::ConvertSurface(img, img->w, img->h, 32, 0x000000FF, 0x0000FF00, 0x00FF0000, 0xFF000000);
|
int width = min( img->w, DISPLAY->GetMaxTextureSize() );
|
||||||
zoomSurface(img, min( img->w, DISPLAY->GetMaxTextureSize() ),
|
int height = min( img->h, DISPLAY->GetMaxTextureSize() );
|
||||||
min( img->h, DISPLAY->GetMaxTextureSize() ));
|
RageSurfaceUtils::Zoom( img, width, height );
|
||||||
}
|
}
|
||||||
|
|
||||||
/* We did this when we cached it. */
|
/* We did this when we cached it. */
|
||||||
@@ -375,8 +375,7 @@ void BannerCache::CacheBannerInternal( CString BannerPath )
|
|||||||
RageSurfaceUtils::ApplyHotPinkColorKey( img );
|
RageSurfaceUtils::ApplyHotPinkColorKey( img );
|
||||||
|
|
||||||
{
|
{
|
||||||
RageSurfaceUtils::ConvertSurface(img, img->w, img->h, 32, 0x000000FF, 0x0000FF00, 0x00FF0000, 0xFF000000);
|
RageSurfaceUtils::Zoom( img, width, height );
|
||||||
zoomSurface(img, width, height);
|
|
||||||
|
|
||||||
/* Dither to the final format. We use A1RGB5, since that's usually supported
|
/* Dither to the final format. We use A1RGB5, since that's usually supported
|
||||||
* natively by both OpenGL and D3D. */
|
* natively by both OpenGL and D3D. */
|
||||||
|
|||||||
@@ -151,9 +151,7 @@ void RageBitmapTexture::Create()
|
|||||||
}
|
}
|
||||||
|
|
||||||
if( img->w != m_iImageWidth || img->h != m_iImageHeight )
|
if( img->w != m_iImageWidth || img->h != m_iImageHeight )
|
||||||
{
|
RageSurfaceUtils::Zoom( img, m_iImageWidth, m_iImageHeight );
|
||||||
zoomSurface(img, m_iImageWidth, m_iImageHeight );
|
|
||||||
}
|
|
||||||
|
|
||||||
// Format of the image that we will pass to OpenGL and that we want OpenGL to use
|
// Format of the image that we will pass to OpenGL and that we want OpenGL to use
|
||||||
RageDisplay::PixelFormat pixfmt;
|
RageDisplay::PixelFormat pixfmt;
|
||||||
|
|||||||
@@ -660,7 +660,7 @@ bool RageDisplay::SaveScreenshot( CString sPath, GraphicsFileFormat format )
|
|||||||
* there's no sense in saving 1280x960 screenshots, and if we're in a custom
|
* there's no sense in saving 1280x960 screenshots, and if we're in a custom
|
||||||
* resolution (eg. 640x240), we don't want to output in that resolution. */
|
* resolution (eg. 640x240), we don't want to output in that resolution. */
|
||||||
if( format != SAVE_LOSSLESS && (surface->h != 640 || surface->w != 480) )
|
if( format != SAVE_LOSSLESS && (surface->h != 640 || surface->w != 480) )
|
||||||
zoomSurface( surface, 640, 480 );
|
RageSurfaceUtils::Zoom( surface, 640, 480 );
|
||||||
|
|
||||||
RageFile out;
|
RageFile out;
|
||||||
if( !out.Open( sPath, RageFile::WRITE ) )
|
if( !out.Open( sPath, RageFile::WRITE ) )
|
||||||
|
|||||||
@@ -131,7 +131,7 @@ static void ZoomSurface( const RageSurface * src, RageSurface * dst )
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void zoomSurface( RageSurface *&src, int dstwidth, int dstheight )
|
void RageSurfaceUtils::Zoom( RageSurface *&src, int dstwidth, int dstheight )
|
||||||
{
|
{
|
||||||
if( src == NULL )
|
if( src == NULL )
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -2,7 +2,10 @@
|
|||||||
#define SDL_ROTOZOOM_H
|
#define SDL_ROTOZOOM_H
|
||||||
|
|
||||||
struct RageSurface;
|
struct RageSurface;
|
||||||
void zoomSurface( RageSurface *&src, int dstwidth, int dstheight );
|
namespace RageSurfaceUtils
|
||||||
|
{
|
||||||
|
void Zoom( RageSurface *&src, int width, int height );
|
||||||
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@@ -124,9 +124,7 @@ void mySDL_WM_SetIcon( CString sIconFile )
|
|||||||
/* Windows icons are 32x32 and SDL can't resize them for us, which
|
/* Windows icons are 32x32 and SDL can't resize them for us, which
|
||||||
* causes mask corruption. (Actually, the above icon *is* 32x32;
|
* causes mask corruption. (Actually, the above icon *is* 32x32;
|
||||||
* this is here just in case it changes.) */
|
* this is here just in case it changes.) */
|
||||||
RageSurfaceUtils::ConvertSurface(srf, srf->w, srf->h,
|
RageSurfaceUtils::Zoom( srf, 32, 32 );
|
||||||
32, 0xFF000000, 0x00FF0000, 0x0000FF00, 0x000000FF);
|
|
||||||
zoomSurface(srf, 32, 32);
|
|
||||||
|
|
||||||
SDL_Surface *sdl_srf = SDLSurfaceFromRageSurface( srf );
|
SDL_Surface *sdl_srf = SDLSurfaceFromRageSurface( srf );
|
||||||
delete srf;
|
delete srf;
|
||||||
|
|||||||
Reference in New Issue
Block a user