size_t GIFImageDecoder::clearCacheExceptTwoFrames(size_t clearExceptFrame1, size_t clearExceptFrame2) { size_t frameBytesCleared = 0; for (size_t i = 0; i < m_frameBufferCache.size(); ++i) { if (m_frameBufferCache[i].getStatus() != ImageFrame::FrameEmpty && i != clearExceptFrame1 && i != clearExceptFrame2) { frameBytesCleared += frameBytesAtIndex(i); clearFrameBuffer(i); } } return frameBytesCleared; }
size_t ImageDecoder::clearCacheExceptFrame(size_t clearExceptFrame) { // Don't clear if there are no frames or only one frame. if (m_frameBufferCache.size() <= 1) return 0; size_t frameBytesCleared = 0; for (size_t i = 0; i < m_frameBufferCache.size(); ++i) { if (i != clearExceptFrame) { frameBytesCleared += frameBytesAtIndex(i); clearFrameBuffer(i); } } return frameBytesCleared; }
void updateScreen() { int i, j, r, g, b; clearFrameBuffer(0x000000); for (j = 0; j < HEIGHT; j++) { for (i = 0; i < WIDTH; i++) { r = rand() % 256; g = rand() % 256; b = rand() % 256; buf[j * bufPitch + i] = (r << 18) + (g << 8) + b; } } }