void GSRasterizerList::Draw(const GSRasterizerData* data) { *m_sync = 0; m_stats.Reset(); __int64 start = __rdtsc(); POSITION pos = GetTailPosition(); while(pos) { GetPrev(pos)->Draw(data); } while(*m_sync) { _mm_pause(); } m_stats.ticks = __rdtsc() - start; pos = GetHeadPosition(); while(pos) { GSRasterizerStats s; GetNext(pos)->GetStats(s); m_stats.pixels += s.pixels; m_stats.prims = max(m_stats.prims, s.prims); } }
CPlaylistItem& CPlaylist::GetPrevWrap(POSITION& pos) { GetPrev(pos); if (!pos) { pos = GetTailPosition(); } return GetAt(pos); }
/** * Deletes all pages and clears the list. */ void CPrintPages::Clear() { POSITION p = GetTailPosition(); while (p) { CPrintPage *page = (CPrintPage*)GetPrev(p); delete page; } RemoveAll(); }
POSITION CPlaylist::GetShuffleAwareTailPosition() { POSITION posTail; if (m_bShuffle) { ReshuffleIfNeeded(); posTail = m_posTailShuffle; } else { posTail = GetTailPosition(); } return posTail; }
//------------------------------------------------------------------------------ // // Function Name: CMLListCtrlElements::Last() // // Parameters: None // // Return Value: A pointer to the last object in the list // // Description: This function will retrieve the last object in the list. // //------------------------------------------------------------------------------ CMLListCtrlElement* CMLListCtrlElements::Last() { // Get the last position m_PrevPos = GetTailPosition(); m_NextPos = NULL; if(m_PrevPos == NULL) return NULL; else return (CMLListCtrlElement*)GetPrev(m_PrevPos); }
/** * Return the last visible item */ CBibItem * CBibList::GetLast() const { POSITION h = GetTailPosition(); while (h) { CBibItem* bi = (CBibItem*)GetPrev(h); ASSERT(bi); if (bi->IsVisible() && bi->IsRegularItem()) return bi; } return NULL; }
CObject* CObAvlTree::RemoveTail() { ASSERT_VALID(this); ASSERT(m_pNodeRoot != NULL); // don't call on empty tree !!! ASSERT(AfxIsValidAddress(m_pNodeRoot, sizeof(CNode))); POSITION pos = GetTailPosition(); CNode* pOldNode = (CNode*)pos; CObject* returnValue = pOldNode->data; RemoveAt(pos); return returnValue; }
void CPlaylist::SortByPath() { CAtlArray<plsort2_t> a; a.SetCount(GetCount()); POSITION pos = GetHeadPosition(); for(int i = 0; pos; i++, GetNext(pos)) a[i].str = GetAt(pos).m_fns.GetHead(), a[i].pos = pos; qsort(a.GetData(), a.GetCount(), sizeof(plsort2_t), compare2); for(int i = 0; i < a.GetCount(); i++) { AddTail(GetAt(a[i].pos)); __super::RemoveAt(a[i].pos); if(m_pos == a[i].pos) m_pos = GetTailPosition(); } }
void CPlaylist::SortById() { CAtlArray<plsort_t> a; a.SetCount(GetCount()); POSITION pos = GetHeadPosition(); for (int i = 0; pos; i++, GetNext(pos)) { a[i].n = GetAt(pos).m_id, a[i].pos = pos; } qsort(a.GetData(), a.GetCount(), sizeof(plsort_t), compare); for (size_t i = 0; i < a.GetCount(); i++) { AddTail(GetAt(a[i].pos)); __super::RemoveAt(a[i].pos); if (m_pos == a[i].pos) { m_pos = GetTailPosition(); } } }
void CPlaylist::Randomize() { CAtlArray<plsort_t> a; a.SetCount(GetCount()); srand((unsigned int)time(NULL)); POSITION pos = GetHeadPosition(); for(int i = 0; pos; i++, GetNext(pos)) a[i].n = rand(), a[i].pos = pos; qsort(a.GetData(), a.GetCount(), sizeof(plsort_t), compare); CList<CPlaylistItem> pl; for(int i = 0; i < a.GetCount(); i++) { AddTail(GetAt(a[i].pos)); __super::RemoveAt(a[i].pos); if(m_pos == a[i].pos) m_pos = GetTailPosition(); } }
void CPlaylist::SortByName() { CAtlArray<plsort2_t> a; a.SetCount(GetCount()); POSITION pos = GetHeadPosition(); for (int i = 0; pos; i++, GetNext(pos)) { CString& fn = GetAt(pos).m_fns.GetHead(); a[i].str = (LPCTSTR)fn + max(fn.ReverseFind('/'), fn.ReverseFind('\\')) + 1; a[i].pos = pos; } qsort(a.GetData(), a.GetCount(), sizeof(plsort2_t), compare2); for (size_t i = 0; i < a.GetCount(); i++) { AddTail(GetAt(a[i].pos)); __super::RemoveAt(a[i].pos); if (m_pos == a[i].pos) { m_pos = GetTailPosition(); } } }