Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(65)

Side by Side Diff: third_party/WebKit/Source/platform/image-decoders/ico/ICOImageDecoder.h

Issue 1962563002: Fix ImageDecoder::frameIsCompleteAtIndex - fully received instead of decoded. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Deferred decoding for ICO Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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 frameIsFullyReceivedAtIndex(size_t) const override;
54
53 // CAUTION: setFailed() deletes all readers and decoders. Be careful to 55 // CAUTION: setFailed() deletes all readers and decoders. Be careful to
54 // avoid accessing deleted memory, especially when calling this from 56 // avoid accessing deleted memory, especially when calling this from
55 // inside BMPImageReader! 57 // inside BMPImageReader!
56 bool setFailed() override; 58 bool setFailed() override;
57 bool hotSpot(IntPoint&) const override; 59 bool hotSpot(IntPoint&) const override;
58 60
59 private: 61 private:
60 enum ImageType { 62 enum ImageType {
61 Unknown, 63 Unknown,
62 BMP, 64 BMP,
63 PNG, 65 PNG,
64 }; 66 };
65 67
66 enum FileType { 68 enum FileType {
67 ICON = 1, 69 ICON = 1,
68 CURSOR = 2, 70 CURSOR = 2,
69 }; 71 };
70 72
71 struct IconDirectoryEntry { 73 struct IconDirectoryEntry {
72 DISALLOW_NEW_EXCEPT_PLACEMENT_NEW(); 74 DISALLOW_NEW_EXCEPT_PLACEMENT_NEW();
73 IntSize m_size; 75 IntSize m_size;
74 uint16_t m_bitCount; 76 uint16_t m_bitCount;
75 IntPoint m_hotSpot; 77 IntPoint m_hotSpot;
76 uint32_t m_imageOffset; 78 uint32_t m_imageOffset;
79 uint32_t m_byteSize;
77 }; 80 };
78 81
79 // Returns true if |a| is a preferable icon entry to |b|. 82 // Returns true if |a| is a preferable icon entry to |b|.
80 // Larger sizes, or greater bitdepths at the same size, are preferable. 83 // Larger sizes, or greater bitdepths at the same size, are preferable.
81 static bool compareEntries(const IconDirectoryEntry& a, const IconDirectoryE ntry& b); 84 static bool compareEntries(const IconDirectoryEntry& a, const IconDirectoryE ntry& b);
82 85
83 // ImageDecoder: 86 // ImageDecoder:
84 virtual void decodeSize() { decode(0, true); } 87 virtual void decodeSize() { decode(0, true); }
85 size_t decodeFrameCount() override; 88 size_t decodeFrameCount() override;
86 void decode(size_t index) override { decode(index, false); } 89 void decode(size_t index) override { decode(index, false); }
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
163 PNGDecoders m_pngDecoders; 166 PNGDecoders m_pngDecoders;
164 167
165 // Valid only while a BMPImageReader is decoding, this holds the size 168 // Valid only while a BMPImageReader is decoding, this holds the size
166 // for the particular entry being decoded. 169 // for the particular entry being decoded.
167 IntSize m_frameSize; 170 IntSize m_frameSize;
168 }; 171 };
169 172
170 } // namespace blink 173 } // namespace blink
171 174
172 #endif 175 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698