📄 fxmanagr.cpp
字号:
m_pHyperlinkManager->AddLink(pEffect->GetDstHXxRect(), pszURL); } else { m_pHyperlinkManager->AddLink(pEffect->GetDstHXxRect(), NULL); } // Check if this is a late effect (one that the current time is // already past the effect's end time). If so, then set the ReInit // flag for the rest of the effects if (IsTimeLater(pEffect->GetEnd(), ulTime) && pEffect->GetDuration() > 0) { bDelayedInit = TRUE; } } else {#ifdef XXXMEH_DEBUG_OUT DEBUG_OUT(m_pErrorMessages, DOL_REALPIX, (s, "Effect (start=%lu,dur=%lu,target=%lu,type=%lu,last=%lu) session init FAILED - ignoring effect", pEffect->GetStart(), pEffect->GetDuration(), pEffect->GetTarget(), pEffect->GetEffectType(), (UINT32) pEffect->GetLastUse()));#endif } } HX_RELEASE(pSession); // Remove the effect from the effects list pos = m_pEffectsList->RemoveAt(pos); // Release the list's ref on the effect HX_RELEASE(pEffect); } else { break; } } else { retVal = HXR_FAIL; } if (FAILED(retVal)) { break; } } } else { retVal = HXR_UNEXPECTED; }#ifdef XXXMEH_DEBUG_ASSERT // Debug-only assert HX_ASSERT(SUCCEEDED(retVal));#endif return retVal;}HX_RESULT PXEffectsManager::CreateEffectSession(PXEffect* pEffect, PXEffectSession** ppSession){ HX_RESULT retVal = HXR_OK; if (pEffect && ppSession) { // Set default *ppSession = NULL; switch (pEffect->GetEffectType()) { case PXEffect::kEffectTypeFill: retVal = PXFillEffectSession::CreateObject((PXFillEffectSession**) ppSession); break; case PXEffect::kEffectTypeFadeOut: retVal = PXFadeOutEffectSession::CreateObject((PXFadeOutEffectSession**) ppSession); break; case PXEffect::kEffectTypeFadeIn: case PXEffect::kEffectTypeCrossFade: retVal = PXFadeInEffectSession::CreateObject((PXFadeInEffectSession**) ppSession); break; case PXEffect::kEffectTypeWipe: retVal = PXWipeEffectSession::CreateObject((PXWipeEffectSession**) ppSession); break; case PXEffect::kEffectTypeViewChange: retVal = PXViewchangeEffectSession::CreateObject((PXViewchangeEffectSession**) ppSession);// This is a higher CPU but simpler viewchange implementation still in testing// retVal = PXSimpleViewchangeEffectSession::CreateObject((PXSimpleViewchangeEffectSession**) ppSession); break; case PXEffect::kEffectTypeExternal: retVal = PXExternalEffectSession::CreateObject((PXExternalEffectSession**) ppSession); break; case PXEffect::kEffectTypeAnimate: retVal = PXAnimationSession::CreateObject((PXAnimationSession**) ppSession); break; default: retVal = HXR_FAIL; } } else { retVal = HXR_INVALID_PARAMETER; } return retVal;}HX_RESULT PXEffectsManager::ExecuteAllSessions(UINT32 ulTime){ HX_RESULT retVal = HXR_OK; if (m_pEffectSessionList) { // Reset our damage rect m_bDisplayDamaged = FALSE; m_cDamageRect.left = 0; m_cDamageRect.top = 0; m_cDamageRect.right = 0; m_cDamageRect.bottom = 0; // Call PXEffectSession::Execute() on all active effect sessions LISTPOSITION pos = m_pEffectSessionList->GetHeadPosition(); while (pos) { PXEffectSession* pSession = (PXEffectSession*) m_pEffectSessionList->GetNext(pos); if (pSession) { // Reset the session's damage rect pSession->ResetDamage(); // Do we need to do a delayed init on this session? HX_RESULT rv = HXR_OK; if (pSession->IsFirstExe() && pSession->GetDelayedInit()) { PXEffect* pSessionEffect = NULL; pSession->GetEffect(&pSessionEffect); if (pSessionEffect) { rv = pSession->Init(this, pSessionEffect, m_pImageManager, m_pErrorMessages); } HX_RELEASE(pSessionEffect); pSession->SetDelayedInit(FALSE); } // Call Execute on this session if (SUCCEEDED(rv)) { rv = pSession->Execute(ulTime); if (SUCCEEDED(rv)) { // Check to see if this session damaged the display if (pSession->IsDisplayDamaged()) { // Get the session's damage rect HXxRect cRect; pSession->GetDamageRect(cRect); // First time through we just set the flag and // assign the current damage rect to the overall // damage rect. Everytime after that, however, we // must perform a simple rectangular convex hull // computation. if (m_bDisplayDamaged) { m_cDamageRect.left = PXMIN(m_cDamageRect.left, cRect.left); m_cDamageRect.top = PXMIN(m_cDamageRect.top, cRect.top); m_cDamageRect.right = PXMAX(m_cDamageRect.right, cRect.right); m_cDamageRect.bottom = PXMAX(m_cDamageRect.bottom, cRect.bottom); } else { m_bDisplayDamaged = TRUE; m_cDamageRect = cRect; } } } else { // If an effect failed, we immediately set it to finished, // so that it will be removed from the active queue pSession->SetFinished(TRUE); } } } else { retVal = HXR_FAIL; } if (FAILED(retVal)) { break; } } } else { retVal = HXR_UNEXPECTED; }#ifdef XXXMEH_DEBUG_ASSERT // Debug-only assert HX_ASSERT(SUCCEEDED(retVal));#endif return retVal;}HX_RESULT PXEffectsManager::UpdateSessionList(UINT32 ulTime){ HX_RESULT retVal = HXR_OK; if (m_pEffectSessionList && m_pPostDurationList) { // Reset the backchannel notify flag m_bBackChannelNotify = FALSE; LISTPOSITION pos = m_pEffectSessionList->GetHeadPosition(); while (pos) { PXEffectSession* pSession = (PXEffectSession*) m_pEffectSessionList->GetAt(pos); if (pSession) { if (pSession->IsFinished()) { PXEffect* pEffect = NULL; pSession->GetEffect(&pEffect); if (pEffect) { if (pEffect->GetEffectType() == PXEffect::kEffectTypeAnimate && pEffect->GetPostBackChannel()) { m_bBackChannelNotify = TRUE; m_ulBackChannelHandle = pEffect->GetTarget(); } } // Release the effect HX_RELEASE(pEffect); // The effect is finished, but the image it used may have not // been completely decoded due to lost or late packets. We check // whether this session needs saving. if (pSession->NeedsPostDurationUpdate()) { // The image did not completely decode, so we will keep the // session around in case we get more packets by moving it // to the post-duration list // // First we compute the expiration time UINT32 ulExpTime = 0; HX_RESULT rv = ComputeExpirationTime(pSession, &ulExpTime); if (SUCCEEDED(rv)) { // Set the expiration time pSession->SetPostDurationExpirationTime(ulExpTime); // Addref the session pSession->AddRef(); // Move it to the post duration list m_pPostDurationList->AddTail((void*) pSession); } } else { // This effect either: a) did not have an image; or b) the image // decoded completely. So we can release our hold on the image // if there was one. pSession->ReleaseTargetImage(); } // Release the list's ref of the session HX_RELEASE(pSession); // Remove the session from the list pos = m_pEffectSessionList->RemoveAt(pos); // Check if we need to clear the indefinite duration flag CheckClearIndefiniteDuration(); } else { m_pEffectSessionList->GetNext(pos); } } else { retVal = HXR_FAIL; } if (FAILED(retVal)) { break; } } } else { retVal = HXR_UNEXPECTED; }#ifdef XXXMEH_DEBUG_ASSERT // Debug-only assert HX_ASSERT(SUCCEEDED(retVal));#endif return retVal;}HX_RESULT PXEffectsManager::AnySpaceTimeOverlap(PXEffect* pQueryEffect, BOOL* pbOverlap){ HX_RESULT retVal = HXR_OK; if (pQueryEffect && pbOverlap) { // Set default *pbOverlap = FALSE; if (m_pEffectsList && m_pEffectSessionList) { // First we check active events for an overlap LISTPOSITION pos = m_pEffectSessionList->GetHeadPosition(); while (pos) { PXEffectSession* pSession = (PXEffectSession*) m_pEffectSessionList->GetNext(pos); if (pSession) { PXEffect* pEffect = NULL; retVal = pSession->GetEffect(&pEffect); if (SUCCEEDED(retVal)) { if (pEffect->IsOverlapped(pQueryEffect)) { *pbOverlap = TRUE; break; } } HX_RELEASE(pEffect); } else { retVal = HXR_FAIL; } if (FAILED(retVal)) { break; } } // Now if we haven't already found an overlap, then check the effects list if (SUCCEEDED(retVal) && *pbOverlap == FALSE) { pos = m_pEffectsList->GetHeadPosition(); while (pos) { PXEffect* pEffect = (PXEffect*) m_pEffectsList->GetNext(pos); if (pEffect) { if (pEffect->IsOverlapped(pQueryEffect)) { *pbOverlap = TRUE; break; } } else { retVal = HXR_FAIL; } if (FAILED(retVal)) { break; } } } }
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -