OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2008, 2009, Google Inc. All rights reserved. | 2 * Copyright (c) 2008, 2009, Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
114 return false; | 114 return false; |
115 | 115 |
116 // Read and process the color table, if needed. | 116 // Read and process the color table, if needed. |
117 if (m_needToProcessColorTable && !processColorTable()) | 117 if (m_needToProcessColorTable && !processColorTable()) |
118 return false; | 118 return false; |
119 | 119 |
120 // Initialize the framebuffer if needed. | 120 // Initialize the framebuffer if needed. |
121 ASSERT(m_buffer); // Parent should set this before asking us to decode! | 121 ASSERT(m_buffer); // Parent should set this before asking us to decode! |
122 if (m_buffer->getStatus() == ImageFrame::FrameEmpty) { | 122 if (m_buffer->getStatus() == ImageFrame::FrameEmpty) { |
123 if (!m_buffer->setSizeAndColorSpace(m_parent->size().width(), | 123 if (!m_buffer->setSizeAndColorSpace(m_parent->size().width(), |
124 m_parent->size().height(), nullptr)) | 124 m_parent->size().height(), |
| 125 m_parent->colorSpace())) { |
125 return m_parent->setFailed(); // Unable to allocate. | 126 return m_parent->setFailed(); // Unable to allocate. |
| 127 } |
126 m_buffer->setStatus(ImageFrame::FramePartial); | 128 m_buffer->setStatus(ImageFrame::FramePartial); |
127 // setSize() calls eraseARGB(), which resets the alpha flag, so we force | 129 // setSize() calls eraseARGB(), which resets the alpha flag, so we force |
128 // it back to false here. We'll set it true below in all cases where | 130 // it back to false here. We'll set it true below in all cases where |
129 // these 0s could actually show through. | 131 // these 0s could actually show through. |
130 m_buffer->setHasAlpha(false); | 132 m_buffer->setHasAlpha(false); |
131 | 133 |
132 // For BMPs, the frame always fills the entire image. | 134 // For BMPs, the frame always fills the entire image. |
133 m_buffer->setOriginalFrameRect(IntRect(IntPoint(), m_parent->size())); | 135 m_buffer->setOriginalFrameRect(IntRect(IntPoint(), m_parent->size())); |
134 | 136 |
135 if (!m_isTopDown) | 137 if (!m_isTopDown) |
(...skipping 713 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
849 | 851 |
850 // Finished decoding whole image. | 852 // Finished decoding whole image. |
851 return Success; | 853 return Success; |
852 } | 854 } |
853 | 855 |
854 void BMPImageReader::moveBufferToNextRow() { | 856 void BMPImageReader::moveBufferToNextRow() { |
855 m_coord.move(-m_coord.x(), m_isTopDown ? 1 : -1); | 857 m_coord.move(-m_coord.x(), m_isTopDown ? 1 : -1); |
856 } | 858 } |
857 | 859 |
858 } // namespace blink | 860 } // namespace blink |
OLD | NEW |