- uint32_t loadingIndex = mLoadWaitingQueue.front();
- mLoadWaitingQueue.erase(mLoadWaitingQueue.begin());
- mOnLoading = true;
- RequestFrameLoading(loadingIndex);
+ // The frames of a single animated image can not be loaded parallelly.
+ // Therefore, a frame is now loading, other orders are waiting.
+ // And, after the frame is loaded, requests load of next order.
+ if(!mLoadWaitingQueue.empty())
+ {
+ uint32_t loadingIndex = mLoadWaitingQueue.front();
+ mLoadWaitingQueue.erase(mLoadWaitingQueue.begin());
+ RequestFrameLoading(loadingIndex, loadingIndex == FIRST_FRAME_INDEX, false);
+ }
+ else if(mQueue.Count() == 1u && textureInformation.frameCount > SINGLE_IMAGE_COUNT)
+ {
+ // There is only an image in queue and no waiting queue.
+ // Request to load batch once again.
+ uint32_t batchFrameIndex = 0u;
+ if(!mLoadWaitingQueue.empty())
+ {
+ batchFrameIndex = (mLoadWaitingQueue.back() + 1) % mFrameCount;
+ }
+ else
+ {
+ batchFrameIndex = (mQueue.Back().mFrameNumber + 1) % mFrameCount;
+ }
+ LoadBatch(batchFrameIndex);
+ }