void BitmapImage::cacheFrame(size_t index) { size_t numFrames = frameCount(); ASSERT(m_decodedSize == 0 || numFrames > 1); if (m_frames.size() < numFrames) m_frames.grow(numFrames); m_frames[index].m_frame = m_source.createFrameAtIndex(index); if (numFrames == 1 && m_frames[index].m_frame) checkForSolidColor(); m_frames[index].m_haveMetadata = true; m_frames[index].m_isComplete = m_source.frameIsCompleteAtIndex(index); if (repetitionCount(false) != cAnimationNone) m_frames[index].m_duration = m_source.frameDurationAtIndex(index); m_frames[index].m_hasAlpha = m_source.frameHasAlphaAtIndex(index); const IntSize frameSize(index ? m_source.frameSizeAtIndex(index) : m_size); if (frameSize != m_size) m_hasUniformFrameSize = false; if (m_frames[index].m_frame) { const int deltaBytes = frameBytes(frameSize); m_decodedSize += deltaBytes; if (imageObserver()) imageObserver()->decodedSizeChanged(this, deltaBytes); } }
void BitmapImage::destroyDecodedDataIfNecessary(bool destroyAll) { // Animated images >5MB are considered large enough that we'll only hang on // to one frame at a time. static const unsigned cLargeAnimationCutoff = 5242880; if (frameCount() * frameBytes(m_size) > cLargeAnimationCutoff) destroyDecodedData(destroyAll); }
void BitmapImage::destroyMetadataAndNotify(int framesCleared) { m_isSolidColor = false; invalidatePlatformData(); const int deltaBytes = framesCleared * -frameBytes(m_size); m_decodedSize += deltaBytes; if (deltaBytes && imageObserver()) imageObserver()->decodedSizeChanged(this, deltaBytes); }
void BitmapImage::destroyMetadataAndNotify(int framesCleared) { m_isSolidColor = false; m_checkedForSolidColor = false; invalidatePlatformData(); int deltaBytes = framesCleared * -frameBytes(m_size); m_decodedSize += deltaBytes; if (framesCleared > 0) { deltaBytes -= m_decodedPropertiesSize; m_decodedPropertiesSize = 0; } if (deltaBytes && imageObserver()) imageObserver()->decodedSizeChanged(this, deltaBytes); }