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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
44 // ImageDecoder: | 44 // ImageDecoder: |
45 String filenameExtension() const override { return "bmp"; } | 45 String filenameExtension() const override { return "bmp"; } |
46 void setData(SharedBuffer*, bool allDataReceived) override; | 46 void setData(SharedBuffer*, bool allDataReceived) override; |
47 // CAUTION: setFailed() deletes |m_reader|. Be careful to avoid | 47 // CAUTION: setFailed() deletes |m_reader|. Be careful to avoid |
48 // accessing deleted memory, especially when calling this from inside | 48 // accessing deleted memory, especially when calling this from inside |
49 // BMPImageReader! | 49 // BMPImageReader! |
50 bool setFailed() override; | 50 bool setFailed() override; |
51 | 51 |
52 private: | 52 private: |
53 // ImageDecoder: | 53 // ImageDecoder: |
54 void decodeSize() override { decode(true); } | 54 void decodeSize() override |
| 55 { |
| 56 decode(true); |
| 57 reportStats(ImageBMP); |
| 58 } |
55 void decode(size_t) override { decode(false); } | 59 void decode(size_t) override { decode(false); } |
56 | 60 |
57 inline uint32_t readUint32(int offset) const | 61 inline uint32_t readUint32(int offset) const |
58 { | 62 { |
59 return BMPImageReader::readUint32(m_data.get(), m_decodedOffset + offset
); | 63 return BMPImageReader::readUint32(m_data.get(), m_decodedOffset + offset
); |
60 } | 64 } |
61 | 65 |
62 // Decodes the image. If |onlySize| is true, stops decoding after | 66 // Decodes the image. If |onlySize| is true, stops decoding after |
63 // calculating the image size. If decoding fails but there is no more | 67 // calculating the image size. If decoding fails but there is no more |
64 // data coming, sets the "decode failure" flag. | 68 // data coming, sets the "decode failure" flag. |
(...skipping 13 matching lines...) Expand all Loading... |
78 // BMPImageReader takes over this will not be updated further. | 82 // BMPImageReader takes over this will not be updated further. |
79 size_t m_decodedOffset; | 83 size_t m_decodedOffset; |
80 | 84 |
81 // The reader used to do most of the BMP decoding. | 85 // The reader used to do most of the BMP decoding. |
82 OwnPtr<BMPImageReader> m_reader; | 86 OwnPtr<BMPImageReader> m_reader; |
83 }; | 87 }; |
84 | 88 |
85 } // namespace blink | 89 } // namespace blink |
86 | 90 |
87 #endif | 91 #endif |
OLD | NEW |