Integrate C++11 branch into 5_1-new
This commit is contained in:
+22
-22
@@ -36,9 +36,9 @@ RString GetErrorString( HRESULT hr )
|
||||
}
|
||||
|
||||
// Globals
|
||||
HMODULE g_D3D9_Module = NULL;
|
||||
LPDIRECT3D9 g_pd3d = NULL;
|
||||
LPDIRECT3DDEVICE9 g_pd3dDevice = NULL;
|
||||
HMODULE g_D3D9_Module = nullptr;
|
||||
LPDIRECT3D9 g_pd3d = nullptr;
|
||||
LPDIRECT3DDEVICE9 g_pd3dDevice = nullptr;
|
||||
D3DCAPS9 g_DeviceCaps;
|
||||
D3DDISPLAYMODE g_DesktopMode;
|
||||
D3DPRESENT_PARAMETERS g_d3dpp;
|
||||
@@ -252,13 +252,13 @@ RageDisplay_D3D::~RageDisplay_D3D()
|
||||
if( g_pd3dDevice )
|
||||
{
|
||||
g_pd3dDevice->Release();
|
||||
g_pd3dDevice = NULL;
|
||||
g_pd3dDevice = nullptr;
|
||||
}
|
||||
|
||||
if( g_pd3d )
|
||||
{
|
||||
g_pd3d->Release();
|
||||
g_pd3d = NULL;
|
||||
g_pd3d = nullptr;
|
||||
}
|
||||
|
||||
/* Even after we call Release(), D3D may still affect our window. It seems
|
||||
@@ -267,7 +267,7 @@ RageDisplay_D3D::~RageDisplay_D3D()
|
||||
if( g_D3D9_Module )
|
||||
{
|
||||
FreeLibrary( g_D3D9_Module );
|
||||
g_D3D9_Module = NULL;
|
||||
g_D3D9_Module = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -365,7 +365,7 @@ D3DFORMAT FindBackBufferType(bool bWindowed, int iBPP)
|
||||
|
||||
RString SetD3DParams( bool &bNewDeviceOut )
|
||||
{
|
||||
if( g_pd3dDevice == NULL ) // device is not yet created. We need to create it
|
||||
if( g_pd3dDevice == nullptr ) // device is not yet created. We need to create it
|
||||
{
|
||||
bNewDeviceOut = true;
|
||||
HRESULT hr = g_pd3d->CreateDevice(
|
||||
@@ -594,7 +594,7 @@ bool RageDisplay_D3D::BeginFrame()
|
||||
}
|
||||
}
|
||||
|
||||
g_pd3dDevice->Clear( 0, NULL, D3DCLEAR_TARGET|D3DCLEAR_ZBUFFER,
|
||||
g_pd3dDevice->Clear( 0, nullptr, D3DCLEAR_TARGET|D3DCLEAR_ZBUFFER,
|
||||
D3DCOLOR_XRGB(0,0,0), 1.0f, 0x00000000 );
|
||||
g_pd3dDevice->BeginScene();
|
||||
|
||||
@@ -642,7 +642,7 @@ bool RageDisplay_D3D::SupportsThreadedRendering()
|
||||
|
||||
RageSurface* RageDisplay_D3D::CreateScreenshot()
|
||||
{
|
||||
RageSurface * result = NULL;
|
||||
RageSurface * result = nullptr;
|
||||
|
||||
// Get the back buffer.
|
||||
IDirect3DSurface9* pSurface;
|
||||
@@ -654,9 +654,9 @@ RageSurface* RageDisplay_D3D::CreateScreenshot()
|
||||
|
||||
// Copy the back buffer into a surface of a type we support.
|
||||
IDirect3DSurface9* pCopy;
|
||||
if( SUCCEEDED( g_pd3dDevice->CreateOffscreenPlainSurface( desc.Width, desc.Height, D3DFMT_A8R8G8B8, D3DPOOL_SCRATCH, &pCopy, NULL ) ) )
|
||||
if( SUCCEEDED( g_pd3dDevice->CreateOffscreenPlainSurface( desc.Width, desc.Height, D3DFMT_A8R8G8B8, D3DPOOL_SCRATCH, &pCopy, nullptr ) ) )
|
||||
{
|
||||
if( SUCCEEDED( D3DXLoadSurfaceFromSurface( pCopy, NULL, NULL, pSurface, NULL, NULL, D3DX_FILTER_NONE, 0) ) )
|
||||
if( SUCCEEDED( D3DXLoadSurfaceFromSurface( pCopy, nullptr, nullptr, pSurface, nullptr, nullptr, D3DX_FILTER_NONE, 0) ) )
|
||||
{
|
||||
// Update desc from the copy.
|
||||
pCopy->GetDesc( &desc );
|
||||
@@ -674,7 +674,7 @@ RageSurface* RageDisplay_D3D::CreateScreenshot()
|
||||
}
|
||||
|
||||
RageSurface *surface = CreateSurfaceFromPixfmt( RagePixelFormat_RGBA8, lr.pBits, desc.Width, desc.Height, lr.Pitch);
|
||||
ASSERT( surface != NULL );
|
||||
ASSERT( surface != nullptr );
|
||||
|
||||
// We need to make a copy, since lr.pBits will go away when we call UnlockRect().
|
||||
result =
|
||||
@@ -722,9 +722,9 @@ void RageDisplay_D3D::SendCurrentMatrices()
|
||||
g_pd3dDevice->SetTextureStageState( tu, D3DTSS_TEXTURETRANSFORMFLAGS, D3DTTFF_COUNT2 );
|
||||
|
||||
// If no texture is set for this texture unit, don't bother setting it up.
|
||||
IDirect3DBaseTexture9* pTexture = NULL;
|
||||
IDirect3DBaseTexture9* pTexture = nullptr;
|
||||
g_pd3dDevice->GetTexture( tu, &pTexture );
|
||||
if( pTexture == NULL )
|
||||
if( pTexture == nullptr )
|
||||
continue;
|
||||
pTexture->Release();
|
||||
|
||||
@@ -1049,7 +1049,7 @@ void RageDisplay_D3D::SetTexture( TextureUnit tu, unsigned iTexture )
|
||||
|
||||
if( iTexture == 0 )
|
||||
{
|
||||
g_pd3dDevice->SetTexture( tu, NULL );
|
||||
g_pd3dDevice->SetTexture( tu, nullptr );
|
||||
|
||||
/* Intentionally commented out. Don't mess with texture stage state
|
||||
* when just setting the texture. Model sets its texture modes before
|
||||
@@ -1136,9 +1136,9 @@ void RageDisplay_D3D::SetBlendMode( BlendMode mode )
|
||||
g_pd3dDevice->SetRenderState( D3DRS_SRCBLEND, D3DBLEND_SRCALPHA );
|
||||
g_pd3dDevice->SetRenderState( D3DRS_DESTBLEND, D3DBLEND_ONE );
|
||||
break;
|
||||
// This is not the right way to do BLEND_SUBTRACT. This code is only here
|
||||
// to prevent crashing when someone tries to use it. -Kyz
|
||||
case BLEND_SUBTRACT:
|
||||
// This is not the right way to do BLEND_SUBTRACT. This code is only here
|
||||
// to prevent crashing when someone tries to use it. -Kyz
|
||||
case BLEND_SUBTRACT:
|
||||
g_pd3dDevice->SetRenderState( D3DRS_SRCBLEND, D3DBLEND_SRCALPHA );
|
||||
g_pd3dDevice->SetRenderState( D3DRS_DESTBLEND, D3DBLEND_ZERO );
|
||||
break;
|
||||
@@ -1241,7 +1241,7 @@ void RageDisplay_D3D::SetZTestMode( ZTestMode mode )
|
||||
|
||||
void RageDisplay_D3D::ClearZBuffer()
|
||||
{
|
||||
g_pd3dDevice->Clear( 0, NULL, D3DCLEAR_ZBUFFER, D3DCOLOR_XRGB(0,0,0), 1.0f, 0x00000000 );
|
||||
g_pd3dDevice->Clear( 0, nullptr, D3DCLEAR_ZBUFFER, D3DCOLOR_XRGB(0,0,0), 1.0f, 0x00000000 );
|
||||
}
|
||||
|
||||
void RageDisplay_D3D::SetTextureWrapping( TextureUnit tu, bool b )
|
||||
@@ -1372,7 +1372,7 @@ unsigned RageDisplay_D3D::CreateTexture(
|
||||
{
|
||||
HRESULT hr;
|
||||
IDirect3DTexture9* pTex;
|
||||
hr = g_pd3dDevice->CreateTexture( power_of_two(img->w), power_of_two(img->h), 1, 0, D3DFORMATS[pixfmt], D3DPOOL_MANAGED, &pTex, NULL );
|
||||
hr = g_pd3dDevice->CreateTexture( power_of_two(img->w), power_of_two(img->h), 1, 0, D3DFORMATS[pixfmt], D3DPOOL_MANAGED, &pTex, nullptr );
|
||||
|
||||
if( FAILED(hr) )
|
||||
RageException::Throw( "CreateTexture(%i,%i,%s) failed: %s",
|
||||
@@ -1409,7 +1409,7 @@ void RageDisplay_D3D::UpdateTexture(
|
||||
int xoffset, int yoffset, int width, int height )
|
||||
{
|
||||
IDirect3DTexture9* pTex = (IDirect3DTexture9*)uTexHandle;
|
||||
ASSERT( pTex != NULL );
|
||||
ASSERT( pTex != nullptr );
|
||||
|
||||
RECT rect;
|
||||
rect.left = xoffset;
|
||||
@@ -1432,7 +1432,7 @@ void RageDisplay_D3D::UpdateTexture(
|
||||
ASSERT( texpixfmt != NUM_RagePixelFormat );
|
||||
|
||||
RageSurface *Texture = CreateSurfaceFromPixfmt(RagePixelFormat(texpixfmt), lr.pBits, width, height, lr.Pitch);
|
||||
ASSERT( Texture != NULL );
|
||||
ASSERT( Texture != nullptr );
|
||||
RageSurfaceUtils::Blit( img, Texture, width, height );
|
||||
|
||||
delete Texture;
|
||||
|
||||
Reference in New Issue
Block a user