-lets use the old coverflow cover loader again, just slightly

changed
This commit is contained in:
fix94.1 2013-01-17 18:52:56 +00:00
parent 73f0bd92a0
commit 95e4327ab6

View File

@ -2823,10 +2823,9 @@ int CCoverFlow::_coverLoader(CCoverFlow *cf)
{ {
cf->m_coverThrdBusy = true; cf->m_coverThrdBusy = true;
CLRet ret; CLRet ret;
int firstItem = 0; u32 firstItem;
int nextItem = 0;
bool update; bool update;
u32 i; u32 i, j;
u32 bufferSize = min(cf->m_numBufCovers * max(2u, cf->m_rows), 80u); u32 bufferSize = min(cf->m_numBufCovers * max(2u, cf->m_rows), 80u);
@ -2834,23 +2833,21 @@ int CCoverFlow::_coverLoader(CCoverFlow *cf)
{ {
update = cf->m_moved; update = cf->m_moved;
cf->m_moved = false; cf->m_moved = false;
LWP_MutexLock(cf->m_mutex); for(j = cf->m_items.size(); j >= bufferSize && cf->m_loadingCovers && !cf->m_moved && update; --j)
nextItem = cf->m_covers[cf->m_range / 2].index;
int diff = nextItem - firstItem;
if(diff < 0) diff *= (-1);
for(u32 j = bufferSize - diff; j <= bufferSize && cf->m_loadingCovers && update; ++j)
{ {
firstItem = cf->m_covers[cf->m_range / 2].index;
i = loopNum((j & 1) ? firstItem - (j + 1) / 2 : firstItem + j / 2, cf->m_items.size()); i = loopNum((j & 1) ? firstItem - (j + 1) / 2 : firstItem + j / 2, cf->m_items.size());
LWP_MutexLock(cf->m_mutex);
TexHandle.Cleanup(cf->m_items[i].texture); TexHandle.Cleanup(cf->m_items[i].texture);
cf->m_items[i].state = STATE_Loading; cf->m_items[i].state = STATE_Loading;
}
firstItem = nextItem;
LWP_MutexUnlock(cf->m_mutex); LWP_MutexUnlock(cf->m_mutex);
}
ret = CL_OK; ret = CL_OK;
for(u32 j = 0; j <= bufferSize && cf->m_loadingCovers && !cf->m_moved && update && ret != CL_NOMEM; ++j) for(j = 0; j <= bufferSize && cf->m_loadingCovers && !cf->m_moved && update && ret != CL_NOMEM; ++j)
{ {
firstItem = cf->m_covers[cf->m_range / 2].index;
i = loopNum((j & 1) ? firstItem - (j + 1) / 2 : firstItem + j / 2, cf->m_items.size()); i = loopNum((j & 1) ? firstItem - (j + 1) / 2 : firstItem + j / 2, cf->m_items.size());
if(cf->m_items[i].texture.data != NULL) if(cf->m_items[i].state != STATE_Loading)
continue; continue;
if((ret = cf->_loadCoverTex(i, cf->m_box, cf->m_useHQcover, false)) == CL_ERROR) if((ret = cf->_loadCoverTex(i, cf->m_box, cf->m_useHQcover, false)) == CL_ERROR)
{ {