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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
51 // BMPImageReader! | 51 // BMPImageReader! |
52 virtual bool setFailed() OVERRIDE; | 52 virtual bool setFailed() OVERRIDE; |
53 | 53 |
54 private: | 54 private: |
55 inline uint32_t readUint32(int offset) const | 55 inline uint32_t readUint32(int offset) const |
56 { | 56 { |
57 return BMPImageReader::readUint32(m_data.get(), m_decodedOffset + offset
); | 57 return BMPImageReader::readUint32(m_data.get(), m_decodedOffset + offset
); |
58 } | 58 } |
59 | 59 |
60 // Decodes the image. If |onlySize| is true, stops decoding after | 60 // Decodes the image. If |onlySize| is true, stops decoding after |
61 // calculating the image size. If decoding fails but there is no more | 61 // calculating the image size. If decoding fails but there is no more |
62 // data coming, sets the "decode failure" flag. | 62 // data coming, sets the "decode failure" flag. |
63 void decode(bool onlySize); | 63 void decode(bool onlySize); |
64 | 64 |
65 // Decodes the image. If |onlySize| is true, stops decoding after | 65 // Decodes the image. If |onlySize| is true, stops decoding after |
66 // calculating the image size. Returns whether decoding succeeded. | 66 // calculating the image size. Returns whether decoding succeeded. |
67 bool decodeHelper(bool onlySize); | 67 bool decodeHelper(bool onlySize); |
68 | 68 |
69 // Processes the file header at the beginning of the data. Sets | 69 // Processes the file header at the beginning of the data. Sets |
70 // |*imgDataOffset| based on the header contents. Returns true if the | 70 // |imgDataOffset| based on the header contents. Returns true if the |
71 // file header could be decoded. | 71 // file header could be decoded. |
72 bool processFileHeader(size_t* imgDataOffset); | 72 bool processFileHeader(size_t& imgDataOffset); |
73 | 73 |
74 // An index into |m_data| representing how much we've already decoded. | 74 // An index into |m_data| representing how much we've already decoded. |
75 // Note that this only tracks data _this_ class decodes; once the | 75 // Note that this only tracks data _this_ class decodes; once the |
76 // BMPImageReader takes over this will not be updated further. | 76 // BMPImageReader takes over this will not be updated further. |
77 size_t m_decodedOffset; | 77 size_t m_decodedOffset; |
78 | 78 |
79 // The reader used to do most of the BMP decoding. | 79 // The reader used to do most of the BMP decoding. |
80 OwnPtr<BMPImageReader> m_reader; | 80 OwnPtr<BMPImageReader> m_reader; |
81 }; | 81 }; |
82 | 82 |
83 } // namespace blink | 83 } // namespace blink |
84 | 84 |
85 #endif | 85 #endif |
OLD | NEW |