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

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

Issue 2081013002: Re-enable DrMemory test for ICOImageDecoderTests.parseAndDecodeByteByByte. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: nit, comment. 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 23 matching lines...) Expand all
34 #include "platform/image-decoders/FastSharedBufferReader.h" 34 #include "platform/image-decoders/FastSharedBufferReader.h"
35 #include "platform/image-decoders/bmp/BMPImageReader.h" 35 #include "platform/image-decoders/bmp/BMPImageReader.h"
36 #include <memory> 36 #include <memory>
37 37
38 namespace blink { 38 namespace blink {
39 39
40 class PNGImageDecoder; 40 class PNGImageDecoder;
41 41
42 // This class decodes the ICO and CUR image formats. 42 // This class decodes the ICO and CUR image formats.
43 class PLATFORM_EXPORT ICOImageDecoder final : public ImageDecoder { 43 class PLATFORM_EXPORT ICOImageDecoder final : public ImageDecoder {
44 WTF_MAKE_NONCOPYABLE(ICOImageDecoder);
44 public: 45 public:
45 ICOImageDecoder(AlphaOption, GammaAndColorProfileOption, size_t maxDecodedBy tes); 46 ICOImageDecoder(AlphaOption, GammaAndColorProfileOption, size_t maxDecodedBy tes);
46 ~ICOImageDecoder() override; 47 ~ICOImageDecoder() override;
47 48
48 // ImageDecoder: 49 // ImageDecoder:
49 String filenameExtension() const override { return "ico"; } 50 String filenameExtension() const override { return "ico"; }
50 void onSetData(SegmentReader*) override; 51 void onSetData(SegmentReader*) override;
51 IntSize size() const override; 52 IntSize size() const override;
52 IntSize frameSizeAtIndex(size_t) const override; 53 IntSize frameSizeAtIndex(size_t) const override;
53 bool setSize(unsigned width, unsigned height) override; 54 bool setSize(unsigned width, unsigned height) override;
(...skipping 11 matching lines...) Expand all
65 PNG, 66 PNG,
66 }; 67 };
67 68
68 enum FileType { 69 enum FileType {
69 ICON = 1, 70 ICON = 1,
70 CURSOR = 2, 71 CURSOR = 2,
71 }; 72 };
72 73
73 struct IconDirectoryEntry { 74 struct IconDirectoryEntry {
74 DISALLOW_NEW_EXCEPT_PLACEMENT_NEW(); 75 DISALLOW_NEW_EXCEPT_PLACEMENT_NEW();
76 IconDirectoryEntry()
77 : m_bitCount(0)
78 , m_imageOffset(0)
79 , m_byteSize(0)
80 {
81 }
75 IntSize m_size; 82 IntSize m_size;
76 uint16_t m_bitCount; 83 uint16_t m_bitCount;
77 IntPoint m_hotSpot; 84 IntPoint m_hotSpot;
78 uint32_t m_imageOffset; 85 uint32_t m_imageOffset;
79 uint32_t m_byteSize; 86 uint32_t m_byteSize;
80 }; 87 };
81 88
82 // Returns true if |a| is a preferable icon entry to |b|. 89 // Returns true if |a| is a preferable icon entry to |b|.
83 // Larger sizes, or greater bitdepths at the same size, are preferable. 90 // Larger sizes, or greater bitdepths at the same size, are preferable.
84 static bool compareEntries(const IconDirectoryEntry& a, const IconDirectoryE ntry& b); 91 static bool compareEntries(const IconDirectoryEntry& a, const IconDirectoryE ntry& b);
85 92
86 // ImageDecoder: 93 // ImageDecoder:
87 virtual void decodeSize() { decode(0, true); } 94 void decodeSize() override { decode(0, true); }
88 size_t decodeFrameCount() override; 95 size_t decodeFrameCount() override;
89 void decode(size_t index) override { decode(index, false); } 96 void decode(size_t index) override { decode(index, false); }
90 97
91 // TODO (scroggo): These functions are identical to functions in BMPImageRea der. Share code? 98 // TODO (scroggo): These functions are identical to functions in BMPImageRea der. Share code?
92 inline uint8_t readUint8(size_t offset) const 99 inline uint8_t readUint8(size_t offset) const
93 { 100 {
94 return m_fastReader.getOneByte(m_decodedOffset + offset); 101 return m_fastReader.getOneByte(m_decodedOffset + offset);
95 } 102 }
96 103
97 inline uint16_t readUint16(int offset) const 104 inline uint16_t readUint16(int offset) const
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
166 PNGDecoders m_pngDecoders; 173 PNGDecoders m_pngDecoders;
167 174
168 // Valid only while a BMPImageReader is decoding, this holds the size 175 // Valid only while a BMPImageReader is decoding, this holds the size
169 // for the particular entry being decoded. 176 // for the particular entry being decoded.
170 IntSize m_frameSize; 177 IntSize m_frameSize;
171 }; 178 };
172 179
173 } // namespace blink 180 } // namespace blink
174 181
175 #endif 182 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698