From 5111876b0de519f9053f7e217010f245e9929e00 Mon Sep 17 00:00:00 2001 From: Glenn Maynard Date: Fri, 23 Aug 2002 01:32:34 +0000 Subject: [PATCH] Hide CTextureRenderer in RageMovieTexture.cpp. --- stepmania/src/RageMovieTexture.cpp | 51 ++++++++++++++++++++++++++---- stepmania/src/RageMovieTexture.h | 50 +++-------------------------- 2 files changed, 49 insertions(+), 52 deletions(-) diff --git a/stepmania/src/RageMovieTexture.cpp b/stepmania/src/RageMovieTexture.cpp index ce44fe51b0..1bce0f5d1b 100644 --- a/stepmania/src/RageMovieTexture.cpp +++ b/stepmania/src/RageMovieTexture.cpp @@ -10,7 +10,6 @@ ----------------------------------------------------------------------------- */ - //----------------------------------------------------------------------------- // In-line Links //----------------------------------------------------------------------------- @@ -23,6 +22,13 @@ #else #pragma comment(lib, "baseclasses/release/strmbase.lib") #endif + +//----------------------------------------------------------------------------- +// Define GUID for Texture Renderer +// {71771540-2017-11cf-AE26-0020AFD79767} +//----------------------------------------------------------------------------- +struct __declspec(uuid("{71771540-2017-11cf-ae26-0020afd79767}")) CLSID_TextureRenderer; + //----------------------------------------------------------------------------- // Includes @@ -38,8 +44,42 @@ #include //----------------------------------------------------------------------------- -// Global Constants +// CTextureRenderer Class Declarations +// +// Usage: 1) CheckMediaType is called by the graph +// 2) SetMediaType is called by the graph +// 3) call GetVidWidth and GetVidHeight to get texture information +// 4) call SetRenderTarget +// 5) Do RenderSample is called by the graph //----------------------------------------------------------------------------- +class CTextureRenderer : public CBaseVideoRenderer +{ +public: + CTextureRenderer(LPUNKNOWN pUnk,HRESULT *phr); + ~CTextureRenderer(); + +public: + // overwritten methods + HRESULT CheckMediaType(const CMediaType *pmt ); // Format acceptable? + HRESULT SetMediaType(const CMediaType *pmt ); // Video format notification + HRESULT DoRenderSample(IMediaSample *pMediaSample); // New video sample + + // new methods + LONG GetVidWidth() {return m_lVidWidth;}; + LONG GetVidHeight(){return m_lVidHeight;}; + HRESULT SetRenderTarget( RageMovieTexture* pTexture ); + +protected: + LONG m_lVidWidth; // Video width + LONG m_lVidHeight; // Video Height + LONG m_lVidPitch; // Video Pitch + + RageMovieTexture* m_pTexture; // the video surface we will copy new frames to + D3DFORMAT m_TextureFormat; // Texture format + BOOL m_bBackBufferLocked; +}; + + //----------------------------------------------------------------------------- @@ -155,10 +195,8 @@ HRESULT CTextureRenderer::DoRenderSample( IMediaSample * pSample ) // Get the video bitmap buffer pSample->GetPointer( &pBmpBuffer ); - // Find which texture we should render to. We want to copy to the "back buffer" - int iIndexBackBuffer = !m_pTexture->m_iIndexFrontBuffer; - LPDIRECT3DTEXTURE8 pD3DTextureCopyTo = m_pTexture->m_pd3dTexture[iIndexBackBuffer]; + LPDIRECT3DTEXTURE8 pD3DTextureCopyTo = m_pTexture->GetBackBuffer(); // Lock the Texture D3DLOCKED_RECT d3dlr; @@ -232,8 +270,7 @@ HRESULT CTextureRenderer::DoRenderSample( IMediaSample * pSample ) // flip active texture - m_pTexture->m_iIndexFrontBuffer = !m_pTexture->m_iIndexFrontBuffer; - + m_pTexture->Flip(); return S_OK; } diff --git a/stepmania/src/RageMovieTexture.h b/stepmania/src/RageMovieTexture.h index f939829dcd..e8cdeb351b 100644 --- a/stepmania/src/RageMovieTexture.h +++ b/stepmania/src/RageMovieTexture.h @@ -18,50 +18,7 @@ #include "baseclasses/streams.h" -//----------------------------------------------------------------------------- -// Define GUID for Texture Renderer -// {71771540-2017-11cf-AE26-0020AFD79767} -//----------------------------------------------------------------------------- -struct __declspec(uuid("{71771540-2017-11cf-ae26-0020afd79767}")) CLSID_TextureRenderer; - -class RageMovieTexture; - -//----------------------------------------------------------------------------- -// CTextureRenderer Class Declarations -// -// Usage: 1) CheckMediaType is called by the graph -// 2) SetMediaType is called by the graph -// 3) call GetVidWidth and GetVidHeight to get texture information -// 4) call SetRenderTarget -// 5) Do RenderSample is called by the graph -//----------------------------------------------------------------------------- -class CTextureRenderer : public CBaseVideoRenderer -{ -public: - CTextureRenderer(LPUNKNOWN pUnk,HRESULT *phr); - ~CTextureRenderer(); - -public: - // overwritten methods - HRESULT CheckMediaType(const CMediaType *pmt ); // Format acceptable? - HRESULT SetMediaType(const CMediaType *pmt ); // Video format notification - HRESULT DoRenderSample(IMediaSample *pMediaSample); // New video sample - - // new methods - LONG GetVidWidth() {return m_lVidWidth;}; - LONG GetVidHeight(){return m_lVidHeight;}; - HRESULT SetRenderTarget( RageMovieTexture* pTexture ); - -protected: - LONG m_lVidWidth; // Video width - LONG m_lVidHeight; // Video Height - LONG m_lVidPitch; // Video Pitch - - RageMovieTexture* m_pTexture; // the video surface we will copy new frames to - D3DFORMAT m_TextureFormat; // Texture format - BOOL m_bBackBufferLocked; -}; - +class CTextureRenderer; //----------------------------------------------------------------------------- // RageMovieTexture Class Declarations @@ -99,10 +56,13 @@ public: virtual void TurnLoopOn(); virtual void TurnLoopOff(); + LPDIRECT3DTEXTURE8 GetBackBuffer() { return m_pd3dTexture[!m_iIndexFrontBuffer]; } + void Flip() { m_iIndexFrontBuffer = !m_iIndexFrontBuffer; } + +protected: LPDIRECT3DTEXTURE8 m_pd3dTexture[2]; // double buffered int m_iIndexFrontBuffer; // index of the buffer that should be rendered from - either 0 or 1 -protected: virtual VOID Create(); virtual HRESULT CreateD3DTexture();