Bug 1890277: part 4) Add CSPParser support for the `trusted-types` directive, guarded...
[gecko.git] / image / ICOFileHeaders.h
bloba47919b91a316d8c910fc8ae31648806dbd112a3
1 /* This Source Code Form is subject to the terms of the Mozilla Public
2 * License, v. 2.0. If a copy of the MPL was not distributed with this
3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
5 #ifndef mozilla_image_ICOFileHeaders_h
6 #define mozilla_image_ICOFileHeaders_h
8 namespace mozilla {
9 namespace image {
11 #define ICONFILEHEADERSIZE 6
12 #define ICODIRENTRYSIZE 16
13 #define PNGSIGNATURESIZE 8
14 #define BMPFILEHEADERSIZE 14
16 /**
17 * The header that comes right at the start of an icon file. (This
18 * corresponds to the Windows ICONDIR structure.)
20 struct IconFileHeader {
21 /**
22 * Must be set to 0;
24 uint16_t mReserved;
25 /**
26 * 1 for icon (.ICO) image (or 2 for cursor (.CUR) image (icon with the
27 * addition of a hotspot), but we don't support cursor).
29 uint16_t mType;
30 /**
31 * The number of BMP/PNG images contained in the icon file.
33 uint16_t mCount;
36 /**
37 * For each BMP/PNG image that the icon file contains there must be a
38 * corresponding icon dir entry. (This corresponds to the Windows
39 * ICONDIRENTRY structure.) These entries are encoded directly after the
40 * IconFileHeader.
42 struct IconDirEntry {
43 uint8_t mWidth;
44 uint8_t mHeight;
45 /**
46 * The number of colors in the color palette of the BMP/PNG that this dir
47 * entry corresponds to, or 0 if the image does not use a color palette.
49 uint8_t mColorCount;
50 /**
51 * Should be set to 0.
53 uint8_t mReserved;
54 union {
55 uint16_t mPlanes; // ICO
56 uint16_t mXHotspot; // CUR
58 union {
59 uint16_t mBitCount; // ICO (bits per pixel)
60 uint16_t mYHotspot; // CUR
62 /**
63 * "bytes in resource" is the length of the encoded BMP/PNG that this dir
64 * entry corresponds to.
66 uint32_t mBytesInRes;
67 /**
68 * The offset of the start of the encoded BMP/PNG that this dir entry
69 * corresponds to (from the start of the icon file).
71 uint32_t mImageOffset;
74 } // namespace image
75 } // namespace mozilla
77 #endif // mozilla_image_ICOFileHeaders_h