summaryrefslogtreecommitdiffstats
path: root/WebCore/platform/image-decoders/bmp/BMPImageReader.h
diff options
context:
space:
mode:
Diffstat (limited to 'WebCore/platform/image-decoders/bmp/BMPImageReader.h')
-rw-r--r--WebCore/platform/image-decoders/bmp/BMPImageReader.h30
1 files changed, 8 insertions, 22 deletions
diff --git a/WebCore/platform/image-decoders/bmp/BMPImageReader.h b/WebCore/platform/image-decoders/bmp/BMPImageReader.h
index 3536e3b..a30a721 100644
--- a/WebCore/platform/image-decoders/bmp/BMPImageReader.h
+++ b/WebCore/platform/image-decoders/bmp/BMPImageReader.h
@@ -57,8 +57,7 @@ namespace WebCore {
uint32_t result;
memcpy(&result, &data->data()[offset], 4);
#if CPU(BIG_ENDIAN)
- result = ((result & 0xff) << 24) | ((result & 0xff00) << 8) |
- ((result & 0xff0000) >> 8) | ((result & 0xff000000) >> 24);
+ result = ((result & 0xff) << 24) | ((result & 0xff00) << 8) | ((result & 0xff0000) >> 8) | ((result & 0xff000000) >> 24);
#endif
return result;
}
@@ -67,10 +66,7 @@ namespace WebCore {
// |startOffset| points to the start of the BMP within the file.
// |buffer| points at an empty RGBA32Buffer that we'll initialize and
// fill with decoded data.
- BMPImageReader(ImageDecoder* parent,
- size_t decodedAndHeaderOffset,
- size_t imgDataOffset,
- bool usesAndMask);
+ BMPImageReader(ImageDecoder* parent, size_t decodedAndHeaderOffset, size_t imgDataOffset, bool usesAndMask);
void setBuffer(RGBA32Buffer* buffer) { m_buffer = buffer; }
void setData(SharedBuffer* data) { m_data = data; }
@@ -179,9 +175,7 @@ namespace WebCore {
// image", so downwards for m_isTopDown images and upwards otherwise.
inline bool pastEndOfImage(int numRows)
{
- return m_isTopDown
- ? ((m_coord.y() + numRows) >= m_parent->size().height())
- : ((m_coord.y() - numRows) < 0);
+ return m_isTopDown ? ((m_coord.y() + numRows) >= m_parent->size().height()) : ((m_coord.y() - numRows) < 0);
}
// Returns the pixel data for the current X coordinate in a uint32_t.
@@ -203,8 +197,7 @@ namespace WebCore {
uint32_t pixel;
memcpy(&pixel, &m_data->data()[m_decodedOffset + offset], 3);
#if CPU(BIG_ENDIAN)
- pixel = ((pixel & 0xff00) << 8) | ((pixel & 0xff0000) >> 8) |
- ((pixel & 0xff000000) >> 24);
+ pixel = ((pixel & 0xff00) << 8) | ((pixel & 0xff0000) >> 8) | ((pixel & 0xff000000) >> 24);
#endif
return pixel;
}
@@ -222,17 +215,13 @@ namespace WebCore {
// in the given pixel data.
inline unsigned getComponent(uint32_t pixel, int component) const
{
- return ((pixel & m_bitMasks[component]) >>
- m_bitShiftsRight[component]) << m_bitShiftsLeft[component];
+ return ((pixel & m_bitMasks[component]) >> m_bitShiftsRight[component]) << m_bitShiftsLeft[component];
}
inline unsigned getAlpha(uint32_t pixel) const
{
// For images without alpha, return alpha of 0xff.
- if (m_bitMasks[3] == 0)
- return 0xff;
-
- return getComponent(pixel, 3);
+ return m_bitMasks[3] ? getComponent(pixel, 3) : 0xff;
}
// Sets the current pixel to the color given by |colorIndex|. This also
@@ -240,9 +229,7 @@ namespace WebCore {
// right by one.
inline void setI(size_t colorIndex)
{
- setRGBA(m_colorTable[colorIndex].rgbRed,
- m_colorTable[colorIndex].rgbGreen,
- m_colorTable[colorIndex].rgbBlue, 0xff);
+ setRGBA(m_colorTable[colorIndex].rgbRed, m_colorTable[colorIndex].rgbGreen, m_colorTable[colorIndex].rgbBlue, 0xff);
}
// Like setI(), but with the individual component values specified.
@@ -251,8 +238,7 @@ namespace WebCore {
unsigned blue,
unsigned alpha)
{
- m_buffer->setRGBA(m_coord.x(), m_coord.y(), red, green, blue,
- alpha);
+ m_buffer->setRGBA(m_coord.x(), m_coord.y(), red, green, blue, alpha);
m_coord.move(1, 0);
}