| 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 289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 300 // during processBitmasks(). | 300 // during processBitmasks(). |
| 301 if (isWindowsV4Plus()) { | 301 if (isWindowsV4Plus()) { |
| 302 m_bitMasks[0] = readUint32(40); | 302 m_bitMasks[0] = readUint32(40); |
| 303 m_bitMasks[1] = readUint32(44); | 303 m_bitMasks[1] = readUint32(44); |
| 304 m_bitMasks[2] = readUint32(48); | 304 m_bitMasks[2] = readUint32(48); |
| 305 m_bitMasks[3] = readUint32(52); | 305 m_bitMasks[3] = readUint32(52); |
| 306 } | 306 } |
| 307 | 307 |
| 308 // Detect top-down BMPs. | 308 // Detect top-down BMPs. |
| 309 if (m_infoHeader.biHeight < 0) { | 309 if (m_infoHeader.biHeight < 0) { |
| 310 // We can't negate INT32_MIN below to get a positive int32_t. |
| 311 // isInfoHeaderValid() will reject heights of 1 << 16 or larger anyway, |
| 312 // so just reject this bitmap now. |
| 313 if (m_infoHeader.biHeight == INT32_MIN) |
| 314 return m_parent->setFailed(); |
| 310 m_isTopDown = true; | 315 m_isTopDown = true; |
| 311 m_infoHeader.biHeight = -m_infoHeader.biHeight; | 316 m_infoHeader.biHeight = -m_infoHeader.biHeight; |
| 312 } | 317 } |
| 313 | 318 |
| 314 return true; | 319 return true; |
| 315 } | 320 } |
| 316 | 321 |
| 317 bool BMPImageReader::isInfoHeaderValid() const | 322 bool BMPImageReader::isInfoHeaderValid() const |
| 318 { | 323 { |
| 319 // Non-positive widths/heights are invalid. (We've already flipped the | 324 // Non-positive widths/heights are invalid. (We've already flipped the |
| (...skipping 492 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 812 // Finished decoding whole image. | 817 // Finished decoding whole image. |
| 813 return Success; | 818 return Success; |
| 814 } | 819 } |
| 815 | 820 |
| 816 void BMPImageReader::moveBufferToNextRow() | 821 void BMPImageReader::moveBufferToNextRow() |
| 817 { | 822 { |
| 818 m_coord.move(-m_coord.x(), m_isTopDown ? 1 : -1); | 823 m_coord.move(-m_coord.x(), m_isTopDown ? 1 : -1); |
| 819 } | 824 } |
| 820 | 825 |
| 821 } // namespace blink | 826 } // namespace blink |
| OLD | NEW |