nsresult nsSkeletonState::GetDuration(const nsTArray<PRUint32>& aTracks, PRInt64& aDuration) { if (!mActive || mVersion < SKELETON_VERSION(4,0) || !HasIndex() || aTracks.Length() == 0) { return NS_ERROR_FAILURE; } PRInt64 endTime = PR_INT64_MIN; PRInt64 startTime = PR_INT64_MAX; for (PRUint32 i=0; i<aTracks.Length(); i++) { nsKeyFrameIndex* index = nsnull; mIndex.Get(aTracks[i], &index); if (!index) { // Can't get the timestamps for one of the required tracks, fail. return NS_ERROR_FAILURE; } if (index->mEndTime > endTime) { endTime = index->mEndTime; } if (index->mStartTime < startTime) { startTime = index->mStartTime; } } NS_ASSERTION(endTime > startTime, "Duration must be positive"); return AddOverflow(endTime, -startTime, aDuration) ? NS_OK : NS_ERROR_FAILURE; }
nsresult SkeletonState::GetDuration(const nsTArray<uint32_t>& aTracks, int64_t& aDuration) { if (!mActive || mVersion < SKELETON_VERSION(4,0) || !HasIndex() || aTracks.Length() == 0) { return NS_ERROR_FAILURE; } int64_t endTime = INT64_MIN; int64_t startTime = INT64_MAX; for (uint32_t i=0; i<aTracks.Length(); i++) { nsKeyFrameIndex* index = nullptr; mIndex.Get(aTracks[i], &index); if (!index) { // Can't get the timestamps for one of the required tracks, fail. return NS_ERROR_FAILURE; } if (index->mEndTime > endTime) { endTime = index->mEndTime; } if (index->mStartTime < startTime) { startTime = index->mStartTime; } } NS_ASSERTION(endTime > startTime, "Duration must be positive"); CheckedInt64 duration = CheckedInt64(endTime) - startTime; aDuration = duration.isValid() ? duration.value() : 0; return duration.isValid() ? NS_OK : NS_ERROR_FAILURE; }
void QuestModel::AddObjective(QuestObjectiveModel* objective, YI_INT32 index) { AddRowsToMatchIndex(index); if (HasIndex(index, 0)) { CYISharedPtr<QuestObjectiveModel> objectivePtr = CYISharedPtr<QuestObjectiveModel>(objective); SetItemData(GetIndex(index, 0), CYIAny(objectivePtr)); } }
void QuestObjectiveModel::AddResolution(QuestObjectiveResolution* resolution, YI_INT32 index) { AddRowsToMatchIndex(index); if (HasIndex(index, 0)) { CYISharedPtr<QuestObjectiveResolution> resolutionPtr = CYISharedPtr<QuestObjectiveResolution>(resolution); SetItemData(GetIndex(index, 0), CYIAny(resolutionPtr)); } }