trivial simplifications

This commit is contained in:
Glenn Maynard
2002-08-22 00:56:22 +00:00
parent 89a8953bba
commit bc7e0ceadd
+9 -16
View File
@@ -150,20 +150,15 @@ HRESULT CTextureRenderer::SetRenderTarget( RageMovieTexture* pTexture )
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
HRESULT CTextureRenderer::DoRenderSample( IMediaSample * pSample ) HRESULT CTextureRenderer::DoRenderSample( IMediaSample * pSample )
{ {
BYTE *pBmpBuffer, *pTxtBuffer; // Bitmap buffer, texture buffer BYTE *pBmpBuffer; // Bitmap buffer
LONG lTxtPitch; // Pitch of bitmap, texture
// Get the video bitmap buffer // Get the video bitmap buffer
pSample->GetPointer( &pBmpBuffer ); pSample->GetPointer( &pBmpBuffer );
// Find which texture we should render to. We want to copy to the "back buffer" // Find which texture we should render to. We want to copy to the "back buffer"
LPDIRECT3DTEXTURE8 pD3DTextureCopyTo; int iIndexBackBuffer = !m_pTexture->m_iIndexFrontBuffer;
switch( m_pTexture->m_iIndexFrontBuffer ) LPDIRECT3DTEXTURE8 pD3DTextureCopyTo = m_pTexture->m_pd3dTexture[iIndexBackBuffer];
{
case 0: pD3DTextureCopyTo = m_pTexture->m_pd3dTexture[1]; break; // 0 is front, so copy to 1
case 1: pD3DTextureCopyTo = m_pTexture->m_pd3dTexture[0]; break; // 1 is front, so copy to 0
}
// Lock the Texture // Lock the Texture
D3DLOCKED_RECT d3dlr; D3DLOCKED_RECT d3dlr;
@@ -176,9 +171,8 @@ HRESULT CTextureRenderer::DoRenderSample( IMediaSample * pSample )
m_bBackBufferLocked = TRUE; m_bBackBufferLocked = TRUE;
// Get the texture buffer & pitch // Get the texture buffer & pitch
pTxtBuffer = static_cast<byte *>(d3dlr.pBits); BYTE *pTxtBuffer = static_cast<byte *>(d3dlr.pBits);
lTxtPitch = d3dlr.Pitch; LONG lTxtPitch = d3dlr.Pitch;
// Copy the bits // Copy the bits
// OPTIMIZATION OPPORTUNITY: Use a video and texture // OPTIMIZATION OPPORTUNITY: Use a video and texture
@@ -238,11 +232,7 @@ HRESULT CTextureRenderer::DoRenderSample( IMediaSample * pSample )
// flip active texture // flip active texture
switch( m_pTexture->m_iIndexFrontBuffer ) m_pTexture->m_iIndexFrontBuffer = !m_pTexture->m_iIndexFrontBuffer;
{
case 0: m_pTexture->m_iIndexFrontBuffer = 1; break;
case 1: m_pTexture->m_iIndexFrontBuffer = 0; break;
}
return S_OK; return S_OK;
@@ -344,6 +334,9 @@ VOID RageMovieTexture::Create()
void HandleDivXError() void HandleDivXError()
{ {
/* Actually, we might need XviD; we might want to look
* at the file and try to figure out if it's something
* common: DIV3, DIV4, DIV5, XVID, or maybe even MPEG2. */
throw RageException( throw RageException(
"Could not locate the DivX video codec.\n" "Could not locate the DivX video codec.\n"
"DivX is required to movie textures and must\n" "DivX is required to movie textures and must\n"