use RageSurface
This commit is contained in:
@@ -14,7 +14,7 @@
|
||||
#include "archutils/win32/WindowsResources.h"
|
||||
|
||||
#include <mmsystem.h>
|
||||
#pragma comment(lib, "winmm.lib") // for GetMicrosecondsSinceStart
|
||||
#pragma comment(lib, "winmm.lib") // for timeGetTime
|
||||
|
||||
ArchHooks_Win32::ArchHooks_Win32()
|
||||
{
|
||||
|
||||
@@ -7,6 +7,8 @@
|
||||
#include "LoadingWindow_SDL.h"
|
||||
#include "loading.xpm"
|
||||
#include "StepMania.xpm" /* icon */
|
||||
#include "RageSurface.h"
|
||||
#include "RageSurfaceUtils.h"
|
||||
|
||||
/* XXX: What is all this Xbox junk doing in LoadingWindow_SDL? */
|
||||
|
||||
@@ -27,34 +29,40 @@ LoadingWindow_SDL::LoadingWindow_SDL()
|
||||
SDL_WM_SetCaption("Loading StepMania", "");
|
||||
|
||||
CString error;
|
||||
SDL_Surface *srf = RageSurface_Load_XPM( icon, error );
|
||||
RageSurface *srf = RageSurface_Load_XPM( icon, error );
|
||||
|
||||
Uint32 color;
|
||||
if( mySDL_MapRGBExact( srf->format, 0xFF, 0, 0xFF, color ) )
|
||||
mySDL_AddColorKey( srf, color );
|
||||
uint32_t color;
|
||||
if( srf->fmt.MapRGBA( 0xFF, 0, 0xFF, 0xFF, color ) )
|
||||
srf->format->palette->colors[ color ].a = 0;
|
||||
|
||||
#if !defined(DARWIN) || !DARWIN
|
||||
/* Windows icons are 32x32 and SDL can't resize them for us, which
|
||||
#if !defined(DARWIN)
|
||||
/* Windows icons are 32x32 and SDL can't resize them for us, which
|
||||
* causes mask corruption. (Actually, the above icon *is* 32x32;
|
||||
* this is here just in case it changes.) */
|
||||
ConvertSDLSurface(srf, srf->w, srf->h,
|
||||
RageSurfaceUtils::ConvertSurface(srf, srf->w, srf->h,
|
||||
32, 0xFF000000, 0x00FF0000, 0x0000FF00, 0x000000FF);
|
||||
zoomSurface(srf, 32, 32);
|
||||
|
||||
SDL_SetAlpha( srf, SDL_SRCALPHA, SDL_ALPHA_OPAQUE );
|
||||
SDL_WM_SetIcon(srf, NULL /* derive from alpha */);
|
||||
SDL_FreeSurface(srf);
|
||||
{
|
||||
SDL_Surface *pSDLSurface = SDLSurfaceFromRageSurface( srf );
|
||||
|
||||
SDL_SetAlpha( pSDLSurface, SDL_SRCALPHA, SDL_ALPHA_OPAQUE );
|
||||
SDL_WM_SetIcon( pSDLSurface, NULL ); /* derive from alpha */
|
||||
SDL_FreeSurface( pSDLSurface );
|
||||
}
|
||||
|
||||
delete srf;
|
||||
#endif
|
||||
|
||||
|
||||
/* Load the BMP - we need its dimensions */
|
||||
SDL_Surface *image = RageSurface_Load_XPM( loading, error );
|
||||
if( image == NULL )
|
||||
RageException::Throw("Couldn't load loading.bmp: %s",SDL_GetError());
|
||||
srf = RageSurface_Load_XPM( loading, error );
|
||||
if( srf == NULL ) // XXX SDL_GetError
|
||||
RageException::Throw( "Couldn't load loading.bmp: %s",SDL_GetError() );
|
||||
|
||||
|
||||
/* Initialize the window */
|
||||
loading_screen = SDL_SetVideoMode(image->w, image->h, 16, SDL_SWSURFACE|SDL_ANYFORMAT|SDL_NOFRAME);
|
||||
loading_screen = SDL_SetVideoMode( srf->w, srf->h, 16, SDL_SWSURFACE|SDL_ANYFORMAT|SDL_NOFRAME );
|
||||
if( loading_screen == NULL )
|
||||
RageException::Throw( "Couldn't initialize loading window: %s", SDL_GetError() );
|
||||
|
||||
@@ -86,12 +94,15 @@ LoadingWindow_SDL::LoadingWindow_SDL()
|
||||
|
||||
#endif
|
||||
|
||||
SDL_BlitSurface(image, NULL, loading_screen, NULL);
|
||||
{
|
||||
SDL_Surface *pSDLSurface = SDLSurfaceFromRageSurface( srf );
|
||||
SDL_BlitSurface( pSDLSurface, NULL, loading_screen, NULL );
|
||||
SDL_FreeSurface( pSDLSurface );
|
||||
}
|
||||
|
||||
SDL_FreeSurface(image);
|
||||
delete srf;
|
||||
|
||||
SDL_UpdateRect(loading_screen, 0,0,0,0);
|
||||
SDL_UpdateRect(loading_screen, 0,0,0,0);
|
||||
SDL_UpdateRect( loading_screen, 0,0,0,0 );
|
||||
}
|
||||
|
||||
#ifdef _XBOX
|
||||
|
||||
@@ -5,19 +5,20 @@
|
||||
#include "RageFileManager.h"
|
||||
#include "archutils/win32/WindowsResources.h"
|
||||
#include <windows.h>
|
||||
#include "SDL_utils.h"
|
||||
#include "RageSurface_Load.h"
|
||||
#include "RageSurface.h"
|
||||
#include "RageSurfaceUtils.h"
|
||||
|
||||
static HBITMAP g_hBitmap = NULL;
|
||||
|
||||
/* Load a file into a GDI surface. */
|
||||
HBITMAP LoadWin32Surface( CString fn )
|
||||
{
|
||||
SDL_Surface *s = RageSurfaceUtils::LoadFile( fn );
|
||||
RageSurface *s = RageSurfaceUtils::LoadFile( fn );
|
||||
if( s == NULL )
|
||||
return NULL;
|
||||
|
||||
ConvertSDLSurface( s, s->w, s->h, 32, 0xFF000000, 0x00FF0000, 0x0000FF00, 0 );
|
||||
RageSurfaceUtils::ConvertSurface( s, s->w, s->h, 32, 0xFF000000, 0x00FF0000, 0x0000FF00, 0 );
|
||||
|
||||
HBITMAP bitmap = CreateCompatibleBitmap( GetDC(NULL), s->w, s->h );
|
||||
ASSERT( bitmap );
|
||||
@@ -40,7 +41,7 @@ HBITMAP LoadWin32Surface( CString fn )
|
||||
SelectObject( BitmapDC, NULL );
|
||||
DeleteObject( BitmapDC );
|
||||
|
||||
SDL_FreeSurface( s );
|
||||
delete s;
|
||||
return bitmap;
|
||||
}
|
||||
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
#include "RageUtil.h"
|
||||
#include "RageLog.h"
|
||||
#include "RageException.h"
|
||||
#include "RageSurface.h"
|
||||
#include "arch/Dialog/Dialog.h"
|
||||
#include "SDL_utils.h"
|
||||
|
||||
@@ -212,14 +213,14 @@ void MovieTexture_DShow::CheckFrame()
|
||||
CreateTexture();
|
||||
|
||||
// DirectShow feeds us in BGR8
|
||||
SDL_Surface *fromDShow = SDL_CreateRGBSurfaceFrom(
|
||||
(void*)buffer, m_iSourceWidth, m_iSourceHeight,
|
||||
RageSurface *fromDShow = CreateSurfaceFrom(
|
||||
m_iSourceWidth, m_iSourceHeight,
|
||||
24,
|
||||
m_iSourceWidth*3,
|
||||
0xFF0000,
|
||||
0x00FF00,
|
||||
0x0000FF,
|
||||
0x000000 );
|
||||
0x000000,
|
||||
(uint8_t *) buffer, m_iSourceWidth*3 );
|
||||
|
||||
/* Optimization notes:
|
||||
*
|
||||
@@ -239,7 +240,7 @@ void MovieTexture_DShow::CheckFrame()
|
||||
m_iImageWidth, m_iImageHeight );
|
||||
CHECKPOINT;
|
||||
|
||||
SDL_FreeSurface( fromDShow );
|
||||
delete fromDShow;
|
||||
|
||||
buffer = NULL;
|
||||
|
||||
@@ -464,12 +465,12 @@ void MovieTexture_DShow::CreateTexture()
|
||||
|
||||
|
||||
const RageDisplay::PixelFormatDesc *pfd = DISPLAY->GetPixelFormatDesc(pixfmt);
|
||||
SDL_Surface *img = SDL_CreateRGBSurfaceSane(SDL_SWSURFACE, m_iTextureWidth, m_iTextureHeight,
|
||||
pfd->bpp, pfd->masks[0], pfd->masks[1], pfd->masks[2], pfd->masks[3]);
|
||||
RageSurface *img = CreateSurface( m_iTextureWidth, m_iTextureHeight,
|
||||
pfd->bpp, pfd->masks[0], pfd->masks[1], pfd->masks[2], pfd->masks[3] );
|
||||
|
||||
m_uTexHandle = DISPLAY->CreateTexture( pixfmt, img, false );
|
||||
|
||||
SDL_FreeSurface( img );
|
||||
delete img;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
#include "RageUtil.h"
|
||||
#include "RageTimer.h"
|
||||
#include "RageFile.h"
|
||||
#include "RageSurface.h"
|
||||
#include "SDL_utils.h"
|
||||
#include "PrefsManager.h"
|
||||
|
||||
@@ -629,7 +630,7 @@ void MovieTexture_FFMpeg::DestroyTexture()
|
||||
{
|
||||
if( m_img )
|
||||
{
|
||||
SDL_FreeSurface( m_img );
|
||||
delete m_img;
|
||||
m_img=NULL;
|
||||
}
|
||||
if(m_uTexHandle)
|
||||
@@ -712,8 +713,8 @@ void MovieTexture_FFMpeg::CreateTexture()
|
||||
LOG->Trace("format %i, %08x %08x %08x %08x",
|
||||
pfd->bpp, pfd->masks[0], pfd->masks[1], pfd->masks[2], pfd->masks[3]);
|
||||
|
||||
m_img = SDL_CreateRGBSurfaceSane(SDL_SWSURFACE, m_iTextureWidth, m_iTextureHeight,
|
||||
pfd->bpp, pfd->masks[0], pfd->masks[1], pfd->masks[2], pfd->masks[3]);
|
||||
m_img = CreateSurface( m_iTextureWidth, m_iTextureHeight, pfd->bpp,
|
||||
pfd->masks[0], pfd->masks[1], pfd->masks[2], pfd->masks[3] );
|
||||
}
|
||||
|
||||
m_uTexHandle = DISPLAY->CreateTexture( pixfmt, m_img, false );
|
||||
|
||||
@@ -65,7 +65,7 @@ private:
|
||||
|
||||
unsigned m_uTexHandle;
|
||||
|
||||
SDL_Surface *m_img;
|
||||
RageSurface *m_img;
|
||||
int m_AVTexfmt; /* AVPixelFormat_t of m_img */
|
||||
|
||||
SDL_sem *m_BufferFinished;
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
#include "RageException.h"
|
||||
#include "MovieTexture_Null.h"
|
||||
#include "SDL_utils.h"
|
||||
#include "RageSurface.h"
|
||||
|
||||
MovieTexture_Null::MovieTexture_Null(RageTextureID ID) : RageMovieTexture(ID)
|
||||
{
|
||||
@@ -30,12 +31,12 @@ MovieTexture_Null::MovieTexture_Null(RageTextureID ID) : RageMovieTexture(ID)
|
||||
RageDisplay::PixelFormat pixfmt = RageDisplay::FMT_RGBA4;
|
||||
|
||||
const RageDisplay::PixelFormatDesc *pfd = DISPLAY->GetPixelFormatDesc( pixfmt );
|
||||
SDL_Surface *img = SDL_CreateRGBSurfaceSane(SDL_SWSURFACE, size, size, pfd->bpp, pfd->masks[0],
|
||||
pfd->masks[1], pfd->masks[2], pfd->masks[3]);
|
||||
RageSurface *img = CreateSurface( size, size, pfd->bpp,
|
||||
pfd->masks[0], pfd->masks[1], pfd->masks[2], pfd->masks[3] );
|
||||
|
||||
texHandle = DISPLAY->CreateTexture( pixfmt, img, false );
|
||||
|
||||
SDL_FreeSurface(img);
|
||||
delete img;
|
||||
}
|
||||
|
||||
MovieTexture_Null::~MovieTexture_Null()
|
||||
|
||||
Reference in New Issue
Block a user