summaryrefslogtreecommitdiff
path: root/Source/WebCore/platform/image-decoders/bmp/BMPImageReader.cpp
diff options
context:
space:
mode:
authorLorry Tar Creator <lorry-tar-importer@lorry>2017-06-27 06:07:23 +0000
committerLorry Tar Creator <lorry-tar-importer@lorry>2017-06-27 06:07:23 +0000
commit1bf1084f2b10c3b47fd1a588d85d21ed0eb41d0c (patch)
tree46dcd36c86e7fbc6e5df36deb463b33e9967a6f7 /Source/WebCore/platform/image-decoders/bmp/BMPImageReader.cpp
parent32761a6cee1d0dee366b885b7b9c777e67885688 (diff)
downloadWebKitGtk-tarball-master.tar.gz
Diffstat (limited to 'Source/WebCore/platform/image-decoders/bmp/BMPImageReader.cpp')
-rw-r--r--Source/WebCore/platform/image-decoders/bmp/BMPImageReader.cpp24
1 files changed, 10 insertions, 14 deletions
diff --git a/Source/WebCore/platform/image-decoders/bmp/BMPImageReader.cpp b/Source/WebCore/platform/image-decoders/bmp/BMPImageReader.cpp
index 5c005534e..2212f14ff 100644
--- a/Source/WebCore/platform/image-decoders/bmp/BMPImageReader.cpp
+++ b/Source/WebCore/platform/image-decoders/bmp/BMPImageReader.cpp
@@ -77,17 +77,12 @@ bool BMPImageReader::decodeBMP(bool onlySize)
// Initialize the framebuffer if needed.
ASSERT(m_buffer); // Parent should set this before asking us to decode!
- if (m_buffer->status() == ImageFrame::FrameEmpty) {
- if (!m_buffer->setSize(m_parent->size().width(), m_parent->size().height()))
+ if (m_buffer->isEmpty()) {
+ if (!m_buffer->initialize(m_parent->size(), m_parent->premultiplyAlpha()))
return m_parent->setFailed(); // Unable to allocate.
- m_buffer->setStatus(ImageFrame::FramePartial);
- // setSize() calls eraseARGB(), which resets the alpha flag, so we force
- // it back to false here. We'll set it true below in all cases where
- // these 0s could actually show through.
- m_buffer->setHasAlpha(false);
- // For BMPs, the frame always fills the entire image.
- m_buffer->setOriginalFrameRect(IntRect(IntPoint(), m_parent->size()));
+ m_buffer->setDecoding(ImageFrame::Decoding::Partial);
+ m_buffer->setHasAlpha(false);
if (!m_isTopDown)
m_coord.setY(m_parent->size().height() - 1);
@@ -122,7 +117,7 @@ bool BMPImageReader::decodeBMP(bool onlySize)
}
// Done!
- m_buffer->setStatus(ImageFrame::FrameComplete);
+ m_buffer->setDecoding(ImageFrame::Decoding::Complete);
return true;
}
@@ -171,7 +166,7 @@ bool BMPImageReader::processInfoHeader()
return m_parent->setFailed();
// Set our size.
- if (!m_parent->setSize(m_infoHeader.biWidth, m_infoHeader.biHeight))
+ if (!m_parent->setSize(IntSize(m_infoHeader.biWidth, m_infoHeader.biHeight)))
return false;
// For paletted images, bitmaps can set biClrUsed to 0 to mean "all
@@ -674,7 +669,7 @@ BMPImageReader::ProcessingResult BMPImageReader::processNonRLEData(bool inRLE, i
// transparent, on the assumption that most ICOs on the
// web will not be doing a lot of inverting.
if (colorIndex) {
- setRGBA(0, 0, 0, 0);
+ setPixel(0, 0, 0, 0);
m_buffer->setHasAlpha(true);
} else
m_coord.move(1, 0);
@@ -707,13 +702,14 @@ BMPImageReader::ProcessingResult BMPImageReader::processNonRLEData(bool inRLE, i
} else {
m_seenNonZeroAlphaPixel = true;
if (m_seenZeroAlphaPixel) {
- m_buffer->zeroFillPixelData();
+ m_buffer->backingStore()->clear();
+ m_buffer->setHasAlpha(true);
m_seenZeroAlphaPixel = false;
} else if (alpha != 255)
m_buffer->setHasAlpha(true);
}
- setRGBA(getComponent(pixel, 0), getComponent(pixel, 1),
+ setPixel(getComponent(pixel, 0), getComponent(pixel, 1),
getComponent(pixel, 2), alpha);
}
}