diff options
author | XhmikosR <xhmikosr@users.sourceforge.net> | 2012-02-05 13:27:07 +0400 |
---|---|---|
committer | XhmikosR <xhmikosr@users.sourceforge.net> | 2012-02-05 13:27:07 +0400 |
commit | 6cb2939b677159a85147c6500835c194ee1ccf86 (patch) | |
tree | 54994b57d8df3203b276d15ee73c46d227ea6826 /src/filters/renderer/VideoRenderers | |
parent | e736ccc10964dfcd571d1b0f07327819c31a63a9 (diff) |
apply astyle
git-svn-id: https://mpc-hc.svn.sourceforge.net/svnroot/mpc-hc/trunk@4039 10f7b99b-c216-0410-bff0-8a66a9350fd8
Diffstat (limited to 'src/filters/renderer/VideoRenderers')
25 files changed, 679 insertions, 675 deletions
diff --git a/src/filters/renderer/VideoRenderers/AllocatorCommon.cpp b/src/filters/renderer/VideoRenderers/AllocatorCommon.cpp index 62c98d783..5f0a7c23b 100644 --- a/src/filters/renderer/VideoRenderers/AllocatorCommon.cpp +++ b/src/filters/renderer/VideoRenderers/AllocatorCommon.cpp @@ -35,7 +35,7 @@ bool IsVMR9InGraph(IFilterGraph* pFG)
{
BeginEnumFilters(pFG, pEF, pBF)
- if(CComQIPtr<IVMRWindowlessControl9>(pBF)) {
+ if (CComQIPtr<IVMRWindowlessControl9>(pBF)) {
return true;
}
EndEnumFilters
@@ -103,7 +103,7 @@ HRESULT CreateEVR(const CLSID& clsid, HWND hWnd, bool bFullscreen, ISubPicAlloca *ppAP = DNew DSObjects::CEVRAllocatorPresenter(hWnd, bFullscreen, hr, Error);
(*ppAP)->AddRef();
- if(FAILED(hr)) {
+ if (FAILED(hr)) {
Error += L"\n";
Error += GetWindowsErrorMessage(hr, NULL);
MessageBox(hWnd, Error, L"Error creating EVR Custom renderer", MB_OK | MB_ICONERROR);
@@ -185,8 +185,8 @@ CString GetWindowsErrorMessage(HRESULT _Error, HMODULE _Module) CString errmsg;
LPVOID lpMsgBuf;
- if(FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER|FORMAT_MESSAGE_FROM_SYSTEM|FORMAT_MESSAGE_IGNORE_INSERTS|FORMAT_MESSAGE_FROM_HMODULE,
- _Module, _Error, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), (LPTSTR)&lpMsgBuf, 0, NULL)) {
+ if (FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER|FORMAT_MESSAGE_FROM_SYSTEM|FORMAT_MESSAGE_IGNORE_INSERTS|FORMAT_MESSAGE_FROM_HMODULE,
+ _Module, _Error, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), (LPTSTR)&lpMsgBuf, 0, NULL)) {
errmsg = (LPCTSTR)lpMsgBuf;
LocalFree(lpMsgBuf);
}
diff --git a/src/filters/renderer/VideoRenderers/AllocatorCommon7.cpp b/src/filters/renderer/VideoRenderers/AllocatorCommon7.cpp index 02d41e59a..b72091b36 100644 --- a/src/filters/renderer/VideoRenderers/AllocatorCommon7.cpp +++ b/src/filters/renderer/VideoRenderers/AllocatorCommon7.cpp @@ -35,7 +35,7 @@ bool IsVMR7InGraph(IFilterGraph* pFG)
{
BeginEnumFilters(pFG, pEF, pBF)
- if(CComQIPtr<IVMRWindowlessControl>(pBF)) {
+ if (CComQIPtr<IVMRWindowlessControl>(pBF)) {
return true;
}
EndEnumFilters
@@ -73,7 +73,7 @@ HRESULT CreateAP7(const CLSID& clsid, HWND hWnd, ISubPicAllocatorPresenter** ppA (*ppAP)->AddRef();
- if(FAILED(hr)) {
+ if (FAILED(hr)) {
(*ppAP)->Release();
*ppAP = NULL;
}
diff --git a/src/filters/renderer/VideoRenderers/D3DFont.cpp b/src/filters/renderer/VideoRenderers/D3DFont.cpp index 5b741ad30..e791c2d9f 100644 --- a/src/filters/renderer/VideoRenderers/D3DFont.cpp +++ b/src/filters/renderer/VideoRenderers/D3DFont.cpp @@ -131,7 +131,7 @@ HRESULT CD3DFont::CreateGDIFont( HDC hDC, HFONT* pFont ) CLIP_DEFAULT_PRECIS, ANTIALIASED_QUALITY,
VARIABLE_PITCH, m_strFontName );
- if( *pFont == NULL ) {
+ if ( *pFont == NULL ) {
return E_FAIL;
}
@@ -152,7 +152,7 @@ HRESULT CD3DFont::PaintAlphabet( HDC hDC, BOOL bMeasureOnly ) TCHAR str[2] = _T("x"); // One-character, null-terminated string
// Calculate the spacing between characters based on line height
- if( 0 == GetTextExtentPoint32( hDC, str, 1, &size ) ) {
+ if ( 0 == GetTextExtentPoint32( hDC, str, 1, &size ) ) {
return E_FAIL;
}
m_dwSpacing = (DWORD) ceil(size.cy * 0.3f);
@@ -162,25 +162,25 @@ HRESULT CD3DFont::PaintAlphabet( HDC hDC, BOOL bMeasureOnly ) DWORD y = 0;
// For each character, draw text on the DC and advance the current position
- for( char c = 32; c < 127; c++ ) {
+ for ( char c = 32; c < 127; c++ ) {
str[0] = c;
- if( 0 == GetTextExtentPoint32( hDC, str, 1, &size ) ) {
+ if ( 0 == GetTextExtentPoint32( hDC, str, 1, &size ) ) {
return E_FAIL;
}
- if( (DWORD)(x + size.cx + m_dwSpacing) > m_dwTexWidth ) {
+ if ( (DWORD)(x + size.cx + m_dwSpacing) > m_dwTexWidth ) {
x = m_dwSpacing;
y += size.cy + 1;
}
// Check to see if there's room to write the character here
- if( y + size.cy > m_dwTexHeight ) {
+ if ( y + size.cy > m_dwTexHeight ) {
return D3DERR_MOREDATA;
}
- if( !bMeasureOnly ) {
+ if ( !bMeasureOnly ) {
// Perform the actual drawing
- if( 0 == ExtTextOut( hDC, x+0, y+0, ETO_OPAQUE, NULL, str, 1, NULL ) ) {
+ if ( 0 == ExtTextOut( hDC, x+0, y+0, ETO_OPAQUE, NULL, str, 1, NULL ) ) {
return E_FAIL;
}
@@ -223,7 +223,7 @@ HRESULT CD3DFont::InitDeviceObjects( LPDIRECT3DDEVICE9 pd3dDevice ) SetMapMode( hDC, MM_TEXT );
hr = CreateGDIFont( hDC, &hFont );
- if( FAILED(hr) ) {
+ if ( FAILED(hr) ) {
goto LCleanReturn;
}
@@ -232,12 +232,12 @@ HRESULT CD3DFont::InitDeviceObjects( LPDIRECT3DDEVICE9 pd3dDevice ) // Calculate the dimensions for the smallest power-of-two texture which
// can hold all the printable characters
m_dwTexWidth = m_dwTexHeight = 128;
- while( D3DERR_MOREDATA == ( hr = PaintAlphabet( hDC, true ) ) ) {
+ while ( D3DERR_MOREDATA == ( hr = PaintAlphabet( hDC, true ) ) ) {
m_dwTexWidth *= 2;
m_dwTexHeight *= 2;
}
- if( FAILED(hr) ) {
+ if ( FAILED(hr) ) {
goto LCleanReturn;
}
@@ -246,7 +246,7 @@ HRESULT CD3DFont::InitDeviceObjects( LPDIRECT3DDEVICE9 pd3dDevice ) D3DCAPS9 d3dCaps;
m_pd3dDevice->GetDeviceCaps( &d3dCaps );
- if( m_dwTexWidth > d3dCaps.MaxTextureWidth ) {
+ if ( m_dwTexWidth > d3dCaps.MaxTextureWidth ) {
m_fTextScale = (FLOAT)d3dCaps.MaxTextureWidth / (FLOAT)m_dwTexWidth;
m_dwTexWidth = m_dwTexHeight = d3dCaps.MaxTextureWidth;
@@ -255,7 +255,7 @@ HRESULT CD3DFont::InitDeviceObjects( LPDIRECT3DDEVICE9 pd3dDevice ) do {
// If we've already tried fitting the new text, the scale is still
// too large. Reduce and try again.
- if( !bFirstRun) {
+ if ( !bFirstRun) {
m_fTextScale *= 0.9f;
}
@@ -264,14 +264,14 @@ HRESULT CD3DFont::InitDeviceObjects( LPDIRECT3DDEVICE9 pd3dDevice ) DeleteObject( SelectObject( hDC, hFontOld ) );
hr = CreateGDIFont( hDC, &hFont );
- if( FAILED(hr) ) {
+ if ( FAILED(hr) ) {
goto LCleanReturn;
}
hFontOld = (HFONT) SelectObject( hDC, hFont );
bFirstRun = false;
- } while( D3DERR_MOREDATA == ( hr = PaintAlphabet( hDC, true ) ) );
+ } while ( D3DERR_MOREDATA == ( hr = PaintAlphabet( hDC, true ) ) );
}
@@ -279,7 +279,7 @@ HRESULT CD3DFont::InitDeviceObjects( LPDIRECT3DDEVICE9 pd3dDevice ) hr = m_pd3dDevice->CreateTexture( m_dwTexWidth, m_dwTexHeight, 1,
0, D3DFMT_A4R4G4B4,
D3DPOOL_MANAGED, &m_pTexture, NULL );
- if( FAILED(hr) ) {
+ if ( FAILED(hr) ) {
goto LCleanReturn;
}
@@ -307,7 +307,7 @@ HRESULT CD3DFont::InitDeviceObjects( LPDIRECT3DDEVICE9 pd3dDevice ) // Paint the alphabet onto the selected bitmap
hr = PaintAlphabet( hDC, false );
- if( FAILED(hr) ) {
+ if ( FAILED(hr) ) {
goto LCleanReturn;
}
@@ -320,9 +320,9 @@ HRESULT CD3DFont::InitDeviceObjects( LPDIRECT3DDEVICE9 pd3dDevice ) BYTE bAlpha; // 4-bit measure of pixel intensity
DWORD x, y;
- for( y=0; y < m_dwTexHeight; y++ ) {
+ for ( y=0; y < m_dwTexHeight; y++ ) {
pDst16 = (WORD*)pDstRow;
- for( x=0; x < m_dwTexWidth; x++ ) {
+ for ( x=0; x < m_dwTexWidth; x++ ) {
bAlpha = (BYTE)((pBitmapBits[m_dwTexWidth*y + x] & 0xff) >> 4);
if (bAlpha > 0) {
*pDst16++ = (WORD) ((bAlpha << 12) | 0x0fff);
@@ -337,7 +337,7 @@ HRESULT CD3DFont::InitDeviceObjects( LPDIRECT3DDEVICE9 pd3dDevice ) // Done updating texture, so clean up used objects
LCleanReturn:
- if( m_pTexture ) {
+ if ( m_pTexture ) {
m_pTexture->UnlockRect(0);
}
@@ -362,26 +362,26 @@ HRESULT CD3DFont::RestoreDeviceObjects() // Create vertex buffer for the letters
int vertexSize = max( sizeof(FONT2DVERTEX), sizeof(FONT3DVERTEX ) );
- if( FAILED( hr = m_pd3dDevice->CreateVertexBuffer( MAX_NUM_VERTICES * vertexSize,
- D3DUSAGE_WRITEONLY | D3DUSAGE_DYNAMIC, 0,
- D3DPOOL_DEFAULT, &m_pVB, NULL ) ) ) {
+ if ( FAILED( hr = m_pd3dDevice->CreateVertexBuffer( MAX_NUM_VERTICES * vertexSize,
+ D3DUSAGE_WRITEONLY | D3DUSAGE_DYNAMIC, 0,
+ D3DPOOL_DEFAULT, &m_pVB, NULL ) ) ) {
return hr;
}
bool bSupportsAlphaBlend = true;
LPDIRECT3D9 pd3d9 = NULL;
- if( SUCCEEDED( m_pd3dDevice->GetDirect3D( &pd3d9 ) ) ) {
+ if ( SUCCEEDED( m_pd3dDevice->GetDirect3D( &pd3d9 ) ) ) {
D3DCAPS9 Caps;
D3DDISPLAYMODE Mode;
LPDIRECT3DSURFACE9 pSurf = NULL;
D3DSURFACE_DESC Desc;
m_pd3dDevice->GetDeviceCaps( &Caps );
m_pd3dDevice->GetDisplayMode( 0, &Mode );
- if( SUCCEEDED( m_pd3dDevice->GetRenderTarget( 0, &pSurf ) ) ) {
+ if ( SUCCEEDED( m_pd3dDevice->GetRenderTarget( 0, &pSurf ) ) ) {
pSurf->GetDesc( &Desc );
- if( FAILED( pd3d9->CheckDeviceFormat( Caps.AdapterOrdinal, Caps.DeviceType, Mode.Format,
- D3DUSAGE_RENDERTARGET | D3DUSAGE_QUERY_POSTPIXELSHADER_BLENDING, D3DRTYPE_SURFACE,
- Desc.Format ) ) ) {
+ if ( FAILED( pd3d9->CheckDeviceFormat( Caps.AdapterOrdinal, Caps.DeviceType, Mode.Format,
+ D3DUSAGE_RENDERTARGET | D3DUSAGE_QUERY_POSTPIXELSHADER_BLENDING, D3DRTYPE_SURFACE,
+ Desc.Format ) ) ) {
bSupportsAlphaBlend = false;
}
SAFE_RELEASE( pSurf );
@@ -390,7 +390,7 @@ HRESULT CD3DFont::RestoreDeviceObjects() }
// Create the state blocks for rendering text
- for( UINT which=0; which<2; which++ ) {
+ for ( UINT which=0; which<2; which++ ) {
m_pd3dDevice->BeginStateBlock();
m_pd3dDevice->SetTexture( 0, m_pTexture );
@@ -400,7 +400,7 @@ HRESULT CD3DFont::RestoreDeviceObjects() m_pd3dDevice->SetRenderState( D3DRS_ZENABLE, FALSE );
}
- if( bSupportsAlphaBlend ) {
+ if ( bSupportsAlphaBlend ) {
m_pd3dDevice->SetRenderState( D3DRS_ALPHABLENDENABLE, TRUE );
m_pd3dDevice->SetRenderState( D3DRS_SRCBLEND, D3DBLEND_SRCALPHA );
m_pd3dDevice->SetRenderState( D3DRS_DESTBLEND, D3DBLEND_INVSRCALPHA );
@@ -435,7 +435,7 @@ HRESULT CD3DFont::RestoreDeviceObjects() m_pd3dDevice->SetSamplerState( 0, D3DSAMP_MAGFILTER, D3DTEXF_POINT );
m_pd3dDevice->SetSamplerState( 0, D3DSAMP_MIPFILTER, D3DTEXF_NONE );
- if( which==0 ) {
+ if ( which==0 ) {
m_pd3dDevice->EndStateBlock( &m_pStateBlockSaved );
} else {
m_pd3dDevice->EndStateBlock( &m_pStateBlockDrawText );
@@ -482,7 +482,7 @@ HRESULT CD3DFont::DeleteDeviceObjects() //-----------------------------------------------------------------------------
HRESULT CD3DFont::GetTextExtent( const TCHAR* strText, SIZE* pSize )
{
- if( NULL==strText || NULL==pSize ) {
+ if ( NULL==strText || NULL==pSize ) {
return E_FAIL;
}
@@ -491,15 +491,15 @@ HRESULT CD3DFont::GetTextExtent( const TCHAR* strText, SIZE* pSize ) FLOAT fWidth = 0.0f;
FLOAT fHeight = fRowHeight;
- while( *strText ) {
+ while ( *strText ) {
TCHAR c = *strText++;
- if( c == _T('\n') ) {
+ if ( c == _T('\n') ) {
fRowWidth = 0.0f;
fHeight += fRowHeight;
}
- if( (c-32) < 0 || (c-32) >= 128-32 ) {
+ if ( (c-32) < 0 || (c-32) >= 128-32 ) {
continue;
}
@@ -508,7 +508,7 @@ HRESULT CD3DFont::GetTextExtent( const TCHAR* strText, SIZE* pSize ) fRowWidth += (tx2-tx1)*m_dwTexWidth - 2*m_dwSpacing;
- if( fRowWidth > fWidth ) {
+ if ( fRowWidth > fWidth ) {
fWidth = fRowWidth;
}
}
@@ -533,7 +533,7 @@ HRESULT CD3DFont::DrawTextScaled( FLOAT x, FLOAT y, FLOAT z, FLOAT fXScale, FLOAT fYScale, DWORD dwColor,
const TCHAR* strText, DWORD dwFlags )
{
- if( m_pd3dDevice == NULL ) {
+ if ( m_pd3dDevice == NULL ) {
return E_FAIL;
}
@@ -545,7 +545,7 @@ HRESULT CD3DFont::DrawTextScaled( FLOAT x, FLOAT y, FLOAT z, m_pd3dDevice->SetStreamSource( 0, m_pVB, 0, sizeof(FONT2DVERTEX) );
// Set filter states
- if( dwFlags & D3DFONT_FILTERED ) {
+ if ( dwFlags & D3DFONT_FILTERED ) {
m_pd3dDevice->SetSamplerState( 0, D3DSAMP_MINFILTER, D3DTEXF_LINEAR );
m_pd3dDevice->SetSamplerState( 0, D3DSAMP_MAGFILTER, D3DTEXF_LINEAR );
}
@@ -555,17 +555,17 @@ HRESULT CD3DFont::DrawTextScaled( FLOAT x, FLOAT y, FLOAT z, FLOAT fLineHeight = ( m_fTexCoords[0][3] - m_fTexCoords[0][1] ) * m_dwTexHeight;
// Center the text block in the viewport
- if( dwFlags & D3DFONT_CENTERED_X ) {
+ if ( dwFlags & D3DFONT_CENTERED_X ) {
const TCHAR* strTextTmp = strText;
float xFinal = 0.0f;
- while( *strTextTmp ) {
+ while ( *strTextTmp ) {
TCHAR c = *strTextTmp++;
- if( c == _T('\n') ) {
+ if ( c == _T('\n') ) {
break; // Isn't supported.
}
- if( (c-32) < 0 || (c-32) >= 128-32 ) {
+ if ( (c-32) < 0 || (c-32) >= 128-32 ) {
continue;
}
@@ -581,7 +581,7 @@ HRESULT CD3DFont::DrawTextScaled( FLOAT x, FLOAT y, FLOAT z, x = -xFinal/vp.Width;
}
- if( dwFlags & D3DFONT_CENTERED_Y ) {
+ if ( dwFlags & D3DFONT_CENTERED_Y ) {
y = -fLineHeight/vp.Height;
}
@@ -599,15 +599,15 @@ HRESULT CD3DFont::DrawTextScaled( FLOAT x, FLOAT y, FLOAT z, DWORD dwNumTriangles = 0L;
m_pVB->Lock( 0, 0, (void**)&pVertices, D3DLOCK_DISCARD );
- while( *strText ) {
+ while ( *strText ) {
TCHAR c = *strText++;
- if( c == _T('\n') ) {
+ if ( c == _T('\n') ) {
sx = fStartX;
sy += fYScale*vp.Height;
}
- if( (c-32) < 0 || (c-32) >= 128-32 ) {
+ if ( (c-32) < 0 || (c-32) >= 128-32 ) {
continue;
}
@@ -622,7 +622,7 @@ HRESULT CD3DFont::DrawTextScaled( FLOAT x, FLOAT y, FLOAT z, w *= (fXScale*vp.Height)/fLineHeight;
h *= (fYScale*vp.Height)/fLineHeight;
- if( c != _T(' ') ) {
+ if ( c != _T(' ') ) {
*pVertices++ = InitFont2DVertex( D3DXVECTOR4(sx+0-0.5f,sy+h-0.5f,sz,rhw), dwColor, tx1, ty2 );
*pVertices++ = InitFont2DVertex( D3DXVECTOR4(sx+0-0.5f,sy+0-0.5f,sz,rhw), dwColor, tx1, ty1 );
*pVertices++ = InitFont2DVertex( D3DXVECTOR4(sx+w-0.5f,sy+h-0.5f,sz,rhw), dwColor, tx2, ty2 );
@@ -631,7 +631,7 @@ HRESULT CD3DFont::DrawTextScaled( FLOAT x, FLOAT y, FLOAT z, *pVertices++ = InitFont2DVertex( D3DXVECTOR4(sx+0-0.5f,sy+0-0.5f,sz,rhw), dwColor, tx1, ty1 );
dwNumTriangles += 2;
- if( dwNumTriangles*3 > (MAX_NUM_VERTICES-6) ) {
+ if ( dwNumTriangles*3 > (MAX_NUM_VERTICES-6) ) {
// Unlock, render, and relock the vertex buffer
m_pVB->Unlock();
m_pd3dDevice->DrawPrimitive( D3DPT_TRIANGLELIST, 0, dwNumTriangles );
@@ -645,7 +645,7 @@ HRESULT CD3DFont::DrawTextScaled( FLOAT x, FLOAT y, FLOAT z, // Unlock and render the vertex buffer
m_pVB->Unlock();
- if( dwNumTriangles > 0 ) {
+ if ( dwNumTriangles > 0 ) {
m_pd3dDevice->DrawPrimitive( D3DPT_TRIANGLELIST, 0, dwNumTriangles );
}
@@ -664,7 +664,7 @@ HRESULT CD3DFont::DrawTextScaled( FLOAT x, FLOAT y, FLOAT z, HRESULT CD3DFont::DrawText( FLOAT sx, FLOAT sy, DWORD dwColor,
const TCHAR* strText, DWORD dwFlags )
{
- if( m_pd3dDevice == NULL ) {
+ if ( m_pd3dDevice == NULL ) {
return E_FAIL;
}
@@ -676,25 +676,25 @@ HRESULT CD3DFont::DrawText( FLOAT sx, FLOAT sy, DWORD dwColor, m_pd3dDevice->SetStreamSource( 0, m_pVB, 0, sizeof(FONT2DVERTEX) );
// Set filter states
- if( dwFlags & D3DFONT_FILTERED ) {
+ if ( dwFlags & D3DFONT_FILTERED ) {
m_pd3dDevice->SetSamplerState( 0, D3DSAMP_MINFILTER, D3DTEXF_LINEAR );
m_pd3dDevice->SetSamplerState( 0, D3DSAMP_MAGFILTER, D3DTEXF_LINEAR );
}
// Center the text block in the viewport
- if( dwFlags & D3DFONT_CENTERED_X ) {
+ if ( dwFlags & D3DFONT_CENTERED_X ) {
D3DVIEWPORT9 vp;
m_pd3dDevice->GetViewport( &vp );
const TCHAR* strTextTmp = strText;
float xFinal = 0.0f;
- while( *strTextTmp ) {
+ while ( *strTextTmp ) {
TCHAR c = *strTextTmp++;
- if( c == _T('\n') ) {
+ if ( c == _T('\n') ) {
break; // Isn't supported.
}
- if( (c-32) < 0 || (c-32) >= 128-32 ) {
+ if ( (c-32) < 0 || (c-32) >= 128-32 ) {
continue;
}
@@ -708,7 +708,7 @@ HRESULT CD3DFont::DrawText( FLOAT sx, FLOAT sy, DWORD dwColor, sx = (vp.Width-xFinal)/2.0f;
}
- if( dwFlags & D3DFONT_CENTERED_Y ) {
+ if ( dwFlags & D3DFONT_CENTERED_Y ) {
D3DVIEWPORT9 vp;
m_pd3dDevice->GetViewport( &vp );
float fLineHeight = ((m_fTexCoords[0][3]-m_fTexCoords[0][1])*m_dwTexHeight);
@@ -724,15 +724,15 @@ HRESULT CD3DFont::DrawText( FLOAT sx, FLOAT sy, DWORD dwColor, DWORD dwNumTriangles = 0;
m_pVB->Lock( 0, 0, (void**)&pVertices, D3DLOCK_DISCARD );
- while( *strText ) {
+ while ( *strText ) {
TCHAR c = *strText++;
- if( c == _T('\n') ) {
+ if ( c == _T('\n') ) {
sx = fStartX;
sy += (m_fTexCoords[0][3]-m_fTexCoords[0][1])*m_dwTexHeight;
}
- if( (c-32) < 0 || (c-32) >= 128-32 ) {
+ if ( (c-32) < 0 || (c-32) >= 128-32 ) {
continue;
}
@@ -744,7 +744,7 @@ HRESULT CD3DFont::DrawText( FLOAT sx, FLOAT sy, DWORD dwColor, FLOAT w = (tx2-tx1) * m_dwTexWidth / m_fTextScale;
FLOAT h = (ty2-ty1) * m_dwTexHeight / m_fTextScale;
- if( c != _T(' ') ) {
+ if ( c != _T(' ') ) {
*pVertices++ = InitFont2DVertex( D3DXVECTOR4(sx+0-0.5f,sy+h-0.5f,0.9f,1.0f), dwColor, tx1, ty2 );
*pVertices++ = InitFont2DVertex( D3DXVECTOR4(sx+0-0.5f,sy+0-0.5f,0.9f,1.0f), dwColor, tx1, ty1 );
*pVertices++ = InitFont2DVertex( D3DXVECTOR4(sx+w-0.5f,sy+h-0.5f,0.9f,1.0f), dwColor, tx2, ty2 );
@@ -753,7 +753,7 @@ HRESULT CD3DFont::DrawText( FLOAT sx, FLOAT sy, DWORD dwColor, *pVertices++ = InitFont2DVertex( D3DXVECTOR4(sx+0-0.5f,sy+0-0.5f,0.9f,1.0f), dwColor, tx1, ty1 );
dwNumTriangles += 2;
- if( dwNumTriangles*3 > (MAX_NUM_VERTICES-6) ) {
+ if ( dwNumTriangles*3 > (MAX_NUM_VERTICES-6) ) {
// Unlock, render, and relock the vertex buffer
m_pVB->Unlock();
m_pd3dDevice->DrawPrimitive( D3DPT_TRIANGLELIST, 0, dwNumTriangles );
@@ -768,7 +768,7 @@ HRESULT CD3DFont::DrawText( FLOAT sx, FLOAT sy, DWORD dwColor, // Unlock and render the vertex buffer
m_pVB->Unlock();
- if( dwNumTriangles > 0 ) {
+ if ( dwNumTriangles > 0 ) {
m_pd3dDevice->DrawPrimitive( D3DPT_TRIANGLELIST, 0, dwNumTriangles );
}
@@ -786,7 +786,7 @@ HRESULT CD3DFont::DrawText( FLOAT sx, FLOAT sy, DWORD dwColor, //-----------------------------------------------------------------------------
HRESULT CD3DFont::Render3DText( const TCHAR* strText, DWORD dwFlags )
{
- if( m_pd3dDevice == NULL ) {
+ if ( m_pd3dDevice == NULL ) {
return E_FAIL;
}
@@ -798,7 +798,7 @@ HRESULT CD3DFont::Render3DText( const TCHAR* strText, DWORD dwFlags ) m_pd3dDevice->SetStreamSource( 0, m_pVB, 0, sizeof(FONT3DVERTEX) );
// Set filter states
- if( dwFlags & D3DFONT_FILTERED ) {
+ if ( dwFlags & D3DFONT_FILTERED ) {
m_pd3dDevice->SetSamplerState( 0, D3DSAMP_MINFILTER, D3DTEXF_LINEAR );
m_pd3dDevice->SetSamplerState( 0, D3DSAMP_MAGFILTER, D3DTEXF_LINEAR );
}
@@ -808,19 +808,19 @@ HRESULT CD3DFont::Render3DText( const TCHAR* strText, DWORD dwFlags ) FLOAT y = 0.0f;
// Center the text block at the origin (not the viewport)
- if( dwFlags & D3DFONT_CENTERED_X ) {
+ if ( dwFlags & D3DFONT_CENTERED_X ) {
SIZE sz;
GetTextExtent( strText, &sz );
x = -(((FLOAT)sz.cx)/10.0f)/2.0f;
}
- if( dwFlags & D3DFONT_CENTERED_Y ) {
+ if ( dwFlags & D3DFONT_CENTERED_Y ) {
SIZE sz;
GetTextExtent( strText, &sz );
y = -(((FLOAT)sz.cy)/10.0f)/2.0f;
}
// Turn off culling for two-sided text
- if( dwFlags & D3DFONT_TWOSIDED ) {
+ if ( dwFlags & D3DFONT_TWOSIDED ) {
m_pd3dDevice->SetRenderState( D3DRS_CULLMODE, D3DCULL_NONE );
}
@@ -834,13 +834,13 @@ HRESULT CD3DFont::Render3DText( const TCHAR* strText, DWORD dwFlags ) DWORD dwNumTriangles = 0L;
m_pVB->Lock( 0, 0, (void**)&pVertices, D3DLOCK_DISCARD );
- while( (c = *strText++) != 0 ) {
- if( c == '\n' ) {
+ while ( (c = *strText++) != 0 ) {
+ if ( c == '\n' ) {
x = fStartX;
y -= (m_fTexCoords[0][3]-m_fTexCoords[0][1])*m_dwTexHeight/10.0f;
}
- if( (c-32) < 0 || (c-32) >= 128-32 ) {
+ if ( (c-32) < 0 || (c-32) >= 128-32 ) {
continue;
}
@@ -852,7 +852,7 @@ HRESULT CD3DFont::Render3DText( const TCHAR* strText, DWORD dwFlags ) FLOAT w = (tx2-tx1) * m_dwTexWidth / ( 10.0f * m_fTextScale );
FLOAT h = (ty2-ty1) * m_dwTexHeight / ( 10.0f * m_fTextScale );
- if( c != _T(' ') ) {
+ if ( c != _T(' ') ) {
*pVertices++ = InitFont3DVertex( D3DXVECTOR3(x+0,y+0,0), D3DXVECTOR3(0,0,-1), tx1, ty2 );
*pVertices++ = InitFont3DVertex( D3DXVECTOR3(x+0,y+h,0), D3DXVECTOR3(0,0,-1), tx1, ty1 );
*pVertices++ = InitFont3DVertex( D3DXVECTOR3(x+w,y+0,0), D3DXVECTOR3(0,0,-1), tx2, ty2 );
@@ -861,7 +861,7 @@ HRESULT CD3DFont::Render3DText( const TCHAR* strText, DWORD dwFlags ) *pVertices++ = InitFont3DVertex( D3DXVECTOR3(x+0,y+h,0), D3DXVECTOR3(0,0,-1), tx1, ty1 );
dwNumTriangles += 2;
- if( dwNumTriangles*3 > (MAX_NUM_VERTICES-6) ) {
+ if ( dwNumTriangles*3 > (MAX_NUM_VERTICES-6) ) {
// Unlock, render, and relock the vertex buffer
m_pVB->Unlock();
m_pd3dDevice->DrawPrimitive( D3DPT_TRIANGLELIST, 0, dwNumTriangles );
@@ -875,7 +875,7 @@ HRESULT CD3DFont::Render3DText( const TCHAR* strText, DWORD dwFlags ) // Unlock and render the vertex buffer
m_pVB->Unlock();
- if( dwNumTriangles > 0 ) {
+ if ( dwNumTriangles > 0 ) {
m_pd3dDevice->DrawPrimitive( D3DPT_TRIANGLELIST, 0, dwNumTriangles );
}
diff --git a/src/filters/renderer/VideoRenderers/DX7AllocatorPresenter.cpp b/src/filters/renderer/VideoRenderers/DX7AllocatorPresenter.cpp index e9dfdddfe..752160d6e 100644 --- a/src/filters/renderer/VideoRenderers/DX7AllocatorPresenter.cpp +++ b/src/filters/renderer/VideoRenderers/DX7AllocatorPresenter.cpp @@ -34,7 +34,7 @@ using namespace DSObjects; static HRESULT TextureBlt(IDirect3DDevice7* pD3DDev, IDirectDrawSurface7* pTexture, Vector dst[4], CRect src)
{
- if(!pTexture) {
+ if (!pTexture) {
return E_POINTER;
}
@@ -44,7 +44,7 @@ static HRESULT TextureBlt(IDirect3DDevice7* pD3DDev, IDirectDrawSurface7* pTextu do {
DDSURFACEDESC2 ddsd;
INITDDSTRUCT(ddsd);
- if(FAILED(hr = pTexture->GetSurfaceDesc(&ddsd))) {
+ if (FAILED(hr = pTexture->GetSurfaceDesc(&ddsd))) {
break;
}
@@ -62,7 +62,7 @@ static HRESULT TextureBlt(IDirect3DDevice7* pD3DDev, IDirectDrawSurface7* pTextu {(float)dst[3].x, (float)dst[3].y, (float)dst[3].z, 1.0f/(float)dst[3].z, (float)src.right / w, (float)src.bottom / h},
};
- for(int i = 0; i < countof(pVertices); i++) {
+ for (int i = 0; i < countof(pVertices); i++) {
pVertices[i].x -= 0.5;
pVertices[i].y -= 0.5;
}
@@ -82,7 +82,7 @@ static HRESULT TextureBlt(IDirect3DDevice7* pD3DDev, IDirectDrawSurface7* pTextu //
- if(FAILED(hr = pD3DDev->BeginScene())) {
+ if (FAILED(hr = pD3DDev->BeginScene())) {
break;
}
@@ -96,7 +96,7 @@ static HRESULT TextureBlt(IDirect3DDevice7* pD3DDev, IDirectDrawSurface7* pTextu pD3DDev->SetTexture(0, NULL);
return S_OK;
- } while(0);
+ } while (0);
return E_FAIL;
}
@@ -112,7 +112,7 @@ CDX7AllocatorPresenter::CDX7AllocatorPresenter(HWND hWnd, HRESULT& hr) : CSubPicAllocatorPresenterImpl(hWnd, hr, NULL)
, m_ScreenSize(0, 0)
{
- if(FAILED(hr)) {
+ if (FAILED(hr)) {
return;
}
@@ -128,12 +128,12 @@ CDX7AllocatorPresenter::CDX7AllocatorPresenter(HWND hWnd, HRESULT& hr) return;
}
- if(FAILED(hr = pDirectDrawCreateEx(NULL, (VOID**)&m_pDD, IID_IDirectDraw7, NULL))
+ if (FAILED(hr = pDirectDrawCreateEx(NULL, (VOID**)&m_pDD, IID_IDirectDraw7, NULL))
|| FAILED(hr = m_pDD->SetCooperativeLevel(AfxGetMainWnd()->GetSafeHwnd(), DDSCL_NORMAL))) {
return;
}
- if(!(m_pD3D = m_pDD)) {
+ if (!(m_pD3D = m_pDD)) {
hr = E_NOINTERFACE;
return;
}
@@ -153,7 +153,7 @@ HRESULT CDX7AllocatorPresenter::CreateDevice() DDSURFACEDESC2 ddsd;
INITDDSTRUCT(ddsd);
- if(FAILED(m_pDD->GetDisplayMode(&ddsd)) ||
+ if (FAILED(m_pDD->GetDisplayMode(&ddsd)) ||
ddsd.ddpfPixelFormat.dwRGBBitCount <= 8) {
return DDERR_INVALIDMODE;
}
@@ -167,12 +167,12 @@ HRESULT CDX7AllocatorPresenter::CreateDevice() INITDDSTRUCT(ddsd);
ddsd.dwFlags = DDSD_CAPS;
ddsd.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE;
- if(FAILED(hr = m_pDD->CreateSurface(&ddsd, &m_pPrimary, NULL))) {
+ if (FAILED(hr = m_pDD->CreateSurface(&ddsd, &m_pPrimary, NULL))) {
return hr;
}
CComPtr<IDirectDrawClipper> pcClipper;
- if(FAILED(hr = m_pDD->CreateClipper(0, &pcClipper, NULL))) {
+ if (FAILED(hr = m_pDD->CreateClipper(0, &pcClipper, NULL))) {
return hr;
}
pcClipper->SetHWnd(0, m_hWnd);
@@ -185,12 +185,12 @@ HRESULT CDX7AllocatorPresenter::CreateDevice() ddsd.ddsCaps.dwCaps = /*DDSCAPS_OFFSCREENPLAIN |*/ DDSCAPS_VIDEOMEMORY | DDSCAPS_3DDEVICE;
ddsd.dwWidth = m_ScreenSize.cx;
ddsd.dwHeight = m_ScreenSize.cy;
- if(FAILED(hr = m_pDD->CreateSurface(&ddsd, &m_pBackBuffer, NULL))) {
+ if (FAILED(hr = m_pDD->CreateSurface(&ddsd, &m_pBackBuffer, NULL))) {
return hr;
}
pcClipper = NULL;
- if(FAILED(hr = m_pDD->CreateClipper(0, &pcClipper, NULL))) {
+ if (FAILED(hr = m_pDD->CreateClipper(0, &pcClipper, NULL))) {
return hr;
}
BYTE rgnDataBuffer[1024];
@@ -202,19 +202,19 @@ HRESULT CDX7AllocatorPresenter::CreateDevice() // m_pD3DDev
- if(FAILED(hr = m_pD3D->CreateDevice(IID_IDirect3DHALDevice, m_pBackBuffer, &m_pD3DDev))) { // this seems to fail if the desktop size is too large (width or height >2048)
+ if (FAILED(hr = m_pD3D->CreateDevice(IID_IDirect3DHALDevice, m_pBackBuffer, &m_pD3DDev))) { // this seems to fail if the desktop size is too large (width or height >2048)
return hr;
}
//
CComPtr<ISubPicProvider> pSubPicProvider;
- if(m_pSubPicQueue) {
+ if (m_pSubPicQueue) {
m_pSubPicQueue->GetSubPicProvider(&pSubPicProvider);
}
CSize size;
- switch(GetRenderersSettings().nSPCMaxRes) {
+ switch (GetRenderersSettings().nSPCMaxRes) {
case 0:
default:
size = m_ScreenSize;
@@ -248,11 +248,11 @@ HRESULT CDX7AllocatorPresenter::CreateDevice() break;
}
- if(m_pAllocator) {
+ if (m_pAllocator) {
m_pAllocator->ChangeDevice(m_pD3DDev);
} else {
m_pAllocator = DNew CDX7SubPicAllocator(m_pD3DDev, size, GetRenderersSettings().fSPCPow2Tex);
- if(!m_pAllocator || FAILED(hr)) {
+ if (!m_pAllocator || FAILED(hr)) {
return E_FAIL;
}
}
@@ -261,11 +261,11 @@ HRESULT CDX7AllocatorPresenter::CreateDevice() m_pSubPicQueue = GetRenderersSettings().nSPCSize > 0
? (ISubPicQueue*)DNew CSubPicQueue(GetRenderersSettings().nSPCSize, !GetRenderersSettings().fSPCAllowAnimationWhenBuffering, m_pAllocator, &hr)
: (ISubPicQueue*)DNew CSubPicQueueNoThread(m_pAllocator, &hr);
- if(!m_pSubPicQueue || FAILED(hr)) {
+ if (!m_pSubPicQueue || FAILED(hr)) {
return E_FAIL;
}
- if(pSubPicProvider) {
+ if (pSubPicProvider) {
m_pSubPicQueue->SetSubPicProvider(pSubPicProvider);
}
@@ -294,18 +294,18 @@ HRESULT CDX7AllocatorPresenter::AllocSurfaces() ddsd.ddpfPixelFormat.dwGBitMask = 0x0000FF00;
ddsd.ddpfPixelFormat.dwBBitMask = 0x000000FF;
- if(s.iAPSurfaceUsage == VIDRNDT_AP_TEXTURE2D || s.iAPSurfaceUsage == VIDRNDT_AP_TEXTURE3D) {
+ if (s.iAPSurfaceUsage == VIDRNDT_AP_TEXTURE2D || s.iAPSurfaceUsage == VIDRNDT_AP_TEXTURE3D) {
ddsd.ddsCaps.dwCaps |= DDSCAPS_TEXTURE;
// ddsd.ddpfPixelFormat.dwFlags |= DDPF_ALPHAPIXELS;
// ddsd.ddpfPixelFormat.dwRGBAlphaBitMask = 0xFF000000;
}
HRESULT hr = m_pDD->CreateSurface(&ddsd, &m_pVideoSurface, NULL);
- if(FAILED(hr)) {
+ if (FAILED(hr)) {
// FIXME: eh, dx9 has no problem creating a 32bpp surface under a 16bpp desktop, but dx7 fails here (textures are ok)
DDSURFACEDESC2 ddsd2;
INITDDSTRUCT(ddsd2);
- if(!(s.iAPSurfaceUsage == VIDRNDT_AP_TEXTURE2D || s.iAPSurfaceUsage == VIDRNDT_AP_TEXTURE3D)
+ if (!(s.iAPSurfaceUsage == VIDRNDT_AP_TEXTURE2D || s.iAPSurfaceUsage == VIDRNDT_AP_TEXTURE3D)
&& SUCCEEDED(m_pDD->GetDisplayMode(&ddsd2))
&& ddsd2.ddpfPixelFormat.dwRGBBitCount == 16) {
ddsd.ddpfPixelFormat.dwRGBBitCount = 16;
@@ -315,12 +315,12 @@ HRESULT CDX7AllocatorPresenter::AllocSurfaces() hr = m_pDD->CreateSurface(&ddsd, &m_pVideoSurface, NULL);
}
- if(FAILED(hr)) {
+ if (FAILED(hr)) {
return hr;
}
}
- if(s.iAPSurfaceUsage == VIDRNDT_AP_TEXTURE3D) {
+ if (s.iAPSurfaceUsage == VIDRNDT_AP_TEXTURE3D) {
m_pVideoTexture = m_pVideoSurface;
}
@@ -356,7 +356,7 @@ STDMETHODIMP_(bool) CDX7AllocatorPresenter::Paint(bool fAll) CAutoLock cAutoLock(this);
- if(m_WindowRect.right <= m_WindowRect.left || m_WindowRect.bottom <= m_WindowRect.top
+ if (m_WindowRect.right <= m_WindowRect.left || m_WindowRect.bottom <= m_WindowRect.top
|| m_NativeVideoSize.cx <= 0 || m_NativeVideoSize.cy <= 0
|| !m_pPrimary || !m_pBackBuffer || !m_pVideoSurface) {
return false;
@@ -371,7 +371,7 @@ STDMETHODIMP_(bool) CDX7AllocatorPresenter::Paint(bool fAll) CRect rDstPri(m_WindowRect);
MapWindowRect(m_hWnd, HWND_DESKTOP, &rDstPri);
- if(fAll) {
+ if (fAll) {
// clear the backbuffer
CRect rl(0, 0, rDstVid.left, rSrcPri.bottom);
@@ -386,8 +386,8 @@ STDMETHODIMP_(bool) CDX7AllocatorPresenter::Paint(bool fAll) // paint the video on the backbuffer
- if(!rDstVid.IsRectEmpty()) {
- if(m_pVideoTexture) {
+ if (!rDstVid.IsRectEmpty()) {
+ if (m_pVideoTexture) {
Vector v[4];
Transform(rDstVid, v);
hr = TextureBlt(m_pD3DDev, m_pVideoTexture, v, rSrcVid);
@@ -409,7 +409,7 @@ STDMETHODIMP_(bool) CDX7AllocatorPresenter::Paint(bool fAll) hr = m_pPrimary->Blt(rDstPri, m_pBackBuffer, rSrcPri, DDBLT_WAIT, NULL);
- if(hr == DDERR_SURFACELOST) {
+ if (hr == DDERR_SURFACELOST) {
m_bPendingResetDevice = true;
SendResetRequest();
return false;
@@ -430,7 +430,7 @@ STDMETHODIMP_(bool) CDX7AllocatorPresenter::ResetDevice() {
HRESULT hr;
DeleteSurfaces();
- if(FAILED(hr = CreateDevice()) || FAILED(hr = AllocSurfaces())) {
+ if (FAILED(hr = CreateDevice()) || FAILED(hr = AllocSurfaces())) {
//DDERR_UNSUPPORTEDMODE - 0x8876024e
TRACE("ResetDevice failed: 0x%08x\n", (LONG)hr);
m_bDeviceResetRequested = false;
@@ -455,26 +455,26 @@ STDMETHODIMP CDX7AllocatorPresenter::GetDIB(BYTE* lpDib, DWORD* size) DDSURFACEDESC2 ddsd;
INITDDSTRUCT(ddsd);
- if(FAILED(m_pVideoSurface->GetSurfaceDesc(&ddsd))) {
+ if (FAILED(m_pVideoSurface->GetSurfaceDesc(&ddsd))) {
return E_FAIL;
}
- if(ddsd.ddpfPixelFormat.dwRGBBitCount != 16 && ddsd.ddpfPixelFormat.dwRGBBitCount != 32) {
+ if (ddsd.ddpfPixelFormat.dwRGBBitCount != 16 && ddsd.ddpfPixelFormat.dwRGBBitCount != 32) {
return E_FAIL;
}
DWORD required = sizeof(BITMAPINFOHEADER) + (ddsd.dwWidth*ddsd.dwHeight*32>>3);
- if(!lpDib) {
+ if (!lpDib) {
*size = required;
return S_OK;
}
- if(*size < required) {
+ if (*size < required) {
return E_OUTOFMEMORY;
}
*size = required;
INITDDSTRUCT(ddsd);
- if(FAILED(hr = m_pVideoSurface->Lock(NULL, &ddsd, DDLOCK_WAIT|DDLOCK_SURFACEMEMORYPTR|DDLOCK_READONLY|DDLOCK_NOSYSLOCK, NULL))) {
+ if (FAILED(hr = m_pVideoSurface->Lock(NULL, &ddsd, DDLOCK_WAIT|DDLOCK_SURFACEMEMORYPTR|DDLOCK_READONLY|DDLOCK_NOSYSLOCK, NULL))) {
// TODO
return hr;
}
diff --git a/src/filters/renderer/VideoRenderers/DX9AllocatorPresenter.cpp b/src/filters/renderer/VideoRenderers/DX9AllocatorPresenter.cpp index 192c42406..f4c5a664b 100644 --- a/src/filters/renderer/VideoRenderers/DX9AllocatorPresenter.cpp +++ b/src/filters/renderer/VideoRenderers/DX9AllocatorPresenter.cpp @@ -74,7 +74,7 @@ CDX9AllocatorPresenter::CDX9AllocatorPresenter(HWND hWnd, bool bFullscreen, HRES {
HINSTANCE hDll;
- if(FAILED(hr)) {
+ if (FAILED(hr)) {
_Error += L"ISubPicAllocatorPresenterImpl failed\n";
return;
}
@@ -85,7 +85,7 @@ CDX9AllocatorPresenter::CDX9AllocatorPresenter(HWND hWnd, bool bFullscreen, HRES m_pD3DXCreateFont = NULL;
m_pD3DXCreateSprite = NULL;
hDll = GetRenderersData()->GetD3X9Dll();
- if(hDll) {
+ if (hDll) {
(FARPROC&)m_pD3DXLoadSurfaceFromMemory = GetProcAddress(hDll, "D3DXLoadSurfaceFromMemory");
(FARPROC&)m_pD3DXLoadSurfaceFromSurface = GetProcAddress(hDll, "D3DXLoadSurfaceFromSurface");
(FARPROC&)m_pD3DXCreateLine = GetProcAddress(hDll, "D3DXCreateLine");
@@ -115,13 +115,13 @@ CDX9AllocatorPresenter::CDX9AllocatorPresenter(HWND hWnd, bool bFullscreen, HRES if (m_pDirect3DCreate9Ex) {
m_pDirect3DCreate9Ex(D3D_SDK_VERSION, &m_pD3DEx);
- if(!m_pD3DEx) {
+ if (!m_pD3DEx) {
m_pDirect3DCreate9Ex(D3D9b_SDK_VERSION, &m_pD3DEx);
}
}
- if(!m_pD3DEx) {
+ if (!m_pD3DEx) {
m_pD3D.Attach(Direct3DCreate9(D3D_SDK_VERSION));
- if(!m_pD3D) {
+ if (!m_pD3D) {
m_pD3D.Attach(Direct3DCreate9(D3D9b_SDK_VERSION));
}
} else {
@@ -537,8 +537,8 @@ void CDX9AllocatorPresenter::VSyncThread() m_DetectedRefreshTime = ThisValue;
m_DetectedRefreshTimePrim = 0;
}
- if(_isnan(m_DetectedRefreshTime)) {m_DetectedRefreshTime = 0.0;}
- if(_isnan(m_DetectedRefreshTimePrim)) {m_DetectedRefreshTimePrim = 0.0;}
+ if (_isnan(m_DetectedRefreshTime)) {m_DetectedRefreshTime = 0.0;}
+ if (_isnan(m_DetectedRefreshTimePrim)) {m_DetectedRefreshTimePrim = 0.0;}
ModerateFloat(m_DetectedRefreshTime, ThisValue, m_DetectedRefreshTimePrim, 1.5);
if (m_DetectedRefreshTime > 0.0) {
@@ -709,7 +709,7 @@ HRESULT CDX9AllocatorPresenter::CreateDevice(CString &_Error) CleanupRenderingEngine();
- if(!m_pD3D) {
+ if (!m_pD3D) {
_Error += L"Failed to create D3D9\n";
return E_UNEXPECTED;
}
@@ -792,7 +792,7 @@ HRESULT CDX9AllocatorPresenter::CreateDevice(CString &_Error) } else if (m_bForceInputHighColorResolution || m_bHighColorResolution) {
m_SurfaceType = D3DFMT_A2R10G10B10;
} else {
- if(m_nPCIVendor == PCIV_ATI)
+ if (m_nPCIVendor == PCIV_ATI)
m_SurfaceType = D3DFMT_X8R8G8B8;
else
m_SurfaceType = D3DFMT_A8R8G8B8;
@@ -808,7 +808,7 @@ HRESULT CDX9AllocatorPresenter::CreateDevice(CString &_Error) if (m_bHighColorResolution) {
pp.BackBufferFormat = D3DFMT_A2R10G10B10;
} else {
- pp.BackBufferFormat = D3DFMT_X8R8G8B8;
+ pp.BackBufferFormat = D3DFMT_X8R8G8B8;
}
pp.Windowed = false;
pp.BackBufferCount = 3;
@@ -909,7 +909,7 @@ HRESULT CDX9AllocatorPresenter::CreateDevice(CString &_Error) m_BackbufferType = pp.BackBufferFormat;
}
- while(hr == D3DERR_DEVICELOST) {
+ while (hr == D3DERR_DEVICELOST) {
TRACE("D3DERR_DEVICELOST. Trying to Reset.\n");
hr = m_pD3DDev->TestCooperativeLevel();
}
@@ -927,7 +927,7 @@ HRESULT CDX9AllocatorPresenter::CreateDevice(CString &_Error) m_pD3DDevEx->SetGPUThreadPriority(7);
}
- if(FAILED(hr)) {
+ if (FAILED(hr)) {
_Error += L"CreateDevice failed\n";
CStringW str;
str.Format(L"Error code: 0x%X\n", hr);
@@ -944,12 +944,12 @@ HRESULT CDX9AllocatorPresenter::CreateDevice(CString &_Error) InitRenderingEngine();
CComPtr<ISubPicProvider> pSubPicProvider;
- if(m_pSubPicQueue) {
+ if (m_pSubPicQueue) {
m_pSubPicQueue->GetSubPicProvider(&pSubPicProvider);
}
CSize size;
- switch(GetRenderersSettings().nSPCMaxRes) {
+ switch (GetRenderersSettings().nSPCMaxRes) {
case 0:
default:
size = m_ScreenSize;
@@ -983,11 +983,11 @@ HRESULT CDX9AllocatorPresenter::CreateDevice(CString &_Error) break;
}
- if(m_pAllocator) {
+ if (m_pAllocator) {
m_pAllocator->ChangeDevice(m_pD3DDev);
} else {
m_pAllocator = DNew CDX9SubPicAllocator(m_pD3DDev, size, GetRenderersSettings().fSPCPow2Tex, false);
- if(!m_pAllocator) {
+ if (!m_pAllocator) {
_Error += L"CDX9SubPicAllocator failed\n";
return E_FAIL;
@@ -998,13 +998,13 @@ HRESULT CDX9AllocatorPresenter::CreateDevice(CString &_Error) m_pSubPicQueue = GetRenderersSettings().nSPCSize > 0
? (ISubPicQueue*)DNew CSubPicQueue(GetRenderersSettings().nSPCSize, !GetRenderersSettings().fSPCAllowAnimationWhenBuffering, m_pAllocator, &hr)
: (ISubPicQueue*)DNew CSubPicQueueNoThread(m_pAllocator, &hr);
- if(!m_pSubPicQueue || FAILED(hr)) {
+ if (!m_pSubPicQueue || FAILED(hr)) {
_Error += L"m_pSubPicQueue failed\n";
return E_FAIL;
}
- if(pSubPicProvider) {
+ if (pSubPicProvider) {
m_pSubPicQueue->SetSubPicProvider(pSubPicProvider);
}
@@ -1066,7 +1066,7 @@ void CDX9AllocatorPresenter::DeleteSurfaces() UINT CDX9AllocatorPresenter::GetAdapter(IDirect3D9* pD3D, bool bGetAdapter)
{
- if(m_hWnd == NULL || pD3D == NULL) {
+ if (m_hWnd == NULL || pD3D == NULL) {
return D3DADAPTER_DEFAULT;
}
@@ -1074,11 +1074,11 @@ UINT CDX9AllocatorPresenter::GetAdapter(IDirect3D9* pD3D, bool bGetAdapter) m_nPCIVendor = 0;
CRenderersSettings& s = GetRenderersSettings();
- if(bGetAdapter && (pD3D->GetAdapterCount()>1) && (s.D3D9RenderDevice != _T(""))) {
+ if (bGetAdapter && (pD3D->GetAdapterCount()>1) && (s.D3D9RenderDevice != _T(""))) {
TCHAR strGUID[50];
D3DADAPTER_IDENTIFIER9 adapterIdentifier;
- for(UINT adp = 0, num_adp = pD3D->GetAdapterCount(); adp < num_adp; ++adp) {
+ for (UINT adp = 0, num_adp = pD3D->GetAdapterCount(); adp < num_adp; ++adp) {
if (pD3D->GetAdapterIdentifier(adp, 0, &adapterIdentifier) == S_OK) {
if ((::StringFromGUID2(adapterIdentifier.DeviceIdentifier, strGUID, 50) > 0) && (s.D3D9RenderDevice == strGUID)) {
m_D3D9Device = adapterIdentifier.Description;
@@ -1090,14 +1090,14 @@ UINT CDX9AllocatorPresenter::GetAdapter(IDirect3D9* pD3D, bool bGetAdapter) }
HMONITOR hMonitor = MonitorFromWindow(m_hWnd, MONITOR_DEFAULTTONEAREST);
- if(hMonitor == NULL) {
+ if (hMonitor == NULL) {
return D3DADAPTER_DEFAULT;
}
- for(UINT adp = 0, num_adp = pD3D->GetAdapterCount(); adp < num_adp; ++adp) {
+ for (UINT adp = 0, num_adp = pD3D->GetAdapterCount(); adp < num_adp; ++adp) {
HMONITOR hAdpMon = pD3D->GetAdapterMonitor(adp);
- if(hAdpMon == hMonitor) {
- if(bGetAdapter) {
+ if (hAdpMon == hMonitor) {
+ if (bGetAdapter) {
D3DADAPTER_IDENTIFIER9 adapterIdentifier;
if (pD3D->GetAdapterIdentifier(adp, 0, &adapterIdentifier) == S_OK) {
m_D3D9Device = adapterIdentifier.Description;
@@ -1185,7 +1185,7 @@ bool CDX9AllocatorPresenter::GetVBlank(int &_ScanLine, int &_bInVBlank, bool _bM int ScanLine = 0;
_ScanLine = 0;
_bInVBlank = 0;
-
+
if (m_pDirectDraw) {
DWORD ScanLineGet = 0;
m_pDirectDraw->GetScanLine(&ScanLineGet);
@@ -1511,7 +1511,7 @@ STDMETHODIMP_(bool) CDX9AllocatorPresenter::Paint(bool fAll) LONGLONG StartPaint = pApp->GetPerfCounter();
CAutoLock cRenderLock(&m_RenderLock);
- if(m_WindowRect.right <= m_WindowRect.left || m_WindowRect.bottom <= m_WindowRect.top
+ if (m_WindowRect.right <= m_WindowRect.left || m_WindowRect.bottom <= m_WindowRect.top
|| m_NativeVideoSize.cx <= 0 || m_NativeVideoSize.cy <= 0
|| !m_pVideoSurface) {
if (m_OrderedPaint) {
@@ -1569,7 +1569,7 @@ STDMETHODIMP_(bool) CDX9AllocatorPresenter::Paint(bool fAll) m_pOSDTexture = NULL;
m_pOSDSurface = NULL;
if ((m_VMR9AlphaBitmap.dwFlags & VMRBITMAP_DISABLE) == 0 && (BYTE *)m_VMR9AlphaBitmapData) {
- if( (m_pD3DXLoadSurfaceFromMemory != NULL) &&
+ if ( (m_pD3DXLoadSurfaceFromMemory != NULL) &&
SUCCEEDED(hr = m_pD3DDev->CreateTexture(rcSrc.Width(), rcSrc.Height(), 1,
D3DUSAGE_RENDERTARGET, D3DFMT_A8R8G8B8,
D3DPOOL_DEFAULT, &m_pOSDTexture, NULL)) ) {
@@ -1633,7 +1633,7 @@ STDMETHODIMP_(bool) CDX9AllocatorPresenter::Paint(bool fAll) BOOL Data;
//Sleep(5);
LONGLONG FlushStartTime = pApp->GetPerfCounter();
- while(S_FALSE == pEventQuery->GetData( &Data, sizeof(Data), D3DGETDATA_FLUSH )) {
+ while (S_FALSE == pEventQuery->GetData( &Data, sizeof(Data), D3DGETDATA_FLUSH )) {
if (!s.m_RenderSettings.iVMRFlushGPUWait) {
break;
}
@@ -1766,7 +1766,7 @@ STDMETHODIMP_(bool) CDX9AllocatorPresenter::Paint(bool fAll) if (!m_bPendingResetDevice) {
bool fResetDevice = false;
- if(hr == D3DERR_DEVICELOST && m_pD3DDev->TestCooperativeLevel() == D3DERR_DEVICENOTRESET) {
+ if (hr == D3DERR_DEVICELOST && m_pD3DDev->TestCooperativeLevel() == D3DERR_DEVICENOTRESET) {
TRACE("Reset Device: D3D Device Lost\n");
fResetDevice = true;
}
@@ -1795,17 +1795,17 @@ STDMETHODIMP_(bool) CDX9AllocatorPresenter::Paint(bool fAll) }
}
- if(s.fResetDevice) {
+ if (s.fResetDevice) {
LONGLONG time = GetRenderersData()->GetPerfCounter();
if (time > m_LastAdapterCheck + 20000000) { // check every 2 sec.
m_LastAdapterCheck = time;
#ifdef _DEBUG
D3DDEVICE_CREATION_PARAMETERS Parameters;
- if(SUCCEEDED(m_pD3DDev->GetCreationParameters(&Parameters))) {
+ if (SUCCEEDED(m_pD3DDev->GetCreationParameters(&Parameters))) {
ASSERT(Parameters.AdapterOrdinal == m_CurrentAdapter);
}
#endif
- if(m_CurrentAdapter != GetAdapter(m_pD3D)) {
+ if (m_CurrentAdapter != GetAdapter(m_pD3D)) {
TRACE("Reset Device: D3D adapter changed\n");
fResetDevice = true;
}
@@ -1817,7 +1817,7 @@ STDMETHODIMP_(bool) CDX9AllocatorPresenter::Paint(bool fAll) }
}
- if(fResetDevice) {
+ if (fResetDevice) {
m_bPendingResetDevice = true;
SendResetRequest();
}
@@ -1863,7 +1863,7 @@ STDMETHODIMP_(bool) CDX9AllocatorPresenter::ResetDevice() TRACE("ResetDevice\n");
_ASSERT(m_MainThreadId == GetCurrentThreadId());
StopWorkerThreads();
-
+
// In VMR-9 deleting the surfaces before we are told to is bad !
// Can't comment out this because CDX9AllocatorPresenter is used by EVR Custom
// Why is EVR using a presenter for DX9 anyway ?!
@@ -1876,7 +1876,7 @@ STDMETHODIMP_(bool) CDX9AllocatorPresenter::ResetDevice() // In VMR-9 'AllocSurfaces' call is redundant afaik because
// 'CreateDevice' calls 'm_pIVMRSurfAllocNotify->ChangeD3DDevice' which in turn calls
// 'CVMR9AllocatorPresenter::InitializeDevice' which calls 'AllocSurfaces'
- if(FAILED(hr = CreateDevice(Error)) || FAILED(hr = AllocSurfaces())) {
+ if (FAILED(hr = CreateDevice(Error)) || FAILED(hr = AllocSurfaces())) {
// TODO: We should probably pause player
#ifdef _DEBUG
Error += GetWindowsErrorMessage(hr, NULL);
@@ -2209,14 +2209,14 @@ void CDX9AllocatorPresenter::DrawStats() strText.Format(L"DirectX SDK : %d", GetRenderersData()->GetDXSdkRelease());
DrawText(rc, strText, 1);
OffsetRect (&rc, 0, TextHeight);
-
- if(m_D3D9Device != _T("")) {
+
+ if (m_D3D9Device != _T("")) {
strText = "Render device: " + m_D3D9Device;
DrawText(rc, strText, 1);
OffsetRect (&rc, 0, TextHeight);
}
- if(m_Decoder != _T("")) {
+ if (m_Decoder != _T("")) {
strText = "Decoder : " + m_Decoder;
DrawText(rc, strText, 1);
OffsetRect (&rc, 0, TextHeight);
@@ -2310,34 +2310,38 @@ STDMETHODIMP CDX9AllocatorPresenter::GetDIB(BYTE* lpDib, DWORD* size) m_pVideoSurface[m_nCurSurface]->GetDesc(&desc);
DWORD required = sizeof(BITMAPINFOHEADER) + (desc.Width * desc.Height * 32 >> 3);
- if(!lpDib) {
+ if (!lpDib) {
*size = required;
return S_OK;
}
- if(*size < required) {
+ if (*size < required) {
return E_OUTOFMEMORY;
}
*size = required;
D3DLOCKED_RECT r;
CComPtr<IDirect3DSurface9> pSurface;
- if(m_bFullFloatingPointProcessing || m_bHalfFloatingPointProcessing || m_bHighColorResolution) {
+ if (m_bFullFloatingPointProcessing || m_bHalfFloatingPointProcessing || m_bHighColorResolution) {
CComPtr<IDirect3DSurface9> fSurface = m_pVideoSurface[m_nCurSurface];
- if(FAILED(hr = m_pD3DDev->CreateOffscreenPlainSurface(desc.Width, desc.Height, D3DFMT_A8R8G8B8, D3DPOOL_DEFAULT, &fSurface, NULL))
- || FAILED(hr = m_pD3DXLoadSurfaceFromSurface(fSurface, NULL, NULL, m_pVideoSurface[m_nCurSurface], NULL, NULL, D3DX_DEFAULT, 0))) return hr;
+ if (FAILED(hr = m_pD3DDev->CreateOffscreenPlainSurface(desc.Width, desc.Height, D3DFMT_A8R8G8B8, D3DPOOL_DEFAULT, &fSurface, NULL))
+ || FAILED(hr = m_pD3DXLoadSurfaceFromSurface(fSurface, NULL, NULL, m_pVideoSurface[m_nCurSurface], NULL, NULL, D3DX_DEFAULT, 0))) return hr;
pSurface = fSurface;
- if(FAILED(hr = pSurface->LockRect(&r, NULL, D3DLOCK_READONLY))) {
+ if (FAILED(hr = pSurface->LockRect(&r, NULL, D3DLOCK_READONLY))) {
pSurface = NULL;
- if(FAILED(hr = m_pD3DDev->CreateOffscreenPlainSurface(desc.Width, desc.Height, D3DFMT_A8R8G8B8, D3DPOOL_SYSTEMMEM, &pSurface, NULL))
- || FAILED(hr = m_pD3DDev->GetRenderTargetData(fSurface, pSurface))
- || FAILED(hr = pSurface->LockRect(&r, NULL, D3DLOCK_READONLY))) return hr;}}
+ if (FAILED(hr = m_pD3DDev->CreateOffscreenPlainSurface(desc.Width, desc.Height, D3DFMT_A8R8G8B8, D3DPOOL_SYSTEMMEM, &pSurface, NULL))
+ || FAILED(hr = m_pD3DDev->GetRenderTargetData(fSurface, pSurface))
+ || FAILED(hr = pSurface->LockRect(&r, NULL, D3DLOCK_READONLY))) return hr;
+ }
+ }
else {
pSurface = m_pVideoSurface[m_nCurSurface];
- if(FAILED(hr = pSurface->LockRect(&r, NULL, D3DLOCK_READONLY))) {
+ if (FAILED(hr = pSurface->LockRect(&r, NULL, D3DLOCK_READONLY))) {
pSurface = NULL;
- if(FAILED(hr = m_pD3DDev->CreateOffscreenPlainSurface(desc.Width, desc.Height, desc.Format, D3DPOOL_SYSTEMMEM, &pSurface, NULL))
- || FAILED(hr = m_pD3DDev->GetRenderTargetData(m_pVideoSurface[m_nCurSurface], pSurface))
- || FAILED(hr = pSurface->LockRect(&r, NULL, D3DLOCK_READONLY))) return hr;}}
+ if (FAILED(hr = m_pD3DDev->CreateOffscreenPlainSurface(desc.Width, desc.Height, desc.Format, D3DPOOL_SYSTEMMEM, &pSurface, NULL))
+ || FAILED(hr = m_pD3DDev->GetRenderTargetData(m_pVideoSurface[m_nCurSurface], pSurface))
+ || FAILED(hr = pSurface->LockRect(&r, NULL, D3DLOCK_READONLY))) return hr;
+ }
+ }
BITMAPINFOHEADER* bih = (BITMAPINFOHEADER*)lpDib;
memset(bih, 0, sizeof(BITMAPINFOHEADER));
diff --git a/src/filters/renderer/VideoRenderers/DX9RenderingEngine.cpp b/src/filters/renderer/VideoRenderers/DX9RenderingEngine.cpp index dd8e45cff..2cb4aa516 100644 --- a/src/filters/renderer/VideoRenderers/DX9RenderingEngine.cpp +++ b/src/filters/renderer/VideoRenderers/DX9RenderingEngine.cpp @@ -48,16 +48,16 @@ static void AdjustQuad(MYD3DVERTEX<texcoords>* v, double dx, double dy) {
double offset = 0.5;
- for(int i = 0; i < 4; i++) {
+ for (int i = 0; i < 4; i++) {
v[i].x -= offset;
v[i].y -= offset;
- for(int j = 0; j < max(texcoords-1, 1); j++) {
+ for (int j = 0; j < max(texcoords-1, 1); j++) {
v[i].t[j].u -= offset*dx;
v[i].t[j].v -= offset*dy;
}
- if(texcoords > 1) {
+ if (texcoords > 1) {
v[i].t[texcoords-1].u -= offset;
v[i].t[texcoords-1].v -= offset;
}
@@ -67,13 +67,13 @@ static void AdjustQuad(MYD3DVERTEX<texcoords>* v, double dx, double dy) template<int texcoords>
static HRESULT TextureBlt(IDirect3DDevice9* pD3DDev, MYD3DVERTEX<texcoords> v[4], D3DTEXTUREFILTERTYPE filter)
{
- if(!pD3DDev) {
+ if (!pD3DDev) {
return E_POINTER;
}
DWORD FVF = 0;
- switch(texcoords) {
+ switch (texcoords) {
case 1:
FVF = D3DFVF_TEX1;
break;
@@ -113,7 +113,7 @@ static HRESULT TextureBlt(IDirect3DDevice9* pD3DDev, MYD3DVERTEX<texcoords> v[4] hr = pD3DDev->SetRenderState(D3DRS_SCISSORTESTENABLE, FALSE);
hr = pD3DDev->SetRenderState(D3DRS_COLORWRITEENABLE, D3DCOLORWRITEENABLE_ALPHA|D3DCOLORWRITEENABLE_BLUE|D3DCOLORWRITEENABLE_GREEN|D3DCOLORWRITEENABLE_RED);
- for(int i = 0; i < texcoords; i++) {
+ for (int i = 0; i < texcoords; i++) {
hr = pD3DDev->SetSamplerState(i, D3DSAMP_MAGFILTER, filter);
hr = pD3DDev->SetSamplerState(i, D3DSAMP_MINFILTER, filter);
hr = pD3DDev->SetSamplerState(i, D3DSAMP_MIPFILTER, D3DTEXF_NONE);
@@ -134,7 +134,7 @@ static HRESULT TextureBlt(IDirect3DDevice9* pD3DDev, MYD3DVERTEX<texcoords> v[4] //
- for(int i = 0; i < texcoords; i++) {
+ for (int i = 0; i < texcoords; i++) {
pD3DDev->SetTexture(i, NULL);
}
@@ -182,12 +182,12 @@ void CDX9RenderingEngine::CleanupRenderingEngine() CleanupFinalPass();
POSITION pos = m_pCustomScreenSpacePixelShaders.GetHeadPosition();
- while(pos) {
+ while (pos) {
CExternalPixelShader &Shader = m_pCustomScreenSpacePixelShaders.GetNext(pos);
Shader.m_pPixelShader = NULL;
}
pos = m_pCustomPixelShaders.GetHeadPosition();
- while(pos) {
+ while (pos) {
CExternalPixelShader &Shader = m_pCustomPixelShaders.GetNext(pos);
Shader.m_pPixelShader = NULL;
}
@@ -215,10 +215,10 @@ HRESULT CDX9RenderingEngine::CreateVideoSurfaces() int nTexturesNeeded = settings.iAPSurfaceUsage == VIDRNDT_AP_TEXTURE3D ? m_nNbDXSurface : 1;
for (int i = 0; i < nTexturesNeeded; i++) {
- if(FAILED(hr = m_pD3DDev->CreateTexture(
- m_NativeVideoSize.cx, m_NativeVideoSize.cy, 1,
- D3DUSAGE_RENDERTARGET, m_SurfaceType,
- D3DPOOL_DEFAULT, &m_pVideoTexture[i], NULL))) {
+ if (FAILED(hr = m_pD3DDev->CreateTexture(
+ m_NativeVideoSize.cx, m_NativeVideoSize.cy, 1,
+ D3DUSAGE_RENDERTARGET, m_SurfaceType,
+ D3DPOOL_DEFAULT, &m_pVideoTexture[i], NULL))) {
return hr;
}
@@ -361,7 +361,7 @@ HRESULT CDX9RenderingEngine::RenderVideoDrawPath(IDirect3DSurface9* pRenderTarge long stop = clock();
long diff = stop - start;
- if(diff >= 10*60*CLOCKS_PER_SEC) {
+ if (diff >= 10*60*CLOCKS_PER_SEC) {
start = stop; // reset after 10 min (ps float has its limits in both range and accuracy)
}
@@ -389,7 +389,7 @@ HRESULT CDX9RenderingEngine::RenderVideoDrawPath(IDirect3DSurface9* pRenderTarge bool first = true;
POSITION pos = m_pCustomPixelShaders.GetHeadPosition();
- while(pos) {
+ while (pos) {
CComPtr<IDirect3DSurface9> pTemporarySurface;
hr = m_pTemporaryVideoTextures[dest]->GetSurfaceLevel(0, &pTemporarySurface);
hr = m_pD3DDev->SetRenderTarget(0, pTemporarySurface);
@@ -972,44 +972,44 @@ HRESULT CDX9RenderingEngine::InitFinalPass() m_pFinalPixelShader = NULL;
if (!m_pDitherTexture) {
- // Create the dither texture
- hr = m_pD3DDev->CreateTexture(DITHER_MATRIX_SIZE, DITHER_MATRIX_SIZE,
- 1,
- D3DUSAGE_DYNAMIC,
- D3DFMT_A16B16G16R16F,
- D3DPOOL_DEFAULT,
- &m_pDitherTexture,
- NULL);
+ // Create the dither texture
+ hr = m_pD3DDev->CreateTexture(DITHER_MATRIX_SIZE, DITHER_MATRIX_SIZE,
+ 1,
+ D3DUSAGE_DYNAMIC,
+ D3DFMT_A16B16G16R16F,
+ D3DPOOL_DEFAULT,
+ &m_pDitherTexture,
+ NULL);
- if (FAILED(hr)) {
- CleanupFinalPass();
- return hr;
- }
+ if (FAILED(hr)) {
+ CleanupFinalPass();
+ return hr;
+ }
- D3DLOCKED_RECT lockedRect;
- hr = m_pDitherTexture->LockRect(0, &lockedRect, NULL, D3DLOCK_DISCARD);
- if (FAILED(hr)) {
- CleanupFinalPass();
- return hr;
- }
+ D3DLOCKED_RECT lockedRect;
+ hr = m_pDitherTexture->LockRect(0, &lockedRect, NULL, D3DLOCK_DISCARD);
+ if (FAILED(hr)) {
+ CleanupFinalPass();
+ return hr;
+ }
- char* outputRowIterator = static_cast<char*>(lockedRect.pBits);
- for (int y = 0; y < DITHER_MATRIX_SIZE; y++) {
- unsigned short* outputIterator = reinterpret_cast<unsigned short*>(outputRowIterator);
- for (int x = 0; x < DITHER_MATRIX_SIZE; x++) {
- for (int i = 0; i < 4; i++) {
- *outputIterator++ = DITHER_MATRIX[y][x];
+ char* outputRowIterator = static_cast<char*>(lockedRect.pBits);
+ for (int y = 0; y < DITHER_MATRIX_SIZE; y++) {
+ unsigned short* outputIterator = reinterpret_cast<unsigned short*>(outputRowIterator);
+ for (int x = 0; x < DITHER_MATRIX_SIZE; x++) {
+ for (int i = 0; i < 4; i++) {
+ *outputIterator++ = DITHER_MATRIX[y][x];
+ }
}
- }
- outputRowIterator += lockedRect.Pitch;
- }
+ outputRowIterator += lockedRect.Pitch;
+ }
- hr = m_pDitherTexture->UnlockRect(0);
- if (FAILED(hr)) {
- CleanupFinalPass();
- return hr;
- }
+ hr = m_pDitherTexture->UnlockRect(0);
+ if (FAILED(hr)) {
+ CleanupFinalPass();
+ return hr;
+ }
}
// Initialize the color management if necessary
@@ -1382,7 +1382,7 @@ HRESULT CDX9RenderingEngine::FinalPass(IDirect3DTexture9* pTexture) {w, h, 0.5f, 2.0f, 1, 1},
};
- for(int i = 0; i < countof(v); i++) {
+ for (int i = 0; i < countof(v); i++) {
v[i].x -= 0.5;
v[i].y -= 0.5;
}
@@ -1550,7 +1550,7 @@ HRESULT CDX9RenderingEngine::DrawRect(DWORD _Color, DWORD _Alpha, const CRect &_ HRESULT CDX9RenderingEngine::AlphaBlt(RECT* pSrc, RECT* pDst, IDirect3DTexture9* pTexture)
{
- if(!pSrc || !pDst) {
+ if (!pSrc || !pDst) {
return E_POINTER;
}
@@ -1560,7 +1560,7 @@ HRESULT CDX9RenderingEngine::AlphaBlt(RECT* pSrc, RECT* pDst, IDirect3DTexture9* D3DSURFACE_DESC d3dsd;
ZeroMemory(&d3dsd, sizeof(d3dsd));
- if(FAILED(pTexture->GetLevelDesc(0, &d3dsd)) /*|| d3dsd.Type != D3DRTYPE_TEXTURE*/) {
+ if (FAILED(pTexture->GetLevelDesc(0, &d3dsd)) /*|| d3dsd.Type != D3DRTYPE_TEXTURE*/) {
return E_FAIL;
}
@@ -1577,8 +1577,8 @@ HRESULT CDX9RenderingEngine::AlphaBlt(RECT* pSrc, RECT* pDst, IDirect3DTexture9* {(float)dst.left, (float)dst.bottom, 0.5f, 2.0f, (float)src.left / w, (float)src.bottom / h},
{(float)dst.right, (float)dst.bottom, 0.5f, 2.0f, (float)src.right / w, (float)src.bottom / h},
};
-
- for(int i = 0; i < countof(pVertices); i++) {
+
+ for (int i = 0; i < countof(pVertices); i++) {
pVertices[i].x -= 0.5;
pVertices[i].y -= 0.5;
}
diff --git a/src/filters/renderer/VideoRenderers/DX9RenderingEngine.h b/src/filters/renderer/VideoRenderers/DX9RenderingEngine.h index 38ffe2a27..acdae17cb 100644 --- a/src/filters/renderer/VideoRenderers/DX9RenderingEngine.h +++ b/src/filters/renderer/VideoRenderers/DX9RenderingEngine.h @@ -95,7 +95,7 @@ namespace DSObjects CStringA m_SourceTarget;
HRESULT Compile(CPixelShaderCompiler *pCompiler) {
HRESULT hr = pCompiler->CompileShader(m_SourceData, "main", m_SourceTarget, 0, &m_pPixelShader);
- if(FAILED(hr)) {
+ if (FAILED(hr)) {
return hr;
}
diff --git a/src/filters/renderer/VideoRenderers/DXRAllocatorPresenter.cpp b/src/filters/renderer/VideoRenderers/DXRAllocatorPresenter.cpp index da927616e..6547c513b 100644 --- a/src/filters/renderer/VideoRenderers/DXRAllocatorPresenter.cpp +++ b/src/filters/renderer/VideoRenderers/DXRAllocatorPresenter.cpp @@ -37,7 +37,7 @@ CDXRAllocatorPresenter::CDXRAllocatorPresenter(HWND hWnd, HRESULT& hr, CString & : CSubPicAllocatorPresenterImpl(hWnd, hr, &_Error)
, m_ScreenSize(0, 0)
{
- if(FAILED(hr)) {
+ if (FAILED(hr)) {
_Error += L"ISubPicAllocatorPresenterImpl failed\n";
return;
}
@@ -47,7 +47,7 @@ CDXRAllocatorPresenter::CDXRAllocatorPresenter(HWND hWnd, HRESULT& hr, CString & CDXRAllocatorPresenter::~CDXRAllocatorPresenter()
{
- if(m_pSRCB) {
+ if (m_pSRCB) {
// nasty, but we have to let it know about our death somehow
((CSubRenderCallback*)(ISubRenderCallback*)m_pSRCB)->SetDXRAP(NULL);
}
@@ -73,8 +73,8 @@ STDMETHODIMP CDXRAllocatorPresenter::NonDelegatingQueryInterface(REFIID riid, vo return GetInterface((IVMRWindowlessControl*)this, ppv);
*/
- if(riid != IID_IUnknown && m_pDXR) {
- if(SUCCEEDED(m_pDXR->QueryInterface(riid, ppv))) {
+ if (riid != IID_IUnknown && m_pDXR) {
+ if (SUCCEEDED(m_pDXR->QueryInterface(riid, ppv))) {
return S_OK;
}
}
@@ -87,7 +87,7 @@ HRESULT CDXRAllocatorPresenter::SetDevice(IDirect3DDevice9* pD3DDev) CheckPointer(pD3DDev, E_POINTER);
CSize size;
- switch(GetRenderersSettings().nSPCMaxRes) {
+ switch (GetRenderersSettings().nSPCMaxRes) {
case 0:
default:
size = m_ScreenSize;
@@ -121,11 +121,11 @@ HRESULT CDXRAllocatorPresenter::SetDevice(IDirect3DDevice9* pD3DDev) break;
}
- if(m_pAllocator) {
+ if (m_pAllocator) {
m_pAllocator->ChangeDevice(pD3DDev);
} else {
m_pAllocator = DNew CDX9SubPicAllocator(pD3DDev, size, GetRenderersSettings().fSPCPow2Tex, true);
- if(!m_pAllocator) {
+ if (!m_pAllocator) {
return E_FAIL;
}
}
@@ -135,11 +135,11 @@ HRESULT CDXRAllocatorPresenter::SetDevice(IDirect3DDevice9* pD3DDev) m_pSubPicQueue = GetRenderersSettings().nSPCSize > 0
? (ISubPicQueue*)DNew CSubPicQueue(GetRenderersSettings().nSPCSize, !GetRenderersSettings().fSPCAllowAnimationWhenBuffering, m_pAllocator, &hr)
: (ISubPicQueue*)DNew CSubPicQueueNoThread(m_pAllocator, &hr);
- if(!m_pSubPicQueue || FAILED(hr)) {
+ if (!m_pSubPicQueue || FAILED(hr)) {
return E_FAIL;
}
- if(m_SubPicProvider) {
+ if (m_SubPicProvider) {
m_pSubPicQueue->SetSubPicProvider(m_SubPicProvider);
}
@@ -152,7 +152,7 @@ HRESULT CDXRAllocatorPresenter::Render( {
__super::SetPosition(CRect(0, 0, width, height), CRect(left, top, right, bottom)); // needed? should be already set by the player
SetTime(rtStart);
- if(atpf > 0 && m_pSubPicQueue) {
+ if (atpf > 0 && m_pSubPicQueue) {
m_pSubPicQueue->SetFPS(10000000.0 / atpf);
}
AlphaBltSubPic(CSize(width, height));
@@ -165,22 +165,22 @@ STDMETHODIMP CDXRAllocatorPresenter::CreateRenderer(IUnknown** ppRenderer) {
CheckPointer(ppRenderer, E_POINTER);
- if(m_pDXR) {
+ if (m_pDXR) {
return E_UNEXPECTED;
}
m_pDXR.CoCreateInstance(CLSID_DXR, GetOwner());
- if(!m_pDXR) {
+ if (!m_pDXR) {
return E_FAIL;
}
CComQIPtr<ISubRender> pSR = m_pDXR;
- if(!pSR) {
+ if (!pSR) {
m_pDXR = NULL;
return E_FAIL;
}
m_pSRCB = DNew CSubRenderCallback(this);
- if(FAILED(pSR->SetCallback(m_pSRCB))) {
+ if (FAILED(pSR->SetCallback(m_pSRCB))) {
m_pDXR = NULL;
return E_FAIL;
}
@@ -198,12 +198,12 @@ STDMETHODIMP CDXRAllocatorPresenter::CreateRenderer(IUnknown** ppRenderer) STDMETHODIMP_(void) CDXRAllocatorPresenter::SetPosition(RECT w, RECT v)
{
- if(CComQIPtr<IBasicVideo> pBV = m_pDXR) {
+ if (CComQIPtr<IBasicVideo> pBV = m_pDXR) {
pBV->SetDefaultSourcePosition();
pBV->SetDestinationPosition(v.left, v.top, v.right - v.left, v.bottom - v.top);
}
- if(CComQIPtr<IVideoWindow> pVW = m_pDXR) {
+ if (CComQIPtr<IVideoWindow> pVW = m_pDXR) {
pVW->SetWindowPosition(w.left, w.top, w.right - w.left, w.bottom - w.top);
}
}
@@ -212,12 +212,12 @@ STDMETHODIMP_(SIZE) CDXRAllocatorPresenter::GetVideoSize(bool fCorrectAR) {
SIZE size = {0, 0};
- if(!fCorrectAR) {
- if(CComQIPtr<IBasicVideo> pBV = m_pDXR) {
+ if (!fCorrectAR) {
+ if (CComQIPtr<IBasicVideo> pBV = m_pDXR) {
pBV->GetVideoSize(&size.cx, &size.cy);
}
} else {
- if(CComQIPtr<IBasicVideo2> pBV2 = m_pDXR) {
+ if (CComQIPtr<IBasicVideo2> pBV2 = m_pDXR) {
pBV2->GetPreferredAspectRatio(&size.cx, &size.cy);
}
}
@@ -233,7 +233,7 @@ STDMETHODIMP_(bool) CDXRAllocatorPresenter::Paint(bool fAll) STDMETHODIMP CDXRAllocatorPresenter::GetDIB(BYTE* lpDib, DWORD* size)
{
HRESULT hr = E_NOTIMPL;
- if(CComQIPtr<IBasicVideo> pBV = m_pDXR) {
+ if (CComQIPtr<IBasicVideo> pBV = m_pDXR) {
hr = pBV->GetCurrentImage((long*)size, (long*)lpDib);
}
return hr;
diff --git a/src/filters/renderer/VideoRenderers/EVRAllocatorPresenter.cpp b/src/filters/renderer/VideoRenderers/EVRAllocatorPresenter.cpp index 1f126b4bc..4634b9db1 100644 --- a/src/filters/renderer/VideoRenderers/EVRAllocatorPresenter.cpp +++ b/src/filters/renderer/VideoRenderers/EVRAllocatorPresenter.cpp @@ -297,18 +297,18 @@ STDMETHODIMP CEVRAllocatorPresenter::CreateRenderer(IUnknown** ppRenderer) CComPtr<IMFVideoRenderer> pMFVR;
CComQIPtr<IMFGetService, &__uuidof(IMFGetService)> pMFGS = pBF;
CComQIPtr<IEVRFilterConfig> pConfig = pBF;
- if(SUCCEEDED(hr)) {
- if(FAILED(pConfig->SetNumberOfStreams(3))) { // TODO - maybe need other number of input stream ...
+ if (SUCCEEDED(hr)) {
+ if (FAILED(pConfig->SetNumberOfStreams(3))) { // TODO - maybe need other number of input stream ...
break;
}
}
hr = pMFGS->GetService (MR_VIDEO_RENDER_SERVICE, IID_IMFVideoRenderer, (void**)&pMFVR);
- if(SUCCEEDED(hr)) {
+ if (SUCCEEDED(hr)) {
hr = QueryInterface (__uuidof(IMFVideoPresenter), (void**)&pVP);
}
- if(SUCCEEDED(hr)) {
+ if (SUCCEEDED(hr)) {
hr = pMFVR->InitializeRenderer (NULL, pVP);
}
@@ -322,7 +322,7 @@ STDMETHODIMP CEVRAllocatorPresenter::CreateRenderer(IUnknown** ppRenderer) m_fUseInternalTimer = false;
#endif
- if(FAILED(hr)) {
+ if (FAILED(hr)) {
*ppRenderer = NULL;
} else {
*ppRenderer = pBF.Detach();
@@ -341,27 +341,27 @@ STDMETHODIMP_(bool) CEVRAllocatorPresenter::Paint(bool fAll) STDMETHODIMP CEVRAllocatorPresenter::NonDelegatingQueryInterface(REFIID riid, void** ppv)
{
HRESULT hr;
- if(riid == __uuidof(IMFClockStateSink)) {
+ if (riid == __uuidof(IMFClockStateSink)) {
hr = GetInterface((IMFClockStateSink*)this, ppv);
- } else if(riid == __uuidof(IMFVideoPresenter)) {
+ } else if (riid == __uuidof(IMFVideoPresenter)) {
hr = GetInterface((IMFVideoPresenter*)this, ppv);
- } else if(riid == __uuidof(IMFTopologyServiceLookupClient)) {
+ } else if (riid == __uuidof(IMFTopologyServiceLookupClient)) {
hr = GetInterface((IMFTopologyServiceLookupClient*)this, ppv);
- } else if(riid == __uuidof(IMFVideoDeviceID)) {
+ } else if (riid == __uuidof(IMFVideoDeviceID)) {
hr = GetInterface((IMFVideoDeviceID*)this, ppv);
- } else if(riid == __uuidof(IMFGetService)) {
+ } else if (riid == __uuidof(IMFGetService)) {
hr = GetInterface((IMFGetService*)this, ppv);
- } else if(riid == __uuidof(IMFAsyncCallback)) {
+ } else if (riid == __uuidof(IMFAsyncCallback)) {
hr = GetInterface((IMFAsyncCallback*)this, ppv);
- } else if(riid == __uuidof(IMFVideoDisplayControl)) {
+ } else if (riid == __uuidof(IMFVideoDisplayControl)) {
hr = GetInterface((IMFVideoDisplayControl*)this, ppv);
- } else if(riid == __uuidof(IEVRTrustedVideoPlugin)) {
+ } else if (riid == __uuidof(IEVRTrustedVideoPlugin)) {
hr = GetInterface((IEVRTrustedVideoPlugin*)this, ppv);
- } else if(riid == IID_IQualProp) {
+ } else if (riid == IID_IQualProp) {
hr = GetInterface((IQualProp*)this, ppv);
- } else if(riid == __uuidof(IMFRateSupport)) {
+ } else if (riid == __uuidof(IMFRateSupport)) {
hr = GetInterface((IMFRateSupport*)this, ppv);
- } else if(riid == __uuidof(IDirect3DDeviceManager9))
+ } else if (riid == __uuidof(IDirect3DDeviceManager9))
// hr = GetInterface((IDirect3DDeviceManager9*)this, ppv);
{
hr = m_pD3DManager->QueryInterface (__uuidof(IDirect3DDeviceManager9), (void**) ppv);
@@ -764,7 +764,7 @@ HRESULT CEVRAllocatorPresenter::CreateProposedOutputType(IMFMediaType* pMixerTyp bool bDoneSomething = true;
- if(m_AspectRatio.cx >= 1 && m_AspectRatio.cy >= 1) { //if any of these is 0, it will stuck into a infinite loop
+ if (m_AspectRatio.cx >= 1 && m_AspectRatio.cy >= 1) { //if any of these is 0, it will stuck into a infinite loop
while (bDoneSomething) {
bDoneSomething = false;
INT MinNum = min(m_AspectRatio.cx, m_AspectRatio.cy);
@@ -924,13 +924,13 @@ HRESULT CEVRAllocatorPresenter::GetMediaTypeMerit(IMFMediaType* pType, int* pMer break;
case FCC('AYUV'):
*pMerit = 3;
- break;
- case D3DFMT_X8R8G8B8:
- if (m_bForceInputHighColorResolution) {
+ break;
+ case D3DFMT_X8R8G8B8:
+ if (m_bForceInputHighColorResolution) {
*pMerit = 63;
- } else {
+ } else {
*pMerit = 1;
- }
+ }
break;
case D3DFMT_A8R8G8B8:// an accepted format, but fails on most surface types
case D3DFMT_A8B8G8R8:
@@ -1245,7 +1245,7 @@ STDMETHODIMP CEVRAllocatorPresenter::GetIdealVideoSize(SIZE *pszMin, SIZE *pszMa D3DDISPLAYMODE d3ddm;
ZeroMemory(&d3ddm, sizeof(d3ddm));
- if(SUCCEEDED(m_pD3D->GetAdapterDisplayMode(GetAdapter(m_pD3D), &d3ddm))) {
+ if (SUCCEEDED(m_pD3D->GetAdapterDisplayMode(GetAdapter(m_pD3D), &d3ddm))) {
pszMax->cx = d3ddm.Width;
pszMax->cy = d3ddm.Height;
}
@@ -1439,16 +1439,16 @@ STDMETHODIMP CEVRAllocatorPresenter::GetNativeVideoSize(LONG* lpWidth, LONG* lpH // This function should be called...
ASSERT (FALSE);
- if(lpWidth) {
+ if (lpWidth) {
*lpWidth = m_NativeVideoSize.cx;
}
- if(lpHeight) {
+ if (lpHeight) {
*lpHeight = m_NativeVideoSize.cy;
}
- if(lpARWidth) {
+ if (lpARWidth) {
*lpARWidth = m_AspectRatio.cx;
}
- if(lpARHeight) {
+ if (lpARHeight) {
*lpARHeight = m_AspectRatio.cy;
}
return S_OK;
@@ -1480,7 +1480,7 @@ STDMETHODIMP CEVRAllocatorPresenter::InitializeDevice(IMFMediaType* pMediaType) }
if (SUCCEEDED(hr)) {
- for(int i = 0; i < m_nNbDXSurface; i++) {
+ for (int i = 0; i < m_nNbDXSurface; i++) {
CComPtr<IMFSample> pMFSample;
hr = pfMFCreateVideoSampleFromSurface (m_pVideoSurface[i], &pMFSample);
@@ -1581,9 +1581,9 @@ void CEVRAllocatorPresenter::GetMixerThread() ExtractAvgTimePerFrame (&mt, m_rtTimePerFrame);
m_bInterlaced = ExtractInterlaced(&mt);
-
+
CComPtr<IPin> pPinTo;
- if(SUCCEEDED(pPin->ConnectedTo(&pPinTo)) && pPinTo) {
+ if (SUCCEEDED(pPin->ConnectedTo(&pPinTo)) && pPinTo) {
m_Decoder = GetFilterName(GetFilterFromPin(pPinTo));
}
}
@@ -1593,7 +1593,7 @@ void CEVRAllocatorPresenter::GetMixerThread() }
// Update internal subtitle clock
- if(m_fUseInternalTimer && m_pSubPicQueue) {
+ if (m_fUseInternalTimer && m_pSubPicQueue) {
m_fps = (float)(10000000.0 / m_rtTimePerFrame);
m_pSubPicQueue->SetFPS(m_fps);
}
@@ -1856,7 +1856,7 @@ STDMETHODIMP_(bool) CEVRAllocatorPresenter::ResetDevice() bool bResult = __super::ResetDevice();
- for(int i = 0; i < m_nNbDXSurface; i++) {
+ for (int i = 0; i < m_nNbDXSurface; i++) {
CComPtr<IMFSample> pMFSample;
HRESULT hr = pfMFCreateVideoSampleFromSurface (m_pVideoSurface[i], &pMFSample);
@@ -1904,7 +1904,7 @@ STDMETHODIMP_(bool) CEVRAllocatorPresenter::DisplayChange() m_bSyncStatsAvailable = false;
bool bResult = __super::DisplayChange();
-
+
return bResult;
}
@@ -2012,18 +2012,18 @@ void CEVRAllocatorPresenter::RenderThread() m_pcFrames++;
bStepForward = true;
m_nStepCount = 0;
-/*
- } else if (m_nStepCount > 0) {
- pMFSample->GetUINT32(GUID_SURFACE_INDEX, (UINT32 *)&m_nCurSurface);
- ++m_OrderedPaint;
- if (!g_bExternalSubtitleTime) {
- __super::SetTime (g_tSegmentStart + nsSampleTime);
- }
- Paint(true);
- m_nDroppedUpdate = 0;
- CompleteFrameStep (false);
- bStepForward = true;
-*/
+ /*
+ } else if (m_nStepCount > 0) {
+ pMFSample->GetUINT32(GUID_SURFACE_INDEX, (UINT32 *)&m_nCurSurface);
+ ++m_OrderedPaint;
+ if (!g_bExternalSubtitleTime) {
+ __super::SetTime (g_tSegmentStart + nsSampleTime);
+ }
+ Paint(true);
+ m_nDroppedUpdate = 0;
+ CompleteFrameStep (false);
+ bStepForward = true;
+ */
} else if ((m_nRenderState == Started)) {
LONGLONG CurrentCounter = GetRenderersData()->GetPerfCounter();
// Calculate wake up timer
diff --git a/src/filters/renderer/VideoRenderers/IPinHook.cpp b/src/filters/renderer/VideoRenderers/IPinHook.cpp index d982ba47a..ed671b30a 100644 --- a/src/filters/renderer/VideoRenderers/IPinHook.cpp +++ b/src/filters/renderer/VideoRenderers/IPinHook.cpp @@ -191,7 +191,7 @@ static HRESULT ( STDMETHODCALLTYPE *ReceiveOrg )( IMemInputPinC * This, IMediaSa static HRESULT STDMETHODCALLTYPE ReceiveMineI(IMemInputPinC * This, IMediaSample *pSample)
{
REFERENCE_TIME rtStart, rtStop;
- if(pSample && SUCCEEDED(pSample->GetTime(&rtStart, &rtStop))) {
+ if (pSample && SUCCEEDED(pSample->GetTime(&rtStart, &rtStop))) {
g_tSampleStart = rtStart;
}
return ReceiveOrg(This, pSample);
@@ -201,7 +201,7 @@ static HRESULT STDMETHODCALLTYPE ReceiveMine(IMemInputPinC * This, IMediaSample {
// Support ffdshow queueing.
// To avoid black out on pause, we have to lock g_ffdshowReceive to synchronize with CMainFrame::OnPlayPause.
- if(queue_ffdshow_support) {
+ if (queue_ffdshow_support) {
CAutoLock lck(&g_ffdshowReceive);
return ReceiveMineI(This,pSample);
}
@@ -236,7 +236,7 @@ void UnhookNewSegmentAndReceive() bool HookNewSegmentAndReceive(IPinC* pPinC, IMemInputPinC* pMemInputPinC)
{
- if(!pPinC || !pMemInputPinC || (GetVersion()&0x80000000)) {
+ if (!pPinC || !pMemInputPinC || (GetVersion()&0x80000000)) {
return false;
}
@@ -250,7 +250,7 @@ bool HookNewSegmentAndReceive(IPinC* pPinC, IMemInputPinC* pMemInputPinC) // Casimir666 : change sizeof(IPinC) to sizeof(IPinCVtbl) to fix crash with EVR hack on Vista!
res = VirtualProtect(pPinC->lpVtbl, sizeof(IPinCVtbl), PAGE_WRITECOPY, &flOldProtect);
- if(NewSegmentOrg == NULL) {
+ if (NewSegmentOrg == NULL) {
NewSegmentOrg = pPinC->lpVtbl->NewSegment;
}
pPinC->lpVtbl->NewSegment = NewSegmentMine; // Function sets global variable(s)
@@ -258,7 +258,7 @@ bool HookNewSegmentAndReceive(IPinC* pPinC, IMemInputPinC* pMemInputPinC) // Casimir666 : change sizeof(IMemInputPinC) to sizeof(IMemInputPinCVtbl) to fix crash with EVR hack on Vista!
res = VirtualProtect(pMemInputPinC->lpVtbl, sizeof(IMemInputPinCVtbl), PAGE_WRITECOPY, &flOldProtect);
- if(ReceiveOrg == NULL) {
+ if (ReceiveOrg == NULL) {
ReceiveOrg = pMemInputPinC->lpVtbl->Receive;
}
pMemInputPinC->lpVtbl->Receive = ReceiveMine; // Function sets global variable(s)
@@ -301,10 +301,10 @@ static void LOG_TOFILE(LPCTSTR FileName, LPCTSTR fmt, ...) va_list args;
va_start(args, fmt);
int nCount = _vsctprintf(fmt, args) + 1;
- if(TCHAR* buff = DNew TCHAR[nCount]) {
+ if (TCHAR* buff = DNew TCHAR[nCount]) {
FILE* f;
_vstprintf_s(buff, nCount, fmt, args);
- if(_tfopen_s(&f, FileName, _T("at")) == 0) {
+ if (_tfopen_s(&f, FileName, _T("at")) == 0) {
fseek(f, 0, 2);
_ftprintf(f, _T("%s\n"), buff);
fclose(f);
@@ -322,7 +322,7 @@ static void LOG(LPCTSTR fmt, ...) TCHAR buff[3000];
FILE* f;
_vstprintf_s(buff, countof(buff), fmt, args);
- if(_tfopen_s(&f, LOG_FILE_DXVA, _T("at")) == 0) {
+ if (_tfopen_s(&f, LOG_FILE_DXVA, _T("at")) == 0) {
fseek(f, 0, 2);
_ftprintf(f, _T("%s\n"), buff);
fclose(f);
@@ -332,7 +332,7 @@ static void LOG(LPCTSTR fmt, ...) }
static void LOGPF(LPCTSTR prefix, const DDPIXELFORMAT* p, int n)
{
- for(int i = 0; i < n; i++) {
+ for (int i = 0; i < n; i++) {
LOG(_T("%s[%d].dwSize = %d"), prefix, i, p[i].dwSize);
LOG(_T("%s[%d].dwFlags = %08x"), prefix, i, p[i].dwFlags);
LOG(_T("%s[%d].dwFourCC = %4.4hs"), prefix, i, &p[i].dwFourCC);
@@ -346,7 +346,7 @@ static void LOGPF(LPCTSTR prefix, const DDPIXELFORMAT* p, int n) static void LOGUDI(LPCTSTR prefix, const AMVAUncompDataInfo* p, int n)
{
- for(int i = 0; i < n; i++) {
+ for (int i = 0; i < n; i++) {
LOG(_T("%s[%d].dwUncompWidth = %d"), prefix, i, p[i].dwUncompWidth);
LOG(_T("%s[%d].dwUncompHeight = %d"), prefix, i, p[i].dwUncompHeight);
@@ -711,7 +711,7 @@ static HRESULT STDMETHODCALLTYPE GetVideoAcceleratorGUIDsMine(IAMVideoAccelerato {
LOG(_T("\nGetVideoAcceleratorGUIDs"));
- if(pdwNumGuidsSupported) {
+ if (pdwNumGuidsSupported) {
LOG(_T("[in] *pdwNumGuidsSupported = %d"), *pdwNumGuidsSupported);
}
@@ -719,11 +719,11 @@ static HRESULT STDMETHODCALLTYPE GetVideoAcceleratorGUIDsMine(IAMVideoAccelerato LOG(_T("hr = %08x"), hr);
- if(pdwNumGuidsSupported) {
+ if (pdwNumGuidsSupported) {
LOG(_T("[out] *pdwNumGuidsSupported = %d"), *pdwNumGuidsSupported);
- if(pGuidsSupported) {
- for(DWORD i = 0; i < *pdwNumGuidsSupported; i++) {
+ if (pGuidsSupported) {
+ for (DWORD i = 0; i < *pdwNumGuidsSupported; i++) {
LOG(_T("[out] pGuidsSupported[%d] = %s"), i, CStringFromGUID(pGuidsSupported[i]));
}
}
@@ -736,11 +736,11 @@ static HRESULT STDMETHODCALLTYPE GetUncompFormatsSupportedMine(IAMVideoAccelerat {
LOG(_T("\nGetUncompFormatsSupported"));
- if(pGuid) {
+ if (pGuid) {
LOG(_T("[in] *pGuid = %s"), CStringFromGUID(*pGuid));
}
- if(pdwNumFormatsSupported) {
+ if (pdwNumFormatsSupported) {
LOG(_T("[in] *pdwNumFormatsSupported = %d"), *pdwNumFormatsSupported);
}
@@ -748,10 +748,10 @@ static HRESULT STDMETHODCALLTYPE GetUncompFormatsSupportedMine(IAMVideoAccelerat LOG(_T("hr = %08x"), hr);
- if(pdwNumFormatsSupported) {
+ if (pdwNumFormatsSupported) {
LOG(_T("[out] *pdwNumFormatsSupported = %d"), *pdwNumFormatsSupported);
- if(pFormatsSupported) {
+ if (pFormatsSupported) {
LOGPF(_T("[out] pFormatsSupported"), pFormatsSupported, *pdwNumFormatsSupported);
}
}
@@ -775,14 +775,14 @@ static HRESULT STDMETHODCALLTYPE GetCompBufferInfoMine(IAMVideoAcceleratorC * Th {
LOG(_T("\nGetCompBufferInfo"));
- if(pGuid) {
+ if (pGuid) {
g_guidDXVADecoder = *pGuid;
g_nDXVAVersion = 1;
#ifdef _DEBUG
LOG(_T("[in] *pGuid = %s"), CStringFromGUID(*pGuid));
- if(pdwNumTypesCompBuffers) {
+ if (pdwNumTypesCompBuffers) {
LOG(_T("[in] *pdwNumTypesCompBuffers = %d"), *pdwNumTypesCompBuffers);
}
#endif
@@ -820,14 +820,14 @@ static HRESULT STDMETHODCALLTYPE BeginFrameMine(IAMVideoAcceleratorC * This, con {
LOG(_T("\nBeginFrame"));
- if(amvaBeginFrameInfo) {
+ if (amvaBeginFrameInfo) {
LOG(_T("[in] amvaBeginFrameInfo->dwDestSurfaceIndex = %08x"), amvaBeginFrameInfo->dwDestSurfaceIndex);
LOG(_T("[in] amvaBeginFrameInfo->pInputData = %08x"), amvaBeginFrameInfo->pInputData);
LOG(_T("[in] amvaBeginFrameInfo->dwSizeInputData = %08x"), amvaBeginFrameInfo->dwSizeInputData);
LOG(_T("[in] amvaBeginFrameInfo->pOutputData = %08x"), amvaBeginFrameInfo->pOutputData);
LOG(_T("[in] amvaBeginFrameInfo->dwSizeOutputData = %08x"), amvaBeginFrameInfo->dwSizeOutputData);
}
- if(amvaBeginFrameInfo && (amvaBeginFrameInfo->dwSizeInputData == 4)) {
+ if (amvaBeginFrameInfo && (amvaBeginFrameInfo->dwSizeInputData == 4)) {
LOG(_T("[in] amvaBeginFrameInfo->pInputData => dwDestSurfaceIndex = %ld "),
((DWORD*)amvaBeginFrameInfo->pInputData)[0]);
}
@@ -844,7 +844,7 @@ static HRESULT STDMETHODCALLTYPE EndFrameMine(IAMVideoAcceleratorC * This, const {
LOG(_T("\nEndFrame"));
- if(pEndFrameInfo) {
+ if (pEndFrameInfo) {
LOG(_T("[in] pEndFrameInfo->dwSizeMiscData = %08x"), pEndFrameInfo->dwSizeMiscData);
LOG(_T("[in] pEndFrameInfo->pMiscData = %08x"), pEndFrameInfo->pMiscData);
@@ -904,7 +904,7 @@ static HRESULT STDMETHODCALLTYPE ExecuteMine(IAMVideoAcceleratorC* This, DWORD d #ifdef _DEBUG
LOG(_T("\nExecute"));
LOG(_T("[in] dwFunction = %08x"), dwFunction);
- if(lpPrivateInputData) {
+ if (lpPrivateInputData) {
if (dwFunction == 0x01000000) {
DXVA_BufferDescription* pBuffDesc = (DXVA_BufferDescription*)lpPrivateInputData;
@@ -951,7 +951,7 @@ static HRESULT STDMETHODCALLTYPE ExecuteMine(IAMVideoAcceleratorC* This, DWORD d LOG(_T("[in] lpPrivateOutputData = %08x"), lpPrivateOutputData);
LOG(_T("[in] cbPrivateOutputData = %08x"), cbPrivateOutputData);
LOG(_T("[in] dwNumBuffers = %08x"), dwNumBuffers);
- if(pamvaBufferInfo) {
+ if (pamvaBufferInfo) {
for (DWORD i=0; i<dwNumBuffers; i++) {
LOG(_T("[in] pamvaBufferInfo, buffer description %d"), i);
LOG(_T("[in] pamvaBufferInfo->dwTypeIndex = %08x"), pamvaBufferInfo[i].dwTypeIndex);
@@ -1000,7 +1000,7 @@ static HRESULT STDMETHODCALLTYPE ExecuteMine(IAMVideoAcceleratorC* This, DWORD d LOG(_T("hr = %08x"), hr);
- if(lpPrivateOutputData && (dwFunction == 0x01000000)) {
+ if (lpPrivateOutputData && (dwFunction == 0x01000000)) {
LOG(_T("[out] *lpPrivateOutputData : Result = %08x"), ((DWORD*)lpPrivateOutputData)[0]);
}
@@ -1038,42 +1038,42 @@ void HookAMVideoAccelerator(IAMVideoAcceleratorC* pAMVideoAcceleratorC) res = VirtualProtect(pAMVideoAcceleratorC->lpVtbl, sizeof(IAMVideoAcceleratorC), PAGE_WRITECOPY, &flOldProtect);
#ifdef _DEBUG
- if(GetVideoAcceleratorGUIDsOrg == NULL) {
+ if (GetVideoAcceleratorGUIDsOrg == NULL) {
GetVideoAcceleratorGUIDsOrg = pAMVideoAcceleratorC->lpVtbl->GetVideoAcceleratorGUIDs;
}
- if(GetUncompFormatsSupportedOrg == NULL) {
+ if (GetUncompFormatsSupportedOrg == NULL) {
GetUncompFormatsSupportedOrg = pAMVideoAcceleratorC->lpVtbl->GetUncompFormatsSupported;
}
- if(GetInternalMemInfoOrg == NULL) {
+ if (GetInternalMemInfoOrg == NULL) {
GetInternalMemInfoOrg = pAMVideoAcceleratorC->lpVtbl->GetInternalMemInfo;
}
#endif
- if(GetCompBufferInfoOrg == NULL) {
+ if (GetCompBufferInfoOrg == NULL) {
GetCompBufferInfoOrg = pAMVideoAcceleratorC->lpVtbl->GetCompBufferInfo;
}
#ifdef _DEBUG
- if(GetInternalCompBufferInfoOrg == NULL) {
+ if (GetInternalCompBufferInfoOrg == NULL) {
GetInternalCompBufferInfoOrg = pAMVideoAcceleratorC->lpVtbl->GetInternalCompBufferInfo;
}
- if(BeginFrameOrg == NULL) {
+ if (BeginFrameOrg == NULL) {
BeginFrameOrg = pAMVideoAcceleratorC->lpVtbl->BeginFrame;
}
- if(EndFrameOrg == NULL) {
+ if (EndFrameOrg == NULL) {
EndFrameOrg = pAMVideoAcceleratorC->lpVtbl->EndFrame;
}
- if(GetBufferOrg == NULL) {
+ if (GetBufferOrg == NULL) {
GetBufferOrg = pAMVideoAcceleratorC->lpVtbl->GetBuffer;
}
- if(ReleaseBufferOrg == NULL) {
+ if (ReleaseBufferOrg == NULL) {
ReleaseBufferOrg = pAMVideoAcceleratorC->lpVtbl->ReleaseBuffer;
}
- if(ExecuteOrg == NULL) {
+ if (ExecuteOrg == NULL) {
ExecuteOrg = pAMVideoAcceleratorC->lpVtbl->Execute;
}
- if(QueryRenderStatusOrg == NULL) {
+ if (QueryRenderStatusOrg == NULL) {
QueryRenderStatusOrg = pAMVideoAcceleratorC->lpVtbl->QueryRenderStatus;
}
- if(DisplayFrameOrg == NULL) {
+ if (DisplayFrameOrg == NULL) {
DisplayFrameOrg = pAMVideoAcceleratorC->lpVtbl->DisplayFrame;
}
@@ -1143,7 +1143,7 @@ public : DECLARE_IUNKNOWN;
STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void** ppv) {
- if(riid == __uuidof(IDirectXVideoDecoder)) {
+ if (riid == __uuidof(IDirectXVideoDecoder)) {
return GetInterface((IDirectXVideoDecoder*)this, ppv);
} else {
return __super::NonDelegatingQueryInterface(riid, ppv);
diff --git a/src/filters/renderer/VideoRenderers/MacrovisionKicker.cpp b/src/filters/renderer/VideoRenderers/MacrovisionKicker.cpp index 4fd82c1f4..9dd33c1e7 100644 --- a/src/filters/renderer/VideoRenderers/MacrovisionKicker.cpp +++ b/src/filters/renderer/VideoRenderers/MacrovisionKicker.cpp @@ -45,10 +45,10 @@ void CMacrovisionKicker::SetInner(IUnknown* pUnk) STDMETHODIMP CMacrovisionKicker::NonDelegatingQueryInterface(REFIID riid, void** ppv)
{
- if(riid == __uuidof(IUnknown)) {
+ if (riid == __uuidof(IUnknown)) {
return __super::NonDelegatingQueryInterface(riid, ppv);
}
- if(riid == __uuidof(IKsPropertySet) && CComQIPtr<IKsPropertySet>(m_pInner)) {
+ if (riid == __uuidof(IKsPropertySet) && CComQIPtr<IKsPropertySet>(m_pInner)) {
return GetInterface((IKsPropertySet*)this, ppv);
}
@@ -61,8 +61,8 @@ STDMETHODIMP CMacrovisionKicker::NonDelegatingQueryInterface(REFIID riid, void** STDMETHODIMP CMacrovisionKicker::Set(REFGUID PropSet, ULONG Id, LPVOID pInstanceData, ULONG InstanceLength, LPVOID pPropertyData, ULONG DataLength)
{
- if(CComQIPtr<IKsPropertySet> pKsPS = m_pInner) {
- if(PropSet == AM_KSPROPSETID_CopyProt && Id == AM_PROPERTY_COPY_MACROVISION
+ if (CComQIPtr<IKsPropertySet> pKsPS = m_pInner) {
+ if (PropSet == AM_KSPROPSETID_CopyProt && Id == AM_PROPERTY_COPY_MACROVISION
/*&& DataLength == 4 && *(DWORD*)pPropertyData*/) {
TRACE(_T("Oops, no-no-no, no macrovision please\n"));
return S_OK;
@@ -76,7 +76,7 @@ STDMETHODIMP CMacrovisionKicker::Set(REFGUID PropSet, ULONG Id, LPVOID pInstance STDMETHODIMP CMacrovisionKicker::Get(REFGUID PropSet, ULONG Id, LPVOID pInstanceData, ULONG InstanceLength, LPVOID pPropertyData, ULONG DataLength, ULONG* pBytesReturned)
{
- if(CComQIPtr<IKsPropertySet> pKsPS = m_pInner) {
+ if (CComQIPtr<IKsPropertySet> pKsPS = m_pInner) {
return pKsPS->Get(PropSet, Id, pInstanceData, InstanceLength, pPropertyData, DataLength, pBytesReturned);
}
@@ -85,7 +85,7 @@ STDMETHODIMP CMacrovisionKicker::Get(REFGUID PropSet, ULONG Id, LPVOID pInstance STDMETHODIMP CMacrovisionKicker::QuerySupported(REFGUID PropSet, ULONG Id, ULONG* pTypeSupport)
{
- if(CComQIPtr<IKsPropertySet> pKsPS = m_pInner) {
+ if (CComQIPtr<IKsPropertySet> pKsPS = m_pInner) {
return pKsPS->QuerySupported(PropSet, Id, pTypeSupport);
}
diff --git a/src/filters/renderer/VideoRenderers/OuterEVR.h b/src/filters/renderer/VideoRenderers/OuterEVR.h index ac941c75e..de8897aea 100644 --- a/src/filters/renderer/VideoRenderers/OuterEVR.h +++ b/src/filters/renderer/VideoRenderers/OuterEVR.h @@ -48,7 +48,7 @@ namespace DSObjects STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void** ppv) {
HRESULT hr;
- if(riid == __uuidof(IVMRMixerBitmap9)) {
+ if (riid == __uuidof(IVMRMixerBitmap9)) {
return GetInterface((IVMRMixerBitmap9*)this, ppv);
}
if (riid == __uuidof(IMediaFilter)) {
@@ -62,8 +62,8 @@ namespace DSObjects }
hr = m_pEVR ? m_pEVR->QueryInterface(riid, ppv) : E_NOINTERFACE;
- if(m_pEVR && FAILED(hr)) {
- if(riid == __uuidof(IVMRffdshow9)) { // Support ffdshow queueing. We show ffdshow that this is patched Media Player Classic.
+ if (m_pEVR && FAILED(hr)) {
+ if (riid == __uuidof(IVMRffdshow9)) { // Support ffdshow queueing. We show ffdshow that this is patched Media Player Classic.
return GetInterface((IVMRffdshow9*)this, ppv);
}
}
diff --git a/src/filters/renderer/VideoRenderers/OuterVMR.cpp b/src/filters/renderer/VideoRenderers/OuterVMR.cpp index a243cccf1..34e88f5a3 100644 --- a/src/filters/renderer/VideoRenderers/OuterVMR.cpp +++ b/src/filters/renderer/VideoRenderers/OuterVMR.cpp @@ -28,7 +28,7 @@ using namespace DSObjects;
STDMETHODIMP COuterVMR9::GetNativeVideoSize(LONG* lpWidth, LONG* lpHeight, LONG* lpARWidth, LONG* lpARHeight) {
- if(CComQIPtr<IVMRWindowlessControl9> pWC9 = m_pVMR) {
+ if (CComQIPtr<IVMRWindowlessControl9> pWC9 = m_pVMR) {
return pWC9->GetNativeVideoSize(lpWidth, lpHeight, lpARWidth, lpARHeight);
}
@@ -36,7 +36,7 @@ STDMETHODIMP COuterVMR9::GetNativeVideoSize(LONG* lpWidth, LONG* lpHeight, LONG* }
STDMETHODIMP COuterVMR9::GetVideoPosition(LPRECT lpSRCRect, LPRECT lpDSTRect) {
- if(CComQIPtr<IVMRWindowlessControl9> pWC9 = m_pVMR) {
+ if (CComQIPtr<IVMRWindowlessControl9> pWC9 = m_pVMR) {
return pWC9->GetVideoPosition(lpSRCRect, lpDSTRect);
}
@@ -44,7 +44,7 @@ STDMETHODIMP COuterVMR9::GetVideoPosition(LPRECT lpSRCRect, LPRECT lpDSTRect) { }
STDMETHODIMP COuterVMR9::GetAspectRatioMode(DWORD* lpAspectRatioMode) {
- if(CComQIPtr<IVMRWindowlessControl9> pWC9 = m_pVMR) {
+ if (CComQIPtr<IVMRWindowlessControl9> pWC9 = m_pVMR) {
*lpAspectRatioMode = VMR_ARMODE_NONE;
return S_OK;
}
@@ -54,7 +54,7 @@ STDMETHODIMP COuterVMR9::GetAspectRatioMode(DWORD* lpAspectRatioMode) { // IVideoWindow
STDMETHODIMP COuterVMR9::get_Width(long* pWidth) {
- if(CComQIPtr<IVMRWindowlessControl9> pWC9 = m_pVMR) {
+ if (CComQIPtr<IVMRWindowlessControl9> pWC9 = m_pVMR) {
CRect s, d;
HRESULT hr = pWC9->GetVideoPosition(&s, &d);
*pWidth = d.Width();
@@ -65,7 +65,7 @@ STDMETHODIMP COuterVMR9::get_Width(long* pWidth) { }
STDMETHODIMP COuterVMR9::get_Height(long* pHeight) {
- if(CComQIPtr<IVMRWindowlessControl9> pWC9 = m_pVMR) {
+ if (CComQIPtr<IVMRWindowlessControl9> pWC9 = m_pVMR) {
CRect s, d;
HRESULT hr = pWC9->GetVideoPosition(&s, &d);
*pHeight = d.Height();
@@ -98,7 +98,7 @@ STDMETHODIMP COuterVMR9::GetSourcePosition(long* pLeft, long* pTop, long* pWidth }
STDMETHODIMP COuterVMR9::GetDestinationPosition(long* pLeft, long* pTop, long* pWidth, long* pHeight) {
- if(CComQIPtr<IVMRWindowlessControl9> pWC9 = m_pVMR) {
+ if (CComQIPtr<IVMRWindowlessControl9> pWC9 = m_pVMR) {
CRect s, d;
HRESULT hr = pWC9->GetVideoPosition(&s, &d);
*pLeft = d.left;
@@ -112,7 +112,7 @@ STDMETHODIMP COuterVMR9::GetDestinationPosition(long* pLeft, long* pTop, long* p }
STDMETHODIMP COuterVMR9::GetVideoSize(long* pWidth, long* pHeight) {
- if(CComQIPtr<IVMRWindowlessControl9> pWC9 = m_pVMR) {
+ if (CComQIPtr<IVMRWindowlessControl9> pWC9 = m_pVMR) {
LONG aw, ah;
// return pWC9->GetNativeVideoSize(pWidth, pHeight, &aw, &ah);
// DVD Nav. bug workaround fix
@@ -125,7 +125,7 @@ STDMETHODIMP COuterVMR9::GetVideoSize(long* pWidth, long* pHeight) { }
STDMETHODIMP COuterVMR9::GetPreferredAspectRatio(long* plAspectX, long* plAspectY) {
- if(CComQIPtr<IVMRWindowlessControl9> pWC9 = m_pVMR) {
+ if (CComQIPtr<IVMRWindowlessControl9> pWC9 = m_pVMR) {
LONG w, h;
return pWC9->GetNativeVideoSize(&w, &h, plAspectX, plAspectY);
}
diff --git a/src/filters/renderer/VideoRenderers/OuterVMR.h b/src/filters/renderer/VideoRenderers/OuterVMR.h index ec7650f65..567d45c9d 100644 --- a/src/filters/renderer/VideoRenderers/OuterVMR.h +++ b/src/filters/renderer/VideoRenderers/OuterVMR.h @@ -53,22 +53,22 @@ namespace DSObjects HRESULT hr;
// Casimir666 : in renderless mode, do the inlaying in place of VMR
- if(riid == __uuidof(IVMRMixerBitmap9)) {
+ if (riid == __uuidof(IVMRMixerBitmap9)) {
return GetInterface((IVMRMixerBitmap9*)this, ppv);
}
hr = m_pVMR ? m_pVMR->QueryInterface(riid, ppv) : E_NOINTERFACE;
- if(m_pVMR && FAILED(hr)) {
- if(riid == __uuidof(IVideoWindow)) {
+ if (m_pVMR && FAILED(hr)) {
+ if (riid == __uuidof(IVideoWindow)) {
return GetInterface((IVideoWindow*)this, ppv);
}
- if(riid == __uuidof(IBasicVideo)) {
+ if (riid == __uuidof(IBasicVideo)) {
return GetInterface((IBasicVideo*)this, ppv);
}
- if(riid == __uuidof(IBasicVideo2)) {
+ if (riid == __uuidof(IBasicVideo2)) {
return GetInterface((IBasicVideo2*)this, ppv);
}
- if(riid == __uuidof(IVMRffdshow9)) { // Support ffdshow queueing. We show ffdshow that this is patched Media Player Classic.
+ if (riid == __uuidof(IVMRffdshow9)) { // Support ffdshow queueing. We show ffdshow that this is patched Media Player Classic.
return GetInterface((IVMRffdshow9*)this, ppv);
}
/* if(riid == __uuidof(IVMRWindowlessControl))
diff --git a/src/filters/renderer/VideoRenderers/PixelShaderCompiler.cpp b/src/filters/renderer/VideoRenderers/PixelShaderCompiler.cpp index 75342cde5..fff93a356 100644 --- a/src/filters/renderer/VideoRenderers/PixelShaderCompiler.cpp +++ b/src/filters/renderer/VideoRenderers/PixelShaderCompiler.cpp @@ -35,15 +35,15 @@ CPixelShaderCompiler::CPixelShaderCompiler(IDirect3DDevice9* pD3DDev, bool fStay HINSTANCE hDll;
hDll = GetRenderersData()->GetD3X9Dll();
- if(hDll) {
+ if (hDll) {
m_pD3DXCompileShader = (D3DXCompileShaderPtr)GetProcAddress(hDll, "D3DXCompileShader");
m_pD3DXDisassembleShader = (D3DXDisassembleShaderPtr)GetProcAddress(hDll, "D3DXDisassembleShader");
}
- if(!fStaySilent) {
- if(!hDll) {
+ if (!fStaySilent) {
+ if (!hDll) {
AfxMessageBox(ResStr(IDS_PIXELSHADERCOMPILER_0), MB_OK);
- } else if(!m_pD3DXCompileShader || !m_pD3DXDisassembleShader) {
+ } else if (!m_pD3DXCompileShader || !m_pD3DXDisassembleShader) {
AfxMessageBox(ResStr(IDS_PIXELSHADERCOMPILER_1), MB_OK);
}
}
@@ -62,7 +62,7 @@ HRESULT CPixelShaderCompiler::CompileShader( CString* disasm,
CString* errmsg)
{
- if(!m_pD3DXCompileShader || !m_pD3DXDisassembleShader) {
+ if (!m_pD3DXCompileShader || !m_pD3DXDisassembleShader) {
return E_FAIL;
}
@@ -71,11 +71,11 @@ HRESULT CPixelShaderCompiler::CompileShader( CComPtr<ID3DXBuffer> pShader, pDisAsm, pErrorMsgs;
hr = m_pD3DXCompileShader(pSrcData, strlen(pSrcData), NULL, NULL, pFunctionName, pProfile, Flags, &pShader, &pErrorMsgs, NULL);
- if(FAILED(hr)) {
- if(errmsg) {
+ if (FAILED(hr)) {
+ if (errmsg) {
CStringA msg = "Unexpected compiler error";
- if(pErrorMsgs) {
+ if (pErrorMsgs) {
int len = pErrorMsgs->GetBufferSize();
memcpy(msg.GetBufferSetLength(len), pErrorMsgs->GetBufferPointer(), len);
}
@@ -86,19 +86,19 @@ HRESULT CPixelShaderCompiler::CompileShader( return hr;
}
- if(ppPixelShader) {
- if(!m_pD3DDev) {
+ if (ppPixelShader) {
+ if (!m_pD3DDev) {
return E_FAIL;
}
hr = m_pD3DDev->CreatePixelShader((DWORD*)pShader->GetBufferPointer(), ppPixelShader);
- if(FAILED(hr)) {
+ if (FAILED(hr)) {
return hr;
}
}
- if(disasm) {
+ if (disasm) {
hr = m_pD3DXDisassembleShader((DWORD*)pShader->GetBufferPointer(), FALSE, NULL, &pDisAsm);
- if(SUCCEEDED(hr) && pDisAsm) {
+ if (SUCCEEDED(hr) && pDisAsm) {
*disasm = CStringA((const char*)pDisAsm->GetBufferPointer());
}
}
diff --git a/src/filters/renderer/VideoRenderers/QT7AllocatorPresenter.cpp b/src/filters/renderer/VideoRenderers/QT7AllocatorPresenter.cpp index de1099997..5d2d1fb1b 100644 --- a/src/filters/renderer/VideoRenderers/QT7AllocatorPresenter.cpp +++ b/src/filters/renderer/VideoRenderers/QT7AllocatorPresenter.cpp @@ -65,7 +65,7 @@ HRESULT CQT7AllocatorPresenter::AllocSurfaces() ddsd.ddpfPixelFormat.dwBBitMask = 0x000000FF;
HRESULT hr = m_pDD->CreateSurface(&ddsd, &m_pVideoSurfaceOff, NULL);
- if(FAILED(hr)) {
+ if (FAILED(hr)) {
return E_FAIL;
}
@@ -97,7 +97,7 @@ STDMETHODIMP CQT7AllocatorPresenter::BeginBlt(const BITMAP& bm) m_NativeVideoSize = m_AspectRatio = CSize(bm.bmWidth, abs(bm.bmHeight));
HRESULT hr;
- if(FAILED(hr = AllocSurfaces())) {
+ if (FAILED(hr = AllocSurfaces())) {
return hr;
}
@@ -106,7 +106,7 @@ STDMETHODIMP CQT7AllocatorPresenter::BeginBlt(const BITMAP& bm) STDMETHODIMP CQT7AllocatorPresenter::DoBlt(const BITMAP& bm)
{
- if(!m_pVideoSurface || !m_pVideoSurfaceOff) {
+ if (!m_pVideoSurface || !m_pVideoSurfaceOff) {
return E_FAIL;
}
@@ -114,7 +114,7 @@ STDMETHODIMP CQT7AllocatorPresenter::DoBlt(const BITMAP& bm) DDSURFACEDESC2 ddsd;
INITDDSTRUCT(ddsd);
- if(FAILED(m_pVideoSurfaceOff->GetSurfaceDesc(&ddsd))) {
+ if (FAILED(m_pVideoSurfaceOff->GetSurfaceDesc(&ddsd))) {
return E_FAIL;
}
@@ -122,9 +122,9 @@ STDMETHODIMP CQT7AllocatorPresenter::DoBlt(const BITMAP& bm) UINT h = abs(bm.bmHeight);
int bpp = bm.bmBitsPixel;
- if((bpp == 16 || bpp == 24 || bpp == 32) && w == ddsd.dwWidth && h == ddsd.dwHeight) {
+ if ((bpp == 16 || bpp == 24 || bpp == 32) && w == ddsd.dwWidth && h == ddsd.dwHeight) {
INITDDSTRUCT(ddsd);
- if(SUCCEEDED(m_pVideoSurfaceOff->Lock(NULL, &ddsd, DDLOCK_WAIT|DDLOCK_SURFACEMEMORYPTR|DDLOCK_WRITEONLY, NULL))) {
+ if (SUCCEEDED(m_pVideoSurfaceOff->Lock(NULL, &ddsd, DDLOCK_WAIT|DDLOCK_SURFACEMEMORYPTR|DDLOCK_WRITEONLY, NULL))) {
BitBltFromRGBToRGB(
w, h,
(BYTE*)ddsd.lpSurface, ddsd.lPitch, ddsd.ddpfPixelFormat.dwRGBBitCount,
@@ -134,14 +134,14 @@ STDMETHODIMP CQT7AllocatorPresenter::DoBlt(const BITMAP& bm) }
}
- if(!fOk) {
+ if (!fOk) {
DDBLTFX fx;
INITDDSTRUCT(fx);
fx.dwFillColor = 0;
m_pVideoSurfaceOff->Blt(NULL, NULL, NULL, DDBLT_WAIT|DDBLT_COLORFILL, &fx);
HDC hDC;
- if(SUCCEEDED(m_pVideoSurfaceOff->GetDC(&hDC))) {
+ if (SUCCEEDED(m_pVideoSurfaceOff->GetDC(&hDC))) {
CString str;
str.Format(_T("Sorry, this format is not supported"));
diff --git a/src/filters/renderer/VideoRenderers/QT9AllocatorPresenter.cpp b/src/filters/renderer/VideoRenderers/QT9AllocatorPresenter.cpp index ff6fe0f8f..3004a7600 100644 --- a/src/filters/renderer/VideoRenderers/QT9AllocatorPresenter.cpp +++ b/src/filters/renderer/VideoRenderers/QT9AllocatorPresenter.cpp @@ -49,9 +49,9 @@ HRESULT CQT9AllocatorPresenter::AllocSurfaces() m_pVideoSurfaceOff = NULL;
- if(FAILED(hr = m_pD3DDev->CreateOffscreenPlainSurface(
- m_NativeVideoSize.cx, m_NativeVideoSize.cy, D3DFMT_X8R8G8B8,
- D3DPOOL_DEFAULT, &m_pVideoSurfaceOff, NULL))) {
+ if (FAILED(hr = m_pD3DDev->CreateOffscreenPlainSurface(
+ m_NativeVideoSize.cx, m_NativeVideoSize.cy, D3DFMT_X8R8G8B8,
+ D3DPOOL_DEFAULT, &m_pVideoSurfaceOff, NULL))) {
return hr;
}
@@ -73,7 +73,7 @@ STDMETHODIMP CQT9AllocatorPresenter::BeginBlt(const BITMAP& bm) CAutoLock cRenderLock(&m_RenderLock);
DeleteSurfaces();
m_NativeVideoSize = m_AspectRatio = CSize(bm.bmWidth, abs(bm.bmHeight));
- if(FAILED(AllocSurfaces())) {
+ if (FAILED(AllocSurfaces())) {
return E_FAIL;
}
return S_OK;
@@ -81,7 +81,7 @@ STDMETHODIMP CQT9AllocatorPresenter::BeginBlt(const BITMAP& bm) STDMETHODIMP CQT9AllocatorPresenter::DoBlt(const BITMAP& bm)
{
- if(!m_pVideoSurface || !m_pVideoSurfaceOff) {
+ if (!m_pVideoSurface || !m_pVideoSurfaceOff) {
return E_FAIL;
}
@@ -89,7 +89,7 @@ STDMETHODIMP CQT9AllocatorPresenter::DoBlt(const BITMAP& bm) D3DSURFACE_DESC d3dsd;
ZeroMemory(&d3dsd, sizeof(d3dsd));
- if(FAILED(m_pVideoSurfaceOff->GetDesc(&d3dsd))) {
+ if (FAILED(m_pVideoSurfaceOff->GetDesc(&d3dsd))) {
return E_FAIL;
}
@@ -100,9 +100,9 @@ STDMETHODIMP CQT9AllocatorPresenter::DoBlt(const BITMAP& bm) d3dsd.Format == D3DFMT_R8G8B8 || d3dsd.Format == D3DFMT_X8R8G8B8 || d3dsd.Format == D3DFMT_A8R8G8B8 ? 32 :
d3dsd.Format == D3DFMT_R5G6B5 ? 16 : 0;
- if((bpp == 16 || bpp == 24 || bpp == 32) && w == d3dsd.Width && h == d3dsd.Height) {
+ if ((bpp == 16 || bpp == 24 || bpp == 32) && w == d3dsd.Width && h == d3dsd.Height) {
D3DLOCKED_RECT r;
- if(SUCCEEDED(m_pVideoSurfaceOff->LockRect(&r, NULL, 0))) {
+ if (SUCCEEDED(m_pVideoSurfaceOff->LockRect(&r, NULL, 0))) {
BitBltFromRGBToRGB(
w, h,
(BYTE*)r.pBits, r.Pitch, dbpp,
@@ -112,11 +112,11 @@ STDMETHODIMP CQT9AllocatorPresenter::DoBlt(const BITMAP& bm) }
}
- if(!fOk) {
+ if (!fOk) {
m_pD3DDev->ColorFill(m_pVideoSurfaceOff, NULL, 0);
HDC hDC;
- if(SUCCEEDED(m_pVideoSurfaceOff->GetDC(&hDC))) {
+ if (SUCCEEDED(m_pVideoSurfaceOff->GetDC(&hDC))) {
CString str;
str.Format(_T("Sorry, this color format is not supported"));
diff --git a/src/filters/renderer/VideoRenderers/RM7AllocatorPresenter.cpp b/src/filters/renderer/VideoRenderers/RM7AllocatorPresenter.cpp index 6833d6510..509161ce5 100644 --- a/src/filters/renderer/VideoRenderers/RM7AllocatorPresenter.cpp +++ b/src/filters/renderer/VideoRenderers/RM7AllocatorPresenter.cpp @@ -68,7 +68,7 @@ HRESULT CRM7AllocatorPresenter::AllocSurfaces() ddsd.ddpfPixelFormat.dwBBitMask = 0x000000FF;
HRESULT hr = m_pDD->CreateSurface(&ddsd, &m_pVideoSurfaceOff, NULL);
- if(FAILED(hr)) {
+ if (FAILED(hr)) {
return E_FAIL;
}
@@ -88,11 +88,11 @@ HRESULT CRM7AllocatorPresenter::AllocSurfaces() hr = m_pDD->CreateSurface(&ddsd, &m_pVideoSurfaceYUY2, NULL);
- if(FAILED(m_pVideoSurfaceOff->Blt(NULL, m_pVideoSurfaceYUY2, NULL, DDBLT_WAIT, NULL))) {
+ if (FAILED(m_pVideoSurfaceOff->Blt(NULL, m_pVideoSurfaceYUY2, NULL, DDBLT_WAIT, NULL))) {
m_pVideoSurfaceYUY2 = NULL;
}
- if(m_pVideoSurfaceYUY2) {
+ if (m_pVideoSurfaceYUY2) {
INITDDSTRUCT(fx);
fx.dwFillColor = 0x80108010;
m_pVideoSurfaceYUY2->Blt(NULL, NULL, NULL, DDBLT_WAIT|DDBLT_COLORFILL, &fx);
@@ -115,7 +115,7 @@ void CRM7AllocatorPresenter::DeleteSurfaces() STDMETHODIMP CRM7AllocatorPresenter::Blt(UCHAR* pImageData, RMABitmapInfoHeader* pBitmapInfo, REF(PNxRect) inDestRect, REF(PNxRect) inSrcRect)
{
- if(!m_pVideoSurface || !m_pVideoSurfaceOff) {
+ if (!m_pVideoSurface || !m_pVideoSurfaceOff) {
return E_FAIL;
}
@@ -123,13 +123,13 @@ STDMETHODIMP CRM7AllocatorPresenter::Blt(UCHAR* pImageData, RMABitmapInfoHeader* bool fYUY2 = false;
CRect src((RECT*)&inSrcRect), dst((RECT*)&inDestRect), src2(CPoint(0,0), src.Size());
- if(src.Width() > dst.Width() || src.Height() > dst.Height()) {
+ if (src.Width() > dst.Width() || src.Height() > dst.Height()) {
return E_FAIL;
}
DDSURFACEDESC2 ddsd;
- if(pBitmapInfo->biCompression == '024I') {
+ if (pBitmapInfo->biCompression == '024I') {
DWORD pitch = pBitmapInfo->biWidth;
DWORD size = pitch*abs(pBitmapInfo->biHeight);
@@ -137,22 +137,22 @@ STDMETHODIMP CRM7AllocatorPresenter::Blt(UCHAR* pImageData, RMABitmapInfoHeader* BYTE* u = pImageData + size + src.top*(pitch/2) + src.left/2;
BYTE* v = pImageData + size + size/4 + src.top*(pitch/2) + src.left/2;
- if(m_pVideoSurfaceYUY2) {
+ if (m_pVideoSurfaceYUY2) {
INITDDSTRUCT(ddsd);
- if(SUCCEEDED(m_pVideoSurfaceYUY2->Lock(src2, &ddsd, DDLOCK_WAIT|DDLOCK_SURFACEMEMORYPTR|DDLOCK_WRITEONLY, NULL))) {
+ if (SUCCEEDED(m_pVideoSurfaceYUY2->Lock(src2, &ddsd, DDLOCK_WAIT|DDLOCK_SURFACEMEMORYPTR|DDLOCK_WRITEONLY, NULL))) {
BitBltFromI420ToYUY2(src.Width(), src.Height(), (BYTE*)ddsd.lpSurface, ddsd.lPitch, y, u, v, pitch);
m_pVideoSurfaceYUY2->Unlock(src2);
fYUY2 = true;
}
} else {
INITDDSTRUCT(ddsd);
- if(SUCCEEDED(m_pVideoSurfaceOff->Lock(src2, &ddsd, DDLOCK_WAIT|DDLOCK_SURFACEMEMORYPTR|DDLOCK_WRITEONLY, NULL))) {
+ if (SUCCEEDED(m_pVideoSurfaceOff->Lock(src2, &ddsd, DDLOCK_WAIT|DDLOCK_SURFACEMEMORYPTR|DDLOCK_WRITEONLY, NULL))) {
BitBltFromI420ToRGB(src.Width(), src.Height(), (BYTE*)ddsd.lpSurface, ddsd.lPitch, ddsd.ddpfPixelFormat.dwRGBBitCount, y, u, v, pitch);
m_pVideoSurfaceOff->Unlock(src2);
fRGB = true;
}
}
- } else if(pBitmapInfo->biCompression == '2YUY') {
+ } else if (pBitmapInfo->biCompression == '2YUY') {
DWORD w = pBitmapInfo->biWidth;
DWORD h = abs(pBitmapInfo->biHeight);
DWORD pitch = pBitmapInfo->biWidth*2;
@@ -161,23 +161,23 @@ STDMETHODIMP CRM7AllocatorPresenter::Blt(UCHAR* pImageData, RMABitmapInfoHeader* BYTE* yvyu = pImageData + src.top*pitch + src.left*2;
- if(m_pVideoSurfaceYUY2) {
+ if (m_pVideoSurfaceYUY2) {
INITDDSTRUCT(ddsd);
- if(SUCCEEDED(m_pVideoSurfaceYUY2->Lock(src2, &ddsd, DDLOCK_WAIT|DDLOCK_SURFACEMEMORYPTR|DDLOCK_WRITEONLY, NULL))) {
+ if (SUCCEEDED(m_pVideoSurfaceYUY2->Lock(src2, &ddsd, DDLOCK_WAIT|DDLOCK_SURFACEMEMORYPTR|DDLOCK_WRITEONLY, NULL))) {
BitBltFromYUY2ToYUY2(src.Width(), src.Height(), (BYTE*)ddsd.lpSurface, ddsd.lPitch, yvyu, pitch);
m_pVideoSurfaceYUY2->Unlock(src2);
fYUY2 = true;
}
} else {
INITDDSTRUCT(ddsd);
- if(SUCCEEDED(m_pVideoSurfaceOff->Lock(src2, &ddsd, DDLOCK_WAIT|DDLOCK_SURFACEMEMORYPTR|DDLOCK_WRITEONLY, NULL))) {
+ if (SUCCEEDED(m_pVideoSurfaceOff->Lock(src2, &ddsd, DDLOCK_WAIT|DDLOCK_SURFACEMEMORYPTR|DDLOCK_WRITEONLY, NULL))) {
BitBltFromYUY2ToRGB(src.Width(), src.Height(), (BYTE*)ddsd.lpSurface, ddsd.lPitch, ddsd.ddpfPixelFormat.dwRGBBitCount, yvyu, pitch);
m_pVideoSurfaceOff->Unlock(src2);
fRGB = true;
}
}
- } else if(pBitmapInfo->biCompression == 0 || pBitmapInfo->biCompression == 3
- || pBitmapInfo->biCompression == 'BGRA') {
+ } else if (pBitmapInfo->biCompression == 0 || pBitmapInfo->biCompression == 3
+ || pBitmapInfo->biCompression == 'BGRA') {
DWORD w = pBitmapInfo->biWidth;
DWORD h = abs(pBitmapInfo->biHeight);
DWORD pitch = pBitmapInfo->biWidth*pBitmapInfo->biBitCount>>3;
@@ -187,9 +187,9 @@ STDMETHODIMP CRM7AllocatorPresenter::Blt(UCHAR* pImageData, RMABitmapInfoHeader* BYTE* rgb = pImageData + src.top*pitch + src.left*(pBitmapInfo->biBitCount>>3);
INITDDSTRUCT(ddsd);
- if(SUCCEEDED(m_pVideoSurfaceOff->Lock(src2, &ddsd, DDLOCK_WAIT|DDLOCK_SURFACEMEMORYPTR|DDLOCK_WRITEONLY, NULL))) {
+ if (SUCCEEDED(m_pVideoSurfaceOff->Lock(src2, &ddsd, DDLOCK_WAIT|DDLOCK_SURFACEMEMORYPTR|DDLOCK_WRITEONLY, NULL))) {
BYTE* lpSurface = (BYTE*)ddsd.lpSurface;
- if(pBitmapInfo->biHeight > 0) {
+ if (pBitmapInfo->biHeight > 0) {
lpSurface += ddsd.lPitch*(src.Height()-1);
ddsd.lPitch = -ddsd.lPitch;
}
@@ -199,14 +199,14 @@ STDMETHODIMP CRM7AllocatorPresenter::Blt(UCHAR* pImageData, RMABitmapInfoHeader* }
}
- if(!fRGB && !fYUY2) {
+ if (!fRGB && !fYUY2) {
DDBLTFX fx;
INITDDSTRUCT(fx);
fx.dwFillColor = 0;
m_pVideoSurfaceOff->Blt(NULL, NULL, NULL, DDBLT_WAIT|DDBLT_COLORFILL, &fx);
HDC hDC;
- if(SUCCEEDED(m_pVideoSurfaceOff->GetDC(&hDC))) {
+ if (SUCCEEDED(m_pVideoSurfaceOff->GetDC(&hDC))) {
CString str;
str.Format(_T("Sorry, this format is not supported"));
@@ -223,10 +223,10 @@ STDMETHODIMP CRM7AllocatorPresenter::Blt(UCHAR* pImageData, RMABitmapInfoHeader* HRESULT hr;
- if(fRGB) {
+ if (fRGB) {
hr = m_pVideoSurface->Blt(dst, m_pVideoSurfaceOff, src2, DDBLT_WAIT, NULL);
}
- if(fYUY2) {
+ if (fYUY2) {
hr = m_pVideoSurface->Blt(dst, m_pVideoSurfaceYUY2, src2, DDBLT_WAIT, NULL);
}
@@ -240,7 +240,7 @@ STDMETHODIMP CRM7AllocatorPresenter::BeginOptimizedBlt(RMABitmapInfoHeader* pBit CAutoLock cAutoLock(this);
DeleteSurfaces();
m_NativeVideoSize = m_AspectRatio = CSize(pBitmapInfo->biWidth, abs(pBitmapInfo->biHeight));
- if(FAILED(AllocSurfaces())) {
+ if (FAILED(AllocSurfaces())) {
return E_FAIL;
}
return PNR_NOTIMPL;
diff --git a/src/filters/renderer/VideoRenderers/RM9AllocatorPresenter.cpp b/src/filters/renderer/VideoRenderers/RM9AllocatorPresenter.cpp index eb344cdc5..5eacf168a 100644 --- a/src/filters/renderer/VideoRenderers/RM9AllocatorPresenter.cpp +++ b/src/filters/renderer/VideoRenderers/RM9AllocatorPresenter.cpp @@ -53,21 +53,21 @@ HRESULT CRM9AllocatorPresenter::AllocSurfaces() HRESULT hr;
- if(FAILED(hr = m_pD3DDev->CreateOffscreenPlainSurface(
- m_NativeVideoSize.cx, m_NativeVideoSize.cy, D3DFMT_X8R8G8B8,
- D3DPOOL_DEFAULT, &m_pVideoSurfaceOff, NULL))) {
+ if (FAILED(hr = m_pD3DDev->CreateOffscreenPlainSurface(
+ m_NativeVideoSize.cx, m_NativeVideoSize.cy, D3DFMT_X8R8G8B8,
+ D3DPOOL_DEFAULT, &m_pVideoSurfaceOff, NULL))) {
return hr;
}
m_pD3DDev->ColorFill(m_pVideoSurfaceOff, NULL, 0);
- if(FAILED(hr = m_pD3DDev->CreateOffscreenPlainSurface(
- m_NativeVideoSize.cx, m_NativeVideoSize.cy, D3DFMT_YUY2,
- D3DPOOL_DEFAULT, &m_pVideoSurfaceYUY2, NULL))) {
+ if (FAILED(hr = m_pD3DDev->CreateOffscreenPlainSurface(
+ m_NativeVideoSize.cx, m_NativeVideoSize.cy, D3DFMT_YUY2,
+ D3DPOOL_DEFAULT, &m_pVideoSurfaceYUY2, NULL))) {
m_pVideoSurfaceYUY2 = NULL;
}
- if(m_pVideoSurfaceYUY2) {
+ if (m_pVideoSurfaceYUY2) {
m_pD3DDev->ColorFill(m_pVideoSurfaceOff, NULL, 0x80108010);
}
@@ -87,7 +87,7 @@ void CRM9AllocatorPresenter::DeleteSurfaces() STDMETHODIMP CRM9AllocatorPresenter::Blt(UCHAR* pImageData, RMABitmapInfoHeader* pBitmapInfo, REF(PNxRect) inDestRect, REF(PNxRect) inSrcRect)
{
- if(!m_pVideoSurface || !m_pVideoSurfaceOff) {
+ if (!m_pVideoSurface || !m_pVideoSurfaceOff) {
return E_FAIL;
}
@@ -95,13 +95,13 @@ STDMETHODIMP CRM9AllocatorPresenter::Blt(UCHAR* pImageData, RMABitmapInfoHeader* bool fYUY2 = false;
CRect src((RECT*)&inSrcRect), dst((RECT*)&inDestRect), src2(CPoint(0,0), src.Size());
- if(src.Width() > dst.Width() || src.Height() > dst.Height()) {
+ if (src.Width() > dst.Width() || src.Height() > dst.Height()) {
return E_FAIL;
}
D3DSURFACE_DESC d3dsd;
ZeroMemory(&d3dsd, sizeof(d3dsd));
- if(FAILED(m_pVideoSurfaceOff->GetDesc(&d3dsd))) {
+ if (FAILED(m_pVideoSurfaceOff->GetDesc(&d3dsd))) {
return E_FAIL;
}
@@ -109,7 +109,7 @@ STDMETHODIMP CRM9AllocatorPresenter::Blt(UCHAR* pImageData, RMABitmapInfoHeader* d3dsd.Format == D3DFMT_R8G8B8 || d3dsd.Format == D3DFMT_X8R8G8B8 || d3dsd.Format == D3DFMT_A8R8G8B8 ? 32 :
d3dsd.Format == D3DFMT_R5G6B5 ? 16 : 0;
- if(pBitmapInfo->biCompression == '024I') {
+ if (pBitmapInfo->biCompression == '024I') {
DWORD pitch = pBitmapInfo->biWidth;
DWORD size = pitch*abs(pBitmapInfo->biHeight);
@@ -117,22 +117,22 @@ STDMETHODIMP CRM9AllocatorPresenter::Blt(UCHAR* pImageData, RMABitmapInfoHeader* BYTE* u = pImageData + size + src.top*(pitch/2) + src.left/2;
BYTE* v = pImageData + size + size/4 + src.top*(pitch/2) + src.left/2;
- if(m_pVideoSurfaceYUY2) {
+ if (m_pVideoSurfaceYUY2) {
D3DLOCKED_RECT r;
- if(SUCCEEDED(m_pVideoSurfaceYUY2->LockRect(&r, src2, 0))) {
+ if (SUCCEEDED(m_pVideoSurfaceYUY2->LockRect(&r, src2, 0))) {
BitBltFromI420ToYUY2(src.Width(), src.Height(), (BYTE*)r.pBits, r.Pitch, y, u, v, pitch);
m_pVideoSurfaceYUY2->UnlockRect();
fYUY2 = true;
}
} else {
D3DLOCKED_RECT r;
- if(SUCCEEDED(m_pVideoSurfaceOff->LockRect(&r, src2, 0))) {
+ if (SUCCEEDED(m_pVideoSurfaceOff->LockRect(&r, src2, 0))) {
BitBltFromI420ToRGB(src.Width(), src.Height(), (BYTE*)r.pBits, r.Pitch, dbpp, y, u, v, pitch);
m_pVideoSurfaceOff->UnlockRect();
fRGB = true;
}
}
- } else if(pBitmapInfo->biCompression == '2YUY') {
+ } else if (pBitmapInfo->biCompression == '2YUY') {
DWORD w = pBitmapInfo->biWidth;
DWORD h = abs(pBitmapInfo->biHeight);
DWORD pitch = pBitmapInfo->biWidth*2;
@@ -141,23 +141,23 @@ STDMETHODIMP CRM9AllocatorPresenter::Blt(UCHAR* pImageData, RMABitmapInfoHeader* BYTE* yvyu = pImageData + src.top*pitch + src.left*2;
- if(m_pVideoSurfaceYUY2) {
+ if (m_pVideoSurfaceYUY2) {
D3DLOCKED_RECT r;
- if(SUCCEEDED(m_pVideoSurfaceYUY2->LockRect(&r, src2, 0))) {
+ if (SUCCEEDED(m_pVideoSurfaceYUY2->LockRect(&r, src2, 0))) {
BitBltFromYUY2ToYUY2(src.Width(), src.Height(), (BYTE*)r.pBits, r.Pitch, yvyu, pitch);
m_pVideoSurfaceYUY2->UnlockRect();
fYUY2 = true;
}
} else {
D3DLOCKED_RECT r;
- if(SUCCEEDED(m_pVideoSurfaceOff->LockRect(&r, src2, 0))) {
+ if (SUCCEEDED(m_pVideoSurfaceOff->LockRect(&r, src2, 0))) {
BitBltFromYUY2ToRGB(src.Width(), src.Height(), (BYTE*)r.pBits, r.Pitch, dbpp, yvyu, pitch);
m_pVideoSurfaceOff->UnlockRect();
fRGB = true;
}
}
- } else if(pBitmapInfo->biCompression == 0 || pBitmapInfo->biCompression == 3
- || pBitmapInfo->biCompression == 'BGRA') {
+ } else if (pBitmapInfo->biCompression == 0 || pBitmapInfo->biCompression == 3
+ || pBitmapInfo->biCompression == 'BGRA') {
DWORD w = pBitmapInfo->biWidth;
DWORD h = abs(pBitmapInfo->biHeight);
DWORD pitch = pBitmapInfo->biWidth*pBitmapInfo->biBitCount>>3;
@@ -167,9 +167,9 @@ STDMETHODIMP CRM9AllocatorPresenter::Blt(UCHAR* pImageData, RMABitmapInfoHeader* BYTE* rgb = pImageData + src.top*pitch + src.left*(pBitmapInfo->biBitCount>>3);
D3DLOCKED_RECT r;
- if(SUCCEEDED(m_pVideoSurfaceOff->LockRect(&r, src2, 0))) {
+ if (SUCCEEDED(m_pVideoSurfaceOff->LockRect(&r, src2, 0))) {
BYTE* pBits = (BYTE*)r.pBits;
- if(pBitmapInfo->biHeight > 0) {
+ if (pBitmapInfo->biHeight > 0) {
pBits += r.Pitch*(src.Height()-1);
r.Pitch = -r.Pitch;
}
@@ -179,11 +179,11 @@ STDMETHODIMP CRM9AllocatorPresenter::Blt(UCHAR* pImageData, RMABitmapInfoHeader* }
}
- if(!fRGB && !fYUY2) {
+ if (!fRGB && !fYUY2) {
m_pD3DDev->ColorFill(m_pVideoSurfaceOff, NULL, 0);
HDC hDC;
- if(SUCCEEDED(m_pVideoSurfaceOff->GetDC(&hDC))) {
+ if (SUCCEEDED(m_pVideoSurfaceOff->GetDC(&hDC))) {
CString str;
str.Format(_T("Sorry, this format is not supported"));
@@ -199,10 +199,10 @@ STDMETHODIMP CRM9AllocatorPresenter::Blt(UCHAR* pImageData, RMABitmapInfoHeader* HRESULT hr;
- if(fRGB) {
+ if (fRGB) {
hr = m_pD3DDev->StretchRect(m_pVideoSurfaceOff, src2, m_pVideoSurface[m_nCurSurface], dst, D3DTEXF_NONE);
}
- if(fYUY2) {
+ if (fYUY2) {
hr = m_pD3DDev->StretchRect(m_pVideoSurfaceYUY2, src2, m_pVideoSurface[m_nCurSurface], dst, D3DTEXF_NONE);
}
@@ -217,7 +217,7 @@ STDMETHODIMP CRM9AllocatorPresenter::BeginOptimizedBlt(RMABitmapInfoHeader* pBit CAutoLock cRenderLock(&m_RenderLock);
DeleteSurfaces();
m_NativeVideoSize = m_AspectRatio = CSize(pBitmapInfo->biWidth, abs(pBitmapInfo->biHeight));
- if(FAILED(AllocSurfaces())) {
+ if (FAILED(AllocSurfaces())) {
return E_FAIL;
}
return PNR_NOTIMPL;
diff --git a/src/filters/renderer/VideoRenderers/SyncRenderer.cpp b/src/filters/renderer/VideoRenderers/SyncRenderer.cpp index 6d6d35f00..03bdafaf4 100644 --- a/src/filters/renderer/VideoRenderers/SyncRenderer.cpp +++ b/src/filters/renderer/VideoRenderers/SyncRenderer.cpp @@ -94,7 +94,7 @@ CBaseAP::CBaseAP(HWND hWnd, bool bFullscreen, HRESULT& hr, CString &_Error): m_llEstVBlankTime(0),
m_CurrentAdapter(0)
{
- if(FAILED(hr)) {
+ if (FAILED(hr)) {
_Error += L"ISubPicAllocatorPresenterImpl failed\n";
return;
}
@@ -105,7 +105,7 @@ CBaseAP::CBaseAP(HWND hWnd, bool bFullscreen, HRESULT& hr, CString &_Error): m_pD3DXCreateFont = NULL;
m_pD3DXCreateSprite = NULL;
hDll = GetRenderersData()->GetD3X9Dll();
- if(hDll) {
+ if (hDll) {
(FARPROC &)m_pD3DXLoadSurfaceFromMemory = GetProcAddress(hDll, "D3DXLoadSurfaceFromMemory");
(FARPROC &)m_pD3DXCreateLine = GetProcAddress(hDll, "D3DXCreateLine");
(FARPROC &)m_pD3DXCreateFont = GetProcAddress(hDll, "D3DXCreateFontW");
@@ -135,16 +135,16 @@ CBaseAP::CBaseAP(HWND hWnd, bool bFullscreen, HRESULT& hr, CString &_Error): if (m_pDirect3DCreate9Ex) {
DEBUG_ONLY(_tprintf(_T("m_pDirect3DCreate9Ex\n")));
m_pDirect3DCreate9Ex(D3D_SDK_VERSION, &m_pD3DEx);
- if(!m_pD3DEx) {
+ if (!m_pD3DEx) {
m_pDirect3DCreate9Ex(D3D9b_SDK_VERSION, &m_pD3DEx);
}
}
- if(!m_pD3DEx) {
+ if (!m_pD3DEx) {
m_pD3D.Attach(Direct3DCreate9(D3D_SDK_VERSION));
- if(!m_pD3D) {
+ if (!m_pD3D) {
m_pD3D.Attach(Direct3DCreate9(D3D9b_SDK_VERSION));
}
- if(m_pD3D) {
+ if (m_pD3D) {
DEBUG_ONLY(_tprintf(_T("m_pDirect3DCreate9\n")));
}
} else {
@@ -205,16 +205,16 @@ void CBaseAP::AdjustQuad(MYD3DVERTEX<texcoords>* v, double dx, double dy) {
double offset = 0.5;
- for(int i = 0; i < 4; i++) {
+ for (int i = 0; i < 4; i++) {
v[i].x -= offset;
v[i].y -= offset;
- for(int j = 0; j < max(texcoords-1, 1); j++) {
+ for (int j = 0; j < max(texcoords-1, 1); j++) {
v[i].t[j].u -= offset*dx;
v[i].t[j].v -= offset*dy;
}
- if(texcoords > 1) {
+ if (texcoords > 1) {
v[i].t[texcoords-1].u -= offset;
v[i].t[texcoords-1].v -= offset;
}
@@ -224,12 +224,12 @@ void CBaseAP::AdjustQuad(MYD3DVERTEX<texcoords>* v, double dx, double dy) template<int texcoords>
HRESULT CBaseAP::TextureBlt(IDirect3DDevice9* pD3DDev, MYD3DVERTEX<texcoords> v[4], D3DTEXTUREFILTERTYPE filter = D3DTEXF_LINEAR)
{
- if(!pD3DDev) {
+ if (!pD3DDev) {
return E_POINTER;
}
DWORD FVF = 0;
- switch(texcoords) {
+ switch (texcoords) {
case 1:
FVF = D3DFVF_TEX1;
break;
@@ -268,7 +268,7 @@ HRESULT CBaseAP::TextureBlt(IDirect3DDevice9* pD3DDev, MYD3DVERTEX<texcoords> v[ hr = pD3DDev->SetRenderState(D3DRS_SCISSORTESTENABLE, FALSE);
hr = pD3DDev->SetRenderState(D3DRS_COLORWRITEENABLE, D3DCOLORWRITEENABLE_ALPHA|D3DCOLORWRITEENABLE_BLUE|D3DCOLORWRITEENABLE_GREEN|D3DCOLORWRITEENABLE_RED);
- for(int i = 0; i < texcoords; i++) {
+ for (int i = 0; i < texcoords; i++) {
hr = pD3DDev->SetSamplerState(i, D3DSAMP_MAGFILTER, filter);
hr = pD3DDev->SetSamplerState(i, D3DSAMP_MINFILTER, filter);
hr = pD3DDev->SetSamplerState(i, D3DSAMP_MIPFILTER, D3DTEXF_NONE);
@@ -284,7 +284,7 @@ HRESULT CBaseAP::TextureBlt(IDirect3DDevice9* pD3DDev, MYD3DVERTEX<texcoords> v[ v[3] = tmp;
hr = pD3DDev->DrawPrimitiveUP(D3DPT_TRIANGLEFAN, 2, v, sizeof(v[0]));
- for(int i = 0; i < texcoords; i++) {
+ for (int i = 0; i < texcoords; i++) {
pD3DDev->SetTexture(i, NULL);
}
@@ -293,7 +293,7 @@ HRESULT CBaseAP::TextureBlt(IDirect3DDevice9* pD3DDev, MYD3DVERTEX<texcoords> v[ HRESULT CBaseAP::DrawRectBase(IDirect3DDevice9* pD3DDev, MYD3DVERTEX<0> v[4])
{
- if(!pD3DDev) {
+ if (!pD3DDev) {
return E_POINTER;
}
@@ -401,17 +401,17 @@ HRESULT CBaseAP::CreateDXDevice(CString &_Error) m_pResizerPixelShader[3] = 0;
POSITION pos = m_pPixelShadersScreenSpace.GetHeadPosition();
- while(pos) {
+ while (pos) {
CExternalPixelShader &Shader = m_pPixelShadersScreenSpace.GetNext(pos);
Shader.m_pPixelShader = NULL;
}
pos = m_pPixelShaders.GetHeadPosition();
- while(pos) {
+ while (pos) {
CExternalPixelShader &Shader = m_pPixelShaders.GetNext(pos);
Shader.m_pPixelShader = NULL;
}
- if(!m_pD3D) {
+ if (!m_pD3D) {
_Error += L"Failed to create Direct3D device\n";
return E_UNEXPECTED;
}
@@ -419,7 +419,7 @@ HRESULT CBaseAP::CreateDXDevice(CString &_Error) D3DDISPLAYMODE d3ddm;
ZeroMemory(&d3ddm, sizeof(d3ddm));
m_CurrentAdapter = GetAdapter(m_pD3D);
- if(FAILED(m_pD3D->GetAdapterDisplayMode(m_CurrentAdapter, &d3ddm))) {
+ if (FAILED(m_pD3D->GetAdapterDisplayMode(m_CurrentAdapter, &d3ddm))) {
_Error += L"Can not retrieve display mode data\n";
return E_UNEXPECTED;
}
@@ -454,7 +454,7 @@ HRESULT CBaseAP::CreateDXDevice(CString &_Error) pp.Flags = D3DPRESENTFLAG_VIDEO;
m_bHighColorResolution = s.m_RenderSettings.iEVRHighColorResolution;
if (m_bHighColorResolution) {
- if(FAILED(m_pD3D->CheckDeviceType(D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, d3ddm.Format, D3DFMT_A2R10G10B10, false))) {
+ if (FAILED(m_pD3D->CheckDeviceType(D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, d3ddm.Format, D3DFMT_A2R10G10B10, false))) {
m_strStatsMsg[MSG_ERROR].Format (L"10 bit RGB is not supported by this graphics device in this resolution.");
m_bHighColorResolution = false;
}
@@ -509,7 +509,7 @@ HRESULT CBaseAP::CreateDXDevice(CString &_Error) m_DisplayType = d3ddm.Format;
m_bHighColorResolution = s.m_RenderSettings.iEVRHighColorResolution;
if (m_bHighColorResolution) {
- if(FAILED(m_pD3D->CheckDeviceType(D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, d3ddm.Format, D3DFMT_A2R10G10B10, false))) {
+ if (FAILED(m_pD3D->CheckDeviceType(D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, d3ddm.Format, D3DFMT_A2R10G10B10, false))) {
m_strStatsMsg[MSG_ERROR].Format (L"10 bit RGB is not supported by this graphics device in this resolution.");
m_bHighColorResolution = false;
}
@@ -546,7 +546,7 @@ HRESULT CBaseAP::CreateDXDevice(CString &_Error) }
}
- while(hr == D3DERR_DEVICELOST) {
+ while (hr == D3DERR_DEVICELOST) {
TRACE("D3DERR_DEVICELOST. Trying to Reset.\n");
hr = m_pD3DDev->TestCooperativeLevel();
}
@@ -565,14 +565,14 @@ HRESULT CBaseAP::CreateDXDevice(CString &_Error) m_pPSC.Attach(DNew CPixelShaderCompiler(m_pD3DDev, true));
m_filter = D3DTEXF_NONE;
- if(m_caps.StretchRectFilterCaps&D3DPTFILTERCAPS_MINFLINEAR && m_caps.StretchRectFilterCaps&D3DPTFILTERCAPS_MAGFLINEAR) {
+ if (m_caps.StretchRectFilterCaps&D3DPTFILTERCAPS_MINFLINEAR && m_caps.StretchRectFilterCaps&D3DPTFILTERCAPS_MAGFLINEAR) {
m_filter = D3DTEXF_LINEAR;
}
m_bicubicA = 0;
CSize size;
- switch(GetRenderersSettings().nSPCMaxRes) {
+ switch (GetRenderersSettings().nSPCMaxRes) {
case 0:
default:
size = m_ScreenSize;
@@ -606,11 +606,11 @@ HRESULT CBaseAP::CreateDXDevice(CString &_Error) break;
}
- if(m_pAllocator) {
+ if (m_pAllocator) {
m_pAllocator->ChangeDevice(m_pD3DDev);
} else {
m_pAllocator = DNew CDX9SubPicAllocator(m_pD3DDev, size, GetRenderersSettings().fSPCPow2Tex, false);
- if(!m_pAllocator) {
+ if (!m_pAllocator) {
_Error += L"CDX9SubPicAllocator failed\n";
return E_FAIL;
}
@@ -619,7 +619,7 @@ HRESULT CBaseAP::CreateDXDevice(CString &_Error) hr = S_OK;
CComPtr<ISubPicProvider> pSubPicProvider;
- if(m_pSubPicQueue) {
+ if (m_pSubPicQueue) {
DEBUG_ONLY(_tprintf(_T("m_pSubPicQueue != NULL\n")));
m_pSubPicQueue->GetSubPicProvider(&pSubPicProvider);
}
@@ -628,12 +628,12 @@ HRESULT CBaseAP::CreateDXDevice(CString &_Error) m_pSubPicQueue = GetRenderersSettings().nSPCSize > 0
? (ISubPicQueue*)DNew CSubPicQueue(GetRenderersSettings().nSPCSize, !GetRenderersSettings().fSPCAllowAnimationWhenBuffering, m_pAllocator, &hr)
: (ISubPicQueue*)DNew CSubPicQueueNoThread(m_pAllocator, &hr);
- if(!m_pSubPicQueue || FAILED(hr)) {
+ if (!m_pSubPicQueue || FAILED(hr)) {
_Error += L"m_pSubPicQueue failed\n";
return E_FAIL;
}
- if(pSubPicProvider) {
+ if (pSubPicProvider) {
m_pSubPicQueue->SetSubPicProvider(pSubPicProvider);
}
@@ -715,19 +715,19 @@ HRESULT CBaseAP::ResetDXDevice(CString &_Error) m_pResizerPixelShader[3] = 0;
POSITION pos = m_pPixelShadersScreenSpace.GetHeadPosition();
- while(pos) {
+ while (pos) {
CExternalPixelShader &Shader = m_pPixelShadersScreenSpace.GetNext(pos);
Shader.m_pPixelShader = NULL;
}
pos = m_pPixelShaders.GetHeadPosition();
- while(pos) {
+ while (pos) {
CExternalPixelShader &Shader = m_pPixelShaders.GetNext(pos);
Shader.m_pPixelShader = NULL;
}
D3DDISPLAYMODE d3ddm;
ZeroMemory(&d3ddm, sizeof(d3ddm));
- if(FAILED(m_pD3D->GetAdapterDisplayMode(GetAdapter(m_pD3D), &d3ddm))) {
+ if (FAILED(m_pD3D->GetAdapterDisplayMode(GetAdapter(m_pD3D), &d3ddm))) {
_Error += L"Can not retrieve display mode data\n";
return E_UNEXPECTED;
}
@@ -755,7 +755,7 @@ HRESULT CBaseAP::ResetDXDevice(CString &_Error) } else {
pp.BackBufferFormat = d3ddm.Format;
}
- if(FAILED(m_pD3DEx->CheckDeviceType(D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, pp.BackBufferFormat, pp.BackBufferFormat, false))) {
+ if (FAILED(m_pD3DEx->CheckDeviceType(D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, pp.BackBufferFormat, pp.BackBufferFormat, false))) {
_Error += L"10 bit RGB is not supported by this graphics device in exclusive mode fullscreen.\n";
return hr;
}
@@ -791,7 +791,7 @@ HRESULT CBaseAP::ResetDXDevice(CString &_Error) m_BackbufferType = D3DFMT_A2R10G10B10;
pp.BackBufferFormat = D3DFMT_A2R10G10B10;
}
- if(FAILED(m_pD3DEx->CheckDeviceType(D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, pp.BackBufferFormat, pp.BackBufferFormat, false))) {
+ if (FAILED(m_pD3DEx->CheckDeviceType(D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, pp.BackBufferFormat, pp.BackBufferFormat, false))) {
_Error += L"10 bit RGB is not supported by this graphics device in windowed mode.\n";
return hr;
}
@@ -830,7 +830,7 @@ HRESULT CBaseAP::ResetDXDevice(CString &_Error) m_pPSC.Attach(DNew CPixelShaderCompiler(m_pD3DDev, true));
m_filter = D3DTEXF_NONE;
- if((m_caps.StretchRectFilterCaps&D3DPTFILTERCAPS_MINFLINEAR)
+ if ((m_caps.StretchRectFilterCaps&D3DPTFILTERCAPS_MINFLINEAR)
&& (m_caps.StretchRectFilterCaps&D3DPTFILTERCAPS_MAGFLINEAR)) {
m_filter = D3DTEXF_LINEAR;
}
@@ -838,11 +838,11 @@ HRESULT CBaseAP::ResetDXDevice(CString &_Error) m_bicubicA = 0;
CComPtr<ISubPicProvider> pSubPicProvider;
- if(m_pSubPicQueue) {
+ if (m_pSubPicQueue) {
m_pSubPicQueue->GetSubPicProvider(&pSubPicProvider);
}
CSize size;
- switch(GetRenderersSettings().nSPCMaxRes) {
+ switch (GetRenderersSettings().nSPCMaxRes) {
case 0:
default:
size = m_ScreenSize;
@@ -876,11 +876,11 @@ HRESULT CBaseAP::ResetDXDevice(CString &_Error) break;
}
- if(m_pAllocator) {
+ if (m_pAllocator) {
m_pAllocator->ChangeDevice(m_pD3DDev);
} else {
m_pAllocator = DNew CDX9SubPicAllocator(m_pD3DDev, size, GetRenderersSettings().fSPCPow2Tex, false);
- if(!m_pAllocator) {
+ if (!m_pAllocator) {
_Error += L"CDX9SubPicAllocator failed\n";
return E_FAIL;
@@ -891,13 +891,13 @@ HRESULT CBaseAP::ResetDXDevice(CString &_Error) m_pSubPicQueue = GetRenderersSettings().nSPCSize > 0
? (ISubPicQueue*)DNew CSubPicQueue(GetRenderersSettings().nSPCSize, !GetRenderersSettings().fSPCAllowAnimationWhenBuffering, m_pAllocator, &hr)
: (ISubPicQueue*)DNew CSubPicQueueNoThread(m_pAllocator, &hr);
- if(!m_pSubPicQueue || FAILED(hr)) {
+ if (!m_pSubPicQueue || FAILED(hr)) {
_Error += L"m_pSubPicQueue failed\n";
return E_FAIL;
}
- if(pSubPicProvider) {
+ if (pSubPicProvider) {
m_pSubPicQueue->SetSubPicProvider(pSubPicProvider);
}
@@ -928,7 +928,7 @@ HRESULT CBaseAP::AllocSurfaces(D3DFORMAT Format) CRenderersSettings& s = GetRenderersSettings();
- for(int i = 0; i < m_nDXSurface+2; i++) {
+ for (int i = 0; i < m_nDXSurface+2; i++) {
m_pVideoTexture[i] = NULL;
m_pVideoSurface[i] = NULL;
}
@@ -938,26 +938,26 @@ HRESULT CBaseAP::AllocSurfaces(D3DFORMAT Format) m_SurfaceType = Format;
HRESULT hr;
- if(s.iAPSurfaceUsage == VIDRNDT_AP_TEXTURE2D || s.iAPSurfaceUsage == VIDRNDT_AP_TEXTURE3D) {
+ if (s.iAPSurfaceUsage == VIDRNDT_AP_TEXTURE2D || s.iAPSurfaceUsage == VIDRNDT_AP_TEXTURE3D) {
int nTexturesNeeded = s.iAPSurfaceUsage == VIDRNDT_AP_TEXTURE3D ? m_nDXSurface+2 : 1;
- for(int i = 0; i < nTexturesNeeded; i++) {
- if(FAILED(hr = m_pD3DDev->CreateTexture(
- m_NativeVideoSize.cx, m_NativeVideoSize.cy, 1, D3DUSAGE_RENDERTARGET, Format, D3DPOOL_DEFAULT, &m_pVideoTexture[i], NULL))) {
+ for (int i = 0; i < nTexturesNeeded; i++) {
+ if (FAILED(hr = m_pD3DDev->CreateTexture(
+ m_NativeVideoSize.cx, m_NativeVideoSize.cy, 1, D3DUSAGE_RENDERTARGET, Format, D3DPOOL_DEFAULT, &m_pVideoTexture[i], NULL))) {
return hr;
}
- if(FAILED(hr = m_pVideoTexture[i]->GetSurfaceLevel(0, &m_pVideoSurface[i]))) {
+ if (FAILED(hr = m_pVideoTexture[i]->GetSurfaceLevel(0, &m_pVideoSurface[i]))) {
return hr;
}
}
- if(s.iAPSurfaceUsage == VIDRNDT_AP_TEXTURE2D) {
- for(int i = 0; i < m_nDXSurface+2; i++) {
+ if (s.iAPSurfaceUsage == VIDRNDT_AP_TEXTURE2D) {
+ for (int i = 0; i < m_nDXSurface+2; i++) {
m_pVideoTexture[i] = NULL;
}
}
} else {
- if(FAILED(hr = m_pD3DDev->CreateOffscreenPlainSurface(m_NativeVideoSize.cx, m_NativeVideoSize.cy, D3DFMT_X8R8G8B8, D3DPOOL_DEFAULT, &m_pVideoSurface[m_nCurSurface], NULL))) {
+ if (FAILED(hr = m_pD3DDev->CreateOffscreenPlainSurface(m_NativeVideoSize.cx, m_NativeVideoSize.cy, D3DFMT_X8R8G8B8, D3DPOOL_DEFAULT, &m_pVideoSurface[m_nCurSurface], NULL))) {
return hr;
}
}
@@ -971,7 +971,7 @@ void CBaseAP::DeleteSurfaces() CAutoLock cAutoLock(this);
CAutoLock cRenderLock(&m_allocatorLock);
- for(int i = 0; i < m_nDXSurface+2; i++) {
+ for (int i = 0; i < m_nDXSurface+2; i++) {
m_pVideoTexture[i] = NULL;
m_pVideoSurface[i] = NULL;
}
@@ -979,18 +979,18 @@ void CBaseAP::DeleteSurfaces() UINT CBaseAP::GetAdapter(IDirect3D9* pD3D)
{
- if(m_hWnd == NULL || pD3D == NULL) {
+ if (m_hWnd == NULL || pD3D == NULL) {
return D3DADAPTER_DEFAULT;
}
HMONITOR hMonitor = MonitorFromWindow(m_hWnd, MONITOR_DEFAULTTONEAREST);
- if(hMonitor == NULL) {
+ if (hMonitor == NULL) {
return D3DADAPTER_DEFAULT;
}
- for(UINT adp = 0, num_adp = pD3D->GetAdapterCount(); adp < num_adp; ++adp) {
+ for (UINT adp = 0, num_adp = pD3D->GetAdapterCount(); adp < num_adp; ++adp) {
HMONITOR hAdpMon = pD3D->GetAdapterMonitor(adp);
- if(hAdpMon == hMonitor) {
+ if (hAdpMon == hMonitor) {
return adp;
}
}
@@ -1008,7 +1008,7 @@ bool CBaseAP::ClipToSurface(IDirect3DSurface9* pSurface, CRect& s, CRect& d) {
D3DSURFACE_DESC d3dsd;
ZeroMemory(&d3dsd, sizeof(d3dsd));
- if(FAILED(pSurface->GetDesc(&d3dsd))) {
+ if (FAILED(pSurface->GetDesc(&d3dsd))) {
return false;
}
@@ -1016,25 +1016,25 @@ bool CBaseAP::ClipToSurface(IDirect3DSurface9* pSurface, CRect& s, CRect& d) int sw = s.Width(), sh = s.Height();
int dw = d.Width(), dh = d.Height();
- if(d.left >= w || d.right < 0 || d.top >= h || d.bottom < 0
+ if (d.left >= w || d.right < 0 || d.top >= h || d.bottom < 0
|| sw <= 0 || sh <= 0 || dw <= 0 || dh <= 0) {
s.SetRectEmpty();
d.SetRectEmpty();
return true;
}
- if(d.right > w) {
+ if (d.right > w) {
s.right -= (d.right-w)*sw/dw;
d.right = w;
}
- if(d.bottom > h) {
+ if (d.bottom > h) {
s.bottom -= (d.bottom-h)*sh/dh;
d.bottom = h;
}
- if(d.left < 0) {
+ if (d.left < 0) {
s.left += (0-d.left)*sw/dw;
d.left = 0;
}
- if(d.top < 0) {
+ if (d.top < 0) {
s.top += (0-d.top)*sh/dh;
d.top = 0;
}
@@ -1089,18 +1089,18 @@ HRESULT CBaseAP::InitResizers(float bicubicA, bool bNeedScreenSizeTexture) m_pScreenSizeTemporaryTexture[0] = NULL;
m_pScreenSizeTemporaryTexture[1] = NULL;
- for(int i = 0; i < countof(m_pResizerPixelShader); i++) {
+ for (int i = 0; i < countof(m_pResizerPixelShader); i++) {
m_pResizerPixelShader[i] = NULL;
}
- if(m_caps.PixelShaderVersion < D3DPS_VERSION(2, 0)) {
+ if (m_caps.PixelShaderVersion < D3DPS_VERSION(2, 0)) {
return E_FAIL;
}
LPCSTR pProfile = m_caps.PixelShaderVersion >= D3DPS_VERSION(3, 0) ? "ps_3_0" : "ps_2_0";
CStringA str;
- if(!LoadResource(IDF_SHADER_RESIZER, str, _T("FILE"))) {
+ if (!LoadResource(IDF_SHADER_RESIZER, str, _T("FILE"))) {
return E_FAIL;
}
@@ -1111,28 +1111,28 @@ HRESULT CBaseAP::InitResizers(float bicubicA, bool bNeedScreenSizeTexture) LPCSTR pEntries[] = {"main_bilinear", "main_bicubic1pass", "main_bicubic2pass_pass1", "main_bicubic2pass_pass2"};
ASSERT(countof(pEntries) == countof(m_pResizerPixelShader));
- for(int i = 0; i < countof(pEntries); i++) {
+ for (int i = 0; i < countof(pEntries); i++) {
CString ErrorMessage;
CString DissAssembly;
hr = m_pPSC->CompileShader(str, pEntries[i], pProfile, 0, &m_pResizerPixelShader[i], &DissAssembly, &ErrorMessage);
- if(FAILED(hr)) {
+ if (FAILED(hr)) {
TRACE("%ws", ErrorMessage.GetString());
ASSERT (0);
return hr;
}
}
- if(m_bicubicA || bNeedScreenSizeTexture) {
- if(FAILED(m_pD3DDev->CreateTexture(
- min(m_ScreenSize.cx, (int)m_caps.MaxTextureWidth), min(max(m_ScreenSize.cy, m_NativeVideoSize.cy), (int)m_caps.MaxTextureHeight), 1, D3DUSAGE_RENDERTARGET, D3DFMT_A8R8G8B8,
- D3DPOOL_DEFAULT, &m_pScreenSizeTemporaryTexture[0], NULL))) {
+ if (m_bicubicA || bNeedScreenSizeTexture) {
+ if (FAILED(m_pD3DDev->CreateTexture(
+ min(m_ScreenSize.cx, (int)m_caps.MaxTextureWidth), min(max(m_ScreenSize.cy, m_NativeVideoSize.cy), (int)m_caps.MaxTextureHeight), 1, D3DUSAGE_RENDERTARGET, D3DFMT_A8R8G8B8,
+ D3DPOOL_DEFAULT, &m_pScreenSizeTemporaryTexture[0], NULL))) {
ASSERT(0);
m_pScreenSizeTemporaryTexture[0] = NULL; // will do 1 pass then
}
}
- if(m_bicubicA || bNeedScreenSizeTexture) {
- if(FAILED(m_pD3DDev->CreateTexture(
- min(m_ScreenSize.cx, (int)m_caps.MaxTextureWidth), min(max(m_ScreenSize.cy, m_NativeVideoSize.cy), (int)m_caps.MaxTextureHeight), 1, D3DUSAGE_RENDERTARGET, D3DFMT_A8R8G8B8,
- D3DPOOL_DEFAULT, &m_pScreenSizeTemporaryTexture[1], NULL))) {
+ if (m_bicubicA || bNeedScreenSizeTexture) {
+ if (FAILED(m_pD3DDev->CreateTexture(
+ min(m_ScreenSize.cx, (int)m_caps.MaxTextureWidth), min(max(m_ScreenSize.cy, m_NativeVideoSize.cy), (int)m_caps.MaxTextureHeight), 1, D3DUSAGE_RENDERTARGET, D3DFMT_A8R8G8B8,
+ D3DPOOL_DEFAULT, &m_pScreenSizeTemporaryTexture[1], NULL))) {
ASSERT(0);
m_pScreenSizeTemporaryTexture[1] = NULL; // will do 1 pass then
}
@@ -1145,7 +1145,7 @@ HRESULT CBaseAP::TextureCopy(IDirect3DTexture9* pTexture) HRESULT hr;
D3DSURFACE_DESC desc;
- if(!pTexture || FAILED(pTexture->GetLevelDesc(0, &desc))) {
+ if (!pTexture || FAILED(pTexture->GetLevelDesc(0, &desc))) {
return E_FAIL;
}
@@ -1157,7 +1157,7 @@ HRESULT CBaseAP::TextureCopy(IDirect3DTexture9* pTexture) {0, h, 0.5f, 2.0f, 0, 1},
{w, h, 0.5f, 2.0f, 1, 1},
};
- for(int i = 0; i < countof(v); i++) {
+ for (int i = 0; i < countof(v); i++) {
v[i].x -= 0.5;
v[i].y -= 0.5;
}
@@ -1174,7 +1174,7 @@ HRESULT CBaseAP::DrawRect(DWORD _Color, DWORD _Alpha, const CRect &_Rect) {float(_Rect.left), float(_Rect.bottom), 0.5f, 2.0f, Color},
{float(_Rect.right), float(_Rect.bottom), 0.5f, 2.0f, Color},
};
- for(int i = 0; i < countof(v); i++) {
+ for (int i = 0; i < countof(v); i++) {
v[i].x -= 0.5;
v[i].y -= 0.5;
}
@@ -1186,7 +1186,7 @@ HRESULT CBaseAP::TextureResize(IDirect3DTexture9* pTexture, Vector dst[4], D3DTE HRESULT hr;
D3DSURFACE_DESC desc;
- if(!pTexture || FAILED(pTexture->GetLevelDesc(0, &desc))) {
+ if (!pTexture || FAILED(pTexture->GetLevelDesc(0, &desc))) {
return E_FAIL;
}
@@ -1214,7 +1214,7 @@ HRESULT CBaseAP::TextureResizeBilinear(IDirect3DTexture9* pTexture, Vector dst[4 HRESULT hr;
D3DSURFACE_DESC desc;
- if(!pTexture || FAILED(pTexture->GetLevelDesc(0, &desc))) {
+ if (!pTexture || FAILED(pTexture->GetLevelDesc(0, &desc))) {
return E_FAIL;
}
@@ -1247,7 +1247,7 @@ HRESULT CBaseAP::TextureResizeBicubic1pass(IDirect3DTexture9* pTexture, Vector d HRESULT hr;
D3DSURFACE_DESC desc;
- if(!pTexture || FAILED(pTexture->GetLevelDesc(0, &desc))) {
+ if (!pTexture || FAILED(pTexture->GetLevelDesc(0, &desc))) {
return E_FAIL;
}
@@ -1362,7 +1362,7 @@ HRESULT CBaseAP::TextureResizeBicubic2pass(IDirect3DTexture9* pTexture, Vector d HRESULT CBaseAP::AlphaBlt(RECT* pSrc, RECT* pDst, IDirect3DTexture9* pTexture)
{
- if(!pSrc || !pDst) {
+ if (!pSrc || !pDst) {
return E_POINTER;
}
@@ -1373,7 +1373,7 @@ HRESULT CBaseAP::AlphaBlt(RECT* pSrc, RECT* pDst, IDirect3DTexture9* pTexture) do {
D3DSURFACE_DESC d3dsd;
ZeroMemory(&d3dsd, sizeof(d3dsd));
- if(FAILED(pTexture->GetLevelDesc(0, &d3dsd)) /*|| d3dsd.Type != D3DRTYPE_TEXTURE*/) {
+ if (FAILED(pTexture->GetLevelDesc(0, &d3dsd)) /*|| d3dsd.Type != D3DRTYPE_TEXTURE*/) {
break;
}
@@ -1433,7 +1433,7 @@ HRESULT CBaseAP::AlphaBlt(RECT* pSrc, RECT* pDst, IDirect3DTexture9* pTexture) m_pD3DDev->SetRenderState(D3DRS_DESTBLEND, db);
return S_OK;
- } while(0);
+ } while (0);
return E_FAIL;
}
@@ -1550,7 +1550,7 @@ STDMETHODIMP_(bool) CBaseAP::Paint(bool fAll) llSyncOffset = REFERENCE_TIME(10000.0 * dSyncOffset); // Reference time units (100 ns)
m_llEstVBlankTime = llCurRefTime + llSyncOffset; // Estimated time for the start of next vblank
- if(m_WindowRect.right <= m_WindowRect.left || m_WindowRect.bottom <= m_WindowRect.top
+ if (m_WindowRect.right <= m_WindowRect.left || m_WindowRect.bottom <= m_WindowRect.top
|| m_NativeVideoSize.cx <= 0 || m_NativeVideoSize.cy <= 0
|| !m_pVideoSurface) {
return false;
@@ -1567,18 +1567,18 @@ STDMETHODIMP_(bool) CBaseAP::Paint(bool fAll) m_pD3DDev->GetBackBuffer(0, 0, D3DBACKBUFFER_TYPE_MONO, &pBackBuffer);
m_pD3DDev->SetRenderTarget(0, pBackBuffer);
hr = m_pD3DDev->Clear(0, NULL, D3DCLEAR_TARGET, 0, 1.0f, 0);
- if(!rDstVid.IsRectEmpty()) {
- if(m_pVideoTexture[m_nCurSurface]) {
+ if (!rDstVid.IsRectEmpty()) {
+ if (m_pVideoTexture[m_nCurSurface]) {
CComPtr<IDirect3DTexture9> pVideoTexture = m_pVideoTexture[m_nCurSurface];
- if(m_pVideoTexture[m_nDXSurface] && m_pVideoTexture[m_nDXSurface+1] && !m_pPixelShaders.IsEmpty()) {
+ if (m_pVideoTexture[m_nDXSurface] && m_pVideoTexture[m_nDXSurface+1] && !m_pPixelShaders.IsEmpty()) {
static __int64 counter = 0;
static long start = clock();
long stop = clock();
long diff = stop - start;
- if(diff >= 10*60*CLOCKS_PER_SEC) {
+ if (diff >= 10*60*CLOCKS_PER_SEC) {
start = stop; // reset after 10 min (ps float has its limits in both range and accuracy)
}
@@ -1598,7 +1598,7 @@ STDMETHODIMP_(bool) CBaseAP::Paint(bool fAll) hr = m_pD3DDev->GetRenderTarget(0, &pRT);
POSITION pos = m_pPixelShaders.GetHeadPosition();
- while(pos) {
+ while (pos) {
pVideoTexture = m_pVideoTexture[dst];
hr = m_pD3DDev->SetRenderTarget(0, m_pVideoSurface[dst]);
@@ -1610,7 +1610,7 @@ STDMETHODIMP_(bool) CBaseAP::Paint(bool fAll) TextureCopy(m_pVideoTexture[src]);
src = dst;
- if(++dst >= m_nDXSurface+2) {
+ if (++dst >= m_nDXSurface+2) {
dst = m_nDXSurface;
}
}
@@ -1626,7 +1626,7 @@ STDMETHODIMP_(bool) CBaseAP::Paint(bool fAll) float A = 0;
- switch(iDX9Resizer) {
+ switch (iDX9Resizer) {
case 3:
A = -0.60f;
break;
@@ -1660,13 +1660,13 @@ STDMETHODIMP_(bool) CBaseAP::Paint(bool fAll) }
}
- if(rSrcVid.Size() != rDstVid.Size()) {
- if(iDX9Resizer == 0 || iDX9Resizer == 1) {
+ if (rSrcVid.Size() != rDstVid.Size()) {
+ if (iDX9Resizer == 0 || iDX9Resizer == 1) {
D3DTEXTUREFILTERTYPE Filter = iDX9Resizer == 0 ? D3DTEXF_POINT : D3DTEXF_LINEAR;
hr = TextureResize(pVideoTexture, dst, Filter, rSrcVid);
- } else if(iDX9Resizer == 2) {
+ } else if (iDX9Resizer == 2) {
hr = TextureResizeBilinear(pVideoTexture, dst, rSrcVid);
- } else if(iDX9Resizer >= 3) {
+ } else if (iDX9Resizer >= 3) {
hr = TextureResizeBicubic2pass(pVideoTexture, dst, rSrcVid);
}
} else {
@@ -1680,7 +1680,7 @@ STDMETHODIMP_(bool) CBaseAP::Paint(bool fAll) long stop = clock() + 333;
long diff = stop - start;
- if(diff >= 10*60*CLOCKS_PER_SEC) {
+ if (diff >= 10*60*CLOCKS_PER_SEC) {
start = stop; // reset after 10 min (ps float has its limits in both range and accuracy)
}
@@ -1697,7 +1697,7 @@ STDMETHODIMP_(bool) CBaseAP::Paint(bool fAll) int src = 1, dst = 0;
POSITION pos = m_pPixelShadersScreenSpace.GetHeadPosition();
- while(pos) {
+ while (pos) {
if (m_pPixelShadersScreenSpace.GetTailPosition() == pos) {
m_pD3DDev->SetRenderTarget(0, pBackBuffer);
} else {
@@ -1719,7 +1719,7 @@ STDMETHODIMP_(bool) CBaseAP::Paint(bool fAll) hr = m_pD3DDev->SetPixelShader(NULL);
}
} else {
- if(pBackBuffer) {
+ if (pBackBuffer) {
ClipToSurface(pBackBuffer, rSrcVid, rDstVid);
// rSrcVid has to be aligned on mod2 for yuy2->rgb conversion with StretchRect
rSrcVid.left &= ~1;
@@ -1727,7 +1727,7 @@ STDMETHODIMP_(bool) CBaseAP::Paint(bool fAll) rSrcVid.top &= ~1;
rSrcVid.bottom &= ~1;
hr = m_pD3DDev->StretchRect(m_pVideoSurface[m_nCurSurface], rSrcVid, pBackBuffer, rDstVid, m_filter);
- if(FAILED(hr)) {
+ if (FAILED(hr)) {
return false;
}
}
@@ -1740,7 +1740,7 @@ STDMETHODIMP_(bool) CBaseAP::Paint(bool fAll) m_pOSDTexture = NULL;
m_pOSDSurface = NULL;
if ((m_VMR9AlphaBitmap.dwFlags & VMRBITMAP_DISABLE) == 0 && (BYTE *)m_VMR9AlphaBitmapData) {
- if( (m_pD3DXLoadSurfaceFromMemory != NULL) &&
+ if ( (m_pD3DXLoadSurfaceFromMemory != NULL) &&
SUCCEEDED(hr = m_pD3DDev->CreateTexture(rcSrc.Width(), rcSrc.Height(), 1,
D3DUSAGE_RENDERTARGET, D3DFMT_A8R8G8B8,
D3DPOOL_DEFAULT, &m_pOSDTexture, NULL)) ) {
@@ -1777,7 +1777,7 @@ STDMETHODIMP_(bool) CBaseAP::Paint(bool fAll) hr = m_pD3DDev->Present(rSrcPri, rDstPri, NULL, NULL);
}
}
- if(FAILED(hr)) {
+ if (FAILED(hr)) {
DEBUG_ONLY(_tprintf(_T("Device lost or something\n")));
}
// Calculate timing statistics
@@ -1832,7 +1832,7 @@ STDMETHODIMP_(bool) CBaseAP::Paint(bool fAll) }
bool fResetDevice = m_bPendingResetDevice;
- if(hr == D3DERR_DEVICELOST && m_pD3DDev->TestCooperativeLevel() == D3DERR_DEVICENOTRESET || hr == S_PRESENT_MODE_CHANGED) {
+ if (hr == D3DERR_DEVICELOST && m_pD3DDev->TestCooperativeLevel() == D3DERR_DEVICENOTRESET || hr == S_PRESENT_MODE_CHANGED) {
fResetDevice = true;
}
if (SettingsNeedResetDevice()) {
@@ -1851,17 +1851,17 @@ STDMETHODIMP_(bool) CBaseAP::Paint(bool fAll) }
}
- if(s.fResetDevice) {
+ if (s.fResetDevice) {
LONGLONG time = GetRenderersData()->GetPerfCounter();
if (time > m_LastAdapterCheck + 20000000) { // check every 2 sec.
m_LastAdapterCheck = time;
#ifdef _DEBUG
D3DDEVICE_CREATION_PARAMETERS Parameters;
- if(SUCCEEDED(m_pD3DDev->GetCreationParameters(&Parameters))) {
+ if (SUCCEEDED(m_pD3DDev->GetCreationParameters(&Parameters))) {
ASSERT(Parameters.AdapterOrdinal == m_CurrentAdapter);
}
#endif
- if(m_CurrentAdapter != GetAdapter(m_pD3D)) {
+ if (m_CurrentAdapter != GetAdapter(m_pD3D)) {
fResetDevice = true;
}
#ifdef _DEBUG
@@ -1872,7 +1872,7 @@ STDMETHODIMP_(bool) CBaseAP::Paint(bool fAll) }
}
- if(fResetDevice) {
+ if (fResetDevice) {
m_bPendingResetDevice = true;
SendResetRequest();
}
@@ -1892,7 +1892,7 @@ STDMETHODIMP_(bool) CBaseAP::ResetDevice() DeleteSurfaces();
HRESULT hr;
CString Error;
- if(FAILED(hr = CreateDXDevice(Error)) || FAILED(hr = AllocSurfaces())) {
+ if (FAILED(hr = CreateDXDevice(Error)) || FAILED(hr = AllocSurfaces())) {
m_bDeviceResetRequested = false;
return false;
}
@@ -2310,20 +2310,20 @@ STDMETHODIMP CBaseAP::GetDIB(BYTE* lpDib, DWORD* size) m_pVideoSurface[m_nCurSurface]->GetDesc(&desc);
DWORD required = sizeof(BITMAPINFOHEADER) + (desc.Width * desc.Height * 32 >> 3);
- if(!lpDib) {
+ if (!lpDib) {
*size = required;
return S_OK;
}
- if(*size < required) {
+ if (*size < required) {
return E_OUTOFMEMORY;
}
*size = required;
CComPtr<IDirect3DSurface9> pSurface = m_pVideoSurface[m_nCurSurface];
D3DLOCKED_RECT r;
- if(FAILED(hr = pSurface->LockRect(&r, NULL, D3DLOCK_READONLY))) {
+ if (FAILED(hr = pSurface->LockRect(&r, NULL, D3DLOCK_READONLY))) {
pSurface = NULL;
- if(FAILED(hr = m_pD3DDev->CreateOffscreenPlainSurface(desc.Width, desc.Height, desc.Format, D3DPOOL_SYSTEMMEM, &pSurface, NULL))
+ if (FAILED(hr = m_pD3DDev->CreateOffscreenPlainSurface(desc.Width, desc.Height, desc.Format, D3DPOOL_SYSTEMMEM, &pSurface, NULL))
|| FAILED(hr = m_pD3DDev->GetRenderTargetData(m_pVideoSurface[m_nCurSurface], pSurface))
|| FAILED(hr = pSurface->LockRect(&r, NULL, D3DLOCK_READONLY))) {
return hr;
@@ -2365,13 +2365,13 @@ STDMETHODIMP CBaseAP::SetPixelShader2(LPCSTR pSrcData, LPCSTR pTarget, bool bScr pPixelShaders = &m_pPixelShaders;
}
- if(!pSrcData && !pTarget) {
+ if (!pSrcData && !pTarget) {
pPixelShaders->RemoveAll();
m_pD3DDev->SetPixelShader(NULL);
return S_OK;
}
- if(!pSrcData || !pTarget) {
+ if (!pSrcData || !pTarget) {
return E_INVALIDARG;
}
@@ -2382,7 +2382,7 @@ STDMETHODIMP CBaseAP::SetPixelShader2(LPCSTR pSrcData, LPCSTR pTarget, bool bScr CComPtr<IDirect3DPixelShader9> pPixelShader;
HRESULT hr = Shader.Compile(m_pPSC);
- if(FAILED(hr)) {
+ if (FAILED(hr)) {
return hr;
}
@@ -2583,18 +2583,18 @@ STDMETHODIMP CSyncAP::CreateRenderer(IUnknown** ppRenderer) CComPtr<IMFVideoRenderer> pMFVR;
CComQIPtr<IMFGetService, &__uuidof(IMFGetService)> pMFGS = pBF;
CComQIPtr<IEVRFilterConfig> pConfig = pBF;
- if(SUCCEEDED(hr)) {
- if(FAILED(pConfig->SetNumberOfStreams(3))) { // TODO - maybe need other number of input stream ...
+ if (SUCCEEDED(hr)) {
+ if (FAILED(pConfig->SetNumberOfStreams(3))) { // TODO - maybe need other number of input stream ...
break;
}
}
hr = pMFGS->GetService (MR_VIDEO_RENDER_SERVICE, IID_IMFVideoRenderer, (void**)&pMFVR);
- if(SUCCEEDED(hr)) {
+ if (SUCCEEDED(hr)) {
hr = QueryInterface(__uuidof(IMFVideoPresenter), (void**)&pVP);
}
- if(SUCCEEDED(hr)) {
+ if (SUCCEEDED(hr)) {
hr = pMFVR->InitializeRenderer(NULL, pVP);
}
@@ -2602,7 +2602,7 @@ STDMETHODIMP CSyncAP::CreateRenderer(IUnknown** ppRenderer) CComQIPtr<IMemInputPin> pMemInputPin = pPin;
m_bUseInternalTimer = HookNewSegmentAndReceive((IPinC*)(IPin*)pPin, (IMemInputPinC*)(IMemInputPin*)pMemInputPin);
- if(FAILED(hr)) {
+ if (FAILED(hr)) {
*ppRenderer = NULL;
} else {
*ppRenderer = pBF.Detach();
@@ -2620,29 +2620,29 @@ STDMETHODIMP_(bool) CSyncAP::Paint(bool fAll) STDMETHODIMP CSyncAP::NonDelegatingQueryInterface(REFIID riid, void** ppv)
{
HRESULT hr;
- if(riid == __uuidof(IMFClockStateSink)) {
+ if (riid == __uuidof(IMFClockStateSink)) {
hr = GetInterface((IMFClockStateSink*)this, ppv);
- } else if(riid == __uuidof(IMFVideoPresenter)) {
+ } else if (riid == __uuidof(IMFVideoPresenter)) {
hr = GetInterface((IMFVideoPresenter*)this, ppv);
- } else if(riid == __uuidof(IMFTopologyServiceLookupClient)) {
+ } else if (riid == __uuidof(IMFTopologyServiceLookupClient)) {
hr = GetInterface((IMFTopologyServiceLookupClient*)this, ppv);
- } else if(riid == __uuidof(IMFVideoDeviceID)) {
+ } else if (riid == __uuidof(IMFVideoDeviceID)) {
hr = GetInterface((IMFVideoDeviceID*)this, ppv);
- } else if(riid == __uuidof(IMFGetService)) {
+ } else if (riid == __uuidof(IMFGetService)) {
hr = GetInterface((IMFGetService*)this, ppv);
- } else if(riid == __uuidof(IMFAsyncCallback)) {
+ } else if (riid == __uuidof(IMFAsyncCallback)) {
hr = GetInterface((IMFAsyncCallback*)this, ppv);
- } else if(riid == __uuidof(IMFVideoDisplayControl)) {
+ } else if (riid == __uuidof(IMFVideoDisplayControl)) {
hr = GetInterface((IMFVideoDisplayControl*)this, ppv);
- } else if(riid == __uuidof(IEVRTrustedVideoPlugin)) {
+ } else if (riid == __uuidof(IEVRTrustedVideoPlugin)) {
hr = GetInterface((IEVRTrustedVideoPlugin*)this, ppv);
- } else if(riid == IID_IQualProp) {
+ } else if (riid == IID_IQualProp) {
hr = GetInterface((IQualProp*)this, ppv);
- } else if(riid == __uuidof(IMFRateSupport)) {
+ } else if (riid == __uuidof(IMFRateSupport)) {
hr = GetInterface((IMFRateSupport*)this, ppv);
- } else if(riid == __uuidof(IDirect3DDeviceManager9)) {
+ } else if (riid == __uuidof(IDirect3DDeviceManager9)) {
hr = m_pD3DManager->QueryInterface (__uuidof(IDirect3DDeviceManager9), (void**) ppv);
- } else if(riid == __uuidof(ISyncClockAdviser)) {
+ } else if (riid == __uuidof(ISyncClockAdviser)) {
hr = GetInterface((ISyncClockAdviser*)this, ppv);
} else {
hr = __super::NonDelegatingQueryInterface(riid, ppv);
@@ -2685,7 +2685,7 @@ STDMETHODIMP CSyncAP::OnClockSetRate(MFTIME hnsSystemTime, float flRate) bool CSyncAP::GetState(DWORD dwMilliSecsTimeout, FILTER_STATE *State, HRESULT &_ReturnValue)
{
CAutoLock lock(&m_SampleQueueLock);
- switch(m_nRenderState) {
+ switch (m_nRenderState) {
case Started:
*State = State_Running;
break;
@@ -2953,7 +2953,7 @@ HRESULT CSyncAP::CreateProposedOutputType(IMFMediaType* pMixerType, IMFMediaType bool bDoneSomething = true;
- if(m_AspectRatio.cx >= 1 && m_AspectRatio.cy >= 1) {
+ if (m_AspectRatio.cx >= 1 && m_AspectRatio.cy >= 1) {
while (bDoneSomething) {
bDoneSomething = false;
INT MinNum = min(m_AspectRatio.cx, m_AspectRatio.cy);
@@ -3130,7 +3130,7 @@ bool CSyncAP::GetSampleFromMixer() UINT dwSurface;
bool newSample = false;
- while(SUCCEEDED(hr)) { // Get as many frames as there are and that we have samples for
+ while (SUCCEEDED(hr)) { // Get as many frames as there are and that we have samples for
CComPtr<IMFSample> pSample;
CComPtr<IMFSample> pNewSample;
if (FAILED(GetFreeSample(&pSample))) { // All samples are taken for the moment. Better luck next time
@@ -3268,7 +3268,7 @@ STDMETHODIMP CSyncAP::GetIdealVideoSize(SIZE *pszMin, SIZE *pszMax) D3DDISPLAYMODE d3ddm;
ZeroMemory(&d3ddm, sizeof(d3ddm));
- if(SUCCEEDED(m_pD3D->GetAdapterDisplayMode(GetAdapter(m_pD3D), &d3ddm))) {
+ if (SUCCEEDED(m_pD3D->GetAdapterDisplayMode(GetAdapter(m_pD3D), &d3ddm))) {
pszMax->cx = d3ddm.Width;
pszMax->cy = d3ddm.Height;
}
@@ -3455,16 +3455,16 @@ STDMETHODIMP CSyncAP::GetNativeVideoSize(LONG* lpWidth, LONG* lpHeight, LONG* lp // This function should be called...
ASSERT (FALSE);
- if(lpWidth) {
+ if (lpWidth) {
*lpWidth = m_NativeVideoSize.cx;
}
- if(lpHeight) {
+ if (lpHeight) {
*lpHeight = m_NativeVideoSize.cy;
}
- if(lpARWidth) {
+ if (lpARWidth) {
*lpARWidth = m_AspectRatio.cx;
}
- if(lpARHeight) {
+ if (lpARHeight) {
*lpARHeight = m_AspectRatio.cy;
}
return S_OK;
@@ -3491,7 +3491,7 @@ STDMETHODIMP CSyncAP::InitializeDevice(AM_MEDIA_TYPE* pMediaType) hr = AllocSurfaces(D3DFMT_X8R8G8B8);
}
- for(int i = 0; i < m_nDXSurface; i++) {
+ for (int i = 0; i < m_nDXSurface; i++) {
CComPtr<IMFSample> pMFSample;
hr = pfMFCreateVideoSampleFromSurface(m_pVideoSurface[i], &pMFSample);
if (SUCCEEDED (hr)) {
@@ -3534,7 +3534,7 @@ void CSyncAP::MixerThread() CAutoLock AutoLock(&m_ImageProcessingLock);
bNewSample = GetSampleFromMixer();
}
- if(m_bUseInternalTimer && m_pSubPicQueue) {
+ if (m_bUseInternalTimer && m_pSubPicQueue) {
m_pSubPicQueue->SetFPS(m_fps);
}
}
@@ -3771,7 +3771,7 @@ STDMETHODIMP_(bool) CSyncAP::ResetDevice() bool bResult = __super::ResetDevice();
- for(int i = 0; i < m_nDXSurface; i++) {
+ for (int i = 0; i < m_nDXSurface; i++) {
CComPtr<IMFSample> pMFSample;
HRESULT hr = pfMFCreateVideoSampleFromSurface (m_pVideoSurface[i], &pMFSample);
if (SUCCEEDED (hr)) {
@@ -3897,7 +3897,7 @@ HRESULT CSyncAP::BeginStreaming() pEVR->QueryFilterInfo(&filterInfo); // This addref's the pGraph member
BeginEnumFilters(filterInfo.pGraph, pEF, pBF)
- if(CComQIPtr<IAMAudioRendererStats> pAS = pBF) {
+ if (CComQIPtr<IAMAudioRendererStats> pAS = pBF) {
m_pAudioStats = pAS;
};
EndEnumFilters
@@ -3925,7 +3925,7 @@ HRESULT CreateSyncRenderer(const CLSID& clsid, HWND hWnd, bool bFullscreen, ISub *ppAP = DNew CSyncAP(hWnd, bFullscreen, hr, Error);
(*ppAP)->AddRef();
- if(FAILED(hr)) {
+ if (FAILED(hr)) {
Error += L"\n";
Error += GetWindowsErrorMessage(hr, NULL);
MessageBox(hWnd, Error, L"Error creating EVR Sync", MB_OK | MB_ICONERROR);
@@ -4131,7 +4131,7 @@ STDMETHODIMP CSyncRenderer::NonDelegatingQueryInterface(REFIID riid, void** ppv) {
HRESULT hr;
- if(riid == __uuidof(IVMRMixerBitmap9)) {
+ if (riid == __uuidof(IVMRMixerBitmap9)) {
return GetInterface((IVMRMixerBitmap9*)this, ppv);
}
@@ -4150,8 +4150,8 @@ STDMETHODIMP CSyncRenderer::NonDelegatingQueryInterface(REFIID riid, void** ppv) }
hr = m_pEVR ? m_pEVR->QueryInterface(riid, ppv) : E_NOINTERFACE;
- if(m_pEVR && FAILED(hr)) {
- if(riid == __uuidof(IVMRffdshow9)) { // Support ffdshow queueing. We show ffdshow that this is patched Media Player Classic.
+ if (m_pEVR && FAILED(hr)) {
+ if (riid == __uuidof(IVMRffdshow9)) { // Support ffdshow queueing. We show ffdshow that this is patched Media Player Classic.
return GetInterface((IVMRffdshow9*)this, ppv);
}
}
@@ -4185,11 +4185,11 @@ CGenlock::CGenlock(DOUBLE target, DOUBLE limit, INT lineD, INT colD, DOUBLE cloc CGenlock::~CGenlock()
{
ResetTiming();
- if(syncOffsetFifo != NULL) {
+ if (syncOffsetFifo != NULL) {
delete syncOffsetFifo;
syncOffsetFifo = NULL;
}
- if(frameCycleFifo != NULL) {
+ if (frameCycleFifo != NULL) {
delete frameCycleFifo;
frameCycleFifo = NULL;
}
diff --git a/src/filters/renderer/VideoRenderers/SyncRenderer.h b/src/filters/renderer/VideoRenderers/SyncRenderer.h index d4ff8acd0..ee1e71e58 100644 --- a/src/filters/renderer/VideoRenderers/SyncRenderer.h +++ b/src/filters/renderer/VideoRenderers/SyncRenderer.h @@ -139,7 +139,7 @@ namespace GothSync CStringA m_SourceTarget;
HRESULT Compile(CPixelShaderCompiler *pCompiler) {
HRESULT hr = pCompiler->CompileShader(m_SourceData, "main", m_SourceTarget, 0, &m_pPixelShader);
- if(FAILED(hr)) {
+ if (FAILED(hr)) {
return hr;
}
return S_OK;
diff --git a/src/filters/renderer/VideoRenderers/VMR7AllocatorPresenter.cpp b/src/filters/renderer/VideoRenderers/VMR7AllocatorPresenter.cpp index e629432bc..eeace4d7c 100644 --- a/src/filters/renderer/VideoRenderers/VMR7AllocatorPresenter.cpp +++ b/src/filters/renderer/VideoRenderers/VMR7AllocatorPresenter.cpp @@ -42,11 +42,11 @@ CVMR7AllocatorPresenter::CVMR7AllocatorPresenter(HWND hWnd, HRESULT& hr) : CDX7AllocatorPresenter(hWnd, hr)
, m_fUseInternalTimer(false)
{
- if(FAILED(hr)) {
+ if (FAILED(hr)) {
return;
}
- if(FAILED(hr = m_pSA.CoCreateInstance(CLSID_AllocPresenter))) {
+ if (FAILED(hr = m_pSA.CoCreateInstance(CLSID_AllocPresenter))) {
hr = E_FAIL;
return;
}
@@ -66,13 +66,13 @@ STDMETHODIMP CVMR7AllocatorPresenter::NonDelegatingQueryInterface(REFIID riid, v HRESULT CVMR7AllocatorPresenter::CreateDevice()
{
HRESULT hr = __super::CreateDevice();
- if(FAILED(hr)) {
+ if (FAILED(hr)) {
return hr;
}
- if(m_pIVMRSurfAllocNotify) {
+ if (m_pIVMRSurfAllocNotify) {
HMONITOR hMonitor = MonitorFromWindow(m_hWnd, MONITOR_DEFAULTTONEAREST);
- if(FAILED(hr = m_pIVMRSurfAllocNotify->ChangeDDrawDevice(m_pDD, hMonitor))) {
+ if (FAILED(hr = m_pIVMRSurfAllocNotify->ChangeDDrawDevice(m_pDD, hMonitor))) {
return hr; //return false;
}
}
@@ -102,25 +102,25 @@ STDMETHODIMP CVMR7AllocatorPresenter::CreateRenderer(IUnknown** ppRenderer) do {
CComPtr<IBaseFilter> pBF;
- if(FAILED(hr = pBF.CoCreateInstance(CLSID_VideoMixingRenderer))) {
+ if (FAILED(hr = pBF.CoCreateInstance(CLSID_VideoMixingRenderer))) {
break;
}
CComQIPtr<IVMRFilterConfig> pConfig = pBF;
- if(!pConfig) {
+ if (!pConfig) {
break;
}
- if(FAILED(hr = pConfig->SetRenderingMode(VMRMode_Renderless))) {
+ if (FAILED(hr = pConfig->SetRenderingMode(VMRMode_Renderless))) {
break;
}
CComQIPtr<IVMRSurfaceAllocatorNotify> pSAN = pBF;
- if(!pSAN) {
+ if (!pSAN) {
break;
}
- if(FAILED(hr = pSAN->AdviseSurfaceAllocator(MY_USER_ID, static_cast<IVMRSurfaceAllocator*>(this)))
+ if (FAILED(hr = pSAN->AdviseSurfaceAllocator(MY_USER_ID, static_cast<IVMRSurfaceAllocator*>(this)))
|| FAILED(hr = AdviseNotify(pSAN))) {
break;
}
@@ -132,7 +132,7 @@ STDMETHODIMP CVMR7AllocatorPresenter::CreateRenderer(IUnknown** ppRenderer) *ppRenderer = (IUnknown*)pBF.Detach();
return S_OK;
- } while(0);
+ } while (0);
return E_FAIL;
}
@@ -147,11 +147,11 @@ STDMETHODIMP_(void) CVMR7AllocatorPresenter::SetTime(REFERENCE_TIME rtNow) STDMETHODIMP CVMR7AllocatorPresenter::AllocateSurface(DWORD_PTR dwUserID, VMRALLOCATIONINFO* lpAllocInfo, DWORD* lpdwBuffer, LPDIRECTDRAWSURFACE7* lplpSurface)
{
- if(!lpAllocInfo || !lpdwBuffer || !lplpSurface) {
+ if (!lpAllocInfo || !lpdwBuffer || !lplpSurface) {
return E_POINTER;
}
- if(!m_pIVMRSurfAllocNotify) {
+ if (!m_pIVMRSurfAllocNotify) {
return E_FAIL;
}
@@ -164,28 +164,28 @@ STDMETHODIMP CVMR7AllocatorPresenter::AllocateSurface(DWORD_PTR dwUserID, VMRALL // then that might stall for about 30 seconds because of some unknown buggy code
// behind <ddraw surface>->Release()
- if(lpAllocInfo->lpHdr->biBitCount < 16) {
+ if (lpAllocInfo->lpHdr->biBitCount < 16) {
return E_FAIL;
}
hr = m_pSA->AllocateSurface(dwUserID, lpAllocInfo, lpdwBuffer, lplpSurface);
- if(FAILED(hr)) {
+ if (FAILED(hr)) {
return hr;
}
m_NativeVideoSize = CSize(abs(lpAllocInfo->lpHdr->biWidth), abs(lpAllocInfo->lpHdr->biHeight));
m_AspectRatio = m_NativeVideoSize;
int arx = lpAllocInfo->szAspectRatio.cx, ary = lpAllocInfo->szAspectRatio.cy;
- if(arx > 0 && ary > 0) {
+ if (arx > 0 && ary > 0) {
m_AspectRatio.SetSize(arx, ary);
}
- if(FAILED(hr = AllocSurfaces())) {
+ if (FAILED(hr = AllocSurfaces())) {
return hr;
}
// test if the colorspace is acceptable
- if(FAILED(hr = m_pVideoSurface->Blt(NULL, *lplpSurface, NULL, DDBLT_WAIT, NULL))) {
+ if (FAILED(hr = m_pVideoSurface->Blt(NULL, *lplpSurface, NULL, DDBLT_WAIT, NULL))) {
DeleteSurfaces();
return hr;
}
@@ -208,7 +208,7 @@ STDMETHODIMP CVMR7AllocatorPresenter::PrepareSurface(DWORD_PTR dwUserID, IDirect {
SetThreadName((DWORD)-1, "CVMR7AllocatorPresenter");
- if(!lpSurface) {
+ if (!lpSurface) {
return E_POINTER;
}
@@ -229,7 +229,7 @@ STDMETHODIMP CVMR7AllocatorPresenter::AdviseNotify(IVMRSurfaceAllocatorNotify* l HRESULT hr;
HMONITOR hMonitor = MonitorFromWindow(m_hWnd, MONITOR_DEFAULTTONEAREST);
- if(FAILED(hr = m_pIVMRSurfAllocNotify->SetDDrawDevice(m_pDD, hMonitor))) {
+ if (FAILED(hr = m_pIVMRSurfAllocNotify->SetDDrawDevice(m_pDD, hMonitor))) {
return hr;
}
@@ -256,7 +256,7 @@ STDMETHODIMP CVMR7AllocatorPresenter::StopPresenting(DWORD_PTR dwUserID) STDMETHODIMP CVMR7AllocatorPresenter::PresentImage(DWORD_PTR dwUserID, VMRPRESENTATIONINFO* lpPresInfo)
{
- if(!lpPresInfo || !lpPresInfo->lpSurf) {
+ if (!lpPresInfo || !lpPresInfo->lpSurf) {
return E_POINTER;
}
@@ -266,14 +266,14 @@ STDMETHODIMP CVMR7AllocatorPresenter::PresentImage(DWORD_PTR dwUserID, VMRPRESEN m_pVideoSurface->Blt(NULL, lpPresInfo->lpSurf, NULL, DDBLT_WAIT, NULL);
}
- if(lpPresInfo->rtEnd > lpPresInfo->rtStart) {
+ if (lpPresInfo->rtEnd > lpPresInfo->rtStart) {
REFERENCE_TIME rtTimePerFrame = lpPresInfo->rtEnd - lpPresInfo->rtStart;
m_fps = 10000000.0 / rtTimePerFrame;
- if(m_pSubPicQueue) {
+ if (m_pSubPicQueue) {
m_pSubPicQueue->SetFPS(m_fps);
- if(m_fUseInternalTimer && !g_bExternalSubtitleTime) {
+ if (m_fUseInternalTimer && !g_bExternalSubtitleTime) {
__super::SetTime(g_tSegmentStart + g_tSampleStart);
}
}
@@ -281,10 +281,10 @@ STDMETHODIMP CVMR7AllocatorPresenter::PresentImage(DWORD_PTR dwUserID, VMRPRESEN CSize VideoSize = m_NativeVideoSize;
int arx = lpPresInfo->szAspectRatio.cx, ary = lpPresInfo->szAspectRatio.cy;
- if(arx > 0 && ary > 0) {
+ if (arx > 0 && ary > 0) {
VideoSize.cx = VideoSize.cy*arx/ary;
}
- if(VideoSize != GetVideoSize()) {
+ if (VideoSize != GetVideoSize()) {
m_AspectRatio.SetSize(arx, ary);
AfxGetApp()->m_pMainWnd->PostMessage(WM_REARRANGERENDERLESS);
}
@@ -305,16 +305,16 @@ STDMETHODIMP CVMR7AllocatorPresenter::GetNativeVideoSize(LONG* lpWidth, LONG* lp CSize vs = m_NativeVideoSize, ar = m_AspectRatio;
// DVD Nav. bug workaround fix
vs.cx = vs.cy * ar.cx / ar.cy;
- if(lpWidth) {
+ if (lpWidth) {
*lpWidth = vs.cx;
}
- if(lpHeight) {
+ if (lpHeight) {
*lpHeight = vs.cy;
}
- if(lpARWidth) {
+ if (lpARWidth) {
*lpARWidth = ar.cx;
}
- if(lpARHeight) {
+ if (lpARHeight) {
*lpARHeight = ar.cy;
}
return S_OK;
@@ -346,7 +346,7 @@ STDMETHODIMP CVMR7AllocatorPresenter::GetVideoPosition(LPRECT lpSRCRect, LPRECT STDMETHODIMP CVMR7AllocatorPresenter::GetAspectRatioMode(DWORD* lpAspectRatioMode)
{
- if(lpAspectRatioMode) {
+ if (lpAspectRatioMode) {
*lpAspectRatioMode = AM_ARMODE_STRETCHED;
}
return S_OK;
@@ -384,7 +384,7 @@ STDMETHODIMP CVMR7AllocatorPresenter::SetBorderColor(COLORREF Clr) STDMETHODIMP CVMR7AllocatorPresenter::GetBorderColor(COLORREF* lpClr)
{
- if(lpClr) {
+ if (lpClr) {
*lpClr = 0;
}
return S_OK;
diff --git a/src/filters/renderer/VideoRenderers/VMR9AllocatorPresenter.cpp b/src/filters/renderer/VideoRenderers/VMR9AllocatorPresenter.cpp index bbb99e9f2..0a5e1c7c4 100644 --- a/src/filters/renderer/VideoRenderers/VMR9AllocatorPresenter.cpp +++ b/src/filters/renderer/VideoRenderers/VMR9AllocatorPresenter.cpp @@ -58,13 +58,13 @@ STDMETHODIMP CVMR9AllocatorPresenter::NonDelegatingQueryInterface(REFIID riid, v HRESULT CVMR9AllocatorPresenter::CreateDevice(CString &_Error)
{
HRESULT hr = __super::CreateDevice(_Error);
- if(FAILED(hr)) {
+ if (FAILED(hr)) {
return hr;
}
- if(m_pIVMRSurfAllocNotify) {
+ if (m_pIVMRSurfAllocNotify) {
HMONITOR hMonitor = m_pD3D->GetAdapterMonitor(m_CurrentAdapter);
- if(FAILED(hr = m_pIVMRSurfAllocNotify->ChangeD3DDevice(m_pD3DDev, hMonitor))) {
+ if (FAILED(hr = m_pIVMRSurfAllocNotify->ChangeD3DDevice(m_pD3DDev, hMonitor))) {
_Error += L"m_pIVMRSurfAllocNotify->ChangeD3DDevice failed";
return hr; //return false;
}
@@ -105,30 +105,30 @@ STDMETHODIMP CVMR9AllocatorPresenter::CreateRenderer(IUnknown** ppRenderer) CComQIPtr<IMemInputPin> pMemInputPin = pPin;
m_fUseInternalTimer = HookNewSegmentAndReceive((IPinC*)(IPin*)pPin, (IMemInputPinC*)(IMemInputPin*)pMemInputPin);
- if(CComQIPtr<IAMVideoAccelerator> pAMVA = pPin) {
+ if (CComQIPtr<IAMVideoAccelerator> pAMVA = pPin) {
HookAMVideoAccelerator((IAMVideoAcceleratorC*)(IAMVideoAccelerator*)pAMVA);
}
CComQIPtr<IVMRFilterConfig9> pConfig = pBF;
- if(!pConfig) {
+ if (!pConfig) {
break;
}
CRenderersSettings& s = GetRenderersSettings();
- if(s.fVMR9MixerMode) {
- if(FAILED(hr = pConfig->SetNumberOfStreams(1))) {
+ if (s.fVMR9MixerMode) {
+ if (FAILED(hr = pConfig->SetNumberOfStreams(1))) {
break;
}
- if(CComQIPtr<IVMRMixerControl9> pMC = pBF) {
+ if (CComQIPtr<IVMRMixerControl9> pMC = pBF) {
DWORD dwPrefs;
pMC->GetMixingPrefs(&dwPrefs);
// See http://msdn.microsoft.com/en-us/library/dd390928(VS.85).aspx
dwPrefs |= MixerPref9_NonSquareMixing;
dwPrefs |= MixerPref9_NoDecimation;
- if(s.fVMR9MixerYUV && !IsVistaOrAbove()) {
+ if (s.fVMR9MixerYUV && !IsVistaOrAbove()) {
dwPrefs &= ~MixerPref9_RenderTargetMask;
dwPrefs |= MixerPref9_RenderTargetYUV;
}
@@ -136,16 +136,16 @@ STDMETHODIMP CVMR9AllocatorPresenter::CreateRenderer(IUnknown** ppRenderer) }
}
- if(FAILED(hr = pConfig->SetRenderingMode(VMR9Mode_Renderless))) {
+ if (FAILED(hr = pConfig->SetRenderingMode(VMR9Mode_Renderless))) {
break;
}
CComQIPtr<IVMRSurfaceAllocatorNotify9> pSAN = pBF;
- if(!pSAN) {
+ if (!pSAN) {
break;
}
- if(FAILED(hr = pSAN->AdviseSurfaceAllocator(MY_USER_ID, static_cast<IVMRSurfaceAllocator9*>(this)))
+ if (FAILED(hr = pSAN->AdviseSurfaceAllocator(MY_USER_ID, static_cast<IVMRSurfaceAllocator9*>(this)))
|| FAILED(hr = AdviseNotify(pSAN))) {
break;
}
@@ -153,7 +153,7 @@ STDMETHODIMP CVMR9AllocatorPresenter::CreateRenderer(IUnknown** ppRenderer) *ppRenderer = (IUnknown*)pBF.Detach();
return S_OK;
- } while(0);
+ } while (0);
return E_FAIL;
}
@@ -171,17 +171,17 @@ STDMETHODIMP CVMR9AllocatorPresenter::InitializeDevice(DWORD_PTR dwUserID, VMR9A CAutoLock lock(this);
CAutoLock cRenderLock(&m_RenderLock);
- if(!lpAllocInfo || !lpNumBuffers) {
+ if (!lpAllocInfo || !lpNumBuffers) {
return E_POINTER;
}
- if(!m_pIVMRSurfAllocNotify) {
+ if (!m_pIVMRSurfAllocNotify) {
return E_FAIL;
}
// WTF: Is this some kind of forgotten debug code ?
- if((GetAsyncKeyState(VK_CONTROL)&0x80000000))
- if(lpAllocInfo->Format == '21VY' || lpAllocInfo->Format == '024I') {
+ if ((GetAsyncKeyState(VK_CONTROL)&0x80000000))
+ if (lpAllocInfo->Format == '21VY' || lpAllocInfo->Format == '024I') {
return E_FAIL;
}
@@ -203,12 +203,12 @@ STDMETHODIMP CVMR9AllocatorPresenter::InitializeDevice(DWORD_PTR dwUserID, VMR9A HRESULT hr;
- if(lpAllocInfo->dwFlags & VMR9AllocFlag_3DRenderTarget) {
+ if (lpAllocInfo->dwFlags & VMR9AllocFlag_3DRenderTarget) {
lpAllocInfo->dwFlags |= VMR9AllocFlag_TextureSurface;
}
hr = m_pIVMRSurfAllocNotify->AllocateSurfaceHelper(lpAllocInfo, lpNumBuffers, &m_pSurfaces[0]);
- if(FAILED(hr)) {
+ if (FAILED(hr)) {
return hr;
}
@@ -219,7 +219,7 @@ STDMETHODIMP CVMR9AllocatorPresenter::InitializeDevice(DWORD_PTR dwUserID, VMR9A CSize VideoSize = GetVisibleVideoSize();
int arx = lpAllocInfo->szAspectRatio.cx;
int ary = lpAllocInfo->szAspectRatio.cy;
- if(arx > 0 && ary > 0) {
+ if (arx > 0 && ary > 0) {
arx = arx / ((float) m_NativeVideoSize.cx / VideoSize.cx);
ary = ary / ((float) m_NativeVideoSize.cy / VideoSize.cy);
m_AspectRatio.SetSize(arx, ary);
@@ -227,13 +227,13 @@ STDMETHODIMP CVMR9AllocatorPresenter::InitializeDevice(DWORD_PTR dwUserID, VMR9A m_AspectRatio = VideoSize;
}
- if(FAILED(hr = AllocSurfaces())) {
+ if (FAILED(hr = AllocSurfaces())) {
return hr;
}
- if(!(lpAllocInfo->dwFlags & VMR9AllocFlag_TextureSurface)) {
+ if (!(lpAllocInfo->dwFlags & VMR9AllocFlag_TextureSurface)) {
// test if the colorspace is acceptable
- if(FAILED(hr = m_pD3DDev->StretchRect(m_pSurfaces[0], NULL, m_pVideoSurface[m_nCurSurface], NULL, D3DTEXF_NONE))) {
+ if (FAILED(hr = m_pD3DDev->StretchRect(m_pSurfaces[0], NULL, m_pVideoSurface[m_nCurSurface], NULL, D3DTEXF_NONE))) {
DeleteSurfaces();
return E_FAIL;
}
@@ -260,7 +260,7 @@ STDMETHODIMP CVMR9AllocatorPresenter::TerminateDevice(DWORD_PTR dwUserID) STDMETHODIMP CVMR9AllocatorPresenter::GetSurface(DWORD_PTR dwUserID, DWORD SurfaceIndex, DWORD SurfaceFlags, IDirect3DSurface9** lplpSurface)
{
- if(!lplpSurface) {
+ if (!lplpSurface) {
return E_POINTER;
}
@@ -271,7 +271,7 @@ STDMETHODIMP CVMR9AllocatorPresenter::GetSurface(DWORD_PTR dwUserID, DWORD Surfa SurfaceIndex = 0
m_pSurfaces.GetCount() = 0
- Scenario:
+ Scenario:
Thread 1:
Wait on m_RenderLock in this function
Thread 2:
@@ -279,15 +279,15 @@ STDMETHODIMP CVMR9AllocatorPresenter::GetSurface(DWORD_PTR dwUserID, DWORD Surfa (Happens by calling ex CDX9AllocatorPresenter::ResetDevice)
When thread 2 releases the lock thread 1 gets it and boom!
-
+
Possible solution: Adding object lock and moving m_RenderLock to try to fix this threading issue.
This problem occurs when moving the window from display a to display b.
-
+
NOTE: This is just a workaround.
CDX9AllocatorPresenter doesn't follow the rules which is why this happened.
And it is used by EVR custom (which it really shouldn't) so i can't easily fix it without breaking EVR custom.
*/
- if(SurfaceIndex >= m_pSurfaces.GetCount()) {
+ if (SurfaceIndex >= m_pSurfaces.GetCount()) {
return E_FAIL;
}
@@ -314,7 +314,7 @@ STDMETHODIMP CVMR9AllocatorPresenter::AdviseNotify(IVMRSurfaceAllocatorNotify9* HRESULT hr;
HMONITOR hMonitor = m_pD3D->GetAdapterMonitor(GetAdapter(m_pD3D));
- if(FAILED(hr = m_pIVMRSurfAllocNotify->SetD3DDevice(m_pD3DDev, hMonitor))) {
+ if (FAILED(hr = m_pIVMRSurfAllocNotify->SetD3DDevice(m_pD3DDev, hMonitor))) {
return hr;
}
@@ -409,18 +409,18 @@ STDMETHODIMP CVMR9AllocatorPresenter::PresentImage(DWORD_PTR dwUserID, VMR9Prese HRESULT hr;
- if(!lpPresInfo || !lpPresInfo->lpSurf) {
+ if (!lpPresInfo || !lpPresInfo->lpSurf) {
return E_POINTER;
}
CAutoLock cAutoLock(this);
CAutoLock cRenderLock(&m_RenderLock);
- if(lpPresInfo->rtEnd > lpPresInfo->rtStart) {
- if(m_pSubPicQueue) {
+ if (lpPresInfo->rtEnd > lpPresInfo->rtStart) {
+ if (m_pSubPicQueue) {
m_pSubPicQueue->SetFPS(m_fps);
- if(m_fUseInternalTimer && !g_bExternalSubtitleTime) {
+ if (m_fUseInternalTimer && !g_bExternalSubtitleTime) {
__super::SetTime(g_tSegmentStart + g_tSampleStart);
}
}
@@ -429,12 +429,12 @@ STDMETHODIMP CVMR9AllocatorPresenter::PresentImage(DWORD_PTR dwUserID, VMR9Prese CSize VideoSize = GetVisibleVideoSize();
int arx = lpPresInfo->szAspectRatio.cx;
int ary = lpPresInfo->szAspectRatio.cy;
- if(arx > 0 && ary > 0) {
+ if (arx > 0 && ary > 0) {
arx = arx / ((float) m_NativeVideoSize.cx / VideoSize.cx);
ary = ary / ((float) m_NativeVideoSize.cy / VideoSize.cy);
VideoSize.cx = VideoSize.cy*arx/ary;
}
- if(VideoSize != GetVideoSize()) {
+ if (VideoSize != GetVideoSize()) {
m_AspectRatio.SetSize(arx, ary);
AfxGetApp()->m_pMainWnd->PostMessage(WM_REARRANGERENDERLESS);
}
@@ -443,9 +443,9 @@ STDMETHODIMP CVMR9AllocatorPresenter::PresentImage(DWORD_PTR dwUserID, VMR9Prese CComPtr<IDirect3DTexture9> pTexture;
lpPresInfo->lpSurf->GetContainer(IID_IDirect3DTexture9, (void**)&pTexture);
- if(pTexture) {
+ if (pTexture) {
m_pVideoSurface[m_nCurSurface] = lpPresInfo->lpSurf;
- if(m_pVideoTexture[m_nCurSurface]) {
+ if (m_pVideoTexture[m_nCurSurface]) {
m_pVideoTexture[m_nCurSurface] = pTexture;
}
} else {
@@ -483,16 +483,16 @@ STDMETHODIMP CVMR9AllocatorPresenter::PresentImage(DWORD_PTR dwUserID, VMR9Prese STDMETHODIMP CVMR9AllocatorPresenter::GetNativeVideoSize(LONG* lpWidth, LONG* lpHeight, LONG* lpARWidth, LONG* lpARHeight)
{
- if(lpWidth) {
+ if (lpWidth) {
*lpWidth = m_NativeVideoSize.cx;
}
- if(lpHeight) {
+ if (lpHeight) {
*lpHeight = m_NativeVideoSize.cy;
}
- if(lpARWidth) {
+ if (lpARWidth) {
*lpARWidth = m_AspectRatio.cx;
}
- if(lpARHeight) {
+ if (lpARHeight) {
*lpARHeight = m_AspectRatio.cy;
}
return S_OK;
@@ -522,7 +522,7 @@ STDMETHODIMP CVMR9AllocatorPresenter::GetVideoPosition(LPRECT lpSRCRect, LPRECT STDMETHODIMP CVMR9AllocatorPresenter::GetAspectRatioMode(DWORD* lpAspectRatioMode)
{
- if(lpAspectRatioMode) {
+ if (lpAspectRatioMode) {
*lpAspectRatioMode = AM_ARMODE_STRETCHED;
}
return S_OK;
@@ -560,7 +560,7 @@ STDMETHODIMP CVMR9AllocatorPresenter::SetBorderColor(COLORREF Clr) STDMETHODIMP CVMR9AllocatorPresenter::GetBorderColor(COLORREF* lpClr)
{
- if(lpClr) {
+ if (lpClr) {
*lpClr = 0;
}
return S_OK;
diff --git a/src/filters/renderer/VideoRenderers/madVRAllocatorPresenter.cpp b/src/filters/renderer/VideoRenderers/madVRAllocatorPresenter.cpp index 965289318..68b85bc75 100644 --- a/src/filters/renderer/VideoRenderers/madVRAllocatorPresenter.cpp +++ b/src/filters/renderer/VideoRenderers/madVRAllocatorPresenter.cpp @@ -33,8 +33,8 @@ using namespace DSObjects; interface __declspec(uuid("D6EE8031-214E-4E9E-A3A7-458925F933AB"))
IMadVRExclusiveModeInfo :
public IUnknown {
- STDMETHOD_(BOOL, IsExclusiveModeActive)(void) = 0;
- STDMETHOD_(BOOL, IsMadVRSeekbarEnabled)(void) = 0;
+ STDMETHOD_(BOOL, IsExclusiveModeActive)(void) = 0;
+ STDMETHOD_(BOOL, IsMadVRSeekbarEnabled)(void) = 0;
};
@@ -46,7 +46,7 @@ CmadVRAllocatorPresenter::CmadVRAllocatorPresenter(HWND hWnd, HRESULT& hr, CStri : CSubPicAllocatorPresenterImpl(hWnd, hr, &_Error)
, m_ScreenSize(0, 0)
{
- if(FAILED(hr)) {
+ if (FAILED(hr)) {
_Error += L"ISubPicAllocatorPresenterImpl failed\n";
return;
}
@@ -56,7 +56,7 @@ CmadVRAllocatorPresenter::CmadVRAllocatorPresenter(HWND hWnd, HRESULT& hr, CStri CmadVRAllocatorPresenter::~CmadVRAllocatorPresenter()
{
- if(m_pSRCB) {
+ if (m_pSRCB) {
// nasty, but we have to let it know about our death somehow
((CSubRenderCallback*)(ISubRenderCallback2*)m_pSRCB)->SetDXRAP(NULL);
}
@@ -82,8 +82,8 @@ STDMETHODIMP CmadVRAllocatorPresenter::NonDelegatingQueryInterface(REFIID riid, return GetInterface((IVMRWindowlessControl*)this, ppv);
*/
- if(riid != IID_IUnknown && m_pDXR) {
- if(SUCCEEDED(m_pDXR->QueryInterface(riid, ppv))) {
+ if (riid != IID_IUnknown && m_pDXR) {
+ if (SUCCEEDED(m_pDXR->QueryInterface(riid, ppv))) {
return S_OK;
}
}
@@ -102,7 +102,7 @@ HRESULT CmadVRAllocatorPresenter::SetDevice(IDirect3DDevice9* pD3DDev) }
CSize size;
- switch(GetRenderersSettings().nSPCMaxRes) {
+ switch (GetRenderersSettings().nSPCMaxRes) {
case 0:
default:
size = m_ScreenSize;
@@ -136,11 +136,11 @@ HRESULT CmadVRAllocatorPresenter::SetDevice(IDirect3DDevice9* pD3DDev) break;
}
- if(m_pAllocator) {
+ if (m_pAllocator) {
m_pAllocator->ChangeDevice(pD3DDev);
} else {
m_pAllocator = DNew CDX9SubPicAllocator(pD3DDev, size, GetRenderersSettings().fSPCPow2Tex, true);
- if(!m_pAllocator) {
+ if (!m_pAllocator) {
return E_FAIL;
}
}
@@ -150,11 +150,11 @@ HRESULT CmadVRAllocatorPresenter::SetDevice(IDirect3DDevice9* pD3DDev) m_pSubPicQueue = GetRenderersSettings().nSPCSize > 0
? (ISubPicQueue*)DNew CSubPicQueue(GetRenderersSettings().nSPCSize, !GetRenderersSettings().fSPCAllowAnimationWhenBuffering, m_pAllocator, &hr)
: (ISubPicQueue*)DNew CSubPicQueueNoThread(m_pAllocator, &hr);
- if(!m_pSubPicQueue || FAILED(hr)) {
+ if (!m_pSubPicQueue || FAILED(hr)) {
return E_FAIL;
}
- if(m_SubPicProvider) {
+ if (m_SubPicProvider) {
m_pSubPicQueue->SetSubPicProvider(m_SubPicProvider);
}
@@ -167,7 +167,7 @@ HRESULT CmadVRAllocatorPresenter::Render( {
__super::SetPosition(CRect(0, 0, width, height), CRect(left, top, right, bottom)); // needed? should be already set by the player
SetTime(rtStart);
- if(atpf > 0 && m_pSubPicQueue) {
+ if (atpf > 0 && m_pSubPicQueue) {
m_fps = (double)(10000000.0 / atpf);
m_pSubPicQueue->SetFPS(m_fps);
}
@@ -181,22 +181,22 @@ STDMETHODIMP CmadVRAllocatorPresenter::CreateRenderer(IUnknown** ppRenderer) {
CheckPointer(ppRenderer, E_POINTER);
- if(m_pDXR) {
+ if (m_pDXR) {
return E_UNEXPECTED;
}
m_pDXR.CoCreateInstance(CLSID_madVR, GetOwner());
- if(!m_pDXR) {
+ if (!m_pDXR) {
return E_FAIL;
}
CComQIPtr<ISubRender> pSR = m_pDXR;
- if(!pSR) {
+ if (!pSR) {
m_pDXR = NULL;
return E_FAIL;
}
m_pSRCB = DNew CSubRenderCallback(this);
- if(FAILED(pSR->SetCallback(m_pSRCB))) {
+ if (FAILED(pSR->SetCallback(m_pSRCB))) {
m_pDXR = NULL;
return E_FAIL;
}
@@ -214,12 +214,12 @@ STDMETHODIMP CmadVRAllocatorPresenter::CreateRenderer(IUnknown** ppRenderer) STDMETHODIMP_(void) CmadVRAllocatorPresenter::SetPosition(RECT w, RECT v)
{
- if(CComQIPtr<IBasicVideo> pBV = m_pDXR) {
+ if (CComQIPtr<IBasicVideo> pBV = m_pDXR) {
pBV->SetDefaultSourcePosition();
pBV->SetDestinationPosition(v.left, v.top, v.right - v.left, v.bottom - v.top);
}
- if(CComQIPtr<IVideoWindow> pVW = m_pDXR) {
+ if (CComQIPtr<IVideoWindow> pVW = m_pDXR) {
pVW->SetWindowPosition(w.left, w.top, w.right - w.left, w.bottom - w.top);
}
}
@@ -228,12 +228,12 @@ STDMETHODIMP_(SIZE) CmadVRAllocatorPresenter::GetVideoSize(bool fCorrectAR) {
SIZE size = {0, 0};
- if(!fCorrectAR) {
- if(CComQIPtr<IBasicVideo> pBV = m_pDXR) {
+ if (!fCorrectAR) {
+ if (CComQIPtr<IBasicVideo> pBV = m_pDXR) {
pBV->GetVideoSize(&size.cx, &size.cy);
}
} else {
- if(CComQIPtr<IBasicVideo2> pBV2 = m_pDXR) {
+ if (CComQIPtr<IBasicVideo2> pBV2 = m_pDXR) {
pBV2->GetPreferredAspectRatio(&size.cx, &size.cy);
}
}
@@ -249,7 +249,7 @@ STDMETHODIMP_(bool) CmadVRAllocatorPresenter::Paint(bool fAll) STDMETHODIMP CmadVRAllocatorPresenter::GetDIB(BYTE* lpDib, DWORD* size)
{
HRESULT hr = E_NOTIMPL;
- if(CComQIPtr<IBasicVideo> pBV = m_pDXR) {
+ if (CComQIPtr<IBasicVideo> pBV = m_pDXR) {
hr = pBV->GetCurrentImage((long*)size, (long*)lpDib);
}
return hr;
diff --git a/src/filters/renderer/VideoRenderers/madVRAllocatorPresenter.h b/src/filters/renderer/VideoRenderers/madVRAllocatorPresenter.h index eb7fe682a..3d28452a3 100644 --- a/src/filters/renderer/VideoRenderers/madVRAllocatorPresenter.h +++ b/src/filters/renderer/VideoRenderers/madVRAllocatorPresenter.h @@ -29,8 +29,8 @@ interface __declspec(uuid("ABA34FDA-DD22-4E00-9AB4-4ABF927D0B0C"))
IMadVRTextOsd :
public IUnknown {
- STDMETHOD(OsdDisplayMessage)(LPCWSTR text, DWORD milliseconds) = 0;
- STDMETHOD(OsdClearMessage)(void) = 0;
+ STDMETHOD(OsdDisplayMessage)(LPCWSTR text, DWORD milliseconds) = 0;
+ STDMETHOD(OsdClearMessage)(void) = 0;
};
namespace DSObjects
|