Assert fixes [ 1212949 ] Fix some asserts in wxMediaCtrl

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@34512 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Julian Smart
2005-06-02 07:55:35 +00:00
parent 424d08955c
commit 96339a78f2

View File

@@ -578,6 +578,7 @@ public:
IMediaControl* m_pMC; IMediaControl* m_pMC;
IMediaEvent* m_pME; IMediaEvent* m_pME;
IMediaPosition* m_pMS; IMediaPosition* m_pMS;
bool m_bVideo;
wxAMMediaThread* m_pThread; wxAMMediaThread* m_pThread;
@@ -1238,6 +1239,11 @@ bool wxAMMediaBackend::Load(const wxString& fileName)
wxASSERT(false); wxASSERT(false);
} }
if(m_bestSize.x == 0 && m_bestSize.y == 0)
m_bVideo = false;
else
m_bVideo = true;
// //
// Force the parent window of this control to recalculate // Force the parent window of this control to recalculate
// the size of this if sizers are being used // the size of this if sizers are being used
@@ -1491,7 +1497,7 @@ wxSize wxAMMediaBackend::GetVideoSize() const
void wxAMMediaBackend::Move(int WXUNUSED(x), int WXUNUSED(y), void wxAMMediaBackend::Move(int WXUNUSED(x), int WXUNUSED(y),
int w, int h) int w, int h)
{ {
if(m_pVMC) if(m_pVMC && m_bVideo)
{ {
RECT srcRect, destRect; RECT srcRect, destRect;
@@ -1632,7 +1638,7 @@ void wxAMMediaBackend::OnStop()
void wxAMMediaEvtHandler::OnEraseBackground(wxEraseEvent& evt) void wxAMMediaEvtHandler::OnEraseBackground(wxEraseEvent& evt)
{ {
wxAMMediaBackend* pThis = (wxAMMediaBackend*) this; wxAMMediaBackend* pThis = (wxAMMediaBackend*) this;
if(pThis->m_pVMC) if(pThis->m_pVMC && pThis->m_bVideo)
{ {
//TODO: Use wxClientDC? //TODO: Use wxClientDC?
HDC hdc = ::GetDC((HWND)pThis->m_ctrl->GetHandle()); HDC hdc = ::GetDC((HWND)pThis->m_ctrl->GetHandle());
@@ -1658,7 +1664,7 @@ void wxAMMediaEvtHandler::OnPaint(wxPaintEvent& WXUNUSED(evt))
{ {
wxAMMediaBackend* pThis = (wxAMMediaBackend*) this; wxAMMediaBackend* pThis = (wxAMMediaBackend*) this;
wxPaintDC dc(pThis->m_ctrl); wxPaintDC dc(pThis->m_ctrl);
if( pThis->m_pVMC ) if( pThis->m_pVMC && pThis->m_bVideo)
{ {
if( pThis->m_pVMC->RepaintVideo((HWND)pThis->m_ctrl->GetHandle(), if( pThis->m_pVMC->RepaintVideo((HWND)pThis->m_ctrl->GetHandle(),
(HDC)dc.GetHDC()) != 0 ) (HDC)dc.GetHDC()) != 0 )