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 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
110 if (m_needToProcessBitmasks && !processBitmasks()) | 110 if (m_needToProcessBitmasks && !processBitmasks()) |
111 return false; | 111 return false; |
112 | 112 |
113 // Read and process the color table, if needed. | 113 // Read and process the color table, if needed. |
114 if (m_needToProcessColorTable && !processColorTable()) | 114 if (m_needToProcessColorTable && !processColorTable()) |
115 return false; | 115 return false; |
116 | 116 |
117 // Initialize the framebuffer if needed. | 117 // Initialize the framebuffer if needed. |
118 DCHECK(m_buffer); // Parent should set this before asking us to decode! | 118 DCHECK(m_buffer); // Parent should set this before asking us to decode! |
119 if (m_buffer->getStatus() == ImageFrame::FrameEmpty) { | 119 if (m_buffer->getStatus() == ImageFrame::FrameEmpty) { |
120 if (!m_buffer->setSizeAndColorSpace(m_parent->size().width(), | 120 if (!m_buffer->allocatePixelData(m_parent->size().width(), |
121 m_parent->size().height(), | 121 m_parent->size().height(), |
122 m_parent->colorSpaceForSkImages())) { | 122 m_parent->colorSpaceForSkImages())) { |
123 return m_parent->setFailed(); // Unable to allocate. | 123 return m_parent->setFailed(); // Unable to allocate. |
124 } | 124 } |
| 125 m_buffer->zeroFillPixelData(); |
125 m_buffer->setStatus(ImageFrame::FramePartial); | 126 m_buffer->setStatus(ImageFrame::FramePartial); |
126 // setSize() calls eraseARGB(), which resets the alpha flag, so we force | 127 // setSize() calls eraseARGB(), which resets the alpha flag, so we force |
127 // it back to false here. We'll set it true below in all cases where | 128 // it back to false here. We'll set it true below in all cases where |
128 // these 0s could actually show through. | 129 // these 0s could actually show through. |
129 m_buffer->setHasAlpha(false); | 130 m_buffer->setHasAlpha(false); |
130 | 131 |
131 // For BMPs, the frame always fills the entire image. | 132 // For BMPs, the frame always fills the entire image. |
132 m_buffer->setOriginalFrameRect(IntRect(IntPoint(), m_parent->size())); | 133 m_buffer->setOriginalFrameRect(IntRect(IntPoint(), m_parent->size())); |
133 | 134 |
134 if (!m_isTopDown) | 135 if (!m_isTopDown) |
(...skipping 707 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
842 | 843 |
843 // Finished decoding whole image. | 844 // Finished decoding whole image. |
844 return Success; | 845 return Success; |
845 } | 846 } |
846 | 847 |
847 void BMPImageReader::moveBufferToNextRow() { | 848 void BMPImageReader::moveBufferToNextRow() { |
848 m_coord.move(-m_coord.x(), m_isTopDown ? 1 : -1); | 849 m_coord.move(-m_coord.x(), m_isTopDown ? 1 : -1); |
849 } | 850 } |
850 | 851 |
851 } // namespace blink | 852 } // namespace blink |
OLD | NEW |