📄 dtbase.h
字号:
//--- Private helpers
private:
static DXTASKPROC _TaskProc;
void _ReleaseReferences();
void _ReleaseServices();
void _UpdateBltFlags(void);
HRESULT _MakeInputsSameSize(void);
HRESULT _ImageMapIn2Out(CDXDBnds & bnds, ULONG ulNumBnds, const CDXDBnds * pInBounds);
HRESULT _MeshMapIn2Out(CDXCBnds & bnds, ULONG ulNumInBnds, CDXCBnds * pInBounds);
//
//--- Public helpers
//
public:
float GetEffectProgress(void) { return m_Progress; }
ULONG GetNumInputs(void) { return m_ulNumInputs; }
//
// Use these inline functions to access input and output objects
//
BOOL HaveInput(ULONG i = 0) { return (m_ulNumInputs > i && m_aInputs[i].m_pNativeInterface); }
IDirect3DRMMeshBuilder3 * OutputMeshBuilder()
{
_ASSERT(m_dwOptionFlags & DXBOF_OUTPUT_MESHBUILDER);
return (IDirect3DRMMeshBuilder3 *)m_Output.m_pNativeInterface;
}
IDXSurface * OutputSurface()
{
_ASSERT((m_dwOptionFlags & DXBOF_OUTPUT_MESHBUILDER) == 0);
return (IDXSurface *)m_Output.m_pNativeInterface;
}
IDirect3DRMMeshBuilder3 * InputMeshBuilder(ULONG i = 0)
{
_ASSERT(i < m_ulNumInputs);
_ASSERT(m_dwOptionFlags & DXBOF_INPUTS_MESHBUILDER);
return (IDirect3DRMMeshBuilder3 *)m_aInputs[i].m_pNativeInterface;
}
IDXSurface * InputSurface(ULONG i = 0)
{
_ASSERT(i < m_ulNumInputs);
_ASSERT((m_dwOptionFlags & DXBOF_INPUTS_MESHBUILDER) == 0);
return (IDXSurface *)m_aInputs[i].m_pNativeInterface;
}
DXSAMPLEFORMATENUM OutputSampleFormat(void)
{
_ASSERT((m_dwOptionFlags & DXBOF_OUTPUT_MESHBUILDER) == 0);
return m_Output.m_SampleFormat;
}
DXSAMPLEFORMATENUM InputSampleFormat(ULONG i = 0)
{
_ASSERT(i < m_ulNumInputs);
_ASSERT((m_dwOptionFlags & DXBOF_INPUTS_MESHBUILDER) == 0);
return m_aInputs[i].m_SampleFormat;
}
BOOL HaveOutput(void) { return m_Output.m_pNativeInterface != NULL; }
bool IsInputDirty(ULONG i = 0)
{
_ASSERT(i < m_ulNumInputs);
return m_aInputs[i].IsDirty();
}
bool IsOutputDirty()
{
_ASSERT(HaveOutput());
return m_Output.IsDirty();
}
//--- Public helpers. Should be called with critical seciton claimed.
inline BOOL DoOver(void) const
{
return m_dwBltFlags & DXBOF_DO_OVER;
}
inline BOOL DoDither(void) const
{
return m_dwBltFlags & DXBOF_DITHER;
}
BOOL NeedSrcPMBuff(ULONG i = 0)
{
return ((m_dwBltFlags & DXBOF_DITHER) || InputSampleFormat(i) != DXPF_PMARGB32);
}
BOOL NeedDestPMBuff(void)
{
return OutputSampleFormat() != DXPF_PMARGB32;
}
void SetDirty() { m_dwGenerationId++; }
void ClearDirty() { OnUpdateGenerationId(); m_dwCleanGenId = m_dwGenerationId; }
BOOL IsTransformDirty() { OnUpdateGenerationId(); return m_dwCleanGenId != m_dwGenerationId; }
public:
//=== IObjectWithSite =======================================
STDMETHOD( SetSite )( IUnknown *pUnkSite );
STDMETHOD( GetSite )( REFIID riid, void ** ppvSite );
//=== IDXBaseObject =========================================
STDMETHOD( GetGenerationId ) (ULONG * pGenId);
STDMETHOD( IncrementGenerationId) (BOOL bRefresh);
STDMETHOD( GetObjectSize ) (ULONG * pcbSize);
//=== IDXTransform ===============================================
STDMETHOD( Setup )( IUnknown * const * punkInputs, ULONG ulNumIn,
IUnknown * const * punkOutputs, ULONG ulNumOut, DWORD dwFlags );
STDMETHOD( Execute )( const GUID* pRequestID,
const DXBNDS *pOutBounds, const DXVEC *pPlacement );
STDMETHOD( MapBoundsIn2Out )( const DXBNDS *pInBounds, ULONG ulNumInBnds,
ULONG ulOutIndex, DXBNDS *pOutBounds );
STDMETHOD( MapBoundsOut2In )( ULONG ulOutIndex, const DXBNDS *pOutBounds, ULONG ulInIndex, DXBNDS *pInBounds );
STDMETHOD( SetMiscFlags ) ( DWORD dwOptionFlags );
STDMETHOD( GetMiscFlags ) ( DWORD * pdwMiscFlags );
STDMETHOD( GetInOutInfo )( BOOL bOutput, ULONG ulIndex, DWORD *pdwFlags, GUID * pIDs, ULONG * pcIDs, IUnknown **ppUnkCurObj);
STDMETHOD( SetQuality )( float fQuality );
STDMETHOD( GetQuality )( float *pfQuality );
STDMETHOD (PointPick) (const DXVEC *pPoint,
ULONG * pulInputSurfaceIndex,
DXVEC *pInputPoint);
//
// Effect interface
//
// NOTE: Derived classes MUST implement get_Capabilities. Use macros below.
//
STDMETHODIMP get_Capabilities(long *pVal) { _ASSERT(true); return E_NOTIMPL; }
//
// All other methods are implemented in the base.
//
STDMETHODIMP get_Progress(float *pVal);
STDMETHODIMP put_Progress(float newVal);
STDMETHODIMP get_StepResolution(float *pVal);
STDMETHODIMP get_Duration(float *pVal);
STDMETHODIMP put_Duration(float newVal);
//
// Helper functions derived classes can use
//
//
// Static function for registering in one or more component categories
//
static HRESULT RegisterTransform(REFCLSID rcid, int ResourceId, ULONG cCatImpl, const CATID * pCatImpl,
ULONG cCatReq, const CATID * pCatReq, BOOL bRegister);
};
//=== Inline Function Definitions ==================================
//=== Macro Definitions ============================================
#define DECLARE_REGISTER_DX_TRANSFORM(id, catid)\
static HRESULT WINAPI UpdateRegistry(BOOL bRegister) \
{ \
return CDXBaseNTo1::RegisterTransform(GetObjectCLSID(), (id), 1, &(catid), 0, NULL, bRegister); \
}
#define DECLARE_REGISTER_DX_TRANS_CATS(id, countimpl, pcatidsimpl, countreq, pcatidsreq)\
static HRESULT WINAPI UpdateRegistry(BOOL bRegister) \
{ \
return CDXBaseNTo1::RegisterTransform(GetObjectCLSID(), (id), (count), (pcatids), (countreq), (pcatidsreq), bRegister); \
}
#define DECLARE_REGISTER_DX_IMAGE_TRANS(id) \
DECLARE_REGISTER_DX_TRANSFORM(id, CATID_DXImageTransform)
#define DECLARE_REGISTER_DX_3D_TRANS(id) \
DECLARE_REGISTER_DX_TRANSFORM(id, CATID_DX3DTransform)
#define DECLARE_REGISTER_DX_IMAGE_AUTHOR_TRANS(id) \
static HRESULT WINAPI UpdateRegistry(BOOL bRegister) \
{ \
GUID a_Cats[2]; \
a_Cats[0] = CATID_DXImageTransform; \
a_Cats[1] = CATID_DXAuthoringTransform; \
return CDXBaseNTo1::RegisterTransform(GetObjectCLSID(), (id), 2, a_Cats, 0, NULL, bRegister); \
}
#define DECLARE_REGISTER_DX_3D_AUTHOR_TRANS(id) \
static HRESULT WINAPI UpdateRegistry(BOOL bRegister) \
{ \
GUID a_Cats[2]; \
a_Cats[0] = CATID_DX3DTransform; \
a_Cats[1] = CATID_DXAuthoringTransform; \
return CDXBaseNTo1::RegisterTransform(GetObjectCLSID(), (id), 2, a_Cats, 0, NULL, bRegister); \
}
//
// Effect interface
//
#define DECLARE_GET_CAPABILITIES(Caps)\
STDMETHODIMP get_Capabilities(long *pVal) { if (DXIsBadWritePtr(pVal, sizeof(*pVal))) return E_POINTER; *pVal = Caps; return S_OK; }
#define DECLARE_GET_PROGRESS()\
STDMETHODIMP get_Progress(float *pVal) { return CDXBaseNTo1::get_Progress(pVal); }
#define DECLARE_PUT_PROGRESS()\
STDMETHODIMP put_Progress(float newVal) { return CDXBaseNTo1::put_Progress(newVal); }
#define DECLARE_GET_STEPRESOLUTION()\
STDMETHODIMP get_StepResolution(float *pVal) { return CDXBaseNTo1::get_StepResolution(pVal); }
#define DECLARE_GET_DURATION()\
STDMETHODIMP get_Duration(float *pVal) { return CDXBaseNTo1::get_Duration(pVal); }
#define DECLARE_PUT_DURATION()\
STDMETHODIMP put_Duration(float newVal) { return CDXBaseNTo1::put_Duration(newVal); }
#define DECLARE_IDXEFFECT_METHODS(Caps)\
DECLARE_GET_CAPABILITIES(Caps)\
DECLARE_GET_PROGRESS()\
DECLARE_PUT_PROGRESS()\
DECLARE_GET_STEPRESOLUTION()\
DECLARE_GET_DURATION()\
DECLARE_PUT_DURATION()
//=== Global Data Declarations =====================================
//=== Function Prototypes ==========================================
#pragma option pop /*P_O_Pop*/
#endif /* This must be the last line in the file */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -