modify render for display diff resolution

This commit is contained in:
huili2 2014-06-12 22:23:40 -07:00
parent 91cd93e5d0
commit 1b68890e1e

View File

@ -75,7 +75,8 @@ CD3D9Utils::CD3D9Utils() {
m_lpD3D9 = NULL;
m_lpD3D9Device = NULL;
m_lpD3D9RawSurfaceShare = NULL;
m_nWidth = 0;
m_nHeight = 0;
// coverity scan uninitial
ZeroMemory (&m_d3dpp, sizeof (m_d3dpp));
}
@ -147,6 +148,16 @@ HRESULT CD3D9Utils::Process (void* pDst[3], SBufferInfo* pInfo, FILE* pFp) {
HRESULT CD3D9Utils::Render (void* pDst[3], SBufferInfo* pInfo) {
HRESULT hResult = E_FAIL;
if (!pInfo)
return E_FAIL;
if (m_nWidth != pInfo->UsrData.sSystemBuffer.iWidth
|| m_nHeight != pInfo->UsrData.sSystemBuffer.iHeight) {
m_nWidth = pInfo->UsrData.sSystemBuffer.iWidth;
m_nHeight = pInfo->UsrData.sSystemBuffer.iHeight;
SAFE_RELEASE (m_lpD3D9RawSurfaceShare);
SAFE_RELEASE (m_lpD3D9Device);
}
hResult = InitResource (NULL, pInfo);
if (SUCCEEDED (hResult))
hResult = Dump2Surface (pDst, m_lpD3D9RawSurfaceShare, pInfo->UsrData.sSystemBuffer.iWidth,
@ -245,6 +256,8 @@ CD3D9ExUtils::CD3D9ExUtils() {
m_lpD3D9Device = NULL;
m_lpD3D9RawSurfaceShare = NULL;
m_nWidth = 0;
m_nHeight = 0;
// coverity scan uninitial
ZeroMemory (&m_d3dpp, sizeof (m_d3dpp));
}
@ -316,6 +329,16 @@ HRESULT CD3D9ExUtils::Process (void* pDst[3], SBufferInfo* pInfo, FILE* pFp) {
HRESULT CD3D9ExUtils::Render (void* pDst[3], SBufferInfo* pInfo) {
HRESULT hResult = E_FAIL;
if (!pInfo)
return E_FAIL;
if (m_nWidth != pInfo->UsrData.sSystemBuffer.iWidth
|| m_nHeight != pInfo->UsrData.sSystemBuffer.iHeight) {
m_nWidth = pInfo->UsrData.sSystemBuffer.iWidth;
m_nHeight = pInfo->UsrData.sSystemBuffer.iHeight;
SAFE_RELEASE (m_lpD3D9RawSurfaceShare);
SAFE_RELEASE (m_lpD3D9Device);
}
hResult = InitResource (NULL, pInfo);
if (SUCCEEDED (hResult))
hResult = Dump2Surface (pDst, m_lpD3D9RawSurfaceShare, pInfo->UsrData.sSystemBuffer.iWidth,
@ -386,6 +409,9 @@ HRESULT CD3D9ExUtils::InitResource (void* pSharedHandle, SBufferInfo* pInfo) {
m_d3dpp.hDeviceWindow = m_hWnd;
m_d3dpp.PresentationInterval = D3DPRESENT_INTERVAL_IMMEDIATE;
hResult = m_lpD3D9->CreateDeviceEx (uiAdapter, D3DDevType, NULL, dwBehaviorFlags, &m_d3dpp, NULL, &m_lpD3D9Device);
if (FAILED (hResult)) {
return hResult;
}
iWidth = pInfo->UsrData.sSystemBuffer.iWidth;
iHeight = pInfo->UsrData.sSystemBuffer.iHeight;
D3Dformat = (D3DFORMAT)NV12_FORMAT;