| 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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 public: | 43 public: |
| 44 ICOImageDecoder(AlphaOption, GammaAndColorProfileOption, size_t maxDecodedBy
tes); | 44 ICOImageDecoder(AlphaOption, GammaAndColorProfileOption, size_t maxDecodedBy
tes); |
| 45 ~ICOImageDecoder() override; | 45 ~ICOImageDecoder() override; |
| 46 | 46 |
| 47 // ImageDecoder: | 47 // ImageDecoder: |
| 48 String filenameExtension() const override { return "ico"; } | 48 String filenameExtension() const override { return "ico"; } |
| 49 void onSetData(SegmentReader*) override; | 49 void onSetData(SegmentReader*) override; |
| 50 IntSize size() const override; | 50 IntSize size() const override; |
| 51 IntSize frameSizeAtIndex(size_t) const override; | 51 IntSize frameSizeAtIndex(size_t) const override; |
| 52 bool setSize(unsigned width, unsigned height) override; | 52 bool setSize(unsigned width, unsigned height) override; |
| 53 bool frameIsCompleteAtIndex(size_t) const override; | |
| 54 // CAUTION: setFailed() deletes all readers and decoders. Be careful to | 53 // CAUTION: setFailed() deletes all readers and decoders. Be careful to |
| 55 // avoid accessing deleted memory, especially when calling this from | 54 // avoid accessing deleted memory, especially when calling this from |
| 56 // inside BMPImageReader! | 55 // inside BMPImageReader! |
| 57 bool setFailed() override; | 56 bool setFailed() override; |
| 58 bool hotSpot(IntPoint&) const override; | 57 bool hotSpot(IntPoint&) const override; |
| 59 | 58 |
| 60 private: | 59 private: |
| 61 enum ImageType { | 60 enum ImageType { |
| 62 Unknown, | 61 Unknown, |
| 63 BMP, | 62 BMP, |
| 64 PNG, | 63 PNG, |
| 65 }; | 64 }; |
| 66 | 65 |
| 67 enum FileType { | 66 enum FileType { |
| 68 ICON = 1, | 67 ICON = 1, |
| 69 CURSOR = 2, | 68 CURSOR = 2, |
| 70 }; | 69 }; |
| 71 | 70 |
| 72 struct IconDirectoryEntry { | 71 struct IconDirectoryEntry { |
| 73 DISALLOW_NEW_EXCEPT_PLACEMENT_NEW(); | 72 DISALLOW_NEW_EXCEPT_PLACEMENT_NEW(); |
| 74 IntSize m_size; | 73 IntSize m_size; |
| 75 uint16_t m_bitCount; | 74 uint16_t m_bitCount; |
| 76 IntPoint m_hotSpot; | 75 IntPoint m_hotSpot; |
| 77 uint32_t m_imageOffset; | 76 uint32_t m_imageOffset; |
| 78 uint32_t m_byteSize; | |
| 79 }; | 77 }; |
| 80 | 78 |
| 81 // Returns true if |a| is a preferable icon entry to |b|. | 79 // Returns true if |a| is a preferable icon entry to |b|. |
| 82 // Larger sizes, or greater bitdepths at the same size, are preferable. | 80 // Larger sizes, or greater bitdepths at the same size, are preferable. |
| 83 static bool compareEntries(const IconDirectoryEntry& a, const IconDirectoryE
ntry& b); | 81 static bool compareEntries(const IconDirectoryEntry& a, const IconDirectoryE
ntry& b); |
| 84 | 82 |
| 85 // ImageDecoder: | 83 // ImageDecoder: |
| 86 virtual void decodeSize() { decode(0, true); } | 84 virtual void decodeSize() { decode(0, true); } |
| 87 size_t decodeFrameCount() override; | 85 size_t decodeFrameCount() override; |
| 88 void decode(size_t index) override { decode(index, false); } | 86 void decode(size_t index) override { decode(index, false); } |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 165 PNGDecoders m_pngDecoders; | 163 PNGDecoders m_pngDecoders; |
| 166 | 164 |
| 167 // Valid only while a BMPImageReader is decoding, this holds the size | 165 // Valid only while a BMPImageReader is decoding, this holds the size |
| 168 // for the particular entry being decoded. | 166 // for the particular entry being decoded. |
| 169 IntSize m_frameSize; | 167 IntSize m_frameSize; |
| 170 }; | 168 }; |
| 171 | 169 |
| 172 } // namespace blink | 170 } // namespace blink |
| 173 | 171 |
| 174 #endif | 172 #endif |
| OLD | NEW |