diff options
author | XhmikosR <xhmikosr@users.sourceforge.net> | 2010-12-17 19:42:55 +0300 |
---|---|---|
committer | XhmikosR <xhmikosr@users.sourceforge.net> | 2010-12-17 19:42:55 +0300 |
commit | 7359bd509afa235acc2ac2f7f95fc9cb5cafd1a4 (patch) | |
tree | b5bb90eeca58fdeb9fde6825f21a25a319823cb4 /src/SubPic/DX7SubPic.cpp | |
parent | d30b15ed4b98c28951d6d45b8928f4c2b6a11129 (diff) |
apply astyle formatting
git-svn-id: https://mpc-hc.svn.sourceforge.net/svnroot/mpc-hc/trunk@2786 10f7b99b-c216-0410-bff0-8a66a9350fd8
Diffstat (limited to 'src/SubPic/DX7SubPic.cpp')
-rw-r--r-- | src/SubPic/DX7SubPic.cpp | 84 |
1 files changed, 46 insertions, 38 deletions
diff --git a/src/SubPic/DX7SubPic.cpp b/src/SubPic/DX7SubPic.cpp index 976510f37..3296c53d3 100644 --- a/src/SubPic/DX7SubPic.cpp +++ b/src/SubPic/DX7SubPic.cpp @@ -36,8 +36,7 @@ CDX7SubPic::CDX7SubPic(IDirect3DDevice7* pD3DDev, IDirectDrawSurface7* pSurface) {
DDSURFACEDESC2 ddsd;
INITDDSTRUCT(ddsd);
- if(SUCCEEDED(m_pSurface->GetSurfaceDesc(&ddsd)))
- {
+ if(SUCCEEDED(m_pSurface->GetSurfaceDesc(&ddsd))) {
m_maxsize.SetSize(ddsd.dwWidth, ddsd.dwHeight);
m_rcDirty.SetRect(0, 0, ddsd.dwWidth, ddsd.dwHeight);
}
@@ -54,8 +53,9 @@ STDMETHODIMP CDX7SubPic::GetDesc(SubPicDesc& spd) {
DDSURFACEDESC2 ddsd;
INITDDSTRUCT(ddsd);
- if(FAILED(m_pSurface->GetSurfaceDesc(&ddsd)))
+ if(FAILED(m_pSurface->GetSurfaceDesc(&ddsd))) {
return E_FAIL;
+ }
spd.type = 0;
spd.w = m_size.cx;
@@ -71,8 +71,9 @@ STDMETHODIMP CDX7SubPic::GetDesc(SubPicDesc& spd) STDMETHODIMP CDX7SubPic::CopyTo(ISubPic* pSubPic)
{
HRESULT hr;
- if(FAILED(hr = __super::CopyTo(pSubPic)))
+ if(FAILED(hr = __super::CopyTo(pSubPic))) {
return hr;
+ }
CPoint p = m_rcDirty.TopLeft();
hr = m_pD3DDev->Load((IDirectDrawSurface7*)pSubPic->GetObject(), &p, (IDirectDrawSurface7*)GetObject(), m_rcDirty, 0);
@@ -82,8 +83,9 @@ STDMETHODIMP CDX7SubPic::CopyTo(ISubPic* pSubPic) STDMETHODIMP CDX7SubPic::ClearDirtyRect(DWORD color)
{
- if(m_rcDirty.IsRectEmpty())
+ if(m_rcDirty.IsRectEmpty()) {
return S_FALSE;
+ }
DDBLTFX fx;
INITDDSTRUCT(fx);
@@ -99,8 +101,9 @@ STDMETHODIMP CDX7SubPic::Lock(SubPicDesc& spd) {
DDSURFACEDESC2 ddsd;
INITDDSTRUCT(ddsd);
- if(FAILED(m_pSurface->Lock(NULL, &ddsd, DDLOCK_SURFACEMEMORYPTR|DDLOCK_WAIT, NULL)))
+ if(FAILED(m_pSurface->Lock(NULL, &ddsd, DDLOCK_SURFACEMEMORYPTR|DDLOCK_WAIT, NULL))) {
return E_FAIL;
+ }
spd.type = 0;
spd.w = m_size.cx;
@@ -117,14 +120,11 @@ STDMETHODIMP CDX7SubPic::Unlock(RECT* pDirtyRect) {
m_pSurface->Unlock(NULL);
- if(pDirtyRect)
- {
+ if(pDirtyRect) {
m_rcDirty = *pDirtyRect;
m_rcDirty.InflateRect(1, 1);
m_rcDirty &= CRect(CPoint(0, 0), m_size);
- }
- else
- {
+ } else {
m_rcDirty = CRect(CPoint(0, 0), m_size);
}
@@ -135,42 +135,41 @@ STDMETHODIMP CDX7SubPic::AlphaBlt(RECT* pSrc, RECT* pDst, SubPicDesc* pTarget) {
ASSERT(pTarget == NULL);
- if(!m_pD3DDev || !m_pSurface || !pSrc || !pDst)
+ if(!m_pD3DDev || !m_pSurface || !pSrc || !pDst) {
return E_POINTER;
+ }
CRect src(*pSrc), dst(*pDst);
HRESULT hr;
- do
- {
+ do {
DDSURFACEDESC2 ddsd;
INITDDSTRUCT(ddsd);
- if(FAILED(hr = m_pSurface->GetSurfaceDesc(&ddsd)))
+ if(FAILED(hr = m_pSurface->GetSurfaceDesc(&ddsd))) {
break;
+ }
float w = (float)ddsd.dwWidth;
float h = (float)ddsd.dwHeight;
- struct
- {
+ struct {
float x, y, z, rhw;
float tu, tv;
}
- pVertices[] =
- {
+ pVertices[] = {
{(float)dst.left, (float)dst.top, 0.5f, 2.0f, (float)src.left / w, (float)src.top / h},
{(float)dst.right, (float)dst.top, 0.5f, 2.0f, (float)src.right / w, (float)src.top / h},
{(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(ptrdiff_t i = 0; i < countof(pVertices); i++)
- {
- pVertices[i].x -= 0.5;
- pVertices[i].y -= 0.5;
- }
-*/
+ /*
+ for(ptrdiff_t i = 0; i < countof(pVertices); i++)
+ {
+ pVertices[i].x -= 0.5;
+ pVertices[i].y -= 0.5;
+ }
+ */
hr = m_pD3DDev->SetTexture(0, m_pSurface);
m_pD3DDev->SetRenderState(D3DRENDERSTATE_CULLMODE, D3DCULL_NONE);
@@ -202,8 +201,9 @@ STDMETHODIMP CDX7SubPic::AlphaBlt(RECT* pSrc, RECT* pDst, SubPicDesc* pTarget) *///
- if(FAILED(hr = m_pD3DDev->BeginScene()))
+ if(FAILED(hr = m_pD3DDev->BeginScene())) {
break;
+ }
hr = m_pD3DDev->DrawPrimitive(D3DPT_TRIANGLESTRIP,
D3DFVF_XYZRHW | D3DFVF_TEX1,
@@ -215,8 +215,7 @@ STDMETHODIMP CDX7SubPic::AlphaBlt(RECT* pSrc, RECT* pDst, SubPicDesc* pTarget) m_pD3DDev->SetTexture(0, NULL);
return S_OK;
- }
- while(0);
+ } while(0);
return E_FAIL;
}
@@ -237,7 +236,9 @@ CDX7SubPicAllocator::CDX7SubPicAllocator(IDirect3DDevice7* pD3DDev, SIZE maxsize STDMETHODIMP CDX7SubPicAllocator::ChangeDevice(IUnknown* pDev)
{
CComQIPtr<IDirect3DDevice7, &IID_IDirect3DDevice7> pD3DDev = pDev;
- if(!pD3DDev) return E_NOINTERFACE;
+ if(!pD3DDev) {
+ return E_NOINTERFACE;
+ }
CAutoLock cAutoLock(this);
m_pD3DDev = pD3DDev;
@@ -249,8 +250,9 @@ STDMETHODIMP CDX7SubPicAllocator::ChangeDevice(IUnknown* pDev) bool CDX7SubPicAllocator::Alloc(bool fStatic, ISubPic** ppSubPic)
{
- if(!ppSubPic)
+ if(!ppSubPic) {
return(false);
+ }
CAutoLock cAutoLock(this);
@@ -269,26 +271,32 @@ bool CDX7SubPicAllocator::Alloc(bool fStatic, ISubPic** ppSubPic) ddsd.ddpfPixelFormat.dwGBitMask = 0x0000FF00;
ddsd.ddpfPixelFormat.dwBBitMask = 0x000000FF;
- if(m_fPow2Textures)
- {
+ if(m_fPow2Textures) {
ddsd.dwWidth = ddsd.dwHeight = 1;
- while(ddsd.dwWidth < (DWORD)m_maxsize.cx) ddsd.dwWidth <<= 1;
- while(ddsd.dwHeight < (DWORD)m_maxsize.cy) ddsd.dwHeight <<= 1;
+ while(ddsd.dwWidth < (DWORD)m_maxsize.cx) {
+ ddsd.dwWidth <<= 1;
+ }
+ while(ddsd.dwHeight < (DWORD)m_maxsize.cy) {
+ ddsd.dwHeight <<= 1;
+ }
}
CComPtr<IDirect3D7> pD3D;
CComQIPtr<IDirectDraw7, &IID_IDirectDraw7> pDD;
- if(FAILED(m_pD3DDev->GetDirect3D(&pD3D)) || !pD3D || !(pDD = pD3D))
+ if(FAILED(m_pD3DDev->GetDirect3D(&pD3D)) || !pD3D || !(pDD = pD3D)) {
return(false);
+ }
CComPtr<IDirectDrawSurface7> pSurface;
- if(FAILED(pDD->CreateSurface(&ddsd, &pSurface, NULL)))
+ if(FAILED(pDD->CreateSurface(&ddsd, &pSurface, NULL))) {
return(false);
+ }
*ppSubPic = DNew CDX7SubPic(m_pD3DDev, pSurface);
- if(!(*ppSubPic))
+ if(!(*ppSubPic)) {
return(false);
+ }
(*ppSubPic)->AddRef();
|