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