diff options
Diffstat (limited to 'WebCore/platform/image-decoders/bmp/BMPImageDecoder.cpp')
-rw-r--r-- | WebCore/platform/image-decoders/bmp/BMPImageDecoder.cpp | 24 |
1 files changed, 9 insertions, 15 deletions
diff --git a/WebCore/platform/image-decoders/bmp/BMPImageDecoder.cpp b/WebCore/platform/image-decoders/bmp/BMPImageDecoder.cpp index de0690f..fb9f9f2 100644 --- a/WebCore/platform/image-decoders/bmp/BMPImageDecoder.cpp +++ b/WebCore/platform/image-decoders/bmp/BMPImageDecoder.cpp @@ -41,9 +41,7 @@ namespace WebCore { static const size_t sizeOfFileHeader = 14; BMPImageDecoder::BMPImageDecoder() - : ImageDecoder() - , m_allDataReceived(false) - , m_decodedOffset(0) + : m_decodedOffset(0) { } @@ -53,7 +51,6 @@ void BMPImageDecoder::setData(SharedBuffer* data, bool allDataReceived) return; ImageDecoder::setData(data, allDataReceived); - m_allDataReceived = allDataReceived; if (m_reader) m_reader->setData(data); } @@ -61,7 +58,7 @@ void BMPImageDecoder::setData(SharedBuffer* data, bool allDataReceived) bool BMPImageDecoder::isSizeAvailable() { if (!ImageDecoder::isSizeAvailable() && !failed()) - decodeWithCheckForDataEnded(true); + decode(true); return ImageDecoder::isSizeAvailable(); } @@ -76,31 +73,29 @@ RGBA32Buffer* BMPImageDecoder::frameBufferAtIndex(size_t index) RGBA32Buffer* buffer = &m_frameBufferCache.first(); if (buffer->status() != RGBA32Buffer::FrameComplete && !failed()) - decodeWithCheckForDataEnded(false); + decode(false); return buffer; } -void BMPImageDecoder::decodeWithCheckForDataEnded(bool onlySize) +void BMPImageDecoder::decode(bool onlySize) { if (failed()) return; // If we couldn't decode the image but we've received all the data, decoding // has failed. - if (!decode(onlySize) && m_allDataReceived) + if (!decodeHelper(onlySize) && isAllDataReceived()) setFailed(); } -bool BMPImageDecoder::decode(bool onlySize) +bool BMPImageDecoder::decodeHelper(bool onlySize) { size_t imgDataOffset = 0; - if ((m_decodedOffset < sizeOfFileHeader) - && !processFileHeader(&imgDataOffset)) + if ((m_decodedOffset < sizeOfFileHeader) && !processFileHeader(&imgDataOffset)) return false; if (!m_reader) { - m_reader.set(new BMPImageReader(this, m_decodedOffset, imgDataOffset, - false)); + m_reader.set(new BMPImageReader(this, m_decodedOffset, imgDataOffset, false)); m_reader->setData(m_data.get()); } @@ -118,8 +113,7 @@ bool BMPImageDecoder::processFileHeader(size_t* imgDataOffset) ASSERT(!m_decodedOffset); if (m_data->size() < sizeOfFileHeader) return false; - const uint16_t fileType = - (m_data->data()[0] << 8) | static_cast<uint8_t>(m_data->data()[1]); + const uint16_t fileType = (m_data->data()[0] << 8) | static_cast<uint8_t>(m_data->data()[1]); *imgDataOffset = readUint32(10); m_decodedOffset = sizeOfFileHeader; |