📄 fxmanagr.cpp
字号:
else { retVal = HXR_UNEXPECTED; } } else { retVal = HXR_INVALID_PARAMETER; } return retVal;}HX_RESULT PXEffectsManager::CheckPostDurationPacket(UINT32 ulHandle){ HX_RESULT retVal = HXR_OK; if (ulHandle) { if (m_pPostDurationList) { LISTPOSITION pos = m_pPostDurationList->GetHeadPosition(); while (pos) { PXEffectSession* pSession = (PXEffectSession*) m_pPostDurationList->GetAt(pos); if (pSession) { PXEffect* pEffect = NULL; retVal = pSession->GetEffect(&pEffect); if (SUCCEEDED(retVal)) { if (pEffect->HasTarget() && pEffect->GetTarget() == ulHandle) { // The image for this post-duration image has been updated, // so we spring into action. // // Clear the finished flag, so the session will do something pSession->SetFinished(FALSE); // Now put it back on the active session list m_pEffectSessionList->AddHead((void*) pSession); // Remove it from the post duration list pos = m_pPostDurationList->RemoveAt(pos); } else { m_pPostDurationList->GetNext(pos); } } HX_RELEASE(pEffect); } else { retVal = HXR_FAIL; } if (FAILED(retVal)) { break; } } } else { retVal = HXR_UNEXPECTED; } } else { retVal = HXR_INVALID_PARAMETER; } return retVal;}HX_RESULT PXEffectsManager::UpdatePostDurationList(UINT32 ulTime){ HX_RESULT retVal = HXR_OK; if (m_pPostDurationList) { LISTPOSITION pos = m_pPostDurationList->GetHeadPosition(); while (pos) { PXEffectSession* pSession = (PXEffectSession*) m_pPostDurationList->GetAt(pos); if (pSession) { if (IsTimeLater(pSession->GetPostDurationExpirationTime(), ulTime)) { // The time for this post-duration session has // expired (i.e. - some other effect has covered up the screen) // so we need to remove it from the list. // // First we release our hold on the target image, if there // is one. retVal = pSession->ReleaseTargetImage(); if (SUCCEEDED(retVal)) { // Release the list's ref on the session HX_RELEASE(pSession); // Remove it from the list pos = m_pPostDurationList->RemoveAt(pos); } } else { m_pPostDurationList->GetNext(pos); } } else { retVal = HXR_FAIL; } if (FAILED(retVal)) { break; } } } else { retVal = HXR_UNEXPECTED; } return retVal;}HX_RESULT PXEffectsManager::ComputeExpirationTime(PXEffectSession* pSession, UINT32* pulTime){ HX_RESULT retVal = HXR_OK; if (pSession && pulTime) { // Set defaults *pulTime = 0xFFFFFFFF; // Init flag which says we have some expiration time BOOL bFoundExpTime = FALSE; // Get the effect for this session PXEffect* pEffect = NULL; HX_RESULT retVal = pSession->GetEffect(&pEffect); if (SUCCEEDED(retVal)) { // First we search the active effects (effect sessions) LISTPOSITION pos = m_pEffectSessionList->GetHeadPosition(); while (pos) { PXEffectSession* pListSess = (PXEffectSession*) m_pEffectSessionList->GetNext(pos); if (pListSess) { PXEffect* pListEffect = NULL; retVal = pListSess->GetEffect(&pListEffect); if (SUCCEEDED(retVal)) { if (IsTimeLater(pEffect->GetEnd(), pListEffect->GetEnd()) && pListEffect->GetDstRect().Contains(pEffect->GetDstRect())) { if (bFoundExpTime) { if (IsTimeLater(pListEffect->GetEnd(), *pulTime)) { *pulTime = pListEffect->GetEnd(); } } else { *pulTime = pListEffect->GetEnd(); bFoundExpTime = TRUE; } } } HX_RELEASE(pListEffect); } else { retVal = HXR_FAIL; } if (FAILED(retVal)) { break; } } if (SUCCEEDED(retVal)) { // Now we search the effect list pos = m_pEffectsList->GetHeadPosition(); while (pos) { PXEffect* pListEffect = (PXEffect*) m_pEffectsList->GetNext(pos); if (pListEffect) { if (IsTimeLater(pEffect->GetEnd(), pListEffect->GetEnd()) && pListEffect->GetDstRect().Contains(pEffect->GetDstRect())) { if (bFoundExpTime) { if (IsTimeLater(pListEffect->GetEnd(), *pulTime)) { *pulTime = pListEffect->GetEnd(); } } else { *pulTime = pListEffect->GetEnd(); bFoundExpTime = TRUE; } } } else { retVal = HXR_FAIL; } if (FAILED(retVal)) { break; } } } } HX_RELEASE(pEffect); } else { retVal = HXR_INVALID_PARAMETER; } return retVal;}HX_RESULT PXEffectsManager::UpdatePostDurationExpirationTimes(){ HX_RESULT retVal = HXR_OK; if (m_pPostDurationList) { LISTPOSITION pos = m_pPostDurationList->GetHeadPosition(); while (pos) { PXEffectSession* pSession = (PXEffectSession*) m_pPostDurationList->GetNext(pos); if (pSession) { UINT32 ulExpTime = 0; retVal = ComputeExpirationTime(pSession, &ulExpTime); if (SUCCEEDED(retVal)) { if (pSession->GetPostDurationExpirationTime() != ulExpTime) {#ifdef XXXMEH_DEBUG_LOG PXEffect* pEffect = NULL; pSession->GetEffect(&pEffect); if (pEffect) { DEBUG_OUTF("c:\\realpix.log", (s, "0x%08x::PXEffectsManager::UpdatePostDurationExpirationTimes() - updating expiration time for effect session (start=%lu,type=%lu) to %lu\n", this, pEffect->GetStart(), pEffect->GetEffectType(), ulExpTime)); } HX_RELEASE(pEffect);#endif // Set the expiration time pSession->SetPostDurationExpirationTime(ulExpTime); } } } else { retVal = HXR_FAIL; } if (FAILED(retVal)) { break; } } } else { retVal = HXR_UNEXPECTED; } return retVal;}void PXEffectsManager::CheckIndefiniteDuration(PXEffect* pEffect){ if (pEffect && m_pEffectSessionList) { // Run through the current list of effect sessions and find the // animation session with indefinite duration LISTPOSITION pos = m_pEffectSessionList->GetHeadPosition(); while (pos) { PXEffectSession* pSession = (PXEffectSession*) m_pEffectSessionList->GetNext(pos); if (pSession) { // Get the effect from the session PXEffect* pListEffect = NULL; HX_RESULT retVal = pSession->GetEffect(&pListEffect); if (SUCCEEDED(retVal)) { // Is this effect: a) an animate effect; and // b) have indefinite duration? if (pListEffect->GetEffectType() == PXEffect::kEffectTypeAnimate && pListEffect->GetDuration() == 0xFFFFFFFF) { // This is an indefinite duration animation effect session (yow!), // so we need to check if the dst rect of the effect to be added // completely contains this effect's dst rect. if (pEffect->GetDstRect().Contains(pListEffect->GetDstRect())) { // The new effect DOES completely contain the indefinite duration // effect. XXXMEH - What we MAY want to check in the future is whether or // not the effect to be added contains transparency in the first // frame. If this is true, we may not want to remove the old effect - // it may be there intentionally. However, for now, we remove it. Actually, // we set the status of the session to finished, which will cause: // a) nothing to be executed this time sync; and b) cause it to be // removed from the session list this time sync. pSession->SetFinished(TRUE); } } } HX_RELEASE(pListEffect); } } }}void PXEffectsManager::CheckClearIndefiniteDuration(){ // We don't need to clear it if it's not set if (m_bCheckIndefiniteDuration && m_pEffectSessionList) { // Run through the list of sessions and if there are // no more animate effects with indefinite durations, then we // can clear the flag BOOL bIndefinitePresent = FALSE; LISTPOSITION pos = m_pEffectSessionList->GetHeadPosition(); while (pos) { PXEffectSession* pSession = (PXEffectSession*) m_pEffectSessionList->GetNext(pos); if (pSession) { PXEffect* pEffect = NULL; HX_RESULT retVal = pSession->GetEffect(&pEffect); if (SUCCEEDED(retVal)) { if (pEffect->GetEffectType() == PXEffect::kEffectTypeAnimate && pEffect->GetDuration() == 0xFFFFFFFF) { bIndefinitePresent = TRUE; } } HX_RELEASE(pEffect); } } // If there were no indefinite duration animate sessions present, // then clear the flag if (!bIndefinitePresent) { m_bCheckIndefiniteDuration = FALSE; } }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -