| 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 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 78 // Larger sizes, or greater bitdepths at the same size, are preferable. | 78 // Larger sizes, or greater bitdepths at the same size, are preferable. |
| 79 static bool compareEntries(const IconDirectoryEntry& a, const IconDirectoryE
ntry& b); | 79 static bool compareEntries(const IconDirectoryEntry& a, const IconDirectoryE
ntry& b); |
| 80 | 80 |
| 81 // ImageDecoder: | 81 // ImageDecoder: |
| 82 virtual void decodeSize() { decode(0, true); } | 82 virtual void decodeSize() { decode(0, true); } |
| 83 size_t decodeFrameCount() override; | 83 size_t decodeFrameCount() override; |
| 84 void decode(size_t index) override { decode(index, false); } | 84 void decode(size_t index) override { decode(index, false); } |
| 85 | 85 |
| 86 inline uint16_t readUint16(int offset) const | 86 inline uint16_t readUint16(int offset) const |
| 87 { | 87 { |
| 88 // TODO (scroggo): This consolidates the data, meaning unnecessary copie
s. | 88 return BMPImageReader::readUint16(m_data.get(), m_decodedOffset + offset
); |
| 89 return BMPImageReader::readUint16(&m_data->data()[m_decodedOffset + offs
et]); | |
| 90 } | 89 } |
| 91 | 90 |
| 92 inline uint32_t readUint32(int offset) const | 91 inline uint32_t readUint32(int offset) const |
| 93 { | 92 { |
| 94 // TODO (scroggo): This consolidates the data, meaning unnecessary copie
s. | 93 return BMPImageReader::readUint32(m_data.get(), m_decodedOffset + offset
); |
| 95 return BMPImageReader::readUint32(&m_data->data()[m_decodedOffset + offs
et]); | |
| 96 } | 94 } |
| 97 | 95 |
| 98 // If the desired PNGImageDecoder exists, gives it the appropriate data. | 96 // If the desired PNGImageDecoder exists, gives it the appropriate data. |
| 99 void setDataForPNGDecoderAtIndex(size_t); | 97 void setDataForPNGDecoderAtIndex(size_t); |
| 100 | 98 |
| 101 // Decodes the entry at |index|. If |onlySize| is true, stops decoding | 99 // Decodes the entry at |index|. If |onlySize| is true, stops decoding |
| 102 // after calculating the image size. If decoding fails but there is no | 100 // after calculating the image size. If decoding fails but there is no |
| 103 // more data coming, sets the "decode failure" flag. | 101 // more data coming, sets the "decode failure" flag. |
| 104 void decode(size_t index, bool onlySize); | 102 void decode(size_t index, bool onlySize); |
| 105 | 103 |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 151 PNGDecoders m_pngDecoders; | 149 PNGDecoders m_pngDecoders; |
| 152 | 150 |
| 153 // Valid only while a BMPImageReader is decoding, this holds the size | 151 // Valid only while a BMPImageReader is decoding, this holds the size |
| 154 // for the particular entry being decoded. | 152 // for the particular entry being decoded. |
| 155 IntSize m_frameSize; | 153 IntSize m_frameSize; |
| 156 }; | 154 }; |
| 157 | 155 |
| 158 } // namespace blink | 156 } // namespace blink |
| 159 | 157 |
| 160 #endif | 158 #endif |
| OLD | NEW |